company_reports.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. api_protect_admin_script();
  14. $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace'));
  15. //$interbreadcrumb[] = array ("url" => 'user_list.php', "name" => get_lang('Report'));
  16. $tool_name = get_lang('Report');
  17. $this_section = SECTION_TRACKING;
  18. $htmlHeadXtra[] = api_get_jqgrid_js();
  19. //jqgrid will use this URL to do the selects
  20. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_course_report';
  21. $extra_fields = UserManager::get_extra_fields(0, 100, null, null, true, true);
  22. //The order is important you need to check the the $column variable in the model.ajax.php file
  23. $columns = array(get_lang('Course'), get_lang('User'), get_lang('ManHours'), get_lang('CertificateGenerated'), get_lang('Approved'), get_lang('CourseAdvance'));
  24. //Column config
  25. $column_model = array(
  26. array('name'=>'course', 'index'=>'title', 'width'=>'180', 'align'=>'left'),
  27. array('name'=>'user', 'index'=>'user', 'width'=>'100', 'align'=>'left','sortable'=>'false'),
  28. array('name'=>'time', 'index'=>'time', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
  29. array('name'=>'certificate', 'index'=>'certificate', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
  30. array('name'=>'progress_100', 'index'=>'progress_100', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
  31. array('name'=>'progress', 'index'=>'progress', 'width'=>'50', 'align'=>'left','sortable'=>'false')
  32. );
  33. if (!empty($extra_fields)) {
  34. foreach($extra_fields as $extra) {
  35. $col = array(
  36. 'name' => $extra['1'],
  37. 'index'=> $extra['1'],
  38. 'width'=>'120',
  39. 'sortable'=>'false'
  40. );
  41. $column_model[] = $col;
  42. $columns[] = $extra['3'];
  43. }
  44. }
  45. //Autowidth
  46. $extra_params['autowidth'] = 'true';
  47. //height auto
  48. $extra_params['height'] = 'auto';
  49. $htmlHeadXtra[] = '<script>
  50. $(function() {
  51. '.Display::grid_js('user_course_report', $url,$columns,$column_model,$extra_params, array(), null, true).'
  52. jQuery("#user_course_report").jqGrid("navGrid","#user_course_report_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
  53. jQuery("#user_course_report").jqGrid("navButtonAdd","#user_course_report_pager",{
  54. caption:"",
  55. onClickButton : function () {
  56. jQuery("#user_course_report").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
  57. }
  58. });
  59. });
  60. </script>';
  61. $content = Display::grid_html('user_course_report');
  62. $app['title'] = $tool_name;
  63. $tpl = $app['template'];
  64. $tpl->assign('content', $content);
  65. $tpl->display_one_col_template();