company_reports.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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';
  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('Course'),
  26. get_lang('User'),
  27. get_lang('ManHours'),
  28. get_lang('CertificateGenerated'),
  29. get_lang('Approved'),
  30. get_lang('CourseAdvance')
  31. );
  32. //Column config
  33. $column_model = array(
  34. array('name'=>'course', 'index'=>'title', 'width'=>'180', 'align'=>'left', 'wrap_cell' => 'true'),
  35. array('name'=>'user', 'index'=>'user', 'width'=>'100', 'align'=>'left','sortable'=>'false', 'wrap_cell' => 'true'),
  36. array('name'=>'time', 'index'=>'time', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
  37. array('name'=>'certificate', 'index'=>'certificate', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
  38. array('name'=>'progress_100', 'index'=>'progress_100', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
  39. array('name'=>'progress', 'index'=>'progress', 'width'=>'50', 'align'=>'left','sortable'=>'false')
  40. );
  41. if (!empty($extra_fields)) {
  42. foreach ($extra_fields as $extra) {
  43. $col = array(
  44. 'name' => $extra['1'],
  45. 'index' => $extra['1'],
  46. 'width' => '120',
  47. 'sortable' =>'false',
  48. 'wrap_cell' => 'true'
  49. );
  50. $column_model[] = $col;
  51. $columns[] = $extra['3'];
  52. }
  53. }
  54. // Autowidth
  55. $extra_params['autowidth'] = 'true';
  56. // height auto
  57. $extra_params['height'] = 'auto';
  58. $htmlHeadXtra[] = '<script>
  59. $(function() {
  60. '.Display::grid_js('user_course_report', $url, $columns, $column_model, $extra_params, array(), null, true).'
  61. jQuery("#user_course_report").jqGrid("navGrid","#user_course_report_pager",{
  62. view:false,
  63. edit:false,
  64. add:false,
  65. del:false,
  66. search:false,
  67. excel:true
  68. });
  69. jQuery("#user_course_report").jqGrid("navButtonAdd","#user_course_report_pager", {
  70. caption:"",
  71. onClickButton : function () {
  72. jQuery("#user_course_report").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
  73. }
  74. });
  75. });
  76. </script>';
  77. $content = Display::grid_html('user_course_report');
  78. $tpl = new Template($tool_name);
  79. $tpl->assign('content', $content);
  80. $tpl->display_one_col_template();