$navigation .= "<a {$CFG->frametarget} href=\"index.php?id={$course->id}\">{$strudutus}</a> ->"; } } } else { $navigation = "<a {$CFG->frametarget} href=\"index.php?id={$course->id}\">{$strudutus}</a> ->"; } $pagetitle = strip_tags($course->shortname . ': ' . format_string($udutu->name)); add_to_log($course->id, 'udutu', 'pre-view', 'view.php?id=' . $cm->id, "{$udutu->id}"); //if ((has_capability('mod/udutu:skipview', get_context_instance(CONTEXT_MODULE,$cm->id))) && udutu_simple_play($udutu,$USER)) { // exit; //} // // Print the page header // print_header($pagetitle, $course->fullname, "{$navigation} <a {$CFG->frametarget} href=\"view.php?id={$cm->id}\">" . format_string($udutu->name, true) . "</a>", '', '', true, update_module_button($cm->id, $course->id, $strudutu), navmenu($course, $cm)); if (empty($cm->visible) and !has_capability('moodle/course:manageactivities', $context)) { notice(get_string("activityiscurrentlyhidden")); } if (has_capability('mod/udutu:viewreport', $context)) { $trackedusers = udutu_get_count_users($udutu->id, $cm->groupingid); if ($trackedusers > 0) { echo "<div class=\"reportlink\"><a {$CFG->frametarget} href=\"report.php?id={$cm->id}\"> " . get_string('viewalluserreports', 'udutu', $trackedusers) . '</a></div>'; } else { echo '<div class="reportlink">' . get_string('noreports', 'udutu') . '</div>'; } } // Print the main part of the page print_heading(format_string($udutu->name)); print_box(format_text($udutu->summary), 'generalbox', 'intro'); udutu_view_display($USER, $udutu, 'view.php?id=' . $cm->id, $cm); print_footer($course);
function udutu_course_format_display($user, $course) { global $CFG; $strupdate = get_string('update'); $strmodule = get_string('modulename', 'udutu'); $context = get_context_instance(CONTEXT_COURSE, $course->id); echo '<div class="mod-udutu">'; if ($udutus = get_all_instances_in_course('udutu', $course)) { // The module udutu activity with the least id is the course $udutu = current($udutus); if (!($cm = get_coursemodule_from_instance('udutu', $udutu->id, $course->id))) { error('Course Module ID was incorrect'); } $colspan = ''; $headertext = '<table width="100%"><tr><td class="title">' . get_string('name') . ': <b>' . format_string($udutu->name) . '</b>'; if (has_capability('moodle/course:manageactivities', $context)) { if (isediting($course->id)) { // Display update icon $path = $CFG->wwwroot . '/course'; $headertext .= '<span class="commands">' . '<a title="' . $strupdate . '" href="' . $path . '/mod.php?update=' . $cm->id . '&sesskey=' . sesskey() . '">' . '<img src="' . $CFG->pixpath . '/t/edit.gif" class="iconsmall" alt="' . $strupdate . '" /></a></span>'; } $headertext .= '</td>'; // Display report link $trackedusers = get_record('udutu_scoes_track', 'udutuid', $udutu->id, '', '', '', '', 'count(distinct(userid)) as c'); if ($trackedusers->c > 0) { $headertext .= '<td class="reportlink">' . '<a ' . $CFG->frametarget . '" href="' . $CFG->wwwroot . '/mod/udutu/report.php?id=' . $cm->id . '">' . get_string('viewallreports', 'udutu', $trackedusers->c) . '</a>'; } else { $headertext .= '<td class="reportlink">' . get_string('noreports', 'udutu'); } $colspan = ' colspan="2"'; } $headertext .= '</td></tr><tr><td' . $colspan . '>' . format_text(get_string('summary') . ':<br />' . $udutu->summary) . '</td></tr></table>'; print_simple_box($headertext, '', '100%'); udutu_view_display($user, $udutu, 'view.php?id=' . $course->id, $cm, '100%'); } else { if (has_capability('moodle/course:update', $context)) { // Create a new activity redirect($CFG->wwwroot . '/course/mod.php?id=' . $course->id . '&section=0&sesskey=' . sesskey() . '&add=udutu'); } else { notify('Could not find a udutu course here'); } } echo '</div>'; }