company_reports.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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';
  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('Course'),
  27. get_lang('User'),
  28. get_lang('ManHours'),
  29. get_lang('CertificateGenerated'),
  30. get_lang('Approved'),
  31. get_lang('CourseAdvance')
  32. );
  33. //Column config
  34. $column_model = array(
  35. array('name'=>'course', 'index'=>'title', 'width'=>'180', 'align'=>'left', 'wrap_cell' => 'true'),
  36. array('name'=>'user', 'index'=>'user', 'width'=>'100', 'align'=>'left','sortable'=>'false', 'wrap_cell' => 'true'),
  37. array('name'=>'time', 'index'=>'time', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
  38. array('name'=>'certificate', 'index'=>'certificate', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
  39. array('name'=>'progress_100', 'index'=>'progress_100', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
  40. array('name'=>'progress', 'index'=>'progress', 'width'=>'50', 'align'=>'left','sortable'=>'false')
  41. );
  42. if (!empty($extra_fields)) {
  43. foreach ($extra_fields as $extra) {
  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",{
  63. view:false,
  64. edit:false,
  65. add:false,
  66. del:false,
  67. search:false,
  68. excel:true
  69. });
  70. jQuery("#user_course_report").jqGrid("navButtonAdd","#user_course_report_pager", {
  71. caption:"",
  72. onClickButton : function () {
  73. jQuery("#user_course_report").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
  74. }
  75. });
  76. });
  77. </script>';
  78. $actions = null;
  79. if (api_is_student_boss()) {
  80. $actions .= Display::url(
  81. Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
  82. api_get_path(WEB_CODE_PATH) . "auth/my_progress.php"
  83. );
  84. $actions .= Display::url(
  85. Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
  86. api_get_path(WEB_CODE_PATH) . "mySpace/student.php"
  87. );
  88. $actions .= Display::url(
  89. Display::return_icon("statistics.png", get_lang("CompanyReport"), array(), ICON_SIZE_MEDIUM),
  90. "#"
  91. );
  92. }
  93. $content = '<div class="actions">';
  94. if (!empty($actions)) {
  95. $content .= $actions;
  96. }
  97. $content .= '<div class="pull-right">';
  98. $content .= Display::url(
  99. get_lang("CompanyReportResumed"),
  100. api_get_path(WEB_CODE_PATH) . "mySpace/company_reports_resumed.php",
  101. array(
  102. 'class' => 'btn btn-info'
  103. )
  104. );
  105. $content .= '</div>';
  106. $content .= '</div>';
  107. $content .= '<h1 class="page-header">' . get_lang('CompanyReport') . '</h1>';
  108. $content .= Display::grid_html('user_course_report');
  109. $tpl = new Template($tool_name);
  110. $tpl->assign('content', $content);
  111. $tpl->display_one_col_template();