From b45fbc4e7a192592f8a38b35a6979311beb3d847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Arag=C3=B3n?= Date: Fri, 6 Apr 2018 11:28:39 -0500 Subject: [PATCH] Improve the design of the most popular session and course --- app/Resources/public/css/base.css | 3 +- main/inc/lib/course.lib.php | 2 +- main/inc/lib/sessionmanager.lib.php | 11 +++- .../default/layout/hot_course_item.tpl | 52 +------------------ .../default/session/sessions_current.tpl | 34 ++++++------ 5 files changed, 32 insertions(+), 70 deletions(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index c88693ed9b..e7208afea1 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -5174,7 +5174,6 @@ div#chat-remote-video video { .hot-courses .grid-courses .items .title{ padding: 0px; - font-size: 15px; font-weight: bold; margin: 0; } @@ -5262,7 +5261,7 @@ div#chat-remote-video video { right: -10px; } .grid-courses .items .description{ - padding: 5px 10px; + padding: 5px 10px 15px; } .grid-courses .items .description .text{ font-size: 12px; diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index 83971bad27..1d00d82df0 100755 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -6590,7 +6590,7 @@ class CourseManager $title = $course['title']; $url = api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code']; $html = Display::url( - Display::returnFontAwesomeIcon('info-circle', 2), + Display::returnFontAwesomeIcon('info-circle', 'lg'), $url, [ 'class' => 'ajax btn btn-default btn-sm', diff --git a/main/inc/lib/sessionmanager.lib.php b/main/inc/lib/sessionmanager.lib.php index 8df8223443..4167670b6e 100755 --- a/main/inc/lib/sessionmanager.lib.php +++ b/main/inc/lib/sessionmanager.lib.php @@ -3253,11 +3253,20 @@ class SessionManager ORDER BY 9 DESC LIMIT 8"; $result = Database::query($sql); + + $plugin = BuyCoursesPlugin::create(); + $checker = $plugin->isEnabled(); + if (Database::num_rows($result) > 0) { while ($row = Database::fetch_array($result, 'ASSOC')) { + if ($checker) { + $row['on_sale'] = $plugin->getItemByProduct( + $row['id'], + BuyCoursesPlugin::PRODUCT_TYPE_SESSION + ); + } $sessions[] = $row; } - return $sessions; } else { return false; diff --git a/main/template/default/layout/hot_course_item.tpl b/main/template/default/layout/hot_course_item.tpl index 7d071e6969..8fe79d0e9e 100755 --- a/main/template/default/layout/hot_course_item.tpl +++ b/main/template/default/layout/hot_course_item.tpl @@ -19,11 +19,11 @@
{% if item.is_registered or _u.is_admin %} -

+

{{ item.title_cut}} -
+ {% else %}

{{ item.title_cut}} @@ -33,54 +33,6 @@
{{ item.rating_html }}
-
- {% if item.teachers | length > 6 %} - - - -
- {% for teacher in item.teachers %} - - {% endfor %} -
- {% else %} - {% for teacher in item.teachers %} - {% if item.teachers | length <= 2 %} - - {{ teacher.fullname }} - -
-
- - {{ teacher.firstname }} {{ teacher.lastname }} - -
-

{{ 'Teacher' | get_lang }}

-
- {% elseif item.teachers | length <= 6 %} - - {{ teacher.fullname }} - - {% endif %} - {% endfor %} - {% endif %} -
{% if item.price %} diff --git a/main/template/default/session/sessions_current.tpl b/main/template/default/session/sessions_current.tpl index f4e90d3bf0..c2f5aba89b 100644 --- a/main/template/default/session/sessions_current.tpl +++ b/main/template/default/session/sessions_current.tpl @@ -6,7 +6,6 @@

- {% for session in hot_sessions %}
@@ -24,31 +23,34 @@ title="title-session">{{ session.name }}
-
- {{ dump(session) }} - - - -
-
- {{ session.firstname }} {{ session.lastname }} -
-

{{ 'Teacher'|get_lang }}

-
- -
{{ session.users }} {{ "Users"|get_lang }}     {{ session.lessons }} {{ "Learnpaths"|get_lang }}
+ {% if session.on_sale != false %} +
+
+ + {{ session.on_sale.iso_code }} {{ session.on_sale.price }} + +
+
+ {% else %} +
+
+ + {{ 'Free'|get_plugin_lang('BuyCoursesPlugin') }} + +
+
+ {% endif %}
+
{% endfor %} - {% endif %} \ No newline at end of file