id)) { $section->course = $course->id; // Create a default section. $section->section = 0; $section->id = insert_record("course_sections", $section); if (! $sections = get_all_sections($course->id) ) { error("Error finding or creating section structures for this course"); } } if (isset($week)) { if ($week == "all") { unset($USER->section); } else { $USER->section = $week; } save_session("USER"); } // Layout the whole page as three big columns. echo ""; echo "
"; // Layout the left column // Links to people print_simple_box("People", $align="CENTER", $width="100%", $color="$THEME->cellheading"); $moddata[]="id\">List of all people"; $modicon[]="\"List"; $moddata[]="id&course=$course->id\">Edit my profile"; $modicon[]="\"Me\""; print_side_block("", $moddata, "", $modicon); // Then all the links to module types $moddata = array(); $modicon = array(); if ($modnamesused) { foreach ($modnamesused as $modname => $modfullname) { $moddata[] = "id\">".$modnamesplural[$modname].""; $modicon[] = "\"$modfullname\""; } } print_simple_box("Activities", $align="CENTER", $width="100%", $color="$THEME->cellheading"); print_side_block("", $moddata, "", $modicon); // Print a form to search forums print_simple_box(get_string("search","forum"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); echo "
"; forum_print_search_form($course); echo "
"; // Admin links and controls if (isteacher($course->id)) { $adminicon[]="\"Edit\""; if (isediting($course->id)) { $admindata[]="id&edit=off\">Turn editing off"; } else { $admindata[]="id&edit=on\">Turn editing on"; } if ($teacherforum = forum_get_course_forum($course->id, "teacher")) { $admindata[]="id\">Teacher Forum..."; $adminicon[]="\"Teacher"; } $admindata[]="id\">Course settings..."; $adminicon[]="\"Course\""; $admindata[]="id\">Logs..."; $adminicon[]="\"Log\""; $admindata[]="id\">Files..."; $adminicon[]="\"Files\""; print_simple_box("Administration", $align="CENTER", $width="100%", $color="$THEME->cellheading"); print_side_block("", $admindata, "", $adminicon); } // Start main column echo "
"; print_simple_box("Weekly Outline", $align="CENTER", $width="100%", $color="$THEME->cellheading"); // Now all the weekly modules $timenow = time(); $weekdate = $course->startdate; // this should be 0:00 Monday of that week $week = 1; $weekofseconds = 604800; $course->enddate = $course->startdate + ($weekofseconds * $course->numsections); echo ""; while ($weekdate < $course->enddate) { $nextweekdate = $weekdate + ($weekofseconds); if (isset($USER->section)) { // Just display a single week if ($USER->section != $week) { $week++; $weekdate = $nextweekdate; continue; } } $thisweek = (($weekdate <= $timenow) && ($timenow < $nextweekdate)); $weekday = date("j F", $weekdate); $endweekday = date("j F", $weekdate+(6*24*3600)); if ($thisweek) { $highlightcolor = $THEME->cellheading2; } else { $highlightcolor = $THEME->cellheading; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $week++; $weekdate = $nextweekdate; } echo "
"; echo "

$week

"; echo "
cellcontent\" WIDTH=\"100%\">"; echo "

cellheading2\">$weekday - $endweekday

"; if (! $thisweek = $sections[$week]) { $thisweek->course = $course->id; // Create a new week structure $thisweek->week = $week; $thisweek->summary = ""; $thisweek->id = insert_record("course_sections", $thisweek); } if (isediting($course->id)) { $thisweek->summary .= " id\">\"Edit

"; } echo text_to_html($thisweek->summary); print_section($course->id, $thisweek, $mods, $modnamesused); if (isediting($course->id)) { echo "
"; popup_form("$CFG->wwwroot/course/mod.php?id=$course->id§ion=$week&add=", $modnames, "section$week", "", "Add..."); echo "
"; } echo "
"; echo ""; if (isset($USER->section)) { echo "id&week=all\" TITLE=\"Show all weeks\">"; } else { echo "id&week=$week\" TITLE=\"Show only week $week\">"; } echo "
"; echo "
"; // Print all the news items. if ($news = forum_get_course_forum($course->id, "news")) { print_simple_box("Latest News", $align="CENTER", $width="100%", $color="$THEME->cellheading"); print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0); echo ""; forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false); echo ""; print_simple_box_end(); } echo "
"; // Print all the recent activity print_simple_box("Recent Activity", $align="CENTER", $width="100%", $color="$THEME->cellheading"); print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0); print_recent_activity($course); print_simple_box_end(); echo "
\n"; ?>