event_controller.php 3.1 KB

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