event_controller.php 3.3 KB

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