mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-37009 Use new renderers for frontpage course and category listings
This commit is contained in:
parent
f53703b7be
commit
99a364564f
2 changed files with 205 additions and 10 deletions
26
index.php
26
index.php
|
@ -208,13 +208,22 @@
|
|||
case FRONTPAGECOURSELIST:
|
||||
$ncourses = $DB->count_records('course');
|
||||
if (isloggedin() and !$hassiteconfig and !isguestuser() and empty($CFG->disablemycourses)) {
|
||||
$mycourseshtml = $courserenderer->frontpage_my_courses();
|
||||
if (empty($mycourseshtml)) {
|
||||
if ($DB->count_records("course_categories") > 1) {
|
||||
$mycourseshtml = $courserenderer->frontpage_categories_list();
|
||||
} else {
|
||||
$mycourseshtml = $courserenderer->frontpage_available_courses();
|
||||
}
|
||||
}
|
||||
echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('mycourses'))), array('href'=>'#skipmycourses', 'class'=>'skip-block'));
|
||||
|
||||
//wrap frontpage course list in div container
|
||||
echo html_writer::start_tag('div', array('id'=>'frontpage-course-list'));
|
||||
|
||||
echo $OUTPUT->heading(get_string('mycourses'), 2, 'headingblock header');
|
||||
print_my_moodle();
|
||||
echo $mycourseshtml;
|
||||
echo $OUTPUT->box($courserenderer->course_search_form('', 'short'), 'mdl-align');
|
||||
|
||||
//end frontpage course list div container
|
||||
echo html_writer::end_tag('div');
|
||||
|
@ -228,7 +237,7 @@
|
|||
echo html_writer::start_tag('div', array('id'=>'frontpage-course-list'));
|
||||
|
||||
echo $OUTPUT->heading(get_string('availablecourses'), 2, 'headingblock header');
|
||||
print_courses(0);
|
||||
echo $courserenderer->frontpage_available_courses();
|
||||
|
||||
//end frontpage course list div container
|
||||
echo html_writer::end_tag('div');
|
||||
|
@ -236,7 +245,7 @@
|
|||
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'));
|
||||
echo $courserenderer->course_search_form('', 'short');
|
||||
echo $OUTPUT->box($courserenderer->course_search_form('', 'short'), 'mdl-align');
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -247,10 +256,8 @@
|
|||
echo html_writer::start_tag('div', array('id'=>'frontpage-category-names'));
|
||||
|
||||
echo $OUTPUT->heading(get_string('categories'), 2, 'headingblock header');
|
||||
echo $OUTPUT->box_start('generalbox categorybox');
|
||||
print_whole_category_list(NULL, NULL, NULL, -1, false);
|
||||
echo $OUTPUT->box_end();
|
||||
echo $courserenderer->course_search_form('', 'short');
|
||||
echo $courserenderer->frontpage_categories_list();
|
||||
echo $OUTPUT->box($courserenderer->course_search_form('', 'short'), 'mdl-align');
|
||||
|
||||
//end frontpage category names div container
|
||||
echo html_writer::end_tag('div');
|
||||
|
@ -265,7 +272,6 @@
|
|||
echo html_writer::start_tag('div', array('id'=>'frontpage-category-combo'));
|
||||
|
||||
echo $OUTPUT->heading(get_string('courses'), 2, 'headingblock header');
|
||||
$renderer = $PAGE->get_renderer('core','course');
|
||||
// if there are too many courses, building course category tree could be slow,
|
||||
// users should go to course index page to see the whole list.
|
||||
$coursecount = $DB->count_records('course');
|
||||
|
@ -277,9 +283,9 @@
|
|||
$link = new moodle_url('/course/');
|
||||
echo $OUTPUT->notification(get_string('maxnumcoursesincombo', 'moodle', array('link'=>$link->out(), 'maxnumofcourses'=>$CFG->numcoursesincombo, 'numberofcourses'=>$coursecount)));
|
||||
} else {
|
||||
echo $renderer->course_category_tree(get_course_category_tree());
|
||||
echo $courserenderer->frontpage_combo_list();
|
||||
}
|
||||
echo $courserenderer->course_search_form('', 'short');
|
||||
echo $OUTPUT->box($courserenderer->course_search_form('', 'short'), 'mdl-align');
|
||||
|
||||
//end frontpage category combo div container
|
||||
echo html_writer::end_tag('div');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue