Skip to content

Commit

Permalink
MDL-25630 moodle/index.php: Wraps individual front page content eleme…
Browse files Browse the repository at this point in the history
…nts (Site news/Course list/Category names/Category combo) in divs with descriptive classes so they can be styled individually.
  • Loading branch information
Mary Evans committed Dec 20, 2012
1 parent 2075186 commit 4c71a80
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@
$forumname = format_string($newsforum->name, true, array('context' => $newsforumcontext));
echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(strip_tags($forumname))), array('href'=>'#skipsitenews', 'class'=>'skip-block'));

// wraps site news forum in div container.
echo html_writer::start_tag('div', array('id'=>'site-news-forum'));

if (isloggedin()) {
$SESSION->fromdiscussion = $CFG->wwwroot;
$subtext = '';
Expand All @@ -198,6 +201,10 @@
}

forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems, 'plain', 'p.modified DESC');

//end site news forum div container
echo html_writer::end_tag('div');

echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipsitenews'));
}
break;
Expand All @@ -206,14 +213,30 @@
$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'));

//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();

//end frontpage course list div container
echo html_writer::end_tag('div');

echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipmycourses'));
} 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'));

//wrap frontpage course list in div container
echo html_writer::start_tag('div', array('id'=>'frontpage-course-list'));

echo $OUTPUT->heading(get_string('availablecourses'), 2, 'headingblock header');
print_courses(0);

//end frontpage course list div container
echo html_writer::end_tag('div');

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'));
Expand All @@ -223,19 +246,31 @@

case FRONTPAGECATEGORYNAMES:
echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('categories'))), array('href'=>'#skipcategories', 'class'=>'skip-block'));

//wrap frontpage category names in div container
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();
print_course_search('', false, 'short');

//end frontpage category names div container
echo html_writer::end_tag('div');

echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipcategories'));
break;

case FRONTPAGECATEGORYCOMBO:
echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('courses'))), array('href'=>'#skipcourses', 'class'=>'skip-block'));

//wrap frontpage category combo in div container
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, budiling course category tree could be slow,
// 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');
if (empty($CFG->numcoursesincombo)) {
Expand All @@ -249,6 +284,10 @@
echo $renderer->course_category_tree(get_course_category_tree());
}
print_course_search('', false, 'short');

//end frontpage category combo div container
echo html_writer::end_tag('div');

echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipcourses'));
break;

Expand Down

0 comments on commit 4c71a80

Please sign in to comment.