- Fix missing sql data & wrong variable name

- Show Progress, Rating and Certificate only if they have been assigned
pull/2487/head
Rafa 9 years ago
parent 918150ce03
commit c274cd8733
  1. 7
      main/inc/lib/course.lib.php
  2. 43
      main/inc/lib/userportal.lib.php
  3. 10
      main/template/default/user_portal/classic_courses_with_category.tpl
  4. 10
      main/template/default/user_portal/classic_courses_without_category.tpl
  5. 10
      main/template/default/user_portal/classic_session.tpl
  6. 10
      main/template/default/user_portal/grid_courses_with_category.tpl
  7. 10
      main/template/default/user_portal/grid_courses_without_category.tpl
  8. 10
      main/template/default/user_portal/grid_session.tpl

@ -3643,7 +3643,8 @@ class CourseManager
$sql = "SELECT
course.id,
course_rel_user.status status
course_rel_user.status status,
course.code as course_code
FROM $TABLECOURS course
INNER JOIN $TABLECOURSUSER course_rel_user
ON (course.id = course_rel_user.c_id)
@ -3683,7 +3684,7 @@ class CourseManager
$params = array();
//Param (course_code) needed to get the student process
$params['course_code'] = $course['code'];
$params['course_code'] = $row['course_code'];
if ($showCustomIcon === 'true' && $iconName != 'course.png') {
$params['thumbnails'] = $course_info['course_image'];
@ -3829,7 +3830,7 @@ class CourseManager
$params = array();
//Param (course_code) needed to get the student process
$params['course_code'] = $course['code'];
$params['course_code'] = $row['code'];
$params['edit_actions'] = '';
$params['document'] = '';
if (api_is_platform_admin()) {

@ -1149,13 +1149,17 @@ class IndexManager
foreach($specialCourses as $key => $specialCourseInfo) {
$progress = Tracking::get_avg_student_progress( $user_id, $specialCourseInfo['course_code'] );
$percentage_score = Tracking :: get_avg_student_score( $user_id, $specialCourseInfo['course_code'], array());
$specialCourses[$key]['student_info']['progress'] = $progress;
$specialCourses[$key]['student_info']['progress'] = ($progress === false)? null : $progress;
$specialCourses[$key]['student_info']['score'] = $percentage_score;
$category = Category::load( null, null, $specialCourseInfo['course_code'], null, null, null );
$specialCourses[$key]['student_info']['certificate'] = Display::label(get_lang('No'));
if (isset($category[0]) && $category[0]->is_certificate_available($user_id)) {
$specialCourses[$key]['student_info']['certificate'] = null;
if (isset($category[0])) {
if($category[0]->is_certificate_available($user_id)){
$specialCourses[$key]['student_info']['certificate'] = Display::label(get_lang('Yes'), 'success');
}else {
$specialCourses[$key]['student_info']['certificate'] = Display::label(get_lang('No'));
}
}
}
@ -1166,13 +1170,17 @@ class IndexManager
foreach($courses['in_category'][$key1]['courses'] as $key2 => $courseInCatInfo) {
$progress = Tracking::get_avg_student_progress( $user_id, $courseInCatInfo['course_code'] );
$percentage_score = Tracking :: get_avg_student_score( $user_id, $courseInCatInfo['course_code'], array());
$courses['in_category'][$key1]['courses'][$key2]['student_info']['progress'] = $progress;
$courses['in_category'][$key1]['courses'][$key2]['student_info']['progress'] = ($progress === false)? null : $progress;
$courses['in_category'][$key1]['courses'][$key2]['student_info']['score'] = $percentage_score;
$category = Category::load( null, null, $courseInCatInfo['course_code'], null, null, null );
$courses['in_category'][$key1]['courses'][$key2]['student_info']['certificate'] = Display::label(get_lang('No'));
if (isset($category[0]) && $category[0]->is_certificate_available($user_id)) {
$courses['in_category'][$key1]['courses'][$key2]['student_info']['certificate'] = Display::label(get_lang('Yes'), 'success');
$courses['in_category'][ $key1 ]['student_info']['certificate'] = null;
if (isset($category[0])) {
if($category[0]->is_certificate_available($user_id)){
$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'));
}
}
}
@ -1182,15 +1190,18 @@ class IndexManager
foreach ( $courses['not_category'] as $key => $courseNotInCatInfo ) {
$progress = Tracking::get_avg_student_progress( $user_id, $courseNotInCatInfo['course_code'] );
$percentage_score = Tracking :: get_avg_student_score( $user_id, $courseNotInCatInfo['course_code'], array());
$courses['not_category'][ $key ]['student_info']['progress'] = $progress;
$courses['not_category'][ $key ]['student_info']['progress'] = ($progress === false)? null : $progress;
$courses['not_category'][ $key ]['student_info']['score'] = $percentage_score;
$category = Category::load( null, null, $courseNotInCatInfo['course_code'], null, null, null );
$courses['not_category'][ $key ]['student_info']['certificate'] = Display::label(get_lang('No'));
if (isset($category[0]) && $category[0]->is_certificate_available($user_id)) {
$courses['not_category'][ $key ]['student_info']['certificate'] = null;
if (isset($category[0])) {
if($category[0]->is_certificate_available($user_id)){
$courses['not_category'][ $key ]['student_info']['certificate'] = Display::label(get_lang('Yes'), 'success');
}else {
$courses['not_category'][ $key ]['student_info']['certificate'] = Display::label(get_lang('No'));
}
}
}
}
@ -1322,13 +1333,17 @@ class IndexManager
if (api_get_configuration_value('my_course_progress') === true && api_is_student() === true) {
$progress = Tracking::get_avg_student_progress( $user_id, $course['course_code'], array(), $session_id );
$percentage_score = Tracking::get_avg_student_score( $user_id, $course['course_code'], array(), $session_id);
$course_session['student_info']['progress'] = $progress;
$course_session['student_info']['progress'] = ($progress === false)? null : $progress;
$course_session['student_info']['score'] = $percentage_score;
$category = Category::load( null, null, $course['course_code'], null, null, $session_id );
$course_session['student_info']['certificate'] = Display::label(get_lang('No'));
if (isset($category[0]) && $category[0]->is_certificate_available($user_id)) {
$course_session['student_info']['certificate'] = null;
if (isset($category[0])) {
if($category[0]->is_certificate_available($user_id)){
$course_session['student_info']['certificate'] = Display::label(get_lang('Yes'), 'success');
}else {
$course_session['student_info']['certificate'] = Display::label(get_lang('No'));
}
}
}

@ -74,9 +74,19 @@
{% if item.student_info %}
<div class="course-student-info">
<div class="student-info">
{% if (item.student_info.progress is not null) %}
{{ "StudentCourseProgress" | get_lang | format(item.student_info.progress) }}
{% endif %}
{% if (item.student_info.score is not null) %}
{{ "StudentCourseScore" | get_lang | format(item.student_info.score) }}
{% endif %}
{% if (item.student_info.certificate is not null) %}
{{ "StudentCourseCertificate" | get_lang | format(item.student_info.certificate) }}
{% endif %}
</div>
</div>
{% endif %}

@ -71,9 +71,19 @@
{% if item.student_info %}
<div class="course-student-info">
<div class="student-info">
{% if (item.student_info.progress is not null) %}
{{ "StudentCourseProgress" | get_lang | format(item.student_info.progress) }}
{% endif %}
{% if (item.student_info.score is not null) %}
{{ "StudentCourseScore" | get_lang | format(item.student_info.score) }}
{% endif %}
{% if (item.student_info.certificate is not null) %}
{{ "StudentCourseCertificate" | get_lang | format(item.student_info.certificate) }}
{% endif %}
</div>
</div>
{% endif %}

@ -83,9 +83,19 @@
{% if item.student_info %}
<div class="course-student-info">
<div class="student-info">
{% if (item.student_info.progress is not null) %}
{{ "StudentCourseProgress" | get_lang | format(item.student_info.progress) }}
{% endif %}
{% if (item.student_info.score is not null) %}
{{ "StudentCourseScore" | get_lang | format(item.student_info.score) }}
{% endif %}
{% if (item.student_info.certificate is not null) %}
{{ "StudentCourseCertificate" | get_lang | format(item.student_info.certificate) }}
{% endif %}
</div>
</div>
{% endif %}

@ -68,9 +68,19 @@
{% if item.student_info %}
<div class="course-student-info">
<div class="student-info">
{% if (item.student_info.progress is not null) %}
{{ "StudentCourseProgress" | get_lang | format(item.student_info.progress) }}
{% endif %}
{% if (item.student_info.score is not null) %}
{{ "StudentCourseScore" | get_lang | format(item.student_info.score) }}
{% endif %}
{% if (item.student_info.certificate is not null) %}
{{ "StudentCourseCertificate" | get_lang | format(item.student_info.certificate) }}
{% endif %}
</div>
</div>
{% endif %}

@ -65,9 +65,19 @@
{% if item.student_info %}
<div class="course-student-info">
<div class="student-info">
{% if (item.student_info.progress is not null) %}
{{ "StudentCourseProgress" | get_lang | format(item.student_info.progress) }}
{% endif %}
{% if (item.student_info.score is not null) %}
{{ "StudentCourseScore" | get_lang | format(item.student_info.score) }}
{% endif %}
{% if (item.student_info.certificate is not null) %}
{{ "StudentCourseCertificate" | get_lang | format(item.student_info.certificate) }}
{% endif %}
</div>
</div>
{% endif %}

@ -62,9 +62,19 @@
{% if item.student_info %}
<div class="course-student-info">
<div class="student-info">
{% if (item.student_info.progress is not null) %}
{{ "StudentCourseProgress" | get_lang | format(item.student_info.progress) }}
{% endif %}
{% if (item.student_info.score is not null) %}
{{ "StudentCourseScore" | get_lang | format(item.student_info.score) }}
{% endif %}
{% if (item.student_info.certificate is not null) %}
{{ "StudentCourseCertificate" | get_lang | format(item.student_info.certificate) }}
{% endif %}
</div>
</div>
{% endif %}

Loading…
Cancel
Save