From 98795fd1a634cf4f69bf66392026260e1ca7df45 Mon Sep 17 00:00:00 2001 From: David Monllao Date: Mon, 3 Sep 2012 15:20:52 +0800 Subject: [PATCH] MDL-10259 core Adding a search courses box if there are too many courses --- index.php | 6 +++++- lang/en/moodle.php | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 38a4438e18b..dd350322440 100644 --- a/index.php +++ b/index.php @@ -204,17 +204,21 @@ break; case FRONTPAGECOURSELIST: + $ncourses = $DB->count_records('course'); if (isloggedin() and !$hassiteconfig and !isguestuser() and empty($CFG->disablemycourses)) { echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('mycourses'))), array('href'=>'#skipmycourses', 'class'=>'skip-block')); echo $OUTPUT->heading(get_string('mycourses'), 2, 'headingblock header'); print_my_moodle(); echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipmycourses')); - } else if ((!$hassiteconfig and !isguestuser()) or ($DB->count_records('course') <= FRONTPAGECOURSELIMIT)) { + } else if ((!$hassiteconfig and !isguestuser()) or ($ncourses <= FRONTPAGECOURSELIMIT)) { // admin should not see list of courses when there are too many of them echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('availablecourses'))), array('href'=>'#skipavailablecourses', 'class'=>'skip-block')); echo $OUTPUT->heading(get_string('availablecourses'), 2, 'headingblock header'); print_courses(0); echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipavailablecourses')); + } else { + echo html_writer::tag('div', get_string('therearecourses', '', $ncourses), array('class' => 'notifyproblem')); + print_course_search('', false, 'short'); } break; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index f7f308401d6..d55a2187203 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -1670,6 +1670,7 @@ $string['theme'] = 'Theme'; $string['themes'] = 'Themes'; $string['themesaved'] = 'New theme saved'; $string['thereareno'] = 'There are no {$a} in this course'; +$string['therearecourses'] = 'There are {$a} courses'; $string['thiscategorycontains'] = 'This category contains'; $string['time'] = 'Time'; $string['timezone'] = 'Timezone'; -- 2.43.0