From: moodler Date: Thu, 7 Nov 2002 09:30:41 +0000 (+0000) Subject: Fixes to course display, tidy up of some code (could do with more) X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9a2235974300f2b1c9c7121e709a4749f704ffd8;p=moodle.git Fixes to course display, tidy up of some code (could do with more) and mainly - addition of section 0 display. --- diff --git a/course/social.php b/course/social.php index 19f7299622..334083e386 100644 --- a/course/social.php +++ b/course/social.php @@ -18,32 +18,34 @@ if ($USER->description) { $moddata[]= $editmyprofile; } else { - $moddata[]= $editmyprofile.$blinker; + $moddata[]= $editmyprofile." *"; } $modicon[]="\"\""; print_side_block("", $moddata, "", $modicon); - // Then, print all the available resources (Section 0) +/// Then, print all the available resources (Section 0) print_simple_box(get_string("resources"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); - print_section($site->id, $sections[0], $mods, $modnamesused, true); + print_section($course->id, $sections[0], $mods, $modnamesused, true); - if (isediting($site->id)) { + if (isediting($course->id)) { echo "
"; popup_form("$CFG->wwwroot/course/mod.php?id=$course->id§ion=0&add=", $modnames, "section0", "", get_string("add")."...", "mods", get_string("activities")); echo "
"; } - // Print all the recent activity + +/// Print all the recent activity print_simple_box(get_string("recentactivity"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); echo "
"; print_recent_activity($course); echo "
"; echo "
"; - // Print a form to search forums + +/// 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); diff --git a/course/topics.php b/course/topics.php index bfb9164ff6..1436533ee5 100644 --- a/course/topics.php +++ b/course/topics.php @@ -33,18 +33,19 @@ } } - - // Layout the whole page as three big columns. - echo ""; - echo "
"; - - // Layout the left column + if ($course->newsitems) { + $news = forum_get_course_forum($course->id, "news"); + } - // Links to people +/// Layout the whole page as three big columns. + echo ""; - $blinker = " *"; +/// The left column ... + echo "
"; + +/// Links to people print_simple_box(get_string("people"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); $moddata[]="id\">".get_string("participants").""; $modicon[]="\"\""; @@ -52,14 +53,13 @@ if ($USER->description) { $moddata[]= $editmyprofile; } else { - $moddata[]= $editmyprofile.$blinker; + $moddata[]= $editmyprofile." *"; } $modicon[]="\"\""; print_side_block("", $moddata, "", $modicon); - // Then all the links to module types - +/// Links to all activity modules by type $moddata = array(); $modicon = array(); if ($modnamesused) { @@ -71,32 +71,69 @@ print_simple_box(get_string("activities"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); print_side_block("", $moddata, "", $modicon); - // Print a form to search forums +/// 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 +/// Admin links and controls if (isteacher($course->id)) { print_course_admin_links($course); } - // Start main column +/// Start main column echo "
"; print_simple_box(get_string("topicoutline"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); - // Everything below uses "section" terminology - each "section" is a topic. - - // Now all the sectionly modules - $timenow = time(); - $section = 1; - $streditsummary = get_string("editsummary"); $stradd = get_string("add"); + echo ""; + +/// Print Section 0 + + $topic = 0; + $thistopic = $sections[$topic]; + + if ($thistopic->summary or $thistopic->sequence or isediting($course->id)) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + + +/// Now all the normal modules by topic +/// Everything below uses "section" terminology - each "section" is a topic. + + $timenow = time(); + $section = 1; + while ($section <= $course->numsections) { if (isset($USER->topic)) { // Just display a single topic @@ -170,17 +207,15 @@ echo "
cellheading\" VALIGN=top WIDTH=20> cellcontent\" WIDTH=\"100%\">"; + + if (isediting($course->id)) { + $thistopic->summary .= " id\">\"$streditsummary\"

"; + } + + echo text_to_html($thistopic->summary); + + print_section($course->id, $thistopic, $mods, $modnamesused); + + if (isediting($course->id)) { + echo "
"; + popup_form("$CFG->wwwroot/course/mod.php?id=$course->id§ion=$topic&add=", + $modnames, "section$topic", "", "$stradd...", "mods", get_string("activities")); + echo "
"; + } + + echo "
cellheading\" VALIGN=top ALIGN=CENTER WIDTH=10> "; + echo "
"; - // Print all the news items. +/// Print all the news items. - if ($course->newsitems) { - if ($news = forum_get_course_forum($course->id, "news")) { - print_simple_box(get_string("latestnews"), $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(); - } + if ($news) { + print_simple_box(get_string("latestnews"), $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 "
"; } diff --git a/course/weeks.php b/course/weeks.php index 2e263b6d3d..1db585b50d 100644 --- a/course/weeks.php +++ b/course/weeks.php @@ -22,16 +22,19 @@ save_session("USER"); } + if ($course->newsitems) { + $news = forum_get_course_forum($course->id, "news"); + } + - // Layout the whole page as three big columns. +/// Layout the whole page as three big columns. echo ""; - echo "
"; - - // Layout the left column +/// The left column ... - // Links to people + echo "
"; +/// Links to people print_simple_box(get_string("people"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); $moddata[]="id\">".get_string("participants").""; $modicon[]="\"\""; @@ -39,14 +42,13 @@ if ($USER->description) { $moddata[]= $editmyprofile; } else { - $moddata[]= $editmyprofile.$blinker; + $moddata[]= $editmyprofile." *"; } $modicon[]="\"\""; print_side_block("", $moddata, "", $modicon); - // Then all the links to module types - +/// Then all the links to activities by type $moddata = array(); $modicon = array(); if ($modnamesused) { @@ -58,33 +60,72 @@ print_simple_box(get_string("activities"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); print_side_block("", $moddata, "", $modicon); - // Print a form to search forums +/// 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 +/// Admin links and controls if (isteacher($course->id)) { print_course_admin_links($course); } - // Start main column + +/// Start main column echo "
"; print_simple_box(get_string("weeklyoutline"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); - // Now all the weekly modules + $streditsummary = get_string("editsummary"); + $stradd = get_string("add"); + + echo ""; + + +/// Print Week 0 with general activities + + $week = 0; + $thisweek = $sections[$week]; + + if ($thisweek->summary or $thisweek->sequence or isediting($course->id)) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + + +/// Now all the weekly sections $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); - $streditsummary = get_string("editsummary"); - $stradd = get_string("add"); - - echo "
cellheading\" VALIGN=top WIDTH=20> cellcontent\" WIDTH=\"100%\">"; + + if (isediting($course->id)) { + $thisweek->summary .= " id\">\"$streditsummary\"

"; + } + + 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", "", "$stradd...", "mods", get_string("activities")); + echo "
"; + } + + echo "
cellheading\" VALIGN=top ALIGN=CENTER WIDTH=10>"; + echo "
"; while ($weekdate < $course->enddate) { $nextweekdate = $weekdate + ($weekofseconds); @@ -164,15 +205,13 @@ // Print all the news items. - if ($course->newsitems) { - if ($news = forum_get_course_forum($course->id, "news")) { - print_simple_box(get_string("latestnews"), $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(); - } + if ($news) { + print_simple_box(get_string("latestnews"), $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 "
"; }