course list not displayed properly on home page #4599

skala
Laurent Opprecht 14 years ago
parent 4ecd909b8c
commit d3544db097
  1. 5
      index.php
  2. 14
      main/inc/lib/userportal.lib.php

@ -122,11 +122,8 @@ if (!empty($_POST['submitAuth'])) {
event_open(); event_open();
} }
//@todo add this in the template
if (api_get_setting('display_categories_on_homepage') == 'true') { if (api_get_setting('display_categories_on_homepage') == 'true') {
echo '<div class="home_cats">'; $controller->tpl->assign('content', $controller->display_anonymous_course_list());
$controller->display_anonymous_course_list();
echo '</div>';
} }
$controller->set_login_form(); $controller->set_login_form();

@ -423,6 +423,7 @@ class IndexManager {
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University - refactoring and code cleaning * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University - refactoring and code cleaning
*/ */
function display_anonymous_course_list() { function display_anonymous_course_list() {
$result = '';
$ctok = $_SESSION['sec_token']; $ctok = $_SESSION['sec_token'];
$stok = Security::get_token(); $stok = Security::get_token();
@ -553,12 +554,12 @@ class IndexManager {
} }
$htmlListCat .= "</ul>"; $htmlListCat .= "</ul>";
} }
echo $htmlTitre; $result .= $htmlTitre;
if ($thereIsSubCat) { if ($thereIsSubCat) {
echo $htmlListCat; $result .= $htmlListCat;
} }
while ($categoryName = Database::fetch_array($resCats)) { while ($categoryName = Database::fetch_array($resCats)) {
echo '<h3>', $categoryName['name'], "</h3>\n"; $result .= '<h3>' . $categoryName['name'] . "</h3>\n";
} }
$numrows = Database::num_rows($sql_result_courses); $numrows = Database::num_rows($sql_result_courses);
$courses_list_string = ''; $courses_list_string = '';
@ -657,16 +658,17 @@ class IndexManager {
} }
$courses_list_string .= "</ul>"; $courses_list_string .= "</ul>";
} else { } else {
//echo '<blockquote>', get_lang('_No_course_publicly_available'), "</blockquote>\n"; //$result .= '<blockquote>', get_lang('_No_course_publicly_available'), "</blockquote>\n";
} }
if ($courses_shown > 0) { if ($courses_shown > 0) {
// Only display the list of courses and categories if there was more than // Only display the list of courses and categories if there was more than
// 0 courses visible to the world (we're in the anonymous list here). // 0 courses visible to the world (we're in the anonymous list here).
echo $courses_list_string; $result .= $courses_list_string;
} }
if ($category != '') { if ($category != '') {
echo '<p><a href="'.api_get_self().'"> ', Display :: return_icon('back.png', get_lang('BackToHomePage')), get_lang('BackToHomePage'), '</a></p>'; $result .= '<p><a href="'.api_get_self().'"> ' . Display :: return_icon('back.png', get_lang('BackToHomePage')) . get_lang('BackToHomePage') . '</a></p>';
} }
return '<div class="home_cats">' . $result . '</div>';
} }
/** /**

Loading…
Cancel
Save