event_controller.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Global events controller class
  5. * @package chamilo.admin
  6. */
  7. $cidReset = true;
  8. require_once '../inc/global.inc.php';
  9. if (api_get_setting('activate_email_template') != 'true') {
  10. api_not_allowed();
  11. }
  12. class eventController { // extends Controller {
  13. public function showAction() {
  14. }
  15. public function newAction() {
  16. }
  17. public function addAction() {
  18. }
  19. public function listingAction() {
  20. $event_email_template = new EventEmailTemplate();
  21. return $event_email_template->display();
  22. }
  23. public function deleteAction($id) {
  24. $event_email_template = new EventEmailTemplate();
  25. return $event_email_template->delete($id);
  26. }
  27. }
  28. $event_controller = new eventController();
  29. $action = isset($_GET['action']) ? $_GET['action'] : null;
  30. switch ($action) {
  31. case 'show':
  32. $event_controller->showAction();
  33. break;
  34. case 'add':
  35. $event_controller->addAction();
  36. break;
  37. case 'new':
  38. $event_controller->newAction();
  39. break;
  40. case 'delete' :
  41. $event_controller->deleteAction($_GET['id']);
  42. $content = $event_controller->listingAction();
  43. break;
  44. default:
  45. case 'listing':
  46. $content = $event_controller->listingAction();
  47. break;
  48. }
  49. //jqgrid will use this URL to do the selects
  50. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_event_email_template';
  51. //The order is important you need to check the the $column variable in the model.ajax.php file
  52. $columns = array(get_lang('Subject'), get_lang('EventTypeName'), get_lang('Language'), get_lang('Status'), get_lang('Actions'));
  53. //Column config
  54. $column_model = array(
  55. array('name'=>'subject', 'index'=>'subject', 'width'=>'80', 'align'=>'left'),
  56. // array('name'=>'message', 'index'=>'message', 'width'=>'500', 'align'=>'left','sortable'=>'false'),
  57. array('name'=>'event_type_name', 'index'=>'event_type_name', 'width'=>'80', 'align'=>'left'),
  58. array('name'=>'language_id', 'index'=>'language_id', 'width'=>'80', 'align'=>'left'),
  59. array('name'=>'activated', 'index'=>'activated', 'width'=>'80', 'align'=>'left'),
  60. array('name'=>'actions', 'index'=>'actions', 'width'=>'100')
  61. );
  62. //Autowidth
  63. $extra_params['autowidth'] = 'true';
  64. //height auto
  65. $extra_params['height'] = 'auto';
  66. $htmlHeadXtra[] = api_get_jqgrid_js();
  67. $htmlHeadXtra[] = '<script>
  68. $(function() {
  69. '.Display::grid_js('event_email_template', $url,$columns,$column_model,$extra_params, array(), $action_links,true).'
  70. });
  71. </script>';
  72. $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
  73. $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Events'));
  74. $tpl = new Template($tool_name);
  75. $tpl->assign('actions', $actions);
  76. $tpl->assign('message', $message);
  77. $tpl->assign('content', $content);
  78. $tpl->display_one_col_template();