id) ) { $week->course = $course->id; // Create a default week. $week->week = 0; $week->id = insert_record("course_weeks", $week); if (! $rawweeks = get_records("course_weeks", "course", $course->id) ) { error("Error finding or creating week structures for this course"); } } foreach($rawweeks as $cw) { //Index the weeks $weeks[$cw->week] = $cw; } if (isset($topic)) { if ($topic == "all") { unset($USER->topic); } else { $USER->topic = $topic; } } if (isteacher($course->id) and isset($marker)) { $course->marker = $marker; if (! set_field("course", "marker", $marker, "id", $course->id)) { error("Could not mark that topic for this course"); } } // 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 ($modtype) { foreach ($modtype as $modname => $modfullname) { $moddata[] = "id\">".$modfullname."s"; $modicon[] = "\"$modfullname\""; } } print_simple_box("Activities", $align="CENTER", $width="100%", $color="$THEME->cellheading"); print_side_block("", $moddata, "", $modicon); // Print a form to search discussions print_simple_box("Search Discussions", $align="CENTER", $width="100%", $color="$THEME->cellheading"); echo "
"; print_discussion_search_form($course); echo "
"; // Admin links and controls if (isteacher($course->id)) { $adminicon[]="\"Edit\""; if ($USER->editing) { $admindata[]="id&edit=off\">Turn editing off"; } else { $admindata[]="id&edit=on\">Turn editing on"; } $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("Topic Outline", $align="CENTER", $width="100%", $color="$THEME->cellheading"); // Everything below uses "week" terminology - each "week" is a topic. // Now all the weekly modules $timenow = time(); $weekdate = $course->startdate; // this should be 0:00 Monday of that week $week = 1; $weekofseconds = 604800; echo ""; while ($weekdate < $course->enddate) { $nextweekdate = $weekdate + ($weekofseconds); if (isset($USER->topic)) { // Just display a single topic if ($USER->topic != $week) { $week++; $weekdate = $nextweekdate; continue; } } $currenttopic = ($course->marker == $week); if ($currenttopic) { $highlightcolor = $THEME->cellheading2; } else { $highlightcolor = $THEME->cellheading; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $week++; $weekdate = $nextweekdate; } echo "
"; echo "

$week

"; echo "
cellcontent\" WIDTH=\"100%\">"; if (! $thisweek = $weeks[$week]) { $thisweek->course = $course->id; // Create a new week structure $thisweek->week = $week; $thisweek->summary = ""; $thisweek->id = insert_record("course_weeks", $thisweek); } if ($USER->editing) { $thisweek->summary .= " id>\"Edit

"; } echo text_to_html($thisweek->summary); echo "

"; if ($thisweek->sequence) { $thisweekmods = explode(",", $thisweek->sequence); foreach ($thisweekmods as $modnumber) { $mod = $mods[$modnumber]; $instancename = get_field("$mod->modname", "name", "id", "$mod->instance"); echo "modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">"; echo " modfullname\""; echo " HREF=\"../mod/$mod->modname/view.php?id=$mod->id\">$instancename"; if ($USER->editing) { echo make_editing_buttons($mod->id); } echo "
\n"; } } echo "

\n"; if ($USER->editing) { echo "
"; popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&week=$week&add=", $modtypes, "week$week", "", "Add..."); echo "
"; } echo "
"; echo ""; if (isset($USER->topic)) { echo "id&topic=all\" TITLE=\"Show all topics\">

"; } else { echo "id&topic=$week\" TITLE=\"Show only topic $week\">

"; } if ($USER->editing and $course->marker != $week) { echo "id&marker=$week\" TITLE=\"Mark this topic as the current topic\">

"; } echo "
"; echo "
"; // Print all the news items. if ($news = get_course_news_forum($course->id)) { print_simple_box("Latest News", $align="CENTER", $width="100%", $color="$THEME->cellheading"); print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0); echo ""; print_forum_latest_topics($news->id, 5, "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"; ?>