array_unshift($learningtable->align, 'center'); if ($learningtwfs) { $currentsection = ''; foreach ($learningtwfs as $twf) { $cm = $modinfo->instances['twf'][$twf->id]; $context = context_module::instance($cm->id); $count = twf_count_discussions($twf, $cm, $course); if ($usetracking) { if ($twf->trackingtype == FORUM_TRACKING_OFF) { $unreadlink = '-'; $trackedlink = '-'; } else { if (isset($untracked[$twf->id])) { $unreadlink = '-'; } else { if ($unread = twf_tp_count_twf_unread_posts($cm, $course)) { $unreadlink = '<span class="unread"><a href="view.php?f=' . $twf->id . '">' . $unread . '</a>'; $unreadlink .= '<a title="' . $strmarkallread . '" href="markposts.php?f=' . $twf->id . '&mark=read"><img src="' . $OUTPUT->pix_url('t/markasread') . '" alt="' . $strmarkallread . '" class="iconsmall" /></a></span>'; } else { $unreadlink = '<span class="read">0</span>'; } } if ($twf->trackingtype == FORUM_TRACKING_FORCED && $CFG->twf_allowforcedreadtracking) { $trackedlink = $stryes; } else { if ($twf->trackingtype === FORUM_TRACKING_OFF || $USER->tracktwfs == 0) { $trackedlink = '-'; } else { $aurl = new moodle_url('/mod/twf/settracking.php', array('id' => $twf->id)); if (!isset($untracked[$twf->id])) { $trackedlink = $OUTPUT->single_button($aurl, $stryes, 'post', array('title' => $strnotracktwf));
/** * Adds information about unread messages, that is only required for the course view page (and * similar), to the course-module object. * @param cm_info $cm Course-module object */ function twf_cm_info_view(cm_info $cm) { global $CFG; if (twf_tp_can_track_twfs()) { if ($unread = twf_tp_count_twf_unread_posts($cm, $cm->get_course())) { $out = '<span class="unread"> <a href="' . $cm->url . '">'; if ($unread == 1) { $out .= get_string('unreadpostsone', 'twf'); } else { $out .= get_string('unreadpostsnumber', 'twf', $unread); } $out .= '</a></span>'; $cm->set_after_link($out); } } }