diff --git a/index.php b/index.php index 51d23ea69f..499787a0aa 100644 --- a/index.php +++ b/index.php @@ -122,11 +122,8 @@ if (!empty($_POST['submitAuth'])) { event_open(); } -//@todo add this in the template if (api_get_setting('display_categories_on_homepage') == 'true') { - echo '
'; - $controller->display_anonymous_course_list(); - echo '
'; + $controller->tpl->assign('content', $controller->display_anonymous_course_list()); } $controller->set_login_form(); diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index 3498f5b22a..4e1bd2b792 100644 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -423,6 +423,7 @@ class IndexManager { * @author Patrick Cool , Ghent University - refactoring and code cleaning */ function display_anonymous_course_list() { + $result = ''; $ctok = $_SESSION['sec_token']; $stok = Security::get_token(); @@ -553,12 +554,12 @@ class IndexManager { } $htmlListCat .= ""; } - echo $htmlTitre; + $result .= $htmlTitre; if ($thereIsSubCat) { - echo $htmlListCat; + $result .= $htmlListCat; } while ($categoryName = Database::fetch_array($resCats)) { - echo '

', $categoryName['name'], "

\n"; + $result .= '

' . $categoryName['name'] . "

\n"; } $numrows = Database::num_rows($sql_result_courses); $courses_list_string = ''; @@ -657,16 +658,17 @@ class IndexManager { } $courses_list_string .= ""; } else { - //echo '
', get_lang('_No_course_publicly_available'), "
\n"; + //$result .= '
', get_lang('_No_course_publicly_available'), "
\n"; } if ($courses_shown > 0) { // 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). - echo $courses_list_string; + $result .= $courses_list_string; } if ($category != '') { - echo '

', Display :: return_icon('back.png', get_lang('BackToHomePage')), get_lang('BackToHomePage'), '

'; + $result .= '

' . Display :: return_icon('back.png', get_lang('BackToHomePage')) . get_lang('BackToHomePage') . '

'; } + return '
' . $result . '
'; } /**