company_reports_resumed.php 4.3 KB

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