-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotification.admin.controller.php
More file actions
104 lines (92 loc) · 3.96 KB
/
notification.admin.controller.php
File metadata and controls
104 lines (92 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* vi:set sw=4 ts=4 noexpandtab fileencoding=utf8:
* @class notificationAdminController
* @author diver(diver@coolsms.co.kr)
* @brief notificationAdminController
*/
class notificationAdminController extends notification {
function init() {
}
/**
* @brief 모듈 환경설정값 쓰기
**/
function procNotificationAdminConfig() {
$args = Context::gets('cellphone_fieldname', 'use_authdata');
// save module configuration.
$oModuleControll = getController('module');
$output = $oModuleControll->insertModuleConfig('notification', $args);
if (!$output->toBool()) return $output;
$this->setMessage('success_updated');
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispNotificationAdminConfig');
$this->setRedirectUrl($returnUrl);
return;
}
}
/**
* @brief notification append
**/
function procNotificationAdminInsert() {
$params = Context::gets('content','mail_content','module_srls','msgtype','sending_method','cellphone_fieldname','use_authdata');
$extra_vars = new stdClass();
$extra_vars->sender_phone = Context::get('sender_phone');
$extra_vars->admin_phones = Context::get('admin_phones');
$extra_vars->admin_emails = Context::get('admin_emails');
$extra_vars->cellphone_fieldname = Context::get('cellphone_fieldname');
$extra_vars->use_authdata = Context::get('use_authdata');
$extra_vars->reverse_notify = Context::get('reverse_notify');
$extra_vars->use_extravar = Context::get('use_extravar');
$extra_vars->use_extravar_email = Context::get('use_extravar_email');
$extra_vars->force_notify = Context::get('force_notify');
$extra_vars->email_sender_name = Context::get('email_sender_name');
$extra_vars->email_sender_address = Context::get('email_sender_address');
$extra_vars->sms_method = Context::get('sms_method');
$extra_vars->sender_key = Context::get('sender_key');
$extra_vars->template_code = Context::get('template_code');
$extra_vars->frist_number = Context::get('frist_number');
$params->notification_srl = Context::get('noti_srl');
if ($params->notification_srl) {
// delete existences
$args = new stdClass();
$args->notification_srl = $params->notification_srl;
$output = executeQuery('notification.deleteNotiCom', $args);
if (!$output->toBool()) return $output;
$output = executeQuery('notification.deleteNotificationModuleSrl', $args);
if (!$output->toBool()) return $output;
} else {
// new sequence
$params->notification_srl = getNextSequence();
}
// insert module srls
$module_srls = explode(',', $params->module_srls);
foreach ($module_srls as $srl) {
$args = new stdClass();
$args->notification_srl = $params->notification_srl;
$args->module_srl = $srl;
$output = executeQuery('notification.insertNotificationModuleSrl', $args);
if (!$output->toBool()) return $output;
}
$params->extra_vars = serialize($extra_vars);
// insert notification
$output = executeQuery('notification.insertNotiCom', $params);
if (!$output->toBool()) return $output;
$redirectUrl = getNotEncodedUrl('', 'module', 'admin', 'act', 'dispNotificationAdminModify','notification_srl',$params->notification_srl);
$this->setRedirectUrl($redirectUrl);
}
function procNotificationAdminDelete() {
$notification_srl = Context::get('notification_srl');
if (!$notification_srl) return new Object(-1, 'msg_invalid_request');
if ($notification_srl) {
// delete existences
$args->notification_srl = $notification_srl;
$query_id = "notification.deleteNotiCom";
executeQuery($query_id, $args);
$query_id = "notification.deleteNotificationModuleSrl";
executeQuery($query_id, $args);
}
$redirectUrl = getNotEncodedUrl('', 'module', 'admin', 'act', 'dispNotificationAdminList');
$this->setRedirectUrl($redirectUrl);
}
}
?>