From 44b404a0ab1a403cdda68f7d734e0e57bbab129c Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Fri, 31 Mar 2017 18:30:15 -0500 Subject: [PATCH] Course Visibility Arrangement --- app/Resources/public/css/base.css | 6 ++++-- main/auth/courses_categories.php | 21 ++++++++++---------- main/template/default/layout/hot_courses.tpl | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index bd86a716dd..3340467a68 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -4771,11 +4771,13 @@ div#chat-remote-video video { border-radius: 5px; margin-bottom: 20px; } -.grid-courses .items.items-courses, -.grid-courses .items.items-hotcourse{ +.grid-courses .items.items-courses{ min-height: 425px; width: 310px; } +.grid-courses .items.items-hotcourse{ + min-height: 360px; +} .grid-courses .items .block-title{ margin: 15px 10px 10px 10px; } diff --git a/main/auth/courses_categories.php b/main/auth/courses_categories.php index a17abe9a80..697b517c81 100755 --- a/main/auth/courses_categories.php +++ b/main/auth/courses_categories.php @@ -158,9 +158,10 @@ if ($showCourses && $action != 'display_sessions') { 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); + $userRegisterdInCourse = CourseManager::is_user_subscribed_in_course($user_id, $course['code']); + $userRegisterdInCourseAsTeacher = CourseManager::is_course_teacher($user_id, $course['code']); + $userRegisterd = ($userRegisterdInCourse && $userRegisterdInCourseAsTeacher); + $course_public = ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD); $course_open = ($course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM); $course_private = ($course['visibility'] == COURSE_VISIBILITY_REGISTERED); @@ -181,7 +182,7 @@ if ($showCourses && $action != 'display_sessions') { } // display thumbnail - $html .= returnThumbnail($course); + $html .= returnThumbnail($course, $userRegisterd); $separator = '
 
'; $subscribeButton = return_register_button($course, $stok, $code, $search_term); @@ -209,7 +210,7 @@ if ($showCourses && $action != 'display_sessions') { // display course title and button bloc $html .= '
'; - $html .= return_title($course); + $html .= return_title($course, $userRegisterd); $html .= return_teacher($course); // display button line @@ -276,7 +277,7 @@ echo $cataloguePagination; * * @return string HTML string */ -function returnThumbnail($course) +function returnThumbnail($course, $registeredUser) { $html = ''; $title = cut($course['title'], 70); @@ -294,7 +295,7 @@ function returnThumbnail($course) $html .= '
'; - if($course['visibility'] == COURSE_VISIBILITY_REGISTERED){ + if(!$registeredUser){ $html .= ''.api_htmlentities($title).''; }else{ $html .= ''.api_htmlentities($title).''; @@ -344,7 +345,7 @@ function return_teacher($course){ * @param $course * @return string HTML string */ -function return_title($course) +function return_title($course, $registeredUser) { $html = ''; $linkCourse = api_get_course_url($course['code']); @@ -353,7 +354,7 @@ function return_title($course) $rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&course_id='.$course['real_id'], $course['point_info']); $html .= '

'; - if ($course['visibility'] == COURSE_VISIBILITY_REGISTERED){ + if (!$registeredUser){ $html .= cut($title, 45); } else { $html .= '' . cut($title, 45) . ''; @@ -431,7 +432,7 @@ function return_already_registered_label($in_status) function return_register_button($course, $stok, $code, $search_term) { $html = ' ' . - Display::returnFontAwesomeIcon('sign-in') . ''; + get_lang('Subscribe') .' '. Display::returnFontAwesomeIcon('sign-in') . ''; return $html; } diff --git a/main/template/default/layout/hot_courses.tpl b/main/template/default/layout/hot_courses.tpl index f7c66df3aa..64d1d017e1 100755 --- a/main/template/default/layout/hot_courses.tpl +++ b/main/template/default/layout/hot_courses.tpl @@ -33,7 +33,7 @@ $(document).ready( function() { {% endif %}

-
+
{% include template ~ '/layout/hot_course_item.tpl' %}