|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
############################################################################### |
|
4
|
|
|
# ASTPP - Open Source VoIP Billing Solution |
|
5
|
|
|
# |
|
6
|
|
|
# Copyright (C) 2016 iNextrix Technologies Pvt. Ltd. |
|
7
|
|
|
# Samir Doshi <[email protected]> |
|
8
|
|
|
# ASTPP Version 3.0 and above |
|
9
|
|
|
# License https://www.gnu.org/licenses/agpl-3.0.html |
|
10
|
|
|
# |
|
11
|
|
|
# This program is free software: you can redistribute it and/or modify |
|
12
|
|
|
# it under the terms of the GNU Affero General Public License as |
|
13
|
|
|
# published by the Free Software Foundation, either version 3 of the |
|
14
|
|
|
# License, or (at your option) any later version. |
|
15
|
|
|
# |
|
16
|
|
|
# This program is distributed in the hope that it will be useful, |
|
17
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19
|
|
|
# GNU Affero General Public License for more details. |
|
20
|
|
|
# |
|
21
|
|
|
# You should have received a copy of the GNU Affero General Public License |
|
22
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
23
|
|
|
############################################################################### |
|
24
|
|
|
|
|
25
|
|
|
class Email extends MX_Controller { |
|
26
|
|
|
|
|
27
|
|
View Code Duplication |
function Email() { |
|
28
|
|
|
parent::__construct(); |
|
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
$this->load->helper('template_inheritance'); |
|
31
|
|
|
|
|
32
|
|
|
$this->load->library('session'); |
|
33
|
|
|
$this->load->library('email_form'); |
|
34
|
|
|
$this->load->library('astpp/form'); |
|
35
|
|
|
$this->load->model('email_model'); |
|
36
|
|
|
$this->load->library('csvreader'); |
|
37
|
|
|
$this->load->library('astpp/email_lib'); |
|
38
|
|
|
if ($this->session->userdata('user_login') == FALSE) |
|
39
|
|
|
redirect(base_url() . '/astpp/login'); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
function email_edit($edit_id = '') { |
|
43
|
|
|
$data['page_title'] = 'Edit Email List'; |
|
|
|
|
|
|
44
|
|
|
if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
45
|
|
|
$account_data = $this->session->userdata("accountinfo"); |
|
46
|
|
|
$reseller = $account_data['id']; |
|
47
|
|
|
$where = array('id' => $edit_id, "reseller_id" => $reseller); |
|
48
|
|
|
} else { |
|
49
|
|
|
$where = array('id' => $edit_id); |
|
50
|
|
|
} |
|
51
|
|
|
$account = $this->db_model->getSelect("*", "mail_details", $where); |
|
52
|
|
View Code Duplication |
if ($account->num_rows > 0) { |
|
53
|
|
|
foreach ($account->result_array() as $key => $value) { |
|
54
|
|
|
$edit_data = $value; |
|
55
|
|
|
} |
|
56
|
|
|
$data['form'] = $this->form->build_form($this->email_form->get_form_fields_email(), $edit_data); |
|
|
|
|
|
|
57
|
|
|
$this->load->view('view_email_add_edit', $data); |
|
58
|
|
|
} else { |
|
59
|
|
|
redirect(base_url() . 'email/email_history_list/'); |
|
60
|
|
|
} |
|
61
|
|
|
redirect(base_url() . 'email/email_history_list/'); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
function email_resend() { |
|
65
|
|
|
$add_array = $this->input->post(); |
|
66
|
|
|
/** |
|
67
|
|
|
ASTPP 3.0 |
|
68
|
|
|
For Signup Email broadcast link change |
|
69
|
|
|
**/ |
|
70
|
|
|
$add_array = $this->db_model->getSelect("*", 'mail_details', array('id' => $add_array['id'])); |
|
71
|
|
|
$add_array = $add_array->result_array(); |
|
72
|
|
|
$add_array = $add_array[0]; |
|
73
|
|
|
/************************************************************/ |
|
74
|
|
|
|
|
75
|
|
|
$data['page_title'] = 'Resand Email'; |
|
|
|
|
|
|
76
|
|
|
$where = array('id' => $add_array['id']); |
|
77
|
|
|
$account = $this->db_model->getSelect("*", "mail_details", $where); |
|
78
|
|
|
foreach ($account->result_array() as $key => $value) { |
|
79
|
|
|
$edit_data = $value; |
|
80
|
|
|
} |
|
81
|
|
|
$add_array=array('accountid'=>$edit_data['accountid'], |
|
|
|
|
|
|
82
|
|
|
'subject'=>$add_array['subject'], |
|
83
|
|
|
'body'=>$add_array['body'], |
|
84
|
|
|
'from'=>$edit_data['from'], |
|
85
|
|
|
'to'=>$edit_data['to'], |
|
86
|
|
|
'status'=>$edit_data['status'], |
|
87
|
|
|
'template'=>$edit_data['template'], |
|
88
|
|
|
'attachment'=>$edit_data['attachment'], |
|
89
|
|
|
|
|
90
|
|
|
); |
|
91
|
|
|
$this->email_re_send($add_array); |
|
92
|
|
|
|
|
93
|
|
|
$this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!'); |
|
94
|
|
|
redirect(base_url() . 'email/email_history_list/'); |
|
95
|
|
|
} |
|
96
|
|
|
function email_resend_edit($edit_id = '') { |
|
97
|
|
|
$data['page_title'] = 'Resend Email'; |
|
|
|
|
|
|
98
|
|
|
$where = array('id' => $edit_id); |
|
99
|
|
|
$account = $this->db_model->getSelect("*", "mail_details", $where); |
|
100
|
|
|
if ($account->num_rows > 0) { |
|
101
|
|
|
foreach ($account->result_array() as $key => $value) { |
|
102
|
|
|
$edit_data = $value; |
|
103
|
|
|
} |
|
104
|
|
|
$data['maildata'] = $edit_data['attachment']; |
|
|
|
|
|
|
105
|
|
|
$data['form'] = $this->form->build_form($this->email_form->get_form_fields_email_edit(), $edit_data); |
|
106
|
|
|
|
|
107
|
|
|
$this->load->view('view_email_add_edit', $data); |
|
108
|
|
|
} else { |
|
109
|
|
|
redirect(base_url() . 'email/email_history_list/'); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
} |
|
113
|
|
|
function email_resend_edit_customer($edit_id = '') { |
|
114
|
|
|
$data['page_title'] = 'Resent Email'; |
|
|
|
|
|
|
115
|
|
|
$where = array('id' => $edit_id); |
|
116
|
|
|
$account = $this->db_model->getSelect("*", "mail_details", $where); |
|
117
|
|
|
if ($account->num_rows > 0) { |
|
118
|
|
|
foreach ($account->result_array() as $key => $value) { |
|
119
|
|
|
$edit_data = $value; |
|
120
|
|
|
} |
|
121
|
|
|
$data['maildata'] = $edit_data['attachment']; |
|
|
|
|
|
|
122
|
|
|
$data['form'] = $this->form->build_form($this->email_form->get_form_fields_email_view_cus_edit(), $edit_data); |
|
123
|
|
|
|
|
124
|
|
|
$this->load->view('view_email_add_edit', $data); |
|
125
|
|
|
} else { |
|
126
|
|
|
redirect(base_url() . 'email/email_history_list/'); |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
function email_resend_customer($edit_id = '') { |
|
|
|
|
|
|
132
|
|
|
$add_array = $this->input->post(); |
|
133
|
|
|
$data['page_title'] = 'Resand Email'; |
|
|
|
|
|
|
134
|
|
|
$where = array('id' => $add_array['id']); |
|
135
|
|
|
$account = $this->db_model->getSelect("*", "mail_details", $where); |
|
136
|
|
|
foreach ($account->result_array() as $key => $value) { |
|
137
|
|
|
$edit_data = $value; |
|
138
|
|
|
} |
|
139
|
|
|
$add_array=array('accountid'=>$edit_data['accountid'], |
|
|
|
|
|
|
140
|
|
|
'subject'=>$add_array['subject'], |
|
141
|
|
|
'body'=>$add_array['body'], |
|
142
|
|
|
'from'=>$edit_data['from'], |
|
143
|
|
|
'to'=>$edit_data['to'], |
|
144
|
|
|
'status'=>$edit_data['status'], |
|
145
|
|
|
'template'=>$edit_data['template'], |
|
146
|
|
|
'attachment'=>$edit_data['attachment'], |
|
147
|
|
|
); |
|
148
|
|
|
$this->email_model->add_email($add_array); |
|
149
|
|
|
$this->email_lib->send_email('',$add_array,'','',1); |
|
150
|
|
|
|
|
151
|
|
|
$this->load->module('accounts/accounts'); |
|
152
|
|
|
$this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!'); |
|
153
|
|
|
redirect(base_url() . 'accounts/customer_edit/'.$value["accountid"]); |
|
|
|
|
|
|
154
|
|
|
} |
|
155
|
|
View Code Duplication |
function email_add($type = "") { |
|
|
|
|
|
|
156
|
|
|
|
|
157
|
|
|
$data['username'] = $this->session->userdata('user_name'); |
|
|
|
|
|
|
158
|
|
|
$data['flag'] = 'create'; |
|
159
|
|
|
$data['page_title'] = 'Create Commission Rate'; |
|
160
|
|
|
$data['form'] = $this->form->build_form($this->email_form->get_form_fields_email(), ''); |
|
161
|
|
|
|
|
162
|
|
|
$this->load->view('view_email_add_edit', $data); |
|
163
|
|
|
} |
|
164
|
|
View Code Duplication |
function email_save() { |
|
165
|
|
|
$add_array = $this->input->post(); |
|
166
|
|
|
$data['form'] = $this->form->build_form($this->email_form->get_form_fields_email(), $add_array); |
|
|
|
|
|
|
167
|
|
|
if ($add_array['id'] != '') { |
|
168
|
|
|
$data['page_title'] = 'Edit email List'; |
|
169
|
|
|
if ($this->form_validation->run() == FALSE) { |
|
170
|
|
|
$data['validation_errors'] = validation_errors(); |
|
171
|
|
|
echo $data['validation_errors']; |
|
172
|
|
|
exit; |
|
173
|
|
|
} else { |
|
174
|
|
|
$this->email_model->edit_email($add_array, $add_array['id']); |
|
175
|
|
|
echo json_encode(array("SUCCESS"=> "Email list updated successfully!")); |
|
176
|
|
|
exit; |
|
177
|
|
|
} |
|
178
|
|
|
} else { |
|
179
|
|
|
$data['page_title'] = 'Create Email List'; |
|
180
|
|
|
if ($this->form_validation->run() == FALSE) { |
|
181
|
|
|
$data['validation_errors'] = validation_errors(); |
|
182
|
|
|
echo $data['validation_errors']; |
|
183
|
|
|
exit; |
|
184
|
|
|
} else { |
|
185
|
|
|
$this->email_model->add_email($add_array); |
|
186
|
|
|
echo json_encode(array("SUCCESS"=> "Email list added successfully!")); |
|
187
|
|
|
exit; |
|
188
|
|
|
} |
|
189
|
|
|
} |
|
190
|
|
|
} |
|
191
|
|
|
function email_re_send($edit_data) { |
|
192
|
|
|
$this->email_lib->send_email('',$edit_data,'',$edit_data['attachment'],1); |
|
193
|
|
|
$this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!'); |
|
194
|
|
|
redirect(base_url() . '/email/email_history_list/'); |
|
195
|
|
|
} |
|
196
|
|
|
function email_view($edit_id = '') { |
|
197
|
|
|
$data['page_title'] = 'View Email'; |
|
|
|
|
|
|
198
|
|
|
$where = array('id' => $edit_id); |
|
199
|
|
|
$account = $this->db_model->getSelect("*", "mail_details", $where); |
|
200
|
|
|
if ($account->num_rows > 0) { |
|
201
|
|
|
foreach ($account->result_array() as $key => $value) { |
|
202
|
|
|
$edit_data = $value; |
|
203
|
|
|
} |
|
204
|
|
|
if($edit_data['status'] == 1){ |
|
205
|
|
|
$edit_data['status']='Not Sent'; |
|
|
|
|
|
|
206
|
|
|
} else{ |
|
207
|
|
|
$edit_data['status']='Sent'; |
|
208
|
|
|
} |
|
209
|
|
|
$data['form'] = $this->form->build_form($this->email_form->get_form_fields_email_view(), $edit_data); |
|
210
|
|
|
|
|
211
|
|
|
$this->load->view('view_email_add_edit', $data); |
|
212
|
|
|
} else { |
|
213
|
|
|
redirect(base_url() . 'email/email_history_list/'); |
|
214
|
|
|
} |
|
215
|
|
|
} |
|
216
|
|
|
function email_view_customer($edit_id = '') { |
|
217
|
|
|
$data['page_title'] = 'View Email'; |
|
|
|
|
|
|
218
|
|
|
$where = array('id' => $edit_id); |
|
219
|
|
|
$account = $this->db_model->getSelect("*", "mail_details", $where); |
|
220
|
|
View Code Duplication |
if ($account->num_rows > 0) { |
|
221
|
|
|
foreach ($account->result_array() as $key => $value) { |
|
222
|
|
|
$edit_data = $value; |
|
223
|
|
|
} |
|
224
|
|
|
$data['form'] = $this->form->build_form($this->email_form->get_form_fields_email_view_cus(), $edit_data); |
|
|
|
|
|
|
225
|
|
|
$this->load->view('view_email_add_edit', $data); |
|
226
|
|
|
} else { |
|
227
|
|
|
redirect(base_url() . 'email/email_history_list/'.$edit_id); |
|
228
|
|
|
} |
|
229
|
|
|
} |
|
230
|
|
|
function email_delete($id) { |
|
231
|
|
|
$this->email_model->remove_email($id); |
|
232
|
|
|
$this->session->set_flashdata('astpp_notification', 'Email removed successfully!'); |
|
233
|
|
|
redirect(base_url() . '/email/email_history_list/'); |
|
234
|
|
|
} |
|
235
|
|
|
function email_delete_customer($accounttype,$accountid,$id) { |
|
236
|
|
|
$this->email_model->remove_email($id); |
|
237
|
|
|
$where = array('id' => $id); |
|
238
|
|
|
$account = $this->db_model->getSelect("*", "mail_details", $where); |
|
239
|
|
|
foreach ($account->result_array() as $key => $value) { |
|
240
|
|
|
$edit_data = $value; |
|
241
|
|
|
} |
|
242
|
|
|
$url ="accounts/".$accounttype."_emailhistory/$accountid/"; |
|
243
|
|
|
$this->session->set_flashdata('astpp_notification', 'Email removed successfully!'); |
|
244
|
|
|
$this->load->module('accounts/accounts'); |
|
245
|
|
|
redirect(base_url() . $url); |
|
246
|
|
|
} |
|
247
|
|
|
function email_mass() { |
|
248
|
|
|
$account_data = $this->session->userdata("accountinfo"); |
|
249
|
|
|
if ($account_data['type'] == '1' || $account_data['type']== 0 || $account_data['type']==3) |
|
250
|
|
|
redirect(base_url() . '/astpp/dashboard/'); |
|
251
|
|
|
$data['username'] = $this->session->userdata('user_name'); |
|
|
|
|
|
|
252
|
|
|
$data['page_title'] = 'Email Mass'; |
|
253
|
|
|
$data['form'] = $this->form->build_form($this->email_form->build_list_for_email_client_area(), ''); |
|
254
|
|
|
$this->load->view('view_email_client_area',$data); |
|
255
|
|
|
} |
|
256
|
|
|
/*Mass Email*/ |
|
257
|
|
View Code Duplication |
function attachment_icons($select = "", $table = "", $attachement="") { |
|
|
|
|
|
|
258
|
|
|
if($attachement!="") |
|
259
|
|
|
{ |
|
260
|
|
|
$array=explode(",", $attachement); |
|
261
|
|
|
$str=''; |
|
262
|
|
|
foreach($array as $key =>$val){ |
|
263
|
|
|
$link = base_url() . "email/email_history_list_attachment/".$val; |
|
264
|
|
|
$str.="<a href='".$link."' title='".$val."' class='btn btn-royelblue btn-sm'><i class='fa fa-paperclip fa-fw'></i></a> "; |
|
265
|
|
|
} |
|
266
|
|
|
return $str; |
|
267
|
|
|
} else{ |
|
268
|
|
|
return ""; |
|
269
|
|
|
} |
|
270
|
|
|
} |
|
271
|
|
|
function email_client_get() |
|
272
|
|
|
{ |
|
273
|
|
|
$files=$_FILES; |
|
274
|
|
|
$add_array = $this->input->post(); |
|
275
|
|
|
$add_array['page_title'] = 'Compose email'; |
|
276
|
|
|
$nooffile= $files['file']['name']; |
|
277
|
|
|
$count=count($nooffile); |
|
278
|
|
|
$add_array['attachment']=''; |
|
279
|
|
|
$add_array['file']=''; |
|
280
|
|
|
for($i=0;$i<$count;$i++){ |
|
281
|
|
|
$tmp_name[]= $files['file']['tmp_name'][$i]; |
|
|
|
|
|
|
282
|
|
|
if($files['file']['error'][$i]==0){ |
|
283
|
|
|
$cur_name = $files['file']['name'][$i]; |
|
284
|
|
|
$parts = explode(".", $cur_name); |
|
285
|
|
|
$add_array['attachment'].=date('ymdhis').$i.'.'.$parts[1].','; |
|
286
|
|
|
$add_array['file'].=date('ymdhis').$i.'.'.$parts[1].','; |
|
287
|
|
|
$uploadedFile1 = $files['file']['tmp_name'][$i]; |
|
288
|
|
|
$user_name='inextrix'; |
|
289
|
|
|
$actual_file_name=date('ymdhis').$i.'.'.$parts[1]; |
|
290
|
|
|
$dir_path= getcwd()."/attachments/"; |
|
291
|
|
|
$path =$dir_path.$actual_file_name; |
|
292
|
|
|
if (move_uploaded_file($uploadedFile1,$path)) { |
|
293
|
|
|
$this->session->set_flashdata('astpp_errormsg', 'files added successfully!'); |
|
294
|
|
|
} |
|
295
|
|
|
else{ |
|
296
|
|
|
$this->session->set_flashdata('astpp_errormsg', 'Please try again !'); |
|
297
|
|
|
} |
|
298
|
|
|
} |
|
299
|
|
|
} |
|
300
|
|
|
$add_array['attachment']=trim($add_array['attachment'],','); |
|
301
|
|
|
$add_array['file']=trim($add_array['file'],','); |
|
302
|
|
|
$add_array['email']= explode(",",$add_array['to']); |
|
303
|
|
|
$this->email_model->multipal_email($add_array); |
|
304
|
|
|
$screen_path = getcwd()."/cron"; |
|
305
|
|
|
$screen_filename = "Email_Broadcast_".strtotime('now'); |
|
306
|
|
|
$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
|
307
|
|
|
exec($command); |
|
308
|
|
|
$this->session->set_flashdata('astpp_errormsg', 'Email broad cast successfully!'); |
|
309
|
|
|
redirect(base_url() . 'email/email_history_list/'); |
|
310
|
|
|
exit; |
|
311
|
|
|
} |
|
312
|
|
|
|
|
313
|
|
|
function email_client_area() { |
|
314
|
|
|
$add_array = $this->input->post(); |
|
315
|
|
|
if($add_array['temp'] == ''){ |
|
316
|
|
|
$subject = ''; |
|
317
|
|
|
$body =''; |
|
318
|
|
|
} |
|
319
|
|
|
else{ |
|
320
|
|
|
$where = array('id' => $add_array['temp']); |
|
321
|
|
|
$account = $this->db_model->getSelect("subject,template", "default_templates", $where); |
|
322
|
|
|
$account_data =$account->result_array(); |
|
323
|
|
|
$subject = isset($account_data[0]['subject'])?$account_data[0]['subject']:''; |
|
324
|
|
|
$body = isset($account_data[0]['template'])?$account_data[0]['template']:''; |
|
325
|
|
|
|
|
326
|
|
|
|
|
327
|
|
|
} |
|
328
|
|
|
$count_all = $this->email_model->get_email_client_data($add_array); |
|
329
|
|
|
$email_arr = array(); |
|
330
|
|
|
$id_arr = array(); |
|
331
|
|
|
foreach($count_all as $key=>$value){ |
|
332
|
|
|
$value = $value; |
|
|
|
|
|
|
333
|
|
|
if($value['email']!=''){ |
|
334
|
|
|
$email_arr[$value['email']]= $value['email']; |
|
335
|
|
|
$id_arr[]= $value['id'];} |
|
336
|
|
|
} |
|
337
|
|
|
if (empty($email_arr)) |
|
338
|
|
|
{ |
|
339
|
|
|
$this->session->set_flashdata('astpp_notification', 'No record found! '); |
|
340
|
|
|
redirect(base_url() . 'email/email_mass/'); |
|
341
|
|
|
} |
|
342
|
|
|
$to_email = $email_arr; |
|
343
|
|
|
|
|
344
|
|
|
$to_id = $id_arr; |
|
345
|
|
|
$to_send_mail = implode(",",$to_email); |
|
346
|
|
|
if($to_send_mail != ''){ |
|
347
|
|
|
$add_arr['email']= $email_arr; |
|
|
|
|
|
|
348
|
|
|
} |
|
349
|
|
|
$data['username'] = $this->session->userdata('user_name'); |
|
|
|
|
|
|
350
|
|
|
$data['page_title'] = 'Compose Email'; |
|
351
|
|
|
$send_id = $this->db_model->getSelect("emailaddress", "invoice_conf", array()); |
|
352
|
|
|
$send_id =$send_id->result_array(); |
|
353
|
|
|
$send_id =$send_id[0]['emailaddress']; |
|
354
|
|
|
$add_arr['template'] = $body; |
|
|
|
|
|
|
355
|
|
|
$add_arr['subject'] = $subject; |
|
356
|
|
|
$add_arr['accountid'] = $id_arr; |
|
357
|
|
|
$add_arr['from'] = $send_id; |
|
358
|
|
|
$add_arr['temp'] = $add_array['temp']; |
|
359
|
|
|
$add_arr['to']=$to_send_mail; |
|
360
|
|
|
$add_arr['temp']=$add_array['temp']; |
|
361
|
|
|
$this->load->view('view_email_brod', $add_arr); |
|
362
|
|
|
} |
|
363
|
|
|
|
|
364
|
|
|
/********************************************************/ |
|
365
|
|
|
function email_history_list_customer() { |
|
366
|
|
|
$add_array = $this->input->post(); |
|
367
|
|
|
$where = array('id' => $add_array['id']); |
|
368
|
|
|
$account = $this->db_model->getSelect("*", "mail_details", $where); |
|
369
|
|
|
foreach ($account->result_array() as $key => $value) { |
|
370
|
|
|
$edit_data = $value; |
|
371
|
|
|
} |
|
372
|
|
|
$this->load->module('accounts/accounts'); |
|
373
|
|
|
redirect(base_url() . 'accounts/customer_edit/'.$value['accountid']); |
|
|
|
|
|
|
374
|
|
|
} |
|
375
|
|
|
function email_history_list() { |
|
376
|
|
|
$data['logintype']=$this->session->userdata('logintype'); |
|
|
|
|
|
|
377
|
|
|
$data['username'] = $this->session->userdata('user_name'); |
|
378
|
|
|
$data['search_flag'] = true; |
|
379
|
|
|
$this->session->set_userdata('advance_search', 0); |
|
380
|
|
|
$data['page_title'] = 'Email History List'; |
|
381
|
|
|
$data['grid_fields'] = $this->email_form->build_list_for_email(); |
|
382
|
|
|
$data["grid_buttons"] = $this->email_form->build_grid_buttons_email(); |
|
383
|
|
|
$data['form_search'] = $this->form->build_serach_form($this->email_form->get_email_history_search_form()); |
|
384
|
|
|
$this->load->view('view_email_list', $data); |
|
385
|
|
|
} |
|
386
|
|
View Code Duplication |
function email_history_list_json() { |
|
387
|
|
|
$data['logintype']=$this->session->userdata('logintype'); |
|
|
|
|
|
|
388
|
|
|
$json_data = array(); |
|
389
|
|
|
$count_all = $this->email_model->get_email_list(false); |
|
390
|
|
|
$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
391
|
|
|
$json_data = $paging_data["json_paging"]; |
|
392
|
|
|
$query = $this->email_model->get_email_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
393
|
|
|
$grid_fields = json_decode($this->email_form->build_list_for_email()); |
|
394
|
|
|
$json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
395
|
|
|
echo json_encode($json_data); |
|
396
|
|
|
} |
|
397
|
|
|
|
|
398
|
|
View Code Duplication |
function customer_mail_record($accountid,$accounttype){ |
|
399
|
|
|
$json_data = array(); |
|
400
|
|
|
$count_all = $this->email_model->customer_get_email_list(false,$accountid,"",""); |
|
401
|
|
|
$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
402
|
|
|
$json_data = $paging_data["json_paging"]; |
|
403
|
|
|
$query = $this->email_model->customer_get_email_list(true,$accountid,$paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
404
|
|
|
$grid_fields = json_decode($this->email_form->build_list_for_email_customer($accountid,$accounttype)); |
|
405
|
|
|
$json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
406
|
|
|
echo json_encode($json_data); |
|
407
|
|
|
} |
|
408
|
|
|
function email_delete_multiple() { |
|
409
|
|
|
$ids = $this->input->post("selected_ids", true); |
|
410
|
|
|
$where = "id IN ($ids)"; |
|
411
|
|
|
$this->db->where($where); |
|
412
|
|
|
echo $this->db->delete("email"); |
|
413
|
|
|
} |
|
414
|
|
|
|
|
415
|
|
|
function email_send_multipal(){ |
|
416
|
|
|
$add_array = $this->input->post(); |
|
417
|
|
|
if($add_array['email'] == '' || $add_array['subject'] == '' || $add_array['template'] == ''){ |
|
418
|
|
|
$this->session->set_flashdata('astpp_notification', 'Email address not found!'); |
|
419
|
|
|
redirect(base_url() . '/email/email_client_area/'); |
|
420
|
|
|
} |
|
421
|
|
|
$this->email_model->multipal_email($add_array); |
|
422
|
|
|
$screen_path = "/var/www/html/ITPLATP/cron"; |
|
423
|
|
|
$screen_filename = "Email_Broadcast_".strtotime('now'); |
|
424
|
|
|
$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
|
425
|
|
|
exec($command); |
|
426
|
|
|
$this->session->set_flashdata('astpp_errormsg', 'Email broad cast successfully!'); |
|
427
|
|
|
redirect(base_url() . 'email/email_history_list/'); |
|
428
|
|
|
|
|
429
|
|
|
} |
|
430
|
|
View Code Duplication |
function email_history_list_search() { |
|
431
|
|
|
$ajax_search = $this->input->post('ajax_search', 0); |
|
432
|
|
|
|
|
433
|
|
|
if ($this->input->post('advance_search', TRUE) == 1) { |
|
434
|
|
|
$this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
435
|
|
|
$action = $this->input->post(); |
|
436
|
|
|
unset($action['action']); |
|
437
|
|
|
unset($action['advance_search']); |
|
438
|
|
|
$this->session->set_userdata('email_search_list', $action); |
|
439
|
|
|
} |
|
440
|
|
|
if (@$ajax_search != 1) { |
|
441
|
|
|
redirect(base_url() . 'email/email_history_list/'); |
|
442
|
|
|
} |
|
443
|
|
|
} |
|
444
|
|
|
|
|
445
|
|
|
function email_history_list_clearsearchfilter() { |
|
446
|
|
|
$this->session->set_userdata('advance_search', 0); |
|
447
|
|
|
$this->session->set_userdata('email_search', ""); |
|
448
|
|
|
} |
|
449
|
|
|
/* |
|
450
|
|
|
* Purpose : Add following code for download attached file |
|
451
|
|
|
* Version 2.1 |
|
452
|
|
|
*/ |
|
453
|
|
|
function email_history_list_attachment($file_name) { |
|
454
|
|
|
if(file_exists(getcwd().'/attachments/'.$file_name)){ |
|
455
|
|
|
header('Content-Type: application/octet-stream'); |
|
456
|
|
|
header('Content-Disposition: attachment; filename='.$file_name); |
|
457
|
|
|
ob_clean(); |
|
458
|
|
|
flush(); |
|
459
|
|
|
readfile(getcwd().'/attachments/'.$file_name); |
|
460
|
|
|
} |
|
461
|
|
|
} |
|
462
|
|
|
|
|
463
|
|
|
} |
|
464
|
|
|
?> |
|
|
|
|
|
|
465
|
|
|
|
|
466
|
|
|
|
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.