diff --git a/main/template/default/auth/courses_categories.php b/main/template/default/auth/courses_categories.php index fe0cc00d8e..dcdac6178c 100755 --- a/main/template/default/auth/courses_categories.php +++ b/main/template/default/auth/courses_categories.php @@ -108,7 +108,7 @@ $code = isset($code) ? $code : null;
-
@@ -127,8 +127,8 @@ $code = isset($code) ? $code : null;
- '; $form .= '
'; $form .= ''; $form .= '
'; - $from .= ''; + $form .= ''; echo $form; ?>
-
-
- -
- + if ($showSessions) { ?> +
+
+ + + +
+ -
- +".get_lang('SearchResultsFor')." ".Security::remove_XSS($_POST['search_term'])."
"; - } + if (!empty($search_term)) { + echo "

".get_lang('SearchResultsFor')." ".Security::remove_XSS($_POST['search_term'])."
"; + } + + $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote'; + $user_id = api_get_user_id(); + + if (!empty($browse_courses_in_category)) { + foreach ($browse_courses_in_category as $course) { + $course_hidden = ($course['visibility'] == COURSE_VISIBILITY_HIDDEN); - $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote'; - $user_id = api_get_user_id(); - - if (!empty($browse_courses_in_category)) { - foreach ($browse_courses_in_category as $course) { - $course_hidden = ($course['visibility'] == COURSE_VISIBILITY_HIDDEN); + if ($course_hidden) { + continue; + } - if ($course_hidden) { - continue; + $user_registerd_in_course = CourseManager::is_user_subscribed_in_course($user_id, $course['code']); + $user_registerd_in_course_as_teacher = CourseManager::is_course_teacher($user_id, $course['code']); + $user_registerd_in_course_as_student = ($user_registerd_in_course && !$user_registerd_in_course_as_teacher); + $course_public = ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD); + $course_open = ($course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM); + $course_private = ($course['visibility'] == COURSE_VISIBILITY_REGISTERED); + $course_closed = ($course['visibility'] == COURSE_VISIBILITY_CLOSED); + + $course_subscribe_allowed = ($course['subscribe'] == 1); + $course_unsubscribe_allowed = ($course['unsubscribe'] == 1); + $count_connections = $course['count_connections']; + $creation_date = substr($course['creation_date'],0,10); + + $icon_title = null; + $html = null; + // display the course bloc + $html .= '

'; + + // display thumbnail + $html .= return_thumbnail($course, $icon_title); + + // display course title and button bloc + $html .= '
'; + $html .= return_title($course); + // display button line + $html .= '
'; + // if user registered as student + if ($user_registerd_in_course_as_student) { + if (!$course_closed) { + if ($course_unsubscribe_allowed) { + $html .= return_unregister_button($course, $stok, $search_term, $code); } + $html .= return_already_registered_label('student'); + } + $html .= return_description_button($course, $icon_title); + } elseif ($user_registerd_in_course_as_teacher) { + // if user registered as teacher + //$html .= return_goto_button($course); - $user_registerd_in_course = CourseManager::is_user_subscribed_in_course($user_id, $course['code']); - $user_registerd_in_course_as_teacher = CourseManager::is_course_teacher($user_id, $course['code']); - $user_registerd_in_course_as_student = ($user_registerd_in_course && !$user_registerd_in_course_as_teacher); - $course_public = ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD); - $course_open = ($course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM); - $course_private = ($course['visibility'] == COURSE_VISIBILITY_REGISTERED); - $course_closed = ($course['visibility'] == COURSE_VISIBILITY_CLOSED); - - $course_subscribe_allowed = ($course['subscribe'] == 1); - $course_unsubscribe_allowed = ($course['unsubscribe'] == 1); - $count_connections = $course['count_connections']; - $creation_date = substr($course['creation_date'],0,10); - - $icon_title = null; - $html = null; - // display the course bloc - $html .= '
'; - - // display thumbnail - $html .= return_thumbnail($course, $icon_title); - - // display course title and button bloc - $html .= '
'; - $html .= return_title($course); - // display button line - $html .= '
'; - // if user registered as student - if ($user_registerd_in_course_as_student) { - if (!$course_closed) { - if ($course_unsubscribe_allowed) { - $html .= return_unregister_button($course, $stok, $search_term, $code); - } - $html .= return_already_registered_label('student'); - } - $html .= return_description_button($course, $icon_title); - } elseif ($user_registerd_in_course_as_teacher) { - // if user registered as teacher + if ($course_unsubscribe_allowed) { + $html .= return_unregister_button($course, $stok, $search_term, $code); + } + $html .= return_already_registered_label('teacher'); + $html .= return_description_button($course, $icon_title); + } else { + // if user not registered in the course + if (!$course_closed) { + if (!$course_private) { //$html .= return_goto_button($course); - - if ($course_unsubscribe_allowed) { - $html .= return_unregister_button($course, $stok, $search_term, $code); - } - $html .= return_already_registered_label('teacher'); - $html .= return_description_button($course, $icon_title); - } else { - // if user not registered in the course - if (!$course_closed) { - if (!$course_private) { - //$html .= return_goto_button($course); - if ($course_subscribe_allowed) { - $html .= return_register_button($course, $stok, $code, $search_term); - } - } + if ($course_subscribe_allowed) { + $html .= return_register_button($course, $stok, $code, $search_term); } - $html .= return_description_button($course, $icon_title); } - - $html .= '
'; - $html .= '
'; - $html .= '
'; - $html .= '
'; - echo $html; - } - } else { - if (!isset($_REQUEST['subscribe_user_with_password']) && - !isset($_REQUEST['subscribe_course']) - ) { - Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory')); - } - } + $html .= return_description_button($course, $icon_title); + } + + $html .= '
'; + $html .= '
'; + $html .= '
'; + $html .= '
'; + echo $html; + } - echo $cataloguePagination; + } else { + if (!isset($_REQUEST['subscribe_user_with_password']) && + !isset($_REQUEST['subscribe_course']) + ) { + Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory')); + } + } +} +echo $cataloguePagination; -?> +?>
- + '; if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') { $html .= ''; @@ -308,6 +309,7 @@ function return_thumbnail($course, $icon_title) $html .= ''.api_htmlentities($title).''; } $html .= ''; // thumbail + return $html; } @@ -316,15 +318,17 @@ function return_thumbnail($course, $icon_title) * @param $course */ function return_title($course) -{ $html = ''; +{ + $html = ''; $linkCourse = api_get_course_url($course['code']); $title = cut($course['title'], 70); $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote'; $teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code']); - $rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&course_id='.$course['real_id'], $course['point_info']); + $rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&course_id='.$course['real_id'], $course['point_info']); $html .= '

' . cut($title, 60) . '

'; $html .= '
'.$teachers.'
'; $html .= '
'. $rating . '
'; + return $html; } @@ -334,11 +338,13 @@ function return_title($course) * @param $icon_title */ function return_description_button($course, $icon_title) -{ +{ $title = $course['title']; + $html = ''; if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') { $html = ''.get_lang('Description').''; } + return $html; } @@ -349,6 +355,7 @@ function return_description_button($course, $icon_title) function return_goto_button($course) { $html = ' '.get_lang('GoToCourse').''; + return $html; } @@ -363,6 +370,7 @@ function return_already_registered_label($in_status) $icon = Display::return_icon('user.png', get_lang('Student'), null, ICON_SIZE_TINY); } $html = Display::div($icon.' '.get_lang("AlreadyRegisteredToCourse"), array('id' => 'register', 'class' => 'user-register')); + return $html; } @@ -377,7 +385,6 @@ function return_register_button($course, $stok, $code, $search_term) { $html = ' '.get_lang('Subscribe').''; return $html; - } /** @@ -391,5 +398,4 @@ function return_unregister_button($course, $stok, $search_term, $code) { $html = ' '.get_lang('Unsubscribe').''; return $html; - }