From 7e2e475014ac6a70528fdbbea09b342e00ce2cf6 Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Tue, 19 Apr 2016 18:35:52 -0500 Subject: [PATCH] add list view course classic BT#11017 --- app/Resources/public/css/base.css | 24 +++- main/img/icons/48/drawing-pin.png | Bin 0 -> 2854 bytes main/inc/lib/course.lib.php | 111 +++++------------ main/inc/lib/display.lib.php | 10 ++ main/inc/lib/userportal.lib.php | 8 +- .../default/user_portal/main_courses.tpl | 116 +++++++++++++++++- 6 files changed, 177 insertions(+), 92 deletions(-) create mode 100644 main/img/icons/48/drawing-pin.png diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index 07bb73c41a..d9d7e56353 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -4856,6 +4856,15 @@ div#chat-remote-video video { width: 100px; height: 100px; } +/* list courses classic*/ +.classic-courses .teachers{ + margin: 0; + padding: 0; + display: inline-block; +} +.classic-courses .teachers li{ + display: inline-block; +} /* list my course user*/ .grid-courses .items{ @@ -4880,12 +4889,17 @@ div#chat-remote-video video { .grid-courses .items .image{ position: relative; } +.grid-courses .items .image .pin{ + position: absolute; + top: -10px; + right: -10px; + z-index: 2; +} .grid-courses .items .image .black_shadow{ top: 0px; left: 0px; width: 100%; height: 100%; - cursor: pointer; padding-top: 40px; opacity: 0; box-sizing: border-box; @@ -4914,7 +4928,7 @@ div#chat-remote-video video { position: absolute; bottom: 0px; right: -10px; - background-color: #35DF86; + background-color: #FD6600; color: #fff; padding: 5px 10px; font-size: 11px; @@ -4924,7 +4938,7 @@ div#chat-remote-video video { .grid-courses .items .cribbon{ width: 0; height: 0; - border-top: 10px solid #19BF69; + border-top: 10px solid #FD3414; border-right: 10px solid transparent; position: absolute; bottom: -10px; @@ -5961,6 +5975,10 @@ a.sessionView { .gallery .canvas-two{ width: 100%; } + .grid-courses .items{ + margin-left: 5%; + margin-right: 5%; + } } .elfinder-cwd-filename { diff --git a/main/img/icons/48/drawing-pin.png b/main/img/icons/48/drawing-pin.png new file mode 100644 index 0000000000000000000000000000000000000000..8bf1ba70911e365b3c325ab9b62c768c94178418 GIT binary patch literal 2854 zcmV+>3)%FEP) zK~z}7#h6=+UDsL1f8V<7bLPyPu_t3Yt{ZHpCb3nMm_+6waYYDBf@30~ynztdLVY0t z6;;gxPaq{y9zYc@5#pALR7ki*pbA1v6gy2JvQUwbKs3fEPF>+!Jh8_!bIv|z@3q#) z!&!S~dpwb-nvgAhI&1HA&;b%NxvjHR^0yPjtE(F!z!`i<&7USR)aP-q60PuI< z9Q>Ap7YpchfC4ZwF#uJF3IPcHKK0BDD_5@kh4=m|KVR32um67%cmsIyb}xLe7 znF73k@qpjpf&f}UNYGhWpp20#Z@u+()9L)ivGI8Di4*u1@QZo;ZI~LsQH6y9PV}JH z0}2aF0gW4Mp4yOY43rSnvF*hdxq9XdSKfHzi-mKqd}0J%1AYPcNALj-D11rb*8#D> zbhfSqdfBD`2bla4Z4np(18@f(Wcv88@!nUz`roUUFMq*)+`t9+6X2JDQ*cj!-%@SPUe2E1&r2#gc)!zD(mt5kzQa6bZQyNSt%Q2zn!kMQTfgPL=( z$w{B1!~)`47i1Igu@y?qy#<78S5XCl!yifD{`>Fe{Q2_$?BBniix)4NZntY=j711x zD#q9gA@ov8J)qls`aYQ20bc;^x!<3d~0mhTfy$YfUbeI$Vf z{H|TQWH1=G+1c5t(P-2UA1`lr$`MGhj#o;`cGc=00rexJR2_u8^7yTjpdHiWQERd=M6=3|UoRCPL~RJ1C$ znHDJ?6L}_AJ<1F`s4{3>OF+`>n#M)86>GF&E@i+?TaJ?kmv8;vZ3GS+IKa7c=h(4h zhwR$5%a&z19b=pacB<;#dFE$QN>i%ZMDL{ViI`&|pPv?)U2VXsQe})~{>Jh;4m5() zK$YLZM-WI^Pvn<1p{elgwa0eu+{w9f=h(e_x9r}%+pVmu%!tSiRsBo|VS9{mYmWJ@ zsunHqPDHGVa75%MD-kLYs+1-gCVxBRLUS|YsDUDa8@IB$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~V;FTZ318W2>T(|(hi4!NN>zb`ww<01*RY@tSF(!$KHj*Nfh|amtk{)$Y6qR#s z=)GTd&fT!qUbfa=a?X8Vj9FeXKhV^)nZt0J-_A~!|k zruTlyIk%Gk59iOHSAc%MPgPYP>t5`p$HKw_Z@&2^07s4-VQy|t4jnoq)>?@%%3v@s z!{JcMvXr{6sj5n=s!F5LNQc9r_IkbKoYPaMPVuQ8Cr+GL*9xl4&(F*D?c3$x!Gm)2 z=uvs%i6`X1fdeu>KQH}$UzV1ZIC${jZSN?G;uFL7za|rz^M!cSh5!Hn07*qoM6N<$ Eg3%R&D*ylh literal 0 HcmV?d00001 diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index c265d823a9..72024013c6 100755 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -1891,6 +1891,7 @@ class CourseManager $listTeachers = array(); $teachers = array(); $count = 0; + while ($teacher = Database::fetch_array($rs)) { $userPicture = UserManager::getUserPicture($teacher['user_id'], USER_IMAGE_SIZE_SMALL); $teachers['id'] = $teacher['user_id']; @@ -3404,7 +3405,7 @@ class CourseManager * @param bool Whether to show the document quick-loader or not * @return string */ - public static function display_special_courses($user_id, $load_dirs = false) + public static function returnSpecialCourses($user_id, $load_dirs = false) { $user_id = intval($user_id); $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); @@ -3418,6 +3419,7 @@ class CourseManager } $html = null; $courseCount = 0; + $listCourse = array(); if (!empty($with_special_courses)) { $sql = "SELECT course.id, @@ -3435,7 +3437,7 @@ class CourseManager $rs_special_course = Database::query($sql); $number_of_courses = Database::num_rows($rs_special_course); - + $showCustomIcon = api_get_setting('course_images_in_courses_list'); $key = 0; if ($number_of_courses > 0) { @@ -3455,97 +3457,46 @@ class CourseManager $course['status'] = STUDENT; } - $params['icon'] = Display::return_icon( - 'blackboard.png', - api_htmlentities($course_info['title']), - array(), - ICON_SIZE_LARGE - ); - - $params['right_actions'] = ''; + $params['edit_actions'] = ''; if (api_is_platform_admin()) { - if ($load_dirs) { - $params['right_actions'] .= '' . - Display::return_icon( - 'folder.png', - get_lang('Documents'), - array('align' => 'absmiddle'), - ICON_SIZE_SMALL - ).''; - $params['right_actions'] .= '' . - Display::return_icon( - 'edit.png', - get_lang('Edit'), - array('align' => 'absmiddle'), - ICON_SIZE_SMALL - ).''; - $params['right_actions'] .= Display::div('', array( - 'id' => 'document_result_' . $course['id'] . '_0', - 'class' => 'document_preview_container' - )); - } else { - $params['right_actions'] .= '' . - Display::return_icon('edit.png', - get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . ''; - } - if ($course['status'] == COURSEMANAGER) { - //echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;')); - } - } else { - if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) { - if ($load_dirs) { - $params['right_actions'] .= '' . - Display::return_icon( - 'folder.png', - get_lang('Documents'), - array('align' => 'absmiddle'), - ICON_SIZE_SMALL - ).''; - $params['right_actions'] .= Display::div('', array( - 'id' => 'document_result_' . $course['id'] . '_0', - 'class' => 'document_preview_container' - )); - } - } - } - - if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) { - $course_title = '' . $course_info['title'] . ''; - } else { - $course_title = $course_info['title'] . " " . Display::tag('span', get_lang('CourseClosed'), - array('class' => 'item_closed')); - } - + $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code']; + } + $params['visibility'] = $course_info['visibility']; + $params['status'] = $course['status']; + $params['icon'] = Display::return_icon('drawing-pin.png',null, null, ICON_SIZE_LARGE, null); + if (api_get_setting('display_coursecode_in_courselist') == 'true') { - $course_title .= ' (' . $course_info['visual_code'] . ') '; - } - if (api_get_setting('display_teacher_in_courselist') == 'true') { - $params['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string( - $course['code'], - self::USER_SEPARATOR, - true - ); + $params['status'] = $course_info['visual_code']; } - $course_title .= ' '; - $course_title .= Display::return_icon('klipper.png', get_lang('CourseAutoRegister')); - $params['title'] = $course_title; + $params['title'] = $course_info['title']; $params['link'] = $course_info['course_public_url'].'?id_session=0&autoreg=1'; + if (api_get_setting('display_teacher_in_courselist') == 'true') { + $params['teachers'] = CourseManager::getTeacheCourseCode($course['code']); + } + + $thumbnails = null; + $image = null; + $iconName = basename($course_info['course_image']); + if ($showCustomIcon === 'true' && $iconName != 'course.png') { + $thumbnails = $course_info['course_image']; + $image = $course_info['course_image_large']; + } + + $params['thumbnails'] = $thumbnails; + $params['image'] = $image; if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) { $params['notifications'] = $show_notification; } - - $html .= self::course_item_html($params, false); $key++; + + $listCourse[$key] = $params; + } } } - - return [ - 'html' => $html, - 'course_count' => $courseCount - ]; + return $listCourse; } /** diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 03729b33d6..f09627355b 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -2481,4 +2481,14 @@ HTML; } return $html; } + /** + * @param string $string + * @return null|string + */ + + public static function shortName($string){ + $ispace = strpos($string," "); + $text = substr($string, 0, $ispace); + return $text; + } } diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index 062d7ac41a..3430e8995f 100755 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -1039,26 +1039,24 @@ class IndexManager $html .= get_lang('YouDoNotHaveAnySessionInItsHistory'); } } - - $listCourse = ''; - $special_courses = ''; + $sessionCount = 0; $courseCount = 0; // If we're not in the history view... if (!isset($_GET['history'])) { // Display special courses. - $specialCourses = CourseManager::display_special_courses( + $specialCourses = CourseManager::returnSpecialCourses( $user_id, $this->load_directories_preview ); - $special_courses = $specialCourses['html']; // Display courses. $courses = CourseManager::returnCourses( $user_id, $this->load_directories_preview ); + $this->tpl->assign('special_courses', $specialCourses); $this->tpl->assign('courses', $courses); $listCourse = $this->tpl->fetch( $this->tpl->get_template('/user_portal/main_courses.tpl')); diff --git a/main/template/default/user_portal/main_courses.tpl b/main/template/default/user_portal/main_courses.tpl index e66a1c9779..f45dc1ee54 100644 --- a/main/template/default/user_portal/main_courses.tpl +++ b/main/template/default/user_portal/main_courses.tpl @@ -1,4 +1,107 @@ - + +{% for course in courses %} +
+ {% for item in course %} +
+
+
+ +
+ {% if item.edit_actions != '' %} +
+ {% endif %} +

+ {% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %} + {{ item.title }} + {% else %} + + {{ item.title }} + + {{ item.notifications }} + {% endif %} +

+
+ {{ 'teacher.png' | img(16, 'Professor'|get_lang ) }} + +
+
+
+
+
+ {% endfor %} +
+{% endfor %} + +
+
+ {% for item in special_courses %} +
+
+
+
{{ item.icon }}
+ + {% if item.category != '' %} + {{ item.category }} +
+ {% endif %} +
+
+ {% for teacher in item.teachers %} + {% set counter = counter + 1 %} + {% if counter <= 3 %} + + + + + {% endif %} + {% endfor %} +
+
+ {% if item.edit_actions != '' %} +
+ {% endif %} +
+
+

+ {% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %} + {{ item.title }} + {% else %} + {{ item.title }} + {% endif %} +

+
{{ item.notifications }}
+ +
+
+
+ {% endfor %} +
+
+ {% for course in courses %}
@@ -15,7 +118,7 @@
{% for teacher in item.teachers %} {% set counter = counter + 1 %} - {% if counter <= 5 %} + {% if counter <= 3 %} @@ -35,7 +138,13 @@ {% endif %}
-

{{ item.title }}

+

+ {% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %} + {{ item.title }} + {% else %} + {{ item.title }} + {% endif %} +

{{ item.notifications }}
@@ -45,4 +154,3 @@
{% endfor %} -