diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index b17c136cb3..a777af2d4c 100755 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -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()) { diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index bcb6464bcf..40ca6fbcc6 100755 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -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'] = Display::label(get_lang('Yes'), 'success'); + $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,16 +1190,19 @@ 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'] = Display::label(get_lang('Yes'), 'success'); + $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'] = Display::label(get_lang('Yes'), 'success'); + $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')); + } } } diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index c160c04e01..7590e8f7f7 100644 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -7963,7 +7963,7 @@ $OnlyUsersFromCourseSession = "Only users from one course in a session"; $ServerXForwardedForInfo = "If the server is behind a proxy or firewall (and only in those cases), it might be using the X_FORWARDED_FOR HTTP header to show the remote user IP (yours, in this case)."; $GeolocalizationCoordinates = "Geolocalization by coordinates"; $ExportUsersOfACourse = "Export users of a course"; -$StudentCourseProgress = "Progress: %s %"; +$StudentCourseProgress = "Progress: %s%"; $StudentCourseScore = "Rating: %s%"; $StudentCourseCertificate = "Certificate: %s"; $MyCourseProgressTitle = "Show course progress to student"; diff --git a/main/template/default/user_portal/classic_courses_with_category.tpl b/main/template/default/user_portal/classic_courses_with_category.tpl index 9de9aee75f..6d431965c2 100644 --- a/main/template/default/user_portal/classic_courses_with_category.tpl +++ b/main/template/default/user_portal/classic_courses_with_category.tpl @@ -74,9 +74,19 @@ {% if item.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 %} +
{% endif %} diff --git a/main/template/default/user_portal/classic_courses_without_category.tpl b/main/template/default/user_portal/classic_courses_without_category.tpl index fab2922f73..c9b6c2f62e 100644 --- a/main/template/default/user_portal/classic_courses_without_category.tpl +++ b/main/template/default/user_portal/classic_courses_without_category.tpl @@ -71,9 +71,19 @@ {% if item.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 %} +
{% endif %} diff --git a/main/template/default/user_portal/classic_session.tpl b/main/template/default/user_portal/classic_session.tpl index f08cf714cb..f6aebe4621 100644 --- a/main/template/default/user_portal/classic_session.tpl +++ b/main/template/default/user_portal/classic_session.tpl @@ -83,9 +83,19 @@ {% if item.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 %} +
{% endif %} diff --git a/main/template/default/user_portal/grid_courses_with_category.tpl b/main/template/default/user_portal/grid_courses_with_category.tpl index 93f252fe50..94b57f8a20 100644 --- a/main/template/default/user_portal/grid_courses_with_category.tpl +++ b/main/template/default/user_portal/grid_courses_with_category.tpl @@ -68,9 +68,19 @@ {% if item.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 %} +
{% endif %} diff --git a/main/template/default/user_portal/grid_courses_without_category.tpl b/main/template/default/user_portal/grid_courses_without_category.tpl index c2143f8dfa..e32e0eb945 100644 --- a/main/template/default/user_portal/grid_courses_without_category.tpl +++ b/main/template/default/user_portal/grid_courses_without_category.tpl @@ -65,9 +65,19 @@ {% if item.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 %} +
{% endif %} diff --git a/main/template/default/user_portal/grid_session.tpl b/main/template/default/user_portal/grid_session.tpl index d5cd9bf5ae..43bd1944da 100644 --- a/main/template/default/user_portal/grid_session.tpl +++ b/main/template/default/user_portal/grid_session.tpl @@ -62,9 +62,19 @@ {% if item.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 %} +
{% endif %}