Passed
Push — 1.11.x ( 106594...56cdc0 )
by Angel Fernando Quiroz
08:52
created

main/admin/event_controller.php (2 issues)

Severity
1
<?php
2
/* For licensing terms, see /license.txt */
3
/**
4
 * Global events controller class.
5
 *
6
 * @deprecated to be removed in 2.x
7
 *
8
 * @package chamilo.admin
9
 */
10
$cidReset = true;
11
12
require_once __DIR__.'/../inc/global.inc.php';
13
14
if (api_get_setting('activate_email_template') != 'true') {
15
    api_not_allowed();
16
}
17
18
$action = isset($_GET['action']) ? $_GET['action'] : null;
19
$action_links = '';
20
$tool_name = '';
21
$message = '';
22
23
switch ($action) {
24
    case 'show':
25
        break;
26
    case 'add':
27
        break;
28
    case 'new':
29
        break;
30
    case 'delete':
31
        $event_email_template = new EventEmailTemplate();
0 ignored issues
show
Deprecated Code introduced by
The class EventEmailTemplate has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

31
        $event_email_template = /** @scrutinizer ignore-deprecated */ new EventEmailTemplate();
Loading history...
32
        $event_email_template->delete($_GET['id']);
33
        $content = $event_email_template->display();
34
        break;
35
    default:
36
    case 'listing':
37
        $event_email_template = new EventEmailTemplate();
0 ignored issues
show
Deprecated Code introduced by
The class EventEmailTemplate has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

37
        $event_email_template = /** @scrutinizer ignore-deprecated */ new EventEmailTemplate();
Loading history...
38
        $content = $event_email_template->display();
39
        break;
40
}
41
42
//jqgrid will use this URL to do the selects
43
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_event_email_template';
44
45
//The order is important you need to check the the $column variable in the model.ajax.php file
46
$columns = [
47
    get_lang('Subject'),
48
    get_lang('EventTypeName'),
49
    get_lang('Language'),
50
    get_lang('Status'),
51
    get_lang('Actions'),
52
];
53
54
//Column config
55
$column_model = [
56
    ['name' => 'subject', 'index' => 'subject', 'width' => '80', 'align' => 'left'],
57
//                        array('name'=>'message',        'index'=>'message', 'width'=>'500',  'align'=>'left','sortable'=>'false'),
58
    ['name' => 'event_type_name', 'index' => 'event_type_name', 'width' => '80', 'align' => 'left'],
59
    ['name' => 'language_id', 'index' => 'language_id', 'width' => '80', 'align' => 'left'],
60
    ['name' => 'activated', 'index' => 'activated', 'width' => '80', 'align' => 'left'],
61
    ['name' => 'actions', 'index' => 'actions', 'width' => '100'],
62
];
63
//Autowidth
64
$extra_params['autowidth'] = 'true';
65
//height auto
66
$extra_params['height'] = 'auto';
67
68
$htmlHeadXtra[] = api_get_jqgrid_js();
69
$htmlHeadXtra[] = '<script>
70
$(function() {
71
    '.Display::grid_js('event_email_template', $url, $columns, $column_model, $extra_params, [], $action_links, true).'
72
});
73
</script>';
74
75
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
76
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Events')];
77
78
$tpl = new Template($tool_name);
79
$tpl->assign('message', $message);
80
$tpl->assign('content', $content);
81
$tpl->display_one_col_template();
82