user_list.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /* See license terms in /license.txt */
  3. require_once '../../main/inc/global.inc.php';
  4. //Add the JS needed to use the jqgrid
  5. $htmlHeadXtra[] = api_get_jqgrid_js();
  6. $allowed = api_is_platform_admin() || api_is_drh();
  7. if (!$allowed) {
  8. api_not_allowed(true);
  9. }
  10. Display::display_header();
  11. //jqgrid will use this URL to do the selects
  12. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_list_plugin_widescale';
  13. //The order is important you need to check the the $column variable in the model.ajax.php file
  14. $columns = array(get_lang('Username'), get_lang('Firstname'), get_lang('Lastname'), get_lang('Password'));
  15. //Column config
  16. $column_model = array(
  17. array('name'=>'username', 'index'=>'username', 'width'=>'100', 'align'=>'left'),
  18. array('name'=>'firstname', 'index'=>'firstname', 'width'=>'100', 'align'=>'left'),
  19. array('name'=>'lastname', 'index'=>'lastname', 'width'=>'100', 'align'=>'left'),
  20. array('name'=>'exam_password', 'index'=>'exam_password', 'width'=>'100', 'align'=>'left','sortable'=>'false'),
  21. //array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false')
  22. );
  23. //Autowidth
  24. $extra_params['autowidth'] = 'true';
  25. //height auto
  26. $extra_params['height'] = 'auto';
  27. //With this function we can add actions to the jgrid (edit, delete, etc)
  28. /*
  29. $action_links = 'function action_formatter(cellvalue, options, rowObject) {
  30. return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
  31. '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'.
  32. '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
  33. '\';
  34. }';*/
  35. $action_links = null;
  36. $room = UserManager::get_extra_user_data_by_field(api_get_user_id(), 'exam_room');
  37. $room = $room['exam_room'];
  38. $schedule = UserManager::get_extra_user_data_by_field(api_get_user_id(), 'exam_schedule');
  39. $schedule = $schedule['exam_schedule'];
  40. echo Display::page_subheader(get_lang('UserList').": ".$room." - ".$schedule);
  41. ?>
  42. <script>
  43. $(function() {
  44. <?php
  45. echo Display::grid_js('user_list', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
  46. ?>
  47. jQuery("#user_list").jqGrid("navGrid","#user_list_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
  48. jQuery("#user_list").jqGrid("navButtonAdd","#user_list_pager",{
  49. caption:"",
  50. onClickButton : function () {
  51. jQuery("#user_list").jqGrid("excelExport",{"url": "<? echo $url?>&export_format=xls"});
  52. }
  53. });
  54. });
  55. </script>
  56. <?php
  57. echo Display::grid_html('user_list');
  58. Display :: display_footer();