mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Fairly radical improvement to the Journal index, putting all the
information on one page.
This commit is contained in:
parent
7625591b3b
commit
2a0d8c5b05
2 changed files with 53 additions and 31 deletions
|
@ -13,7 +13,7 @@
|
|||
add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
if ($course->category) {
|
||||
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
}
|
||||
|
||||
$strjournal = get_string("modulename", "journal");
|
||||
|
@ -37,14 +37,11 @@
|
|||
$timenow = time();
|
||||
|
||||
if ($course->format == "weeks") {
|
||||
$table->head = array ($strweek, $strquestion, $stranswer);
|
||||
$table->align = array ("CENTER", "LEFT", "LEFT");
|
||||
$strsection = $strweek;
|
||||
} else if ($course->format == "topics") {
|
||||
$table->head = array ($strtopic, $strquestion, $stranswer);
|
||||
$table->align = array ("CENTER", "LEFT", "LEFT");
|
||||
$strsection = $strtopic;
|
||||
} else {
|
||||
$table->head = array ($strquestion, $stranswer);
|
||||
$table->align = array ("LEFT", "LEFT");
|
||||
$strsection = "";
|
||||
}
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
|
@ -55,36 +52,15 @@
|
|||
} else {
|
||||
$journal->timefinish = 9999999999;
|
||||
}
|
||||
|
||||
$journalopen = ($journal->timestart < $timenow && $timenow < $journal->timefinish);
|
||||
|
||||
$entrytext = get_field("journal_entries", "text", "userid", $USER->id, "journal", $journal->id);
|
||||
journal_user_complete_index($course, $USER, $journal, $journalopen, "$strsection $journal->section");
|
||||
|
||||
$text = text_to_html($entrytext)."<p align=right><a href=\"view.php?id=$journal->coursemodule\">";
|
||||
|
||||
if ($journalopen) {
|
||||
$text .= "$stredit</a></p>";
|
||||
} else {
|
||||
$text .= "$strview</a></p>";
|
||||
}
|
||||
if (!empty($journal->section)) {
|
||||
$section = "$journal->section";
|
||||
} else {
|
||||
$section = "";
|
||||
}
|
||||
if ($course->format == "weeks" or $course->format == "topics") {
|
||||
$table->data[] = array ($section,
|
||||
text_to_html($journal->intro),
|
||||
$text);
|
||||
} else {
|
||||
$table->data[] = array (text_to_html($journal->intro),
|
||||
$text);
|
||||
}
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
|
||||
print_table($table);
|
||||
|
||||
print_footer($course);
|
||||
|
||||
?>
|
||||
|
|
|
@ -28,7 +28,8 @@ function journal_user_complete($course, $user, $mod, $journal) {
|
|||
echo format_text($entry->text, $entry->format);
|
||||
}
|
||||
if ($entry->teacher) {
|
||||
journal_print_feedback($course, $entry);
|
||||
$grades = make_grades_menu($journal->assessed);
|
||||
journal_print_feedback($course, $entry, $grades);
|
||||
}
|
||||
print_simple_box_end();
|
||||
|
||||
|
@ -37,6 +38,51 @@ function journal_user_complete($course, $user, $mod, $journal) {
|
|||
}
|
||||
}
|
||||
|
||||
function journal_user_complete_index($course, $user, $journal, $journalopen, $heading) {
|
||||
|
||||
if ($heading) {
|
||||
echo "<h3>$heading - $journal->name</h3>";
|
||||
} else {
|
||||
echo "<h3>$journal->name</h3>";
|
||||
}
|
||||
|
||||
print_simple_box_start("left", "90%");
|
||||
echo format_text($journal->intro);
|
||||
print_simple_box_end();
|
||||
echo "<br clear=all />";
|
||||
echo "<br />";
|
||||
|
||||
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 />";
|
||||
|
||||
}
|
||||
|
||||
|
||||
function journal_cron () {
|
||||
// Function to be run periodically according to the moodle cron
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue