fix grid list course and session - refs #2681

pull/2818/head
Alex Aragón 6 years ago
parent 0ae02756fe
commit 5a0282bb4d
  1. 18
      assets/css/scss/_base.scss
  2. 4
      main/inc/lib/api.lib.php
  3. 3
      main/inc/lib/course.lib.php
  4. 68
      main/inc/lib/userportal.lib.php
  5. 20
      main/template/default/user_portal/classic_courses.html.twig
  6. 20
      main/template/default/user_portal/sessions.html.twig
  7. 14
      src/ThemeBundle/Resources/views/Macros/box.html.twig

@ -590,6 +590,7 @@ footer {
break-inside: avoid;
display: inline-table;
.card-session{
border-bottom-width: 5px;
.card-title{
font-size: 16px;
a{
@ -597,6 +598,9 @@ footer {
}
}
}
.card-list{
margin-top: 10px;
}
}
}
@ -622,11 +626,19 @@ footer {
grid-template-columns: auto;
grid-gap: 10px;
align-items: center;
.category{
position: absolute;
border-radius: 10px;
background-color: $default-yellow;
color: $default-black;
font-weight: bold;
padding: 0.2rem 0.8rem;
top: -0.8rem;
left: 0.5rem;
font-size: 12px;
}
.card-body{
padding: 1rem 1.2rem;
.card-icon{
text-align: center;
}
@include portrait($breakpoint-sm, $breakpoint-md){
padding: 0.8rem;
}

@ -2168,7 +2168,8 @@ function api_get_course_info_by_id($id = 0)
$sql = "SELECT
course.*,
course_category.code faCode,
course_category.name faName
course_category.name faName,
course_category.id faId
FROM $course_table
LEFT JOIN $course_cat_table
ON course.category_code = course_category.code
@ -2223,6 +2224,7 @@ function api_format_course_array($course_data)
$_course['extLink']['name'] = $course_data['department_name'];
$_course['categoryCode'] = $course_data['faCode'];
$_course['categoryName'] = $course_data['faName'];
$_course['categoryId'] = !empty($course_data['faId']) ? $course_data['faId'] : null;
$_course['visibility'] = $course_data['visibility'];
$_course['subscribe_allowed'] = $course_data['subscribe'];
$_course['subscribe'] = $course_data['subscribe'];

@ -4095,8 +4095,11 @@ class CourseManager
$params['image'] = $image;
$params['title'] = $course_info['title'];
$params['title_cut'] = $params['title'];
$params['category'] = $course_info['categoryName'];
$params['category_code'] = $course_info['categoryCode'];
$params['category_id'] = $course_info['categoryId'];
$params['color'] = Display::randomColor($params['category_id']);
$params['teachers'] = $teachers;
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {

@ -1058,7 +1058,7 @@ class IndexManager
$loadHistory = false
) {
$gameModeIsActive = api_get_setting('gamification_mode');
$viewGridCourses = api_get_configuration_value('view_grid_courses') === true;
//$viewGridCourses = api_get_configuration_value('view_grid_courses') === true;
$showSimpleSessionInfo = api_get_configuration_value('show_simple_session_info');
$coursesWithoutCategoryTemplate = '/user_portal/classic_courses.html.twig';
$showAllSessions = api_get_configuration_value('show_all_sessions_on_my_course_page') === true;
@ -1154,69 +1154,6 @@ class IndexManager
}
}
/*if (isset($courses['in_category'])) {
foreach ($courses['in_category'] as $key1 => $value) {
if (isset($courses['in_category'][$key1]['courses'])) {
foreach ($courses['in_category'][$key1]['courses'] as $key2 => $courseInCatInfo) {
if ($studentInfoProgress) {
$progress = Tracking::get_avg_student_progress(
$user_id,
$courseInCatInfo['course_code']
);
$courses['in_category'][$key1]['courses'][$key2]['student_info']['progress'] = $progress === false ? null : $progress;
}
if ($studentInfoScore) {
$percentage_score = Tracking::get_avg_student_score(
$user_id,
$specialCourseInfo['course_code'],
[]
);
$courses['in_category'][$key1]['courses'][$key2]['student_info']['score'] = $percentage_score;
}
if ($studentInfoCertificate) {
$category = Category::load(
null,
null,
$courseInCatInfo['course_code'],
null,
null,
null
);
$courses['in_category'][$key1]['student_info']['certificate'] = null;
$isCertificateAvailable = $category[0]->is_certificate_available($user_id);
if (isset($category[0])) {
if ($viewGrid) {
if ($isCertificateAvailable) {
$courses['in_category'][$key1]['student_info']['certificate'] = get_lang(
'Yes'
);
} else {
$courses['in_category'][$key1]['student_info']['certificate'] = get_lang(
'No'
);
}
} else {
if ($isCertificateAvailable) {
$courses['in_category'][$key1]['student_info']['certificate'] = Display::label(
get_lang('Yes'),
'success'
);
} else {
$courses['in_category'][$key1]['student_info']['certificate'] = Display::label(
get_lang('No'),
'danger'
);
}
}
}
}
}
}
}
}*/
if (isset($courses['not_category'])) {
foreach ($courses['not_category'] as $key => $courseNotInCatInfo) {
if ($studentInfoProgress) {
@ -1274,9 +1211,6 @@ class IndexManager
}
}
if ($viewGridCourses) {
$coursesWithoutCategoryTemplate = '/user_portal/grid_courses.html.twig';
}
if ($specialCourses) {
if ($categoryCodeFilter) {

@ -5,21 +5,24 @@
{% if not courses is empty %}
<div class="course-list">
{% for item in courses %}
{% set image %}
{% if item.category %}
<div class="category" style="background: {{ item.color.color }}; color:{{ item.color.luminosity }}">
{{ item.category }}
</div>
{% endif %}
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') and not item.current_user_is_teacher %}
{% if item.thumbnails != '' %}
<img src="{{ item.thumbnails }}" title="{{ item.title }}"
alt="{{ item.title }}"/>
{% if item.image != '' %}
<img src="{{ item.image }}" title="{{ item.title }}"
alt="{{ item.title }}" class="img-fluid"/>
{% else %}
{{ 'blackboard.png' | img(48, item.title ) }}
{% endif %}
{% else %}
<a href="{{ item.link }}">
{% if item.thumbnails != '' %}
<img src="{{ item.thumbnails }}" title="{{ item.title }}"
alt="{{ item.title }}"/>
{% if item.image != '' %}
<img src="{{ item.image }}" title="{{ item.title }}"
alt="{{ item.title }}" class="img-fluid"/>
{% else %}
{{ 'blackboard.png' | img(48, item.title ) }}
{% endif %}
@ -102,7 +105,6 @@
{{ macro.box_course_classic(item.course_id, title, content, image) }}
{% endfor %}
</div>
{% endif %}

@ -37,16 +37,16 @@
{% endif %}
{% endset %}
{% set content %}
<div class="card-courses">
<ul class="list-group list-group-flush">
{% for row in item.courses %}
<li class="list-group-item">
<img src="{{ row.icon }}" width="32px">
<a href="{{ row.link }}">{{ row.name }}</a>
</li>
{% endfor %}
</ul>
</div>
<ul class="list-group list-group-flush">
{% for row in item.courses %}
<li class="list-group-item">
<img src="{{ row.icon }}" width="32px">
<a href="{{ row.link }}">{{ row.name }}</a>
</li>
{% endfor %}
</ul>
{% if item.student_info %}
{% if (item.student_info.progress is not null) and (item.student_info.score is not null) %}

@ -265,12 +265,10 @@
<div id="course-{{ id }}" class="card card-course-classic" style="border-bottom-color: {{ '#' ~ random(values)~ random(values)~ random(values)~ random(values)~ random(values)~ random(values)~'50' }}">
<div class="card-body">
<div class="row">
<div class="col-md-3">
<div class="card-icon">
{{ image }}
</div>
<div class="col-md-5">
{{ image }}
</div>
<div class="col-md-9">
<div class="col-md-7">
{{ title }}
{{ content }}
</div>
@ -282,7 +280,8 @@
{% macro box_session(id, title, content, image) %}
{% autoescape false %}
<div id="session-{{ id }}" class="card card-session">
{% set values = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']%}
<div id="session-{{ id }}" class="card card-session" style="border-bottom-color: {{ '#' ~ random(values)~ random(values)~ random(values)~ random(values)~ random(values)~ random(values)~'50' }}">
<div class="card-body">
<div class="card-info">
<div class="row">
@ -300,4 +299,5 @@
</div>
</div>
{% endautoescape %}
{% endmacro %}
{% endmacro %}

Loading…
Cancel
Save