Adding columns in company_report.php see BT#5741

skala
Julio Montoya 12 years ago
parent d0bb36beb8
commit 1d1e3c086e
  1. 4
      main/inc/ajax/model.ajax.php
  2. 9
      main/inc/lib/course.lib.php
  3. 6
      main/mySpace/company_reports.php

@ -258,8 +258,8 @@ switch ($action) {
} }
break; break;
case 'get_user_course_report': case 'get_user_course_report':
$columns = array('course', 'user', 'time', 'certificate', 'score', 'progress'); $columns = array('course', 'user', 'time', 'certificate', 'progress_100', 'progress');
$column_names = array(get_lang('Course'), get_lang('User'), get_lang('ManHours'), get_lang('Approved'), get_lang('Score'), get_lang('NotesObtained')); $column_names = array(get_lang('Course'), get_lang('User'), get_lang('ManHours'), get_lang('CertificateGenerated'), get_lang('Approved'), get_lang('CourseAdvance'));
$extra_fields = UserManager::get_extra_fields(0, 100, null, null, true, true); $extra_fields = UserManager::get_extra_fields(0, 100, null, null, true, true);
if (!empty($extra_fields)) { if (!empty($extra_fields)) {
foreach($extra_fields as $extra) { foreach($extra_fields as $extra) {

@ -1223,7 +1223,7 @@ class CourseManager {
if ($return_count && $resumed_report) { if ($return_count && $resumed_report) {
return $count_rows; return $count_rows;
} }
$table_user_field_value = Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES); $table_user_field_value = Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES);
if ($count_rows) { if ($count_rows) {
while ($user = Database::fetch_array($rs)) { while ($user = Database::fetch_array($rs)) {
@ -1301,8 +1301,11 @@ class CourseManager {
$report_info['certificate'] = Display::label(get_lang('Yes'), 'success'); $report_info['certificate'] = Display::label(get_lang('Yes'), 'success');
} }
$report_info['score'] = Tracking::get_avg_student_score($user['user_id'], $course_code, array(), 0); //$report_info['score'] = Tracking::get_avg_student_score($user['user_id'], $course_code, array(), 0);
$report_info['progress'] = Tracking::get_avg_student_progress($user['user_id'], $course_code, array(), 0)."%";
$progress = intval(Tracking::get_avg_student_progress($user['user_id'], $course_code, array(), 0));
$report_info['progress_100'] = $progress == 100 ? Display::label(get_lang('Yes'), 'success') : Display::label(get_lang('No'));
$report_info['progress'] = $progress."%";
foreach ($extra_fields as $extra) { foreach ($extra_fields as $extra) {
$user_data = UserManager::get_extra_user_data_by_field($user['user_id'], $extra['1']); $user_data = UserManager::get_extra_user_data_by_field($user['user_id'], $extra['1']);

@ -28,7 +28,7 @@ $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_course_report';
$extra_fields = UserManager::get_extra_fields(0, 100, null, null, true, true); $extra_fields = UserManager::get_extra_fields(0, 100, null, null, true, true);
//The order is important you need to check the the $column variable in the model.ajax.php file //The order is important you need to check the the $column variable in the model.ajax.php file
$columns = array(get_lang('Course'), get_lang('User'), get_lang('ManHours'), get_lang('Approved'), get_lang('Score'), get_lang('NotesObtained')); $columns = array(get_lang('Course'), get_lang('User'), get_lang('ManHours'), get_lang('CertificateGenerated'), get_lang('Approved'), get_lang('CourseAdvance'));
//Column config //Column config
$column_model = array( $column_model = array(
@ -36,8 +36,8 @@ $column_model = array(
array('name'=>'user', 'index'=>'user', 'width'=>'100', 'align'=>'left','sortable'=>'false'), array('name'=>'user', 'index'=>'user', 'width'=>'100', 'align'=>'left','sortable'=>'false'),
array('name'=>'time', 'index'=>'time', 'width'=>'50', 'align'=>'left','sortable'=>'false'), array('name'=>'time', 'index'=>'time', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
array('name'=>'certificate', 'index'=>'certificate', 'width'=>'50', 'align'=>'left','sortable'=>'false'), array('name'=>'certificate', 'index'=>'certificate', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
array('name'=>'score', 'index'=>'score', 'width'=>'50', 'align'=>'left','sortable'=>'false'), array('name'=>'progress_100', 'index'=>'progress_100', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
array('name'=>'progress', 'index'=>'progress', 'width'=>'50', 'align'=>'left','sortable'=>'false'), array('name'=>'progress', 'index'=>'progress', 'width'=>'50', 'align'=>'left','sortable'=>'false')
); );
if (!empty($extra_fields)) { if (!empty($extra_fields)) {

Loading…
Cancel
Save