diff --git a/admin/site.html b/admin/site.html index 72b6218eeca..603af4de582 100644 --- a/admin/site.html +++ b/admin/site.html @@ -33,26 +33,46 @@
| $option "; + choose_from_menu ($values, "frontpage[$key]", isset($seq[$key])?$seq[$key]:0, '', '', 0, false, $disabled); + echo ' | ';
+ }
+ ?>
+
| $option "; - choose_from_menu ($values, "frontpage[$key]", isset($seq[$key])?$seq[$key]:0, ""); + choose_from_menu ($values, "frontpageloggedin[$key]", isset($seq[$key])?$seq[$key]:0, ''); echo ' | ';
}
?>
diff --git a/admin/site.php b/admin/site.php
index 17c40d5225c..ce06de6b965 100644
--- a/admin/site.php
+++ b/admin/site.php
@@ -37,6 +37,13 @@
$form->numsections = 1; // Force the topic display for this format
}
+ $form->frontpageloggedin = array_flip($form->frontpageloggedin);
+ unset($form->frontpageloggedin[0]);
+ $form->frontpageloggedin = array_flip($form->frontpageloggedin);
+ asort($form->frontpageloggedin);
+ $form->frontpageloggedin = implode(',',array_flip($form->frontpageloggedin));
+ set_config("frontpageloggedin", $form->frontpageloggedin);
+
$form->timemodified = time();
if ($form->id) {
@@ -98,12 +105,18 @@
if (isset($CFG->frontpage)) {
$form->frontpage = $CFG->frontpage;
-
} else {
$form->frontpage = FRONTPAGECOURSELIST; // Show course list by default
set_config("frontpage", $form->frontpage);
}
+ if (isset($CFG->frontpageloggedin)) {
+ $form->frontpageloggedin = $CFG->frontpageloggedin;
+ } else {
+ $form->frontpageloggedin = $form->frontpage;
+ set_config("frontpageloggedin", $form->frontpageloggedin);
+ }
+
$stradmin = get_string("administration");
$strconfiguration = get_string("configuration");
$strsitesettings = get_string("sitesettings");
diff --git a/course/lib.php b/course/lib.php
index 801243e396b..d52a91cc922 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -24,6 +24,9 @@ define("FRONTPAGENEWS", 0);
define("FRONTPAGECOURSELIST", 1);
define("FRONTPAGECATEGORYNAMES", 2);
define("FRONTPAGETOPICONLY", 3);
+define("FRONTPAGECATEGORYCOMBO", 4);
+
+define("FRONTPAGECOURSELIMIT", 200); // maximum number of courses displayed on the frontpage
function print_recent_selector_form($course, $advancedfilter=0, $selecteduser=0, $selecteddate="lastlogin",
$mod="", $modid="activity/All", $modaction="", $selectedgroup="", $selectedsort="default") {
@@ -1034,7 +1037,7 @@ function make_categories_list(&$list, &$parents, $category=NULL, $path="") {
}
-function print_whole_category_list($category=NULL, $displaylist=NULL, $parentslist=NULL, $depth=-1) {
+function print_whole_category_list($category=NULL, $displaylist=NULL, $parentslist=NULL, $depth=-1, $files = false) {
/// Recursive function to print out all the categories in a nice format
/// with or without courses included
global $CFG;
@@ -1049,7 +1052,7 @@ function print_whole_category_list($category=NULL, $displaylist=NULL, $parentsli
if ($category) {
if ($category->visible or iscreator()) {
- print_category_info($category, $depth);
+ print_category_info($category, $depth, $files);
} else {
return; // Don't bother printing children of invisible categories
}
@@ -1072,7 +1075,7 @@ function print_whole_category_list($category=NULL, $displaylist=NULL, $parentsli
$down = $last ? false : true;
$first = false;
- print_whole_category_list($cat, $displaylist, $parentslist, $depth + 1);
+ print_whole_category_list($cat, $displaylist, $parentslist, $depth + 1, $files);
}
}
}
@@ -1093,7 +1096,7 @@ function make_categories_options() {
return $cats;
}
-function print_category_info($category, $depth) {
+function print_category_info($category, $depth, $files = false) {
/// Prints the category info in indented fashion
/// This function is only used by print_whole_category_list() above
@@ -1108,10 +1111,8 @@ function print_category_info($category, $depth) {
$catlinkcss = $category->visible ? '' : ' class="dimmed" ';
- $frontpage = explode(',', $CFG->frontpage);
- $frontpage = $frontpage?array_flip($frontpage):array();
- $coursecount = count_records('course') <= 200;
- if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST]) && $coursecount) {
+ $coursecount = count_records('course') <= FRONTPAGECOURSELIMIT;
+ if ($files and $coursecount) {
$catimage = '