function journal_user_complete_index($course, $user, $journal, $journalopen, $heading) { /// Prints a journal, entry and feedback ... used on the journal index page. if (isteacher($course->id)) { $entrycount = journal_count_entries($journal, get_current_group($course->id)); $entryinfo = " (<a href=\"report.php?id={$journal->coursemodule}\">" . get_string("viewallentries", "journal", $entrycount) . "</a>)"; } else { $entryinfo = ""; } $journal->name = "<a href=\"view.php?id={$journal->coursemodule}\">" . format_string($journal->name, true) . "</a>"; if ($heading) { echo "<h3>{$heading} - {$journal->name}{$entryinfo}</h3>"; } else { echo "<h3>{$journal->name}{$entryinfo}</h3>"; } print_simple_box_start("left", "90%"); echo format_text($journal->intro, $journal->introformat); print_simple_box_end(); echo "<br clear=\"all\" />"; echo "<br />"; if (isstudent($course->id) or isteacher($course->id)) { print_simple_box_start("right", "90%"); if ($journalopen) { echo "<p align=\"right\"><a href=\"edit.php?id={$journal->coursemodule}\">"; echo get_string("edit") . "</a></p>"; } else { echo "<p align=\"right\"><a href=\"view.php?id={$journal->coursemodule}\">"; echo get_string("view") . "</a></p>"; } if ($entry = get_record("journal_entries", "userid", $user->id, "journal", $journal->id)) { if ($entry->modified) { echo "<p align=\"center\"><font size=\"1\">" . get_string("lastedited") . ": " . userdate($entry->modified) . "</font></p>"; } if ($entry->text) { echo format_text($entry->text, $entry->format); } if ($entry->teacher) { $grades = make_grades_menu($journal->assessed); journal_print_feedback($course, $entry, $grades); } } else { print_string("noentry", "journal"); } print_simple_box_end(); echo "<br clear=\"all\" />"; echo "<br />"; } }
if ($entriesmanager) { // Display the report.php col only if is a entries manager in some CONTEXT_MODULE if (empty($managersomewhere)) { $table->head[] = get_string('viewentries', 'journal'); $table->align[] = 'left'; $managersomewhere = true; // Fill the previous col cells $manageentriescell = count($table->head) - 1; for ($j = 0; $j < $i; $j++) { if (is_array($table->data[$j])) { $table->data[$j][$manageentriescell] = ''; } } } //$entrycount = journal_count_entries($journal, get_current_group($course->id)); $entrycount = journal_count_entries($journal, groups_get_all_groups($course->id, $USER->id)); $table->data[$i][] = "<a href=\"report.php?id={$journal->coursemodule}\">" . get_string("viewallentries", "journal", $entrycount) . "</a>"; } else { if (!empty($managersomewhere)) { $table->data[$i][] = ""; } } $i++; } echo "<br />"; echo html_writer::table($table); // Trigger course module instance list event. $params = array('context' => context_course::instance($course->id)); $event = \mod_journal\event\course_module_instance_list_viewed::create($params); $event->add_record_snapshot('course', $course); $event->trigger();
add_to_log($course->id, "journal", "view", "view.php?id={$cm->id}", $journal->id, $cm->id); if (!($cw = get_record("course_sections", "id", $cm->section))) { error("Course module is incorrect"); } $strjournal = get_string("modulename", "journal"); $strjournals = get_string("modulenameplural", "journal"); $navlinks = array(); $navlinks[] = array('name' => $strjournals, 'link' => "index.php?id={$course->id}", 'type' => 'activity'); $navlinks[] = array('name' => format_string($journal->name), 'link' => '', 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); print_header_simple(format_string($journal->name), '', $navigation, '', '', true, update_module_button($cm->id, $course->id, $strjournal), navmenu($course, $cm)); /// Check to see if groups are being used here $groupmode = groupmode($course, $cm); $currentgroup = setup_and_print_groups($course, $groupmode, "view.php?id={$cm->id}"); if (isteacher($course->id)) { $entrycount = journal_count_entries($journal, $currentgroup); echo '<div class="reportlink"><a href="report.php?id=' . $cm->id . '">' . get_string('viewallentries', 'journal', $entrycount) . '</a></div>'; } $journal->intro = trim($journal->intro); if (!empty($journal->intro)) { print_box(format_text($journal->intro, $journal->introformat), 'generalbox', 'intro'); } echo '<br />'; $timenow = time(); if ($course->format == 'weeks' and $journal->days) { $timestart = $course->startdate + ($cw->section - 1) * 604800; if ($journal->days) { $timefinish = $timestart + 3600 * 24 * $journal->days; } else { $timefinish = $course->enddate; }