company_reports_resumed.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Special report for corporate users
  5. * @package chamilo.reporting
  6. */
  7. /**
  8. * Code
  9. */
  10. $language_file = array('admin', 'gradebook', 'tracking');
  11. $cidReset = true;
  12. require_once '../inc/global.inc.php';
  13. if (!(api_is_platform_admin(false, true))) {
  14. api_not_allowed();
  15. }
  16. $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('MySpace'));
  17. $tool_name = get_lang('Report');
  18. $this_section = SECTION_TRACKING;
  19. $htmlHeadXtra[] = api_get_jqgrid_js();
  20. // jqgrid will use this URL to do the selects
  21. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_course_report_resumed';
  22. $extra_fields = UserManager::get_extra_fields(0, 100, null, null, true, true);
  23. // The order is important you need to check the the $column variable in the model.ajax.php file.
  24. $columns = array(
  25. get_lang('Company'),
  26. get_lang('TrainingHoursAccumulated'),
  27. get_lang('CountOfSubscriptions'),
  28. get_lang('CountOfUsers'),
  29. get_lang('AverageHoursPerStudent'),
  30. get_lang('CountCertificates')
  31. );
  32. // Column config.
  33. $column_model = array(
  34. array('name' => 'extra_ruc', 'index' => 'extra_ruc', 'width' => '100', 'align' => 'left', 'sortable' => 'false', 'wrap_cell' => 'true'),
  35. array('name' => 'training_hours', 'index' => 'training_hours', 'width' => '100', 'align' => 'left'),
  36. array('name' => 'count_users', 'index' => 'count_users', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
  37. array('name' => 'count_users_registered', 'index' => 'count_users_registered', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
  38. array('name' => 'average_hours_per_user', 'index' => 'average_hours_per_user', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
  39. array('name' => 'count_certificates', 'index' => 'count_certificates', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
  40. );
  41. if (!empty($extra_fields)) {
  42. foreach ($extra_fields as $extra) {
  43. if ($extra['1'] == 'ruc') {
  44. continue;
  45. }
  46. $col = array(
  47. 'name' => $extra['1'],
  48. 'index' => $extra['1'],
  49. 'width' => '120',
  50. 'sortable' =>'false',
  51. 'wrap_cell' => 'true'
  52. );
  53. $column_model[] = $col;
  54. $columns[] = $extra['3'];
  55. }
  56. }
  57. // Autowidth.
  58. $extra_params['autowidth'] = 'true';
  59. //height auto
  60. $extra_params['height'] = 'auto';
  61. $htmlHeadXtra[] = '<script>
  62. $(function() {
  63. '.Display::grid_js('user_course_report', $url, $columns, $column_model, $extra_params, array(), null, true).'
  64. jQuery("#user_course_report").jqGrid("navGrid","#user_course_report_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
  65. jQuery("#user_course_report").jqGrid("navButtonAdd","#user_course_report_pager",{
  66. caption:"",
  67. onClickButton : function () {
  68. jQuery("#user_course_report").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
  69. }
  70. });
  71. });
  72. </script>';
  73. $content = Display::grid_html('user_course_report');
  74. $tpl = new Template($tool_name);
  75. $tpl->assign('content', $content);
  76. $tpl->display_one_col_template();