moodle/mod/journal/index.php

64 lines
1.8 KiB
PHP
Raw Normal View History

2001-11-22 06:23:56 +00:00
<?PHP // $Id$
require_once("../../config.php");
require_once("lib.php");
2001-11-22 06:23:56 +00:00
require_variable($id); // course
if (! $course = get_record("course", "id", $id)) {
error("Course ID is incorrect");
}
require_login($course->id);
add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", "");
2001-11-22 06:23:56 +00:00
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
2002-08-12 09:38:31 +00:00
$strjournal = get_string("modulename", "journal");
$strjournals = get_string("modulenameplural", "journal");
$strweek = get_string("week");
$strtopic = get_string("topic");
2002-11-10 08:43:44 +00:00
print_header("$course->shortname: $strjournals", "$course->fullname", "$navigation $strjournals",
"", "", true, "", navmenu($course));
2001-11-22 06:23:56 +00:00
if (! $journals = get_all_instances_in_course("journal", $course)) {
2001-11-22 06:23:56 +00:00
notice("There are no journals", "../../course/view.php?id=$course->id");
die;
}
$timenow = time();
if ($course->format == "weeks") {
$strsection = $strweek;
} else if ($course->format == "topics") {
$strsection = $strtopic;
} else {
$strsection = "";
}
2001-11-22 06:23:56 +00:00
foreach ($journals as $journal) {
$journal->timestart = $course->startdate + (($journal->section - 1) * 608400);
2003-01-01 07:18:43 +00:00
if (!empty($journal->daysopen)) {
2001-11-22 06:23:56 +00:00
$journal->timefinish = $journal->timestart + (3600 * 24 * $journal->daysopen);
} else {
$journal->timefinish = 9999999999;
}
$journalopen = ($journal->timestart < $timenow && $timenow < $journal->timefinish);
2003-04-26 12:38:53 +00:00
journal_user_complete_index($course, $USER, $journal, $journalopen, "$strsection $journal->section");
2001-11-22 06:23:56 +00:00
}
2003-04-26 12:38:53 +00:00
echo "<br />";
2002-08-12 09:38:31 +00:00
2001-11-22 06:23:56 +00:00
print_footer($course);
?>