COURSE DISPLAY REVAMP
OK, some big changes here to the front end, particularly in course categories and course display. Course categories can now be nested (to any level). Courses and course categories can now be manually sorted any way required. There is a groovy front end for managing these, and a better range of options for formatting the front page. It all still needs some polishing, which I'll be doing over the next couple of days, including better auto-sorting. I would not use this on production systems just yet.
This commit is contained in:
@@ -61,14 +61,23 @@
|
||||
echo "<br />";
|
||||
}
|
||||
|
||||
if ($site->newsitems > 0 ) {
|
||||
$categories = get_categories();
|
||||
if (count($categories) > 1) {
|
||||
print_course_categories($categories, "none", $side);
|
||||
} else {
|
||||
$category = array_shift($categories);
|
||||
print_all_courses($category->id, "minimal", 10, $side);
|
||||
}
|
||||
switch ($CFG->frontpage) {
|
||||
case FRONTPAGENEWS: // print news links on the side
|
||||
print_courses_sideblock(0, "$side");
|
||||
break;
|
||||
|
||||
case FRONTPAGECOURSELIST:
|
||||
case FRONTPAGECATEGORYNAMES:
|
||||
if ($site->newsitems) {
|
||||
if ($news = forum_get_course_forum($site->id, "news")) {
|
||||
print_side_block_start(get_string("latestnews"), $side, "sideblocklatestnews");
|
||||
echo "<font size=\"-2\">";
|
||||
forum_print_latest_discussions($news->id, $site->newsitems, "minimal", "", false);
|
||||
echo "</font>";
|
||||
print_side_block_end();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
print_spacer(1,$side);
|
||||
}
|
||||
@@ -86,38 +95,49 @@
|
||||
}
|
||||
echo "<td width=\"70%\" valign=\"top\">";
|
||||
|
||||
if ($site->newsitems == 0 ) {
|
||||
print_heading_block(get_string("availablecourses"));
|
||||
print_spacer(8,1);
|
||||
$categories = get_categories();
|
||||
if (count($categories) > 1) {
|
||||
print_course_categories($categories, "index");
|
||||
} else {
|
||||
print_all_courses("all");
|
||||
}
|
||||
|
||||
} else {
|
||||
if (! $newsforum = forum_get_course_forum($site->id, "news")) {
|
||||
error("Could not find or create a main news forum for the site");
|
||||
}
|
||||
|
||||
if (isset($USER->id)) {
|
||||
$SESSION->fromdiscussion = "$CFG->wwwroot";
|
||||
if (forum_is_subscribed($USER->id, $newsforum->id)) {
|
||||
$subtext = get_string("unsubscribe", "forum");
|
||||
} else {
|
||||
$subtext = get_string("subscribe", "forum");
|
||||
switch ($CFG->frontpage) { /// Display the main part of the front page.
|
||||
case FRONTPAGENEWS:
|
||||
if (! $newsforum = forum_get_course_forum($site->id, "news")) {
|
||||
error("Could not find or create a main news forum for the site");
|
||||
}
|
||||
$headertext = "<table border=0 align=right cellpadding=0 cellspacing=0><tr>
|
||||
<td align=right><font size=1>
|
||||
<a href=\"mod/forum/subscribe.php?id=$newsforum->id\">$subtext</a>
|
||||
</td></tr></table>$newsforum->name";
|
||||
} else {
|
||||
$headertext = $newsforum->name;
|
||||
}
|
||||
print_heading_block($headertext);
|
||||
print_spacer(8,1);
|
||||
forum_print_latest_discussions($newsforum->id, $site->newsitems);
|
||||
|
||||
if (isset($USER->id)) {
|
||||
$SESSION->fromdiscussion = "$CFG->wwwroot";
|
||||
if (forum_is_subscribed($USER->id, $newsforum->id)) {
|
||||
$subtext = get_string("unsubscribe", "forum");
|
||||
} else {
|
||||
$subtext = get_string("subscribe", "forum");
|
||||
}
|
||||
$headertext = "<table border=0 width=100% cellpadding=0 cellspacing=0><tr>
|
||||
<td>$newsforum->name</td>
|
||||
<td align=right><font size=1>
|
||||
<a href=\"mod/forum/subscribe.php?id=$newsforum->id\">$subtext</a>
|
||||
</td></tr></table>";
|
||||
} else {
|
||||
$headertext = $newsforum->name;
|
||||
}
|
||||
print_heading_block($headertext);
|
||||
print_spacer(8,1);
|
||||
forum_print_latest_discussions($newsforum->id, $site->newsitems);
|
||||
break;
|
||||
|
||||
case FRONTPAGECOURSELIST:
|
||||
case FRONTPAGECATEGORYNAMES:
|
||||
if (isset($USER->id) and !isset($USER->admin)) {
|
||||
print_heading_block(get_string("mycourses"));
|
||||
print_spacer(8,1);
|
||||
print_my_moodle();
|
||||
} else {
|
||||
print_heading_block(get_string("availablecourses"));
|
||||
print_spacer(8,1);
|
||||
if (count_records("course_categories") > 1) {
|
||||
print_whole_category_list();
|
||||
} else {
|
||||
print_courses(0, "100%");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
echo "</td>";
|
||||
|
||||
Reference in New Issue
Block a user