From 53bc13e4eba4fef73b797b27e8b26ef368a65637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Arag=C3=B3n?= Date: Wed, 10 Apr 2019 18:03:22 -0500 Subject: [PATCH 1/7] new array function for user summary - refs #7683 --- main/inc/lib/myspace.lib.php | 94 +++++++++++++++++++ main/mySpace/admin_view.php | 1 + .../my_space/tracking_user_overview.tpl | 3 + 3 files changed, 98 insertions(+) create mode 100644 main/template/default/my_space/tracking_user_overview.tpl diff --git a/main/inc/lib/myspace.lib.php b/main/inc/lib/myspace.lib.php index 1d1b805e51..efdae0da8f 100644 --- a/main/inc/lib/myspace.lib.php +++ b/main/inc/lib/myspace.lib.php @@ -308,6 +308,100 @@ class MySpace return $return; } + /** + * Creates a small table in the last column of the table with the user overview. + * + * @param int $user_id the id of the user + * + * @return array List course + */ + + public static function returnCourseTrackingFilter($user_id){ + + $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); + // getting all the courses of the user + $sql = "SELECT * FROM $tbl_course_user + WHERE + user_id = '".intval($user_id)."' AND + relation_type<>".COURSE_RELATION_TYPE_RRHH." "; + $result = Database::query($sql); + + $list = []; + + while ($row = Database::fetch_array($result)) { + $courseInfo = api_get_course_info_by_id($row['c_id']); + $courseId = $courseInfo['real_id']; + $courseCode = $courseInfo['code']; + + if (empty($courseInfo)) { + continue; + } + + $avg_score = Tracking::get_avg_student_score($user_id, $courseCode); + if (is_numeric($avg_score)) { + $avg_score = round($avg_score, 2); + } else { + $avg_score = '-'; + } + + // student exercises results (obtained score, maximum score, number of exercises answered, score percentage) + $exercises_results = self::exercises_results($user_id, $courseCode); + + $item = [ + 'code' => $courseInfo['code'], + 'real_id' => $courseInfo['real_id'], + 'title' => $courseInfo['title'], + 'category' => $courseInfo['categoryName'], + 'image_small' => $courseInfo['course_image'], + 'image_large' => $courseInfo['course_image_large'], + 'time_spent' => api_time_to_hms(Tracking::get_time_spent_on_the_course($user_id, $courseId)), + 'student_progress' => round(Tracking::get_avg_student_progress($user_id, $courseCode)), + 'student_score' => $avg_score, + 'student_message' => Tracking::count_student_messages($user_id, $courseCode), + 'student assignments' => Tracking::count_student_assignments($user_id, $courseCode), + 'student_exercises' => (is_null($exercises_results['percentage']) ? '' : $exercises_results['score_obtained'].'/'.$exercises_results['score_possible'].' ( '.$exercises_results['percentage'].'% )'), + 'questions_answered' => $exercises_results['questions_answered'], + 'last_connection' => Tracking::get_last_connection_date_on_the_course($user_id, $courseInfo) + ]; + $list[] = $item; + } + + return $list; + } + + /** + * Display a sortable table that contains an overview off all the + * reporting progress of all users and all courses the user is subscribed to. + * + * @author Patrick Cool , Ghent University, Belgium + * + * @version Chamilo 1.8.6 + * + * @since October 2008 + */ + + public static function returnTrackingUserOverview(){ + + $tpl = new Template('', false, false,false,false,false,false); + $dataUser = self::get_user_data_tracking_overview(null,10,1,'ASC'); + + $list = []; + foreach ($dataUser as $item){ + $listUser = [ + 'id' => $item['col4'], + 'code_user' => $item['col0'], + 'complete_name' => $item['col1'] . ' ' . $item['col2'], + 'username' => $item['col3'], + 'course' => self::returnCourseTrackingFilter($item['col4']) + ]; + $list [] = $listUser; + } + $tpl->assign('data', $list); + $templateName = $tpl->get_template('my_space/tracking_user_overview.tpl'); + $tpl->display($templateName); + + } + /** * Display a sortable table that contains an overview off all the * reporting progress of all users and all courses the user is subscribed to. diff --git a/main/mySpace/admin_view.php b/main/mySpace/admin_view.php index 995e90aaaa..225de467b6 100644 --- a/main/mySpace/admin_view.php +++ b/main/mySpace/admin_view.php @@ -46,6 +46,7 @@ switch ($display) { MySpace::display_tracking_coach_overview($exportCSV); break; case 'user': + echo MySpace::returnTrackingUserOverview(); MySpace::display_tracking_user_overview(); break; case 'session': diff --git a/main/template/default/my_space/tracking_user_overview.tpl b/main/template/default/my_space/tracking_user_overview.tpl new file mode 100644 index 0000000000..ee89bc7331 --- /dev/null +++ b/main/template/default/my_space/tracking_user_overview.tpl @@ -0,0 +1,3 @@ +{% for item in data %} + {{ dump(item) }} +{% endfor %} \ No newline at end of file From c68ccd9f7a637b992d7269d15c62cf1a574d8c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Arag=C3=B3n?= Date: Thu, 11 Apr 2019 16:09:23 -0500 Subject: [PATCH 2/7] improvement in user summary - refs #7681 --- app/Resources/public/css/base.css | 151 +++++++++++++++++- main/inc/lib/myspace.lib.php | 6 +- .../my_space/tracking_user_overview.tpl | 119 +++++++++++++- 3 files changed, 270 insertions(+), 6 deletions(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index 409f7c4633..cc3e58c778 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -9797,10 +9797,157 @@ ul.dropdown-menu.inner > li > a { position: relative; } -/* Fix grid with one row and multiples columns. Works for .col-sm-6.col-md-4.col-lg-3 */ -.row.clear-rows-6-4-3 { +.summary-height{ + height: calc(100% - 20px); + display: flex; + flex-grow: 1; + flex-direction: column; + box-shadow: 0 0 13px 0 rgba(82,63,105,0.05); + margin-bottom: 20px; + border-radius: 4px; + border: 1px solid #cdcdcd; +} +.summary{ + padding: 0; + height: 100%; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + flex-direction: row; + width: 100%; +} +.summary-body{ + flex-grow: 1; + padding-left: 10px !important; + padding-right: 10px !important; + margin-top: 15px !important; } +.summary-item{ + display: flex; + -webkit-box-pack: justify; + justify-content: flex-start; + -webkit-box-align: center; + align-items: center; + padding-bottom: 2rem; +} +.summary-item .icon{ + padding-right: 1.25rem; +} +.summary-item .icon img{ + border: 1px solid #cdcdcd; +} +.summary-item .user .username{ + font-size: 12px; +} +.summary-item .user .name{ + color: #6c7293; + font-size: 1.56rem; + font-weight: 500; + padding-right: 1.25rem; + margin-top: 1rem; + display: inline-block; + flex-grow: 1; + transition: color 0.3s ease; +} +.summary-item .user .name:hover{ + color: #366cf3; + transition: color 0.3s ease; +} +.summary-item .user{ + width: 14%; +} +.summary-item .summary-course{ + width: 80%; +} +.summary-item .summary-course .alert{ + margin-bottom: 0; +} +.summary-item .summary-course .course-item{ + padding-bottom: 1rem; + padding-top: 1rem; + border-bottom: 1px dashed #cdcdcd; + display: flex; + flex-wrap: nowrap; +} +.summary-item .summary-course .course-item:last-child{ + border-bottom: none; +} +.summary-item .summary-course .course-item .course-info{ + margin-right: 20px; + width: 30%; +} +.summary-item .summary-course .course-item .course-info h5{ + font-weight: bold; + padding: 0; + margin: 0; +} +.summary-item .summary-course .course-item .course-info .code{ + font-size: 12px; +} +.summary-item .summary-course .course-item .box{ + width: 10%; + text-align: center; + line-height: 50px; + margin-right: 5px; + font-size: 12px; + border-radius: 5px; +} +.summary-item .summary-course .course-item .box .kt-badge{ + height: 0; + width: auto; + padding: 0.5rem 0.5rem; + border-radius: 2px; + font-weight: bold; +} +.summary-legend{ + padding: 10px 0; + margin-bottom: 2rem; +} +.summary-legend .list-legend{ + margin: 0; + padding: 0; + list-style: none; +} +.summary-legend .list-legend li{ + display: inline-block; + font-size: 12px; +} +.summary-legend .cube{ + width: 13px; + height: 13px; + display: inline-block; + margin-right: 2px; + border-radius: 2px; + border: 1px solid; +} +.student-progress{ + color: #366cf3; + background: rgba(54,108,243,0.35); +} +.student-score{ + color: #1dc9b7; + background: rgba(29,201,183,0.35); +} +.student-message{ + color: #fd397a; + background: rgba(253,57,122,0.35); +} +.student-assignments{ + color: #ffb822; + background: rgba(255,184,34,0.35); +} +.student-exercises{ + background-color: #83af3d3b !important; + color: #4f9c53; +} +.questions-answered{ + background-color: #fb5f0442 !important; + color: #FF5722; +} +.last-connection{ + color: #2196f3; + background: rgba(57, 217, 253, 0.35); +} @media (min-width: 768px) { .clear-rows-6-4-3 .col-sm-6:nth-child(2n+1) { clear: left; diff --git a/main/inc/lib/myspace.lib.php b/main/inc/lib/myspace.lib.php index efdae0da8f..8860f119a7 100644 --- a/main/inc/lib/myspace.lib.php +++ b/main/inc/lib/myspace.lib.php @@ -358,7 +358,7 @@ class MySpace 'student_progress' => round(Tracking::get_avg_student_progress($user_id, $courseCode)), 'student_score' => $avg_score, 'student_message' => Tracking::count_student_messages($user_id, $courseCode), - 'student assignments' => Tracking::count_student_assignments($user_id, $courseCode), + 'student_assignments' => Tracking::count_student_assignments($user_id, $courseCode), 'student_exercises' => (is_null($exercises_results['percentage']) ? '' : $exercises_results['score_obtained'].'/'.$exercises_results['score_possible'].' ( '.$exercises_results['percentage'].'% )'), 'questions_answered' => $exercises_results['questions_answered'], 'last_connection' => Tracking::get_last_connection_date_on_the_course($user_id, $courseInfo) @@ -387,12 +387,14 @@ class MySpace $list = []; foreach ($dataUser as $item){ + $avatar = UserManager::getUserPicture($item['col4'],USER_IMAGE_SIZE_SMALL); $listUser = [ 'id' => $item['col4'], 'code_user' => $item['col0'], 'complete_name' => $item['col1'] . ' ' . $item['col2'], 'username' => $item['col3'], - 'course' => self::returnCourseTrackingFilter($item['col4']) + 'course' => self::returnCourseTrackingFilter($item['col4']), + 'avatar' => $avatar ]; $list [] = $listUser; } diff --git a/main/template/default/my_space/tracking_user_overview.tpl b/main/template/default/my_space/tracking_user_overview.tpl index ee89bc7331..5014c557f1 100644 --- a/main/template/default/my_space/tracking_user_overview.tpl +++ b/main/template/default/my_space/tracking_user_overview.tpl @@ -1,3 +1,118 @@ +
+
    +
  • + + + {{ 'AvgStudentsProgress'|get_lang }} +
  • +
  • + + + {{ 'AvgCourseScore'|get_lang }} +
  • +
  • + + + {{ 'TotalNumberOfMessages'|get_lang }} +
  • +
  • + + + {{ 'TotalNumberOfAssignments'|get_lang }} +
  • +
  • + + + {{ 'TotalExercisesScoreObtained'|get_lang }} +
  • +
  • + + + {{ 'TotalExercisesAnswered'|get_lang }} +
  • +
  • + + + {{ 'LatestLogin'|get_lang }} +
  • +
+
+ {% for item in data %} - {{ dump(item) }} -{% endfor %} \ No newline at end of file +
+
+
+
+
+ +
+
+ + {{ item.complete_name }} + +
{{ item.username }}
+
+ +
+ {% if item.course %} + {% for course in item.course %} +
+
+
{{ course.title }}
+ {{ course.code }} +
+
+ + {{ course.time_spent }} +
+
+ + {{ course.student_progress }} % + +
+
+ + {{ course.student_score }} + +
+
+ + {{ course.student_message }} + +
+
+ + {{ course.student_assignments }} + +
+
+ + {{ course.student_assignments }} + +
+
+ + {{ course.questions_answered }} + +
+
+ {% if course.last_connection %} + + {{ course.last_connection }} + + {% endif %} +
+
+ {% endfor %} + {% else %} + + {% endif %} +
+ +
+
+
+
+{% endfor %} From 61f7df478c40dbfa27b08bbf8d82755e2525d58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Arag=C3=B3n?= Date: Thu, 11 Apr 2019 16:38:12 -0500 Subject: [PATCH 3/7] update colors - refs #7683 --- app/Resources/public/css/base.css | 6 ++++-- main/mySpace/admin_view.php | 2 +- main/template/default/my_space/tracking_user_overview.tpl | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index cc3e58c778..c73982b717 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -9806,6 +9806,7 @@ ul.dropdown-menu.inner > li > a { margin-bottom: 20px; border-radius: 4px; border: 1px solid #cdcdcd; + background-color: #f9f9fc; } .summary{ padding: 0; @@ -9874,7 +9875,7 @@ ul.dropdown-menu.inner > li > a { } .summary-item .summary-course .course-item .course-info{ margin-right: 20px; - width: 30%; + width: 25%; } .summary-item .summary-course .course-item .course-info h5{ font-weight: bold; @@ -9898,6 +9899,7 @@ ul.dropdown-menu.inner > li > a { padding: 0.5rem 0.5rem; border-radius: 2px; font-weight: bold; + border: 1px solid; } .summary-legend{ padding: 10px 0; @@ -9933,7 +9935,7 @@ ul.dropdown-menu.inner > li > a { background: rgba(253,57,122,0.35); } .student-assignments{ - color: #ffb822; + color: #FF9800; background: rgba(255,184,34,0.35); } .student-exercises{ diff --git a/main/mySpace/admin_view.php b/main/mySpace/admin_view.php index 225de467b6..efa3699847 100644 --- a/main/mySpace/admin_view.php +++ b/main/mySpace/admin_view.php @@ -47,7 +47,7 @@ switch ($display) { break; case 'user': echo MySpace::returnTrackingUserOverview(); - MySpace::display_tracking_user_overview(); + /*MySpace::display_tracking_user_overview();*/ break; case 'session': MySpace::display_tracking_session_overview(); diff --git a/main/template/default/my_space/tracking_user_overview.tpl b/main/template/default/my_space/tracking_user_overview.tpl index 5014c557f1..42a624eb69 100644 --- a/main/template/default/my_space/tracking_user_overview.tpl +++ b/main/template/default/my_space/tracking_user_overview.tpl @@ -47,7 +47,7 @@
- + {{ item.complete_name }}
{{ item.username }}
From 076d6e3abac4e995a3507be6817ee0197306146c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Arag=C3=B3n?= Date: Fri, 12 Apr 2019 11:20:31 -0500 Subject: [PATCH 4/7] Pagination of results user summary - refs #7683 --- app/Resources/public/css/base.css | 10 +- main/inc/lib/myspace.lib.php | 148 ++++++------------ main/inc/lib/sortable_table.class.php | 20 ++- main/mySpace/admin_view.php | 3 +- .../{ => partials}/tracking_user_overview.tpl | 43 +---- .../default/my_space/user_summary.tpl | 41 +++++ 6 files changed, 109 insertions(+), 156 deletions(-) rename main/template/default/my_space/{ => partials}/tracking_user_overview.tpl (75%) create mode 100644 main/template/default/my_space/user_summary.tpl diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index c73982b717..0d1db49e72 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -9797,13 +9797,21 @@ ul.dropdown-menu.inner > li > a { position: relative; } +.table-transparent>tbody>tr>td, +.table-transparent>tbody>tr>th, +.table-transparent>tfoot>tr>td, +.table-transparent>tfoot>tr>th, +.table-transparent>thead>tr>td, +.table-transparent>thead>tr>th{ + border: none; +} .summary-height{ height: calc(100% - 20px); display: flex; flex-grow: 1; flex-direction: column; box-shadow: 0 0 13px 0 rgba(82,63,105,0.05); - margin-bottom: 20px; + margin-bottom: 0; border-radius: 4px; border: 1px solid #cdcdcd; background-color: #f9f9fc; diff --git a/main/inc/lib/myspace.lib.php b/main/inc/lib/myspace.lib.php index 8860f119a7..d5b8db205a 100644 --- a/main/inc/lib/myspace.lib.php +++ b/main/inc/lib/myspace.lib.php @@ -316,7 +316,7 @@ class MySpace * @return array List course */ - public static function returnCourseTrackingFilter($user_id){ + public static function returnCourseTracking($user_id){ $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); // getting all the courses of the user @@ -374,33 +374,33 @@ class MySpace * reporting progress of all users and all courses the user is subscribed to. * * @author Patrick Cool , Ghent University, Belgium + * Alex Aragon , BeezNest, PerĂº * - * @version Chamilo 1.8.6 + * @version Chamilo 1.11.8 * - * @since October 2008 + * @since April 2019 */ - public static function returnTrackingUserOverview(){ + public static function returnTrackingUserOverviewFilter($user_id){ $tpl = new Template('', false, false,false,false,false,false); - $dataUser = self::get_user_data_tracking_overview(null,10,1,'ASC'); + $userInfo = api_get_user_info($user_id); + + $avatar = UserManager::getUserPicture($user_id,USER_IMAGE_SIZE_SMALL); + $user = [ + 'id' => $user_id, + 'code_user' => $userInfo['official_code'], + 'complete_name' => $userInfo['complete_name'], + 'username' => $userInfo['username'], + 'course' => self::returnCourseTracking($user_id), + 'avatar' => $avatar + ]; - $list = []; - foreach ($dataUser as $item){ - $avatar = UserManager::getUserPicture($item['col4'],USER_IMAGE_SIZE_SMALL); - $listUser = [ - 'id' => $item['col4'], - 'code_user' => $item['col0'], - 'complete_name' => $item['col1'] . ' ' . $item['col2'], - 'username' => $item['col3'], - 'course' => self::returnCourseTrackingFilter($item['col4']), - 'avatar' => $avatar - ]; - $list [] = $listUser; - } - $tpl->assign('data', $list); - $templateName = $tpl->get_template('my_space/tracking_user_overview.tpl'); - $tpl->display($templateName); + $tpl->assign('item', $user); + $templateName = $tpl->get_template('my_space/partials/tracking_user_overview.tpl'); + $content = $tpl->fetch($templateName); + + return $content; } @@ -409,88 +409,36 @@ class MySpace * reporting progress of all users and all courses the user is subscribed to. * * @author Patrick Cool , Ghent University, Belgium + * Alex Aragon , BeezNest, PerĂº * - * @version Dokeos 1.8.6 + * @version Chamilo 1.11.8 * - * @since October 2008 + * @since October 2008, Update April 2019 */ public static function display_tracking_user_overview() { self::display_user_overview_export_options(); - $t_head = ''; - $t_head .= ''; - $t_head .= ''; - $t_head .= ''; - $t_head .= ''; - $t_head .= ''; - $t_head .= ''; - $t_head .= ''; - $t_head .= ''; - $t_head .= ''; - $t_head .= ''; - $t_head .= '
'.get_lang('Course').''.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).''.cut(get_lang('AvgStudentsProgress'), 6, true).''.cut(get_lang('AvgCourseScore'), 6, true).''.cut(get_lang('TotalNumberOfMessages'), 6, true).''.cut(get_lang('TotalNumberOfAssignments'), 6, true).''.get_lang('TotalExercisesScoreObtained').''.cut(get_lang('TotalExercisesAnswered'), 6, true).''.get_lang('LatestLogin').'
'; + $addparams = ['view' => 'admin', 'display' => 'user']; $table = new SortableTable( 'tracking_user_overview', ['MySpace', 'get_number_of_users_tracking_overview'], ['MySpace', 'get_user_data_tracking_overview'], - 0 - ); - $table->additional_parameters = $addparams; - $table->set_header( 0, - get_lang('OfficialCode'), - true, - ['style' => 'font-size:8pt'], - ['style' => 'font-size:8pt'] - ); - if (api_is_western_name_order()) { - $table->set_header( - 1, - get_lang('FirstName'), - true, - ['style' => 'font-size:8pt'], - ['style' => 'font-size:8pt'] - ); - $table->set_header( - 2, - get_lang('LastName'), - true, - ['style' => 'font-size:8pt'], - ['style' => 'font-size:8pt'] - ); - } else { - $table->set_header( - 1, - get_lang('LastName'), - true, - ['style' => 'font-size:8pt'], - ['style' => 'font-size:8pt'] - ); - $table->set_header( - 2, - get_lang('FirstName'), - true, - ['style' => 'font-size:8pt'], - ['style' => 'font-size:8pt'] - ); - } - $table->set_header( - 3, - get_lang('LoginName'), - true, - ['style' => 'font-size:8pt'], - ['style' => 'font-size:8pt'] - ); - $table->set_header( - 4, - $t_head, - false, - ['style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'], - ['style' => 'width:90%;padding:0;font-size:7.5pt;'] + 20, + 'ASC', + null,[ + 'class' => 'table table-transparent' + ] ); - $table->set_column_filter(4, ['MySpace', 'course_info_tracking_filter']); - $table->display(); + $table->additional_parameters = $addparams; + + $table->set_column_filter(0, ['MySpace', 'returnTrackingUserOverviewFilter']); + $tableContent = $table->return_table(); + $tpl = new Template('', false, false,false,false,false,false); + $tpl->assign('table', $tableContent); + $templateName = $tpl->get_template('my_space/user_summary.tpl'); + $tpl->display($templateName); } /** @@ -2283,23 +2231,15 @@ class MySpace $userList = UserManager::get_user_list([], $order, $from, $numberItems); $return = []; foreach ($userList as $user) { - $firstPosition = $user['lastname']; - $secondPosition = $user['firstname']; - if ($isWestern) { + //$firstPosition = $user['lastname']; + //$secondPosition = $user['firstname']; + /*if ($isWestern) { $firstPosition = $user['firstname']; $secondPosition = $user['lastname']; - } + }*/ $return[] = [ - '0' => $user['official_code'], - 'col0' => $user['official_code'], - '1' => $firstPosition, - 'col1' => $firstPosition, - '2' => $secondPosition, - 'col2' => $secondPosition, - '3' => $user['username'], - 'col3' => $user['username'], - '4' => $user['user_id'], - 'col4' => $user['user_id'], + '0' => $user['user_id'], + 'col0' => $user['user_id'] ]; } diff --git a/main/inc/lib/sortable_table.class.php b/main/inc/lib/sortable_table.class.php index 21da11e8ce..19f54ef616 100755 --- a/main/inc/lib/sortable_table.class.php +++ b/main/inc/lib/sortable_table.class.php @@ -104,18 +104,19 @@ class SortableTable extends HTML_Table /** * Create a new SortableTable. * - * @param string $table_name A name for the table (default = 'table') + * @param string $table_name A name for the table (default = 'table') * @param string $get_total_number_function A user defined function to get * the total number of items in the table - * @param string $get_data_function A function to get the data to display on + * @param string $get_data_function A function to get the data to display on * the current page - * @param int $default_column The default column on which the data should be + * @param int $default_column The default column on which the data should be * sorted - * @param int $default_items_per_page The default number of items to show + * @param int $default_items_per_page The default number of items to show * on one page - * @param string $default_order_direction The default order direction; + * @param string $default_order_direction The default order direction; * either the constant 'ASC' or 'DESC' * @param string $table_id + * @param array $parameters They are custom attributes of the table */ public function __construct( $table_name = 'table', @@ -124,13 +125,18 @@ class SortableTable extends HTML_Table $default_column = 1, $default_items_per_page = 20, $default_order_direction = 'ASC', - $table_id = null + $table_id = null, + $parameters = [] ) { if (empty($table_id)) { $table_id = $table_name.uniqid(); } + if(isset($parameters) && empty($parameters)){ + $parameters = ['class' => 'table table-bordered data_table', 'id' => $table_id]; + } + $this->table_id = $table_id; - parent::__construct(['class' => 'table table-bordered data_table', 'id' => $table_id]); + parent::__construct($parameters); $this->table_name = $table_name; $this->additional_parameters = []; $this->param_prefix = $table_name.'_'; diff --git a/main/mySpace/admin_view.php b/main/mySpace/admin_view.php index efa3699847..995e90aaaa 100644 --- a/main/mySpace/admin_view.php +++ b/main/mySpace/admin_view.php @@ -46,8 +46,7 @@ switch ($display) { MySpace::display_tracking_coach_overview($exportCSV); break; case 'user': - echo MySpace::returnTrackingUserOverview(); - /*MySpace::display_tracking_user_overview();*/ + MySpace::display_tracking_user_overview(); break; case 'session': MySpace::display_tracking_session_overview(); diff --git a/main/template/default/my_space/tracking_user_overview.tpl b/main/template/default/my_space/partials/tracking_user_overview.tpl similarity index 75% rename from main/template/default/my_space/tracking_user_overview.tpl rename to main/template/default/my_space/partials/tracking_user_overview.tpl index 42a624eb69..e9400698dd 100644 --- a/main/template/default/my_space/tracking_user_overview.tpl +++ b/main/template/default/my_space/partials/tracking_user_overview.tpl @@ -1,44 +1,3 @@ -
-
    -
  • - - - {{ 'AvgStudentsProgress'|get_lang }} -
  • -
  • - - - {{ 'AvgCourseScore'|get_lang }} -
  • -
  • - - - {{ 'TotalNumberOfMessages'|get_lang }} -
  • -
  • - - - {{ 'TotalNumberOfAssignments'|get_lang }} -
  • -
  • - - - {{ 'TotalExercisesScoreObtained'|get_lang }} -
  • -
  • - - - {{ 'TotalExercisesAnswered'|get_lang }} -
  • -
  • - - - {{ 'LatestLogin'|get_lang }} -
  • -
-
- -{% for item in data %}
@@ -115,4 +74,4 @@
-{% endfor %} + diff --git a/main/template/default/my_space/user_summary.tpl b/main/template/default/my_space/user_summary.tpl new file mode 100644 index 0000000000..9a93dd6723 --- /dev/null +++ b/main/template/default/my_space/user_summary.tpl @@ -0,0 +1,41 @@ +
+
    +
  • + + + {{ 'AvgStudentsProgress'|get_lang }} +
  • +
  • + + + {{ 'AvgCourseScore'|get_lang }} +
  • +
  • + + + {{ 'TotalNumberOfMessages'|get_lang }} +
  • +
  • + + + {{ 'TotalNumberOfAssignments'|get_lang }} +
  • +
  • + + + {{ 'TotalExercisesScoreObtained'|get_lang }} +
  • +
  • + + + {{ 'TotalExercisesAnswered'|get_lang }} +
  • +
  • + + + {{ 'LatestLogin'|get_lang }} +
  • +
+
+ +{{ table }} \ No newline at end of file From 0d3f5e14cac63711c603f0b236e30c5e0d902b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Arag=C3=B3n?= Date: Fri, 12 Apr 2019 11:21:56 -0500 Subject: [PATCH 5/7] format code user summary - refs #7683 --- main/inc/lib/myspace.lib.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/main/inc/lib/myspace.lib.php b/main/inc/lib/myspace.lib.php index d5b8db205a..d5df2369c4 100644 --- a/main/inc/lib/myspace.lib.php +++ b/main/inc/lib/myspace.lib.php @@ -316,14 +316,15 @@ class MySpace * @return array List course */ - public static function returnCourseTracking($user_id){ + public static function returnCourseTracking($user_id) + { $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); // getting all the courses of the user $sql = "SELECT * FROM $tbl_course_user WHERE - user_id = '".intval($user_id)."' AND - relation_type<>".COURSE_RELATION_TYPE_RRHH." "; + user_id = '" . intval($user_id) . "' AND + relation_type<>" . COURSE_RELATION_TYPE_RRHH . " "; $result = Database::query($sql); $list = []; @@ -359,7 +360,7 @@ class MySpace 'student_score' => $avg_score, 'student_message' => Tracking::count_student_messages($user_id, $courseCode), 'student_assignments' => Tracking::count_student_assignments($user_id, $courseCode), - 'student_exercises' => (is_null($exercises_results['percentage']) ? '' : $exercises_results['score_obtained'].'/'.$exercises_results['score_possible'].' ( '.$exercises_results['percentage'].'% )'), + 'student_exercises' => (is_null($exercises_results['percentage']) ? '' : $exercises_results['score_obtained'] . '/' . $exercises_results['score_possible'] . ' ( ' . $exercises_results['percentage'] . '% )'), 'questions_answered' => $exercises_results['questions_answered'], 'last_connection' => Tracking::get_last_connection_date_on_the_course($user_id, $courseInfo) ]; @@ -381,13 +382,14 @@ class MySpace * @since April 2019 */ - public static function returnTrackingUserOverviewFilter($user_id){ + public static function returnTrackingUserOverviewFilter($user_id) + { - $tpl = new Template('', false, false,false,false,false,false); + $tpl = new Template('', false, false, false, false, false, false); $userInfo = api_get_user_info($user_id); - $avatar = UserManager::getUserPicture($user_id,USER_IMAGE_SIZE_SMALL); - $user = [ + $avatar = UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_SMALL); + $user = [ 'id' => $user_id, 'code_user' => $userInfo['official_code'], 'complete_name' => $userInfo['complete_name'], @@ -427,7 +429,7 @@ class MySpace 0, 20, 'ASC', - null,[ + null, [ 'class' => 'table table-transparent' ] ); @@ -435,7 +437,7 @@ class MySpace $table->set_column_filter(0, ['MySpace', 'returnTrackingUserOverviewFilter']); $tableContent = $table->return_table(); - $tpl = new Template('', false, false,false,false,false,false); + $tpl = new Template('', false, false, false, false, false, false); $tpl->assign('table', $tableContent); $templateName = $tpl->get_template('my_space/user_summary.tpl'); $tpl->display($templateName); From 223ec82082d64a896708088a5c94aa23f19db993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Arag=C3=B3n?= Date: Fri, 12 Apr 2019 11:37:38 -0500 Subject: [PATCH 6/7] add tooltip help --- .../my_space/partials/tracking_user_overview.tpl | 16 ++++++++-------- main/template/default/my_space/user_summary.tpl | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/main/template/default/my_space/partials/tracking_user_overview.tpl b/main/template/default/my_space/partials/tracking_user_overview.tpl index e9400698dd..9ae5905daf 100644 --- a/main/template/default/my_space/partials/tracking_user_overview.tpl +++ b/main/template/default/my_space/partials/tracking_user_overview.tpl @@ -20,41 +20,41 @@
{{ course.title }}
{{ course.code }}
-
+
{{ course.time_spent }}
-
+
{{ course.student_progress }} %
-
+
{{ course.student_score }}
-
+
{{ course.student_message }}
-
+
{{ course.student_assignments }}
- + {{ course.student_assignments }}
- + {{ course.questions_answered }}
-
+
{% if course.last_connection %} {{ course.last_connection }} diff --git a/main/template/default/my_space/user_summary.tpl b/main/template/default/my_space/user_summary.tpl index 9a93dd6723..5188fcc4a5 100644 --- a/main/template/default/my_space/user_summary.tpl +++ b/main/template/default/my_space/user_summary.tpl @@ -1,3 +1,9 @@ +
  • From db4935e3241b02c93631eb5cc71197e1bc4d6f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Arag=C3=B3n?= Date: Fri, 12 Apr 2019 16:34:44 -0500 Subject: [PATCH 7/7] fix tooltip help - refs #7683 --- main/inc/lib/myspace.lib.php | 8 +++++--- .../default/my_space/partials/tracking_user_overview.tpl | 7 +++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/main/inc/lib/myspace.lib.php b/main/inc/lib/myspace.lib.php index d5df2369c4..c8e171de8a 100644 --- a/main/inc/lib/myspace.lib.php +++ b/main/inc/lib/myspace.lib.php @@ -2209,11 +2209,13 @@ class MySpace public static function get_user_data_tracking_overview($from, $numberItems, $column, $direction) { $isWestern = api_is_western_name_order(); + switch ($column) { case '0': - $column = 'official_code'; + $column = $isWestern ? 'firstname' : 'lastname'; + //$column = 'official_code'; break; - case '1': + /*case '1': $column = $isWestern ? 'firstname' : 'lastname'; break; case '2': @@ -2224,7 +2226,7 @@ class MySpace break; case '4': $column = 'username'; - break; + break;*/ } $order = [ diff --git a/main/template/default/my_space/partials/tracking_user_overview.tpl b/main/template/default/my_space/partials/tracking_user_overview.tpl index 9ae5905daf..13523ff701 100644 --- a/main/template/default/my_space/partials/tracking_user_overview.tpl +++ b/main/template/default/my_space/partials/tracking_user_overview.tpl @@ -6,18 +6,17 @@
- + {{ item.complete_name }}
{{ item.username }}
-
{% if item.course %} {% for course in item.course %}
-
{{ course.title }}
+
{{ course.title }}
{{ course.code }}
@@ -65,7 +64,7 @@ {% endfor %} {% else %} {% endif %}