company_reports_resumed.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Special report for corporate users
  5. * @package chamilo.reporting
  6. */
  7. $cidReset = true;
  8. require_once '../inc/global.inc.php';
  9. $userNotAllowed = !api_is_student_boss() && !api_is_platform_admin(false, true);
  10. if ($userNotAllowed) {
  11. api_not_allowed(true);
  12. }
  13. $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('MySpace'));
  14. $tool_name = get_lang('Report');
  15. $this_section = SECTION_TRACKING;
  16. $htmlHeadXtra[] = api_get_jqgrid_js();
  17. $sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : -1;
  18. // jqgrid will use this URL to do the selects
  19. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_course_report_resumed&session_id='.$sessionId;
  20. $extra_fields = UserManager::get_extra_fields(0, 100, null, null, true, true);
  21. // The order is important you need to check the the $column variable in the model.ajax.php file.
  22. $columns = array(
  23. get_lang('Company'),
  24. get_lang('TrainingHoursAccumulated'),
  25. get_lang('CountOfSubscriptions'),
  26. get_lang('CountOfUsers'),
  27. get_lang('AverageHoursPerStudent'),
  28. get_lang('CountCertificates')
  29. );
  30. // Column config.
  31. $column_model = array(
  32. array('name' => 'extra_ruc', 'index' => 'extra_ruc', 'width' => '100', 'align' => 'left', 'sortable' => 'false', 'wrap_cell' => 'true'),
  33. array('name' => 'training_hours', 'index' => 'training_hours', 'width' => '100', 'align' => 'left'),
  34. array('name' => 'count_users', 'index' => 'count_users', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
  35. array('name' => 'count_users_registered', 'index' => 'count_users_registered', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
  36. array('name' => 'average_hours_per_user', 'index' => 'average_hours_per_user', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
  37. array('name' => 'count_certificates', 'index' => 'count_certificates', 'width' => '100', 'align' => 'left', 'sortable' => 'false'),
  38. );
  39. if (!empty($extra_fields)) {
  40. foreach ($extra_fields as $extra) {
  41. if ($extra['1'] == 'ruc') {
  42. continue;
  43. }
  44. $col = array(
  45. 'name' => $extra['1'],
  46. 'index' => $extra['1'],
  47. 'width' => '120',
  48. 'sortable' =>'false',
  49. 'wrap_cell' => 'true'
  50. );
  51. $column_model[] = $col;
  52. $columns[] = $extra['3'];
  53. }
  54. }
  55. // Autowidth.
  56. $extra_params['autowidth'] = 'true';
  57. //height auto
  58. $extra_params['height'] = 'auto';
  59. $htmlHeadXtra[] = '<script>
  60. $(function() {
  61. '.Display::grid_js('user_course_report', $url, $columns, $column_model, $extra_params, array(), null, true).'
  62. jQuery("#user_course_report").jqGrid("navGrid","#user_course_report_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
  63. jQuery("#user_course_report").jqGrid("navButtonAdd","#user_course_report_pager",{
  64. caption:"",
  65. onClickButton : function () {
  66. jQuery("#user_course_report").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
  67. }
  68. });
  69. });
  70. </script>';
  71. $actions = null;
  72. if (api_is_student_boss()) {
  73. $actions .= Display::url(
  74. Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
  75. api_get_path(WEB_CODE_PATH) . "auth/my_progress.php"
  76. );
  77. $actions .= Display::url(
  78. Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
  79. api_get_path(WEB_CODE_PATH) . "mySpace/student.php"
  80. );
  81. $actions .= Display::url(
  82. Display::return_icon("statistics.png", get_lang("CompanyReport"), array(), ICON_SIZE_MEDIUM),
  83. api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php"
  84. );
  85. $actions .= Display::url(
  86. Display::return_icon(
  87. "certificate_list.png",
  88. get_lang("GradebookSeeListOfStudentsCertificates"),
  89. [],
  90. ICON_SIZE_MEDIUM
  91. ),
  92. api_get_path(WEB_CODE_PATH) . "gradebook/certificate_report.php"
  93. );
  94. }
  95. $content = '<div class="actions">';
  96. if (!empty($actions)) {
  97. $content .= $actions;
  98. }
  99. if (!api_is_student_boss()) {
  100. $content .= Display::url(
  101. get_lang("CompanyReport"),
  102. api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php",
  103. array(
  104. 'class' => 'btn btn-success'
  105. )
  106. );
  107. }
  108. $content .= '</div>';
  109. $content .= '<h1 class="page-header">' . get_lang('CompanyReportResumed') . '</h1>';
  110. $content .= Display::grid_html('user_course_report');
  111. $tpl = new Template($tool_name);
  112. $tpl->assign('content', $content);
  113. $tpl->display_one_col_template();