Adding new options in the company report see #BT5778

1.9.x
Julio Montoya 11 years ago
parent cae20a5ce2
commit 69300e8148
  1. 39
      main/inc/ajax/model.ajax.php
  2. 18
      main/inc/lib/course.lib.php
  3. 16
      main/mySpace/company_reports.php
  4. 26
      main/mySpace/company_reports_resumed.php

@ -337,11 +337,20 @@ switch ($action) {
break;
case 'get_user_course_report_resumed':
$columns = array(
'extra_ruc', 'training_hours', 'count_users', 'count_users_registered', 'average_hours_per_user', 'count_certificates'
'extra_ruc',
'extra_razon_social',
'extra_sector_actividad',
'training_hours',
'count_users',
'count_users_registered',
'average_hours_per_user',
'count_certificates'
);
$column_names = array(
get_lang('Company'),
get_lang('BusinessName'),
get_lang('Activity'),
get_lang('TrainingHoursAccumulated'),
get_lang('CountOfSubscriptions'),
get_lang('CountOfUsers'),
@ -358,10 +367,11 @@ switch ($action) {
null,
true,
true,
'ruc',
array('ruc', 'razon_social', 'sector_actividad'),
$courseCodeList,
$userIdList
);
$new_result = array();
if (!empty($result)) {
foreach ($result as $row) {
@ -382,6 +392,7 @@ switch ($action) {
get_lang('Approved'),
get_lang('CourseAdvance')
);
$extra_fields = UserManager::get_extra_fields(0, 100, null, null, true, true);
if (!empty($extra_fields)) {
foreach ($extra_fields as $extra) {
@ -576,16 +587,16 @@ switch ($action) {
}
$columns = array(
'session',
'exercise_id',
'quiz_title',
'username',
'lastname',
'firstname',
'time',
'question_id',
'question',
'answer',
'session',
'exercise_id',
'quiz_title',
'username',
'lastname',
'firstname',
'time',
'question_id',
'question',
'answer',
'correct'
);
@ -609,7 +620,7 @@ switch ($action) {
/**
* Add lessons of course
*
*
*/
$columns = array(
'username',
@ -618,7 +629,7 @@ switch ($action) {
);
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';
$lessons = LearnpathList::get_course_lessons($course['code'], $sessionId);
foreach ($lessons as $lesson_id => $lesson)
foreach ($lessons as $lesson_id => $lesson)
{
$columns[] = $lesson_id;
}

@ -1152,10 +1152,10 @@ class CourseManager
/**
* Return user info array of all users registered in the specified real or virtual course
* This only returns the users that are registered in this actual course, not linked courses.
* @param null $course_code
* @param string $course_code
* @param int $session_id
* @param null $limit
* @param null $order_by the field to order the users by.
* @param string $limit
* @param string $order_by the field to order the users by.
* Valid values are 'lastname', 'firstname', 'username', 'email', 'official_code' OR a part of a SQL statement
* that starts with ORDER BY ...
* @param null $filter_by_status if using the session_id: 0 or 2 (student, coach),
@ -1163,9 +1163,10 @@ class CourseManager
* @param null $return_count
* @param bool $add_reports
* @param bool $resumed_report
* @param null $extra_field
* @param array $extra_field
* @param array $courseCodeList
* @param array $userList
* @param string $filterByActive
* @return array|int
*/
public static function get_user_list_from_course_code(
@ -1177,7 +1178,7 @@ class CourseManager
$return_count = null,
$add_reports = false,
$resumed_report = false,
$extra_field = null,
$extra_field = array(),
$courseCodeList = array(),
$userIdList = array(),
$filterByActive = null
@ -1253,8 +1254,11 @@ class CourseManager
}
if ($return_count && $resumed_report) {
$extra_field_info = UserManager::get_extra_field_information_by_name($extra_field);
$sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES).' as ufv ON (user.user_id = ufv.user_id AND (field_id = '.$extra_field_info['id'].' OR field_id IS NULL ) )';
foreach ($extra_field as $extraField) {
$extraFieldInfo = UserManager::get_extra_field_information_by_name($extraField);
$sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES).' as ufv
ON (user.user_id = ufv.user_id AND (field_id = '.$extraFieldInfo['id'].' OR field_id IS NULL ) )';
}
}
$sql .= ' WHERE '.$filter_by_status_condition.' '.implode(' OR ', $where);

@ -29,7 +29,14 @@ $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);
//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('CertificateGenerated'), get_lang('Approved'), get_lang('CourseAdvance'));
$columns = array(
get_lang('Course'),
get_lang('User'),
get_lang('ManHours'),
get_lang('CertificateGenerated'),
get_lang('Approved'),
get_lang('CourseAdvance')
);
//Column config
$column_model = array(
@ -45,9 +52,10 @@ if (!empty($extra_fields)) {
foreach ($extra_fields as $extra) {
$col = array(
'name' => $extra['1'],
'index'=> $extra['1'],
'width'=>'120',
'sortable'=>'false'
'index' => $extra['1'],
'width' =>'120',
'sortable' =>'false',
'wrap_cell' => "true"
);
$column_model[] = $col;

@ -9,6 +9,7 @@
*/
$language_file = array('admin', 'gradebook', 'tracking');
$cidReset = true;
require_once '../inc/global.inc.php';
if (!(api_is_platform_admin(false, true))) {
@ -18,22 +19,31 @@ if (!(api_is_platform_admin(false, true))) {
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('MySpace'));
$tool_name = get_lang('Report');
$this_section = SECTION_TRACKING;
$htmlHeadXtra[] = api_get_jqgrid_js();
//jqgrid will use this URL to do the selects
// jqgrid will use this URL to do the selects
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_course_report_resumed';
$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
$columns = array(get_lang('Company'), get_lang('TrainingHoursAccumulated'), get_lang('CountOfSubscriptions'), get_lang('CountOfUsers'), get_lang('AverageHoursPerStudent'), get_lang('CountCertificates'));
// The order is important you need to check the the $column variable in the model.ajax.php file.
$columns = array(
get_lang('Company'),
get_lang('BusinessName'),
get_lang('Activity'),
get_lang('TrainingHoursAccumulated'),
get_lang('CountOfSubscriptions'),
get_lang('CountOfUsers'),
get_lang('AverageHoursPerStudent'),
get_lang('CountCertificates')
);
//Column config
// Column config.
$column_model = array(
array('name' => 'extra_ruc', 'index' => 'extra_ruc', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
array('name' => 'extra_ruc', 'index' => 'extra_ruc', 'width' => '100', 'align' => 'left', 'sortable' => 'false', 'wrap_cell' => "true"),
array('name' => 'extra_razon_social', 'index' => 'extra_ruc', 'width' => '100', 'align' => 'left', 'sortable' => 'false', 'wrap_cell' => "true"),
array('name' => 'extra_sector_actividad', 'index' => 'extra_ruc', 'width' => '100', 'align' => 'left', 'sortable' => 'false', 'wrap_cell' => "true"),
array('name' => 'training_hours', 'index' => 'training_hours', 'width' => '100', 'align' => 'left'),
array('name' => 'count_users', 'index' => 'count_users', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
array('name' => 'count_users_registered', 'index' => 'count_users_registered', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
@ -41,7 +51,7 @@ $column_model = array(
array('name' => 'count_certificates', 'index' => 'count_certificates', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
);
//Autowidth
// Autowidth.
$extra_params['autowidth'] = 'true';
//height auto
$extra_params['height'] = 'auto';

Loading…
Cancel
Save