Fixing course categories in index.php see #5249

skala
Julio Montoya 13 years ago
parent 85178f5770
commit 89b0bdc9db
  1. 2
      index.php
  2. 11
      main/css/base_chamilo.css
  3. 11
      main/css/blue_lagoon/default.css
  4. 11
      main/css/cool_blue/default.css
  5. 11
      main/css/delicious_bordeaux/default.css
  6. 10
      main/css/dokeos_blue/default.css
  7. 10
      main/css/dokeos_classic/default.css
  8. 15
      main/css/dokeos_classic_2D/default.css
  9. 10
      main/css/empire_green/default.css
  10. 11
      main/css/fruity_orange/default.css
  11. 10
      main/css/medical/default.css
  12. 11
      main/css/public_admin/default.css
  13. 11
      main/css/royal_purple/default.css
  14. 11
      main/css/sober_brown/default.css
  15. 11
      main/css/steel_grey/default.css
  16. 11
      main/css/tasty_olive/default.css
  17. 131
      main/inc/lib/userportal.lib.php
  18. 27
      main/template/default/layout/layout_2_col.tpl

@ -127,7 +127,7 @@ if (!empty($_POST['submitAuth'])) {
}
if (api_get_setting('display_categories_on_homepage') == 'true') {
$controller->tpl->assign('content', $controller->return_anonymous_course_list());
$controller->tpl->assign('course_category_block', $controller->return_courses_in_categories());
}
// Facebook connexion, if activated

@ -499,16 +499,7 @@ a.nobold:hover {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: transparent;
}
.home_news {
width: 45%;
float: right;

@ -1159,16 +1159,7 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: #fff;
}
.home_news {
width: 45%;
float: right;

@ -1107,16 +1107,7 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: #fff;
}
.home_news {
width: 45%;
float: right;

@ -1119,16 +1119,7 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: #fff;
}
.home_news {
width: 45%;
float: right;

@ -1128,16 +1128,6 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: #fff;
}
.home_news {
width: 45%;
float: right;

@ -998,16 +998,6 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: #fff;
}
.home_news {
width: 45%;
float: right;

@ -1055,21 +1055,6 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/*
==============================================================================
divs for category list / platform news on home page
==============================================================================
*/
.home_cats {
background: #fff;
float: left;
margin: 0;
padding: 0px;
padding-top: 8px;
position: relative;
width: 45%;
}
.home_news {
background: #fff;
float: right;

@ -1117,16 +1117,6 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: #fff;
}
.home_news {
width: 45%;
float: right;

@ -1125,16 +1125,7 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: #fff;
}
.home_news {
width: 45%;
float: right;

@ -1099,16 +1099,6 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: transparent;
}
.home_news {
width: 45%;
float: right;

@ -868,16 +868,7 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: transparent;
}
.home_news {
width: 45%;
float: right;

@ -1076,16 +1076,7 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: #fff;
}
.home_news {
width: 45%;
float: right;

@ -760,16 +760,7 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: transparent;
}
.home_news {
width: 45%;
float: right;

@ -1109,16 +1109,7 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: #fff;
}
.home_news {
width: 45%;
float: right;

@ -1053,16 +1053,7 @@ span.form_error {
margin: 0;
padding: 4px 0 0 10px;
}
/* divs for category list / platform news on home page */
.home_cats {
width: 45%;
float: left;
position: relative;
margin: 0;
padding: 0px;
padding-top: 8px;
background: #fff;
}
.home_news {
width: 45%;
float: right;

@ -342,8 +342,9 @@ class IndexManager {
*
* @version 1.1
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University - refactoring and code cleaning
* @author Julio Montoya <gugli100@gmail.com>, Beeznest template modifs
*/
function return_anonymous_course_list() {
function return_courses_in_categories() {
$result = '';
$ctok = $_SESSION['sec_token'];
$stok = Security::get_token();
@ -406,8 +407,7 @@ class IndexManager {
GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count ORDER BY t1.tree_pos, t1.name";
// Showing only the category of courses of the current access_url_id.
global $_configuration;
// Showing only the category of courses of the current access_url_id
if ($_configuration['multiple_access_urls']) {
$url_access_id = api_get_current_access_url_id();
if ($url_access_id != -1) {
@ -427,10 +427,10 @@ class IndexManager {
$resCats = Database::query($sqlGetSubCatList);
$thereIsSubCat = false;
if (Database::num_rows($resCats) > 0) {
$htmlListCat = '<h4 style="margin-top: 0px;">'.get_lang('CatList').'</h4><ul>';
$htmlListCat = Display::page_header(get_lang('CatList'));
$htmlListCat .= '<ul>';
while ($catLine = Database::fetch_array($resCats)) {
if ($catLine['code'] != $category) {
if ($catLine['code'] != $category) {
$category_has_open_courses = self::category_has_open_courses($catLine['code']);
if ($category_has_open_courses) {
// The category contains courses accessible to anonymous visitors.
@ -439,20 +439,20 @@ class IndexManager {
if (api_get_setting('show_number_of_courses') == 'true') {
$htmlListCat .= ' ('.$catLine['nbCourse'].' '.get_lang('Courses').')';
}
$htmlListCat .= "</li>\n";
$htmlListCat .= "</li>";
$thereIsSubCat = true;
} elseif ($catLine['children_count'] > 0) {
// The category has children, subcategories.
$htmlListCat .= '<li>';
$htmlListCat .= '<a href="'.api_get_self().'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';
$htmlListCat .= "</li>\n";
$htmlListCat .= "</li>";
$thereIsSubCat = true;
}
/* End changed code to eliminate the (0 courses) after empty categories. */
elseif (api_get_setting('show_empty_course_categories') == 'true') {
$htmlListCat .= '<li>';
$htmlListCat .= $catLine['name'];
$htmlListCat .= "</li>\n";
$htmlListCat .= "</li>";
$thereIsSubCat = true;
} // Else don't set thereIsSubCat to true to avoid printing things if not requested.
} else {
@ -463,11 +463,11 @@ class IndexManager {
if (!is_null($catLine['parent_id']) || (api_get_setting('show_back_link_on_top_of_tree') != 'true' && !is_null($catLine['code']))) {
$htmlTitre .= '<a href="'.api_get_self().'?category='.$catLine['parent_id'].'">&lt;&lt; '.get_lang('Up').'</a>';
}
$htmlTitre .= "</p>\n";
$htmlTitre .= "</p>";
if ($category != "" && !is_null($catLine['code'])) {
$htmlTitre .= '<h3>'.$catLine['name']."</h3>\n";
$htmlTitre .= '<h3>'.$catLine['name']."</h3>";
} else {
$htmlTitre .= '<h3>'.get_lang('Categories')."</h3>\n";
$htmlTitre .= '<h3>'.get_lang('Categories')."</h3>";
}
}
}
@ -484,10 +484,9 @@ class IndexManager {
$courses_list_string = '';
$courses_shown = 0;
if ($numrows > 0) {
if ($thereIsSubCat) {
$courses_list_string .= "<hr size=\"1\" noshade=\"noshade\">\n";
}
$courses_list_string .= '<h4 style="margin-top: 0px;">'.get_lang('CourseList')."</h4>\n<ul>\n";
$courses_list_string .= Display::page_header(get_lang('CourseList'));
$courses_list_string .= "<ul>";
if (api_get_user_id()) {
$courses_of_user = self::get_courses_of_user(api_get_user_id());
@ -516,79 +515,79 @@ class IndexManager {
$courses_list_string .= implode(' - ', $course_details);
$courses_list_string .= "</li>\n";
}
}
// We DO show the closed courses.
// The course is accessible if (link to the course homepage):
// 1. the course is open to the world (doesn't matter if the user is logged in or not): $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD);
// 2. the user is logged in and the course is open to the world or open to the platform: ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM);
// 3. the user is logged in and the user is subscribed to the course and the course visibility is not COURSE_VISIBILITY_CLOSED;
// 4. the user is logged in and the user is course admin of te course (regardless of the course visibility setting);
// 5. the user is the platform admin api_is_platform_admin().
//
else {
$courses_shown++;
} else {
// We DO show the closed courses.
// The course is accessible if (link to the course homepage):
// 1. the course is open to the world (doesn't matter if the user is logged in or not): $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD);
// 2. the user is logged in and the course is open to the world or open to the platform: ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM);
// 3. the user is logged in and the user is subscribed to the course and the course visibility is not COURSE_VISIBILITY_CLOSED;
// 4. the user is logged in and the user is course admin of te course (regardless of the course visibility setting);
// 5. the user is the platform admin api_is_platform_admin().
//
$courses_shown++;
$courses_list_string .= "<li>\n";
if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD
|| ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM)
|| ($user_identified && key_exists($course['code'], $courses_of_user) && $course['visibility'] != COURSE_VISIBILITY_CLOSED)
|| $courses_of_user[$course['code']]['status'] == '1'
|| api_is_platform_admin()) {
$courses_list_string .= '<a href="'.$web_course_path.$course['directory'].'/">';
}
$courses_list_string .= $course['title'];
if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD
|| ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM)
|| ($user_identified && key_exists($course['code'], $courses_of_user) && $course['visibility'] != COURSE_VISIBILITY_CLOSED)
|| $courses_of_user[$course['code']]['status'] == '1'
|| api_is_platform_admin()) {
$courses_list_string .= '<a href="'.$web_course_path.$course['directory'].'/">';
}
$courses_list_string .= $course['title'];
if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD
|| ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM)
|| ($user_identified && key_exists($course['code'], $courses_of_user) && $course['visibility'] != COURSE_VISIBILITY_CLOSED)
|| $courses_of_user[$course['code']]['status'] == '1'
|| api_is_platform_admin()) {
$courses_list_string .= '</a><br />';
}
$course_details = array();
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$course_details[] = $course['visual_code'];
}
$courses_list_string .= '</a><br />';
}
$course_details = array();
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$course_details[] = $course['visual_code'];
}
// if (api_get_setting('display_coursecode_in_courselist') == 'true' && api_get_setting('display_teacher_in_courselist') == 'true') {
// $courses_list_string .= ' - ';
// }
if (api_get_setting('display_teacher_in_courselist') == 'true') {
if (api_get_setting('display_teacher_in_courselist') == 'true') {
$course_details[] = $course['tutor_name'];
}
if (api_get_setting('show_different_course_language') == 'true' && $course['course_language'] != api_get_setting('platformLanguage')) {
$course_details[] = $course['course_language'];
}
if (api_get_setting('show_different_course_language') == 'true' && $course['course_language'] != api_get_setting('platformLanguage')) {
if (api_get_setting('show_different_course_language') == 'true' && $course['course_language'] != api_get_setting('platformLanguage')) {
$course_details[] = $course['course_language'];
}
$courses_list_string .= implode(' - ', $course_details);
// We display a subscription link if:
// We display a subscription link if:
// 1. it is allowed to register for the course and if the course is not already in the courselist of the user and if the user is identiefied
// 2.
if ($user_identified && !key_exists($course['code'], $courses_of_user)) {
if ($course['subscribe'] == '1') {
$courses_list_string .= '<form action="main/auth/courses.php?action=subscribe&category='.Security::remove_XSS($_GET['category']).'" method="post">';
$courses_list_string .= '<input type="hidden" name="sec_token" value="'.$stok.'">';
$courses_list_string .= '<input type="hidden" name="subscribe" value="'.$course['code'].'" />';
$courses_list_string .= '<input type="image" name="unsub" src="main/img/enroll.gif" alt="'.get_lang('Subscribe').'" />'.get_lang('Subscribe').'</form>';
} else {
$courses_list_string .= '<br />'.get_lang('SubscribingNotAllowed');
}
}
$courses_list_string .= "</li>";
}
}
if ($user_identified && !key_exists($course['code'], $courses_of_user)) {
if ($course['subscribe'] == '1') {
$courses_list_string .= '<form action="main/auth/courses.php?action=subscribe&category='.Security::remove_XSS($_GET['category']).'" method="post">';
$courses_list_string .= '<input type="hidden" name="sec_token" value="'.$stok.'">';
$courses_list_string .= '<input type="hidden" name="subscribe" value="'.$course['code'].'" />';
$courses_list_string .= '<input type="image" name="unsub" src="main/img/enroll.gif" alt="'.get_lang('Subscribe').'" />'.get_lang('Subscribe').'</form>';
} else {
$courses_list_string .= '<br />'.get_lang('SubscribingNotAllowed');
}
}
$courses_list_string .= "</li>";
} //end else
} // end foreach
$courses_list_string .= "</ul>";
} else {
//$result .= '<blockquote>', get_lang('_No_course_publicly_available'), "</blockquote>\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).
$result .= $courses_list_string;
}
} else {
//$result .= '<blockquote>', get_lang('_No_course_publicly_available'), "</blockquote>\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).
$result .= $courses_list_string;
}
if ($category != '') {
$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>';
return $result;
}
/**

@ -12,17 +12,17 @@
</div>
{% endif %}
{# ?? #}
{# Portal homepage #}
{% if home_page_block %}
<section id="home_page">
<section id="homepage">
<div class="row">
<div class="span9">
{{ home_page_block}}
{{ home_page_block }}
</div>
</div>
</section>
{% endif %}
{# ?? #}
{{ sniff_notification }}
@ -33,16 +33,27 @@
{{ content }}
</section>
{% endif %}
{# Announcements #}
{% if announcements_block %}
<section id="announcements_page">
<section id="announcements">
{{ announcements_block }}
</section>
{% endif %}
{# Course categories (must be turned on in the admin settings) #}
{% if course_category_block %}
<section id="course_category">
<div class="row">
<div class="span9">
{{ course_category_block }}
</div>
</div>
</section>
{% endif %}
{# Hot courses template #}
{% include "default/layout/hot_courses.tpl" %}
{% include "default/layout/hot_courses.tpl" %}
{# Content bottom #}
{% if plugin_content_bottom %}

Loading…
Cancel
Save