Completed
Push — master ( fd29c3...7c77d2 )
by Julito
91:07 queued 30:09
created

eventController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 1
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
use Chamilo\CoreBundle\Framework\Container;
5
6
/**
7
 * Global events controller class
8
 * @package chamilo.admin
9
 */
10
$cidReset = true;
11
12
if (api_get_setting('mail.activate_email_template') != 'true') {
13
    api_not_allowed();
14
}
15
16
$action = isset($_GET['action']) ? $_GET['action'] : null;
17
18
switch ($action) {
19
    case 'show':
20
        break;
21
    case 'add':
22
        break;
23
    case 'new':
24
        break;
25
    case 'delete' :
26
        $event_email_template = new EventEmailTemplate();
27
        $event_email_template->delete($_GET['id']);
28
        $content = $event_email_template->display();
29
        break;
30
    default:
31
    case 'listing':
32
        $event_email_template = new EventEmailTemplate();
33
        $content = $event_email_template->display();
34
        break;
35
}
36
37
//jqgrid will use this URL to do the selects
38
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_event_email_template';
39
40
//The order is important you need to check the the $column variable in the model.ajax.php file
41
$columns = array(
42
    get_lang('Subject'),
43
    get_lang('EventTypeName'),
44
    get_lang('Language'),
45
    get_lang('Status'),
46
    get_lang('Actions'),
47
);
48
49
//Column config
50
$column_model   = array(
51
    array('name'=>'subject',        'index'=>'subject',        'width'=>'80',   'align'=>'left'),
52
    //                        array('name'=>'message',        'index'=>'message', 'width'=>'500',  'align'=>'left','sortable'=>'false'),
53
    array('name'=>'event_type_name',        'index'=>'event_type_name',        'width'=>'80',   'align'=>'left'),
54
    array('name'=>'language_id',        'index'=>'language_id',        'width'=>'80',   'align'=>'left'),
55
    array('name'=>'activated',        'index'=>'activated',        'width'=>'80',   'align'=>'left'),
56
    array('name' => 'actions', 'index' => 'actions', 'width' => '100'),
57
);
58
//Autowidth
59
$extra_params['autowidth'] = 'true';
60
//height auto
61
$extra_params['height'] = 'auto';
62
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
70
$interbreadcrumb[] = array('url' => Container::getRouter()->generate('administration'), 'name' => get_lang('PlatformAdmin'));
71
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Events'));
72
73
$tpl = new Template($tool_name);
0 ignored issues
show
Deprecated Code introduced by
The class Template has been deprecated.

This class, trait or interface has been deprecated.

Loading history...
74
$tpl->assign('actions', $actions);
75
$tpl->assign('message', $message);
76
$tpl->assign('content', $content);
77
$tpl->display_one_col_template();
78