From: moodler Date: Mon, 9 Dec 2002 07:35:40 +0000 (+0000) Subject: Various little tweaks to improve the display of course home X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5e367a2d5691d67c091e388802f4268b31e91d5e;p=moodle.git Various little tweaks to improve the display of course home pages and front page ... still have some work to do though --- diff --git a/course/index.php b/course/index.php index 3e2238b837..2ff1185761 100644 --- a/course/index.php +++ b/course/index.php @@ -34,7 +34,6 @@ if ($showcategories) { echo ""; echo "
"; - print_simple_box($strcategories, "CENTER", 180, $THEME->cellheading); print_course_categories($categories, $category, 180); echo ""; } else { @@ -45,7 +44,7 @@ if ($category) { if (isset($title)) { - print_simple_box($title, "CENTER", "100%", $THEME->cellheading); + print_heading_block($title); } echo "
"; print_all_courses($category); diff --git a/course/lib.php b/course/lib.php index a45c0049a0..7ddcda23fe 100644 --- a/course/lib.php +++ b/course/lib.php @@ -208,7 +208,7 @@ function print_all_courses($category="all", $style="full", $maxcount=999) { } } $fulllist = "

wwwroot/course/\">".get_string("fulllistofcourses")."..."; - print_side_block("", $moddata, "$fulllist", $modicon); + print_side_block(get_string("courses"), "", $moddata, $modicon, $fulllist); } else { foreach ($courses as $course) { @@ -251,12 +251,14 @@ function print_course($course) { echo "

"; } if ($course->guest) { - echo "wwwroot/course/view.php?id=$course->id\">"; - echo "\"\"wwwroot/user/user.gif\">  "; + $strallowguests = get_string("allowguests"); + echo "wwwroot/course/view.php?id=$course->id\">"; + echo "\"$strallowguests\"wwwroot/user/user.gif\">  "; } if ($course->password) { - echo "wwwroot/course/view.php?id=$course->id\">"; - echo "\"\"wwwroot/pix/i/key.gif\">"; + $strrequireskey = get_string("requireskey"); + echo "wwwroot/course/view.php?id=$course->id\">"; + echo "\"$strrequireskey\"wwwroot/pix/i/key.gif\">"; } @@ -465,6 +467,40 @@ function get_all_categories() { return get_records_sql("SELECT * FROM course_categories ORDER by name"); } +function print_section_block($heading, $course, $section, $mods, $modnames, $modnamesused, + $absolute=true, $width="100%", $isediting=false) { + + global $CFG; + + $modinfo = unserialize($course->modinfo); + $moddata = array(); + $modicon = array(); + $editbuttons = ""; + + if ($section->sequence) { + + $sectionmods = explode(",", $section->sequence); + + foreach ($sectionmods as $modnumber) { + $mod = $mods[$modnumber]; + if ($isediting) { + $editbuttons = make_editing_buttons($mod->id, $absolute); + } + $instancename = urldecode($modinfo[$modnumber]->name); + $modicon[] = "wwwroot/mod/$mod->modname/icon.gif\" height=\"16\" width=\"16\" alt=\"$mod->modfullname\">"; + $moddata[] = "modfullname\" href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename
$editbuttons"; + } + } + if (isediting($site->id)) { + $editmenu = popup_form("$CFG->wwwroot/course/mod.php?id=$course->id§ion=0&add=", + $modnames, "section0", "", get_string("add")."...", "mods", get_string("activities"), true); + $editmenu = "
$editmenu
"; + } + + print_side_block($heading, "", $moddata, $modicon, $editmenu, $width); +} + + function print_section($course, $section, $mods, $modnamesused, $absolute=false, $width="100%") { global $CFG; @@ -482,6 +518,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, echo " modfullname\""; echo " HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename"; if (isediting($course->id)) { + echo "  "; echo make_editing_buttons($mod->id, $absolute); } echo "
\n"; @@ -490,33 +527,70 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, echo "

\n\n"; } -function print_side_block($heading="", $list=NULL, $footer="", $icons=NULL, $width=180) { +function print_heading_block($heading, $width="100%") { + global $THEME; + + echo ""; + echo ""; + echo "
borders\">"; + echo ""; + echo "
cellheading\">"; + echo stripslashes($heading); + echo "
"; + echo "
"; +} + +function print_side_block($heading="", $content="", $list=NULL, $icons=NULL, $footer="", $width=180) { +// Prints a nice side block with an optional header. The content can either +// be a block of HTML or a list of text with optional icons. - echo "\n"; - echo "\n"; - if ($list) { - foreach($list as $key => $string) { - echo ""; + echo ""; + echo "

$heading

"; - if ($icons[$key]) { - echo $icons[$key]; - } else { - echo ""; + global $THEME; + + echo ""; + echo ""; + echo "
borders\">"; + echo ""; + if ($heading) { + echo ""; + echo ""; + echo ""; + } + if ($content) { + echo ""; + echo ""; + echo ""; + } else { + echo ""; } - if ($footer) { - echo "\n"; - } - echo "
cellheading\">$heading
cellcontent2\">$content
cellcontent2\">"; + echo ""; + foreach ($list as $key => $string) { + echo "cellcontent2\">"; + if ($icons) { + echo ""; } - echo "\n\n"; + echo ""; + echo ""; } + if ($footer) { + echo "cellcontent2\">"; + if ($icons) { + echo ""; + } + echo ""; + echo ""; + } + echo "
".$icons[$key].""; - echo "

$string

"; - echo "
$string
 $footer
"; + echo "

$footer


\n\n"; + + echo "

"; } + function print_admin_links ($siteid, $width=180) { global $THEME, $CFG; - print_simple_box(get_string("administration"), $align="CENTER", $width, $color="$THEME->cellheading"); $icon = "wwwroot/pix/i/settings.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">"; $moddata[]="wwwroot/admin/config.php\">".get_string("configvariables").""; $modicon[]=$icon; @@ -551,7 +625,9 @@ function print_admin_links ($siteid, $width=180) { $moddata[]="wwwroot/admin/auth.php\">".get_string("authentication").""; $modicon[]=$icon; $fulladmin = "

wwwroot/admin/\">".get_string("admin")."..."; - print_side_block("", $moddata, "$fulladmin", $modicon, $width); + + print_side_block(get_string("administration"), "", $moddata, $modicon, $fulladmin, $width); + echo "wwwroot/pix/spacer.gif\" WIDTH=\"$width\" HEIGHT=1>
"; } @@ -590,8 +666,7 @@ function print_course_admin_links($course, $width=180) { $adminicon[]="wwwroot/mod/forum/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">"; } - print_simple_box(get_string("administration"), $align="CENTER", $width, $color="$THEME->cellheading"); - print_side_block("", $admindata, "", $adminicon, $width); + print_side_block(get_string("administration"), "", $admindata, $adminicon, "", $width); } function print_course_categories($categories, $selected="none", $width=180) { @@ -665,7 +740,7 @@ function print_course_categories($categories, $selected="none", $width=180) { if (isset($USER->id)) { $catdata[] = "wwwroot/course/index.php?category=my\">".get_string("mycourses").""; } - print_side_block("", $catdata, $showall.$mine, $caticon, $width); + print_side_block(get_string("categories"), "", $catdata, $caticon, $showall.$mine, $width); } } @@ -875,8 +950,7 @@ function make_editing_buttons($moduleid, $absolute=false) { } else { $path = ""; } - return "    - diff --git a/course/social.php b/course/social.php index 43f9c1839a..40e8a59183 100644 --- a/course/social.php +++ b/course/social.php @@ -10,7 +10,6 @@ cellheading"); $moddata[]="id\">".get_string("participants").""; $modicon[]="\"\""; $editmyprofile = "firstname $USER->lastname\" HREF=\"../user/view.php?id=$USER->id&course=$course->id\">". @@ -21,37 +20,31 @@ $moddata[]= $editmyprofile." *"; } $modicon[]="\"\""; - print_side_block("", $moddata, "", $modicon); + print_side_block(get_string("people"), "", $moddata, $modicon); /// Then, print all the available resources (Section 0) - print_simple_box(get_string("resources"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); - print_section($course, $sections[0], $mods, $modnamesused, true); - - 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_section_block(get_string("activities"), $course, $sections[0], + $mods, $modnames, $modnamesused, true, "100%", isediting($course->id)); /// Print all the recent activity - print_simple_box(get_string("recentactivity"), "CENTER", "100%", $THEME->cellheading); - print_simple_box_start("CENTER", "100%", $THEME->body, 3, 0); - print_recent_activity($course); - print_simple_box_end(); - echo "
"; + if ($course->showrecent) { + print_heading_block(get_string("recentactivity")); + print_simple_box_start("CENTER", "100%", $THEME->body, 3, 0); + print_recent_activity($course); + print_simple_box_end(); + echo "
"; + } /// 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 "
"; + $searchform = forum_print_search_form($course, "", true); + $searchform = "
$searchform
"; + print_side_block(get_string("search","forum"), $searchform); - // Admin links and controls +/// Admin links and controls if (isteacher($course->id)) { print_course_admin_links($course, "100%"); } @@ -66,7 +59,7 @@ $subtext = get_string("subscribe", "forum"); } $headertext = "
".get_string("socialheadline")."id\">$subtext
"; - print_simple_box("$headertext", $align="CENTER", $width="100%", $color="$THEME->cellheading"); + print_heading_block($headertext); echo "\"\"
"; forum_print_latest_discussions($social->id, 10, "plain", "DESC", false); diff --git a/course/topics.php b/course/topics.php index b78da557c8..7f609aa94b 100644 --- a/course/topics.php +++ b/course/topics.php @@ -50,7 +50,6 @@ echo ""; /// Links to people - print_simple_box(get_string("people"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); $moddata[]="
id\">".get_string("participants").""; $modicon[]="\"\""; $editmyprofile = "firstname $USER->lastname\" HREF=\"../user/view.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile").""; @@ -60,7 +59,7 @@ $moddata[]= $editmyprofile." *"; } $modicon[]="\"\""; - print_side_block("", $moddata, "", $modicon); + print_side_block(get_string("people"), "", $moddata, $modicon); /// Links to all activity modules by type @@ -72,14 +71,12 @@ $modicon[] = "\"\""; } } - print_simple_box($stractivities, $align="CENTER", $width="100%", $color="$THEME->cellheading"); - print_side_block("", $moddata, "", $modicon); + print_side_block($stractivities, "", $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 "
"; + $searchform = forum_print_search_form($course, "", true); + $searchform = "
$searchform
"; + print_side_block(get_string("search","forum"), $searchform); /// Admin links and controls if (isteacher($course->id)) { diff --git a/course/weeks.php b/course/weeks.php index 30b75c7b08..d8186b5f45 100644 --- a/course/weeks.php +++ b/course/weeks.php @@ -39,7 +39,6 @@ echo ""; /// Links to people - print_simple_box(get_string("people"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); $moddata[]="id\">".get_string("participants").""; $modicon[]="\"\""; $editmyprofile = "firstname $USER->lastname\" HREF=\"../user/view.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile").""; @@ -49,7 +48,7 @@ $moddata[]= $editmyprofile." *"; } $modicon[]="\"\""; - print_side_block("", $moddata, "", $modicon); + print_side_block(get_string("people"), "", $moddata, $modicon); /// Then all the links to activities by type @@ -61,14 +60,12 @@ $modicon[] = "\"\""; } } - print_simple_box($stractivities, $align="CENTER", $width="100%", $color="$THEME->cellheading"); - print_side_block("", $moddata, "", $modicon); + print_side_block($stractivities, "", $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 "
"; + $searchform = forum_print_search_form($course, "", true); + $searchform = "
$searchform
"; + print_side_block(get_string("search","forum"), $searchform); /// Admin links and controls @@ -79,8 +76,7 @@ /// Start main column echo ""; - - print_simple_box(get_string("weeklyoutline"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); + print_heading_block(get_string("weeklyoutline")); echo ""; @@ -207,7 +203,7 @@ // Print all the news items. if ($news) { - print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); + print_heading_block(get_string("latestnews")); print_simple_box_start("CENTER", "100%", $THEME->cellcontent, 3, 0); echo ""; forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false); @@ -218,7 +214,7 @@ // Print all the recent activity if ($course->showrecent) { - print_simple_box(get_string("recentactivity"), $align="CENTER", $width="100%", $color="$THEME->cellheading"); + print_heading_block(get_string("recentactivity")); print_simple_box_start("CENTER", "100%", $THEME->cellcontent, 3, 0); print_recent_activity($course); print_simple_box_end(); diff --git a/index.php b/index.php index 2701251a36..c885cd9d5c 100644 --- a/index.php +++ b/index.php @@ -42,27 +42,15 @@ if ($sections[0]->sequence or isediting($site->id)) { get_all_mods($site->id, $mods, $modnames, $modnamesplural, $modnamesused); - print_simple_box(get_string("mainmenu"), "CENTER", $side, "$THEME->cellheading"); - } - - if ($sections[0]->sequence) { - print_section($site, $sections[0], $mods, $modnamesused, true, $side); - } - - if (isediting($site->id)) { - echo "
"; - popup_form("$CFG->wwwroot/course/mod.php?id=$site->id§ion=0&add=", - $modnames, "section0", "", get_string("add")."..."); - echo "
"; + print_section_block(get_string("mainmenu"), $site, $sections[0], + $mods, $modnames, $modnamesused, true, $side, isediting($site->id)); } if ($site->newsitems > 0 ) { $categories = get_all_categories(); if (count($categories) > 1) { - print_simple_box(get_string("categories"), "CENTER", $side, "$THEME->cellheading"); print_course_categories($categories, "none", $side); } else { - print_simple_box(get_string("courses"), "CENTER", $side, "$THEME->cellheading"); $category = array_shift($categories); print_all_courses($category->id, "minimal", 10); } @@ -83,7 +71,7 @@ echo "
"; if ($site->newsitems == 0 ) { - print_simple_box(get_string("availablecourses"), "CENTER", "100%", "$THEME->cellheading"); + print_heading_block(get_string("availablecourses")); print_spacer(8,1); $categories = get_all_categories(); if (count($categories) > 1) { @@ -113,7 +101,7 @@ } else { $headertext = get_string("sitenews"); } - print_simple_box($headertext, "CENTER", "100%", $THEME->cellheading); + print_heading_block($headertext); print_spacer(8,1); forum_print_latest_discussions($newsforum->id, $site->newsitems); } diff --git a/mod/forum/lib.php b/mod/forum/lib.php index afbfbf9b0c..6d5ceb6fdd 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -804,16 +804,23 @@ function forum_print_mode_form($discussion, $mode) { echo "

\n"; } -function forum_print_search_form($course, $search="") { +function forum_print_search_form($course, $search="", $return=false) { global $CFG; - echo "
"; - echo "
wwwroot/mod/forum/search.php\">"; - echo "
"; - echo ""; - echo "id\">"; - echo "
"; - echo "
"; + $output = "
"; + $output .= "
wwwroot/mod/forum/search.php\">"; + $output .= ""; + $output .= "
"; + $output .= ""; + $output .= "
"; + $output .= "id\">"; + $output .= "
"; + $output .= "
"; + + if ($return) { + return $output; + } + echo $output; } diff --git a/theme/standard/config.php b/theme/standard/config.php index 6806d64d17..e6b1f57d3d 100644 --- a/theme/standard/config.php +++ b/theme/standard/config.php @@ -4,7 +4,7 @@ $THEME->body = "#FFEECE"; // Main page color $THEME->cellheading = "#FFD991"; // Standard headings of big tables $THEME->cellheading2 = "#FFB62D"; // Highlight headings of tables $THEME->cellcontent = "#FFFFFF"; // For areas with text -$THEME->cellcontent2 = "#FFD991"; // Alternate colour +$THEME->cellcontent2 = "#FFEECE"; // Alternate colour $THEME->borders = "#555555"; // Table borders ?>