|
1
|
|
|
<?php |
|
2
|
|
|
############################################################################### |
|
3
|
|
|
# ASTPP - Open Source VoIP Billing Solution |
|
4
|
|
|
# |
|
5
|
|
|
# Copyright (C) 2016 iNextrix Technologies Pvt. Ltd. |
|
6
|
|
|
# Samir Doshi <[email protected]> |
|
7
|
|
|
# ASTPP Version 3.0 and above |
|
8
|
|
|
# License https://www.gnu.org/licenses/agpl-3.0.html |
|
9
|
|
|
# |
|
10
|
|
|
# This program is free software: you can redistribute it and/or modify |
|
11
|
|
|
# it under the terms of the GNU Affero General Public License as |
|
12
|
|
|
# published by the Free Software Foundation, either version 3 of the |
|
13
|
|
|
# License, or (at your option) any later version. |
|
14
|
|
|
# |
|
15
|
|
|
# This program is distributed in the hope that it will be useful, |
|
16
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18
|
|
|
# GNU Affero General Public License for more details. |
|
19
|
|
|
# |
|
20
|
|
|
# You should have received a copy of the GNU Affero General Public License |
|
21
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
22
|
|
|
############################################################################### |
|
23
|
|
|
|
|
24
|
|
|
if ( ! defined('BASEPATH')) |
|
25
|
|
|
exit('No direct script access allowed'); |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Dynamically build forms for display |
|
29
|
|
|
*/ |
|
30
|
|
|
class Form { |
|
31
|
|
|
|
|
32
|
|
|
protected $CI; // codeigniter |
|
33
|
|
|
protected $fields = array(); // array of fields |
|
34
|
|
|
protected $form_title = 'Form'; |
|
35
|
|
|
protected $form_id = 'form'; |
|
36
|
|
|
protected $form_action = ''; |
|
37
|
|
|
protected $form_class = ''; |
|
38
|
|
|
protected $hidden = array(); |
|
39
|
|
|
protected $multipart = FALSE; // default to standard form |
|
40
|
|
|
protected $submit_button = 'Submit'; |
|
41
|
|
|
protected $after_button = ''; |
|
42
|
|
|
protected $rules = array(); // storage for validation rules |
|
43
|
|
|
|
|
44
|
|
View Code Duplication |
function __construct() { |
|
45
|
|
|
$this->CI = & get_instance(); |
|
46
|
|
|
$this->CI->load->library('form_validation'); |
|
|
|
|
|
|
47
|
|
|
$this->CI->load->library('astpp/common'); |
|
48
|
|
|
$this->CI->load->model('db_model'); |
|
49
|
|
|
$this->check_permissions(); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
// __construct |
|
53
|
|
|
/** |
|
54
|
|
|
* adds raw html to the field array |
|
55
|
|
|
*/ |
|
56
|
|
|
function check_permissions() { |
|
57
|
|
|
if ($this->CI->session->userdata('user_login') == TRUE) { |
|
58
|
|
|
$module_info = unserialize($this->CI->session->userdata("permited_modules")); |
|
|
|
|
|
|
59
|
|
|
if ($this->CI->session->userdata('userlevel_logintype') != 0 && $this->CI->session->userdata('userlevel_logintype') != 3) { |
|
60
|
|
|
$module_info[] = 'dashboard'; |
|
61
|
|
|
} |
|
62
|
|
|
$url = $this->CI->uri->uri_string; |
|
|
|
|
|
|
63
|
|
|
$file_name = explode("/", $url); |
|
64
|
|
|
if (isset($file_name['1'])) { |
|
65
|
|
|
$module = explode('_', $file_name['1']); |
|
66
|
|
|
} else { |
|
67
|
|
|
$module = $file_name; |
|
68
|
|
|
} |
|
69
|
|
|
if ($this->CI->session->userdata('userlevel_logintype') == 1) { |
|
70
|
|
|
$module_info[] = 'user'; |
|
71
|
|
|
} |
|
72
|
|
|
if (in_array($module[0], $module_info)) { |
|
73
|
|
|
if ($this->CI->session->userdata('userlevel_logintype') == 0 && $module[0] == 'customer' && isset($file_name[1]) && $file_name[1] != 'customer_transfer') { |
|
74
|
|
|
redirect(base_url().'user/user/'); |
|
75
|
|
|
} else { |
|
76
|
|
|
return true; |
|
77
|
|
|
} |
|
78
|
|
|
} else { |
|
79
|
|
|
$this->CI->session->set_userdata('astpp_errormsg', 'You do not have permission to access this module..!'); |
|
80
|
|
|
if ($this->CI->session->userdata('userlevel_logintype') == '-1' || $this->CI->session->userdata('logintype') == '1') { |
|
81
|
|
|
redirect(base_url().'dashboard/'); |
|
82
|
|
|
} else { |
|
83
|
|
|
redirect(base_url().'user/user/'); |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
} else { |
|
87
|
|
|
redirect(base_url()); |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
function build_form($fields_array, $values) { |
|
92
|
|
|
$form_contents = ''; |
|
93
|
|
|
$form_contents .= '<div class="pop_md col-md-12 margin-t-10 padding-x-8">'; |
|
94
|
|
|
if (isset($fields_array['breadcrumb'])) { |
|
95
|
|
|
$form_contents .= form_breadcrumb($fields_array['breadcrumb']); |
|
96
|
|
|
unset($fields_array['breadcrumb']); |
|
97
|
|
|
} |
|
98
|
|
|
$form_contents .= form_open($fields_array['forms'][0], $fields_array['forms'][1]); |
|
99
|
|
|
unset($fields_array['forms']); |
|
100
|
|
|
$button_array = array(); |
|
101
|
|
|
if (isset($fields_array['button_save']) || isset($fields_array['button_cancel']) || isset($fields_array['additional_button'])) { |
|
102
|
|
|
$save = $fields_array['button_save']; |
|
103
|
|
|
unset($fields_array['button_save']); |
|
104
|
|
|
if (isset($fields_array['button_cancel'])) { |
|
105
|
|
|
$cancel = $fields_array['button_cancel']; |
|
106
|
|
|
unset($fields_array['button_cancel']); |
|
107
|
|
|
} |
|
108
|
|
|
if (isset($fields_array['additional_button'])) { |
|
109
|
|
|
$additiopnal_button = $fields_array['additional_button']; |
|
110
|
|
|
unset($fields_array['additional_button']); |
|
111
|
|
|
} |
|
112
|
|
|
} |
|
113
|
|
|
if (isset($additiopnal_button)) { |
|
114
|
|
|
$form_contents .= form_button(gettext($additiopnal_button)); |
|
115
|
|
|
} |
|
116
|
|
|
$i = 0; |
|
117
|
|
|
foreach ($fields_array as $fieldset_key => $form_fileds) { |
|
118
|
|
|
if (count($fields_array) > 1) { |
|
119
|
|
|
if ($i == 1 || $i == 3) { |
|
120
|
|
|
$form_contents .= '<div class="col-md-6 no-padding pull-right">'; |
|
121
|
|
|
$form_contents .= '<div class="col-md-12 padding-x-4">'; |
|
122
|
|
|
} else { |
|
123
|
|
|
$form_contents .= '<div class="col-md-6 no-padding">'; |
|
124
|
|
|
$form_contents .= '<div class="col-md-12 padding-x-4">'; |
|
125
|
|
|
} |
|
126
|
|
|
} else { |
|
127
|
|
|
$form_contents .= '<div class="col-md-12 no-padding">'; |
|
128
|
|
|
$form_contents .= '<div class="col-md-12 no-padding">'; |
|
129
|
|
|
} |
|
130
|
|
|
$form_contents .= '<ul class="no-padding">'; |
|
131
|
|
|
$form_contents .= '<div class="col-md-12 no-padding">'; |
|
132
|
|
|
if ($i == 1 || $i == 3) { |
|
133
|
|
|
$form_contents .= form_fieldset(gettext($fieldset_key)); |
|
134
|
|
|
} else { |
|
135
|
|
|
$form_contents .= form_fieldset(gettext($fieldset_key)); |
|
136
|
|
|
} |
|
137
|
|
|
foreach ($form_fileds as $fieldkey => $fieldvalue) { |
|
138
|
|
|
$form_contents .= '<li class="col-md-12">'; |
|
139
|
|
|
if ($fieldvalue[1] == 'HIDDEN') { |
|
140
|
|
View Code Duplication |
if (isset($this->CI->input->post)) |
|
141
|
|
|
$fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
|
|
|
|
|
142
|
|
|
else |
|
143
|
|
|
$fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : ''); |
|
144
|
|
|
$form_contents .= form_hidden($fieldvalue[2]['name'], $fieldvalue[2]['value']); |
|
145
|
|
|
} else { |
|
146
|
|
|
$validation_arr = array(); |
|
147
|
|
|
if ($fieldvalue[1] == 'INPUT') { |
|
148
|
|
|
if ( ! empty($fieldvalue[3])) { |
|
149
|
|
|
$validation_arr = explode("|", $fieldvalue[3]); |
|
150
|
|
|
} |
|
151
|
|
|
} |
|
152
|
|
|
elseif ($fieldvalue[2] == 'SELECT') { |
|
153
|
|
|
|
|
154
|
|
|
if (is_array($fieldvalue[4])) { |
|
155
|
|
|
$validation_arr = explode("|", $fieldvalue[4]['rules']); |
|
156
|
|
|
} else { |
|
157
|
|
|
$validation_arr = explode("|", $fieldvalue[4]); |
|
158
|
|
|
} |
|
159
|
|
|
} |
|
160
|
|
|
if ( ! empty($validation_arr)) { |
|
161
|
|
|
$fieldvalue[0] = in_array('required', $validation_arr) ? $fieldvalue[0]."<span style='color:black;'> *</span>" : $fieldvalue[0]; |
|
162
|
|
|
$fieldvalue[0] = in_array('dropdown', $validation_arr) ? $fieldvalue[0]."<span style='color:black;'> *</span>" : $fieldvalue[0]; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
if (is_array($fieldvalue[1]) || (is_array($fieldvalue[2]) && isset($fieldvalue[2]['hidden']))) { |
|
166
|
|
|
$form_contents .= form_label(gettext($fieldvalue[0]), $fieldvalue[0], array('class' => 'col-md-3 no-padding add_settings')); |
|
167
|
|
|
} else { |
|
168
|
|
|
$form_contents .= form_label(gettext($fieldvalue[0]), "", array("class" => "col-md-3 no-padding")); |
|
169
|
|
|
} |
|
170
|
|
|
} |
|
171
|
|
|
if ($fieldvalue[2] == 'SELECT' && ! isset($fieldvalue[13])) { |
|
172
|
|
|
|
|
173
|
|
|
/* |
|
174
|
|
|
To make Drop down enabled disabled |
|
175
|
|
|
*/ |
|
176
|
|
|
$extra = isset($fieldvalue[1]['extra']) ? $fieldvalue[1]['extra'] : ''; |
|
177
|
|
|
/***************************/ |
|
178
|
|
|
if ($fieldvalue[7] != '' && $fieldvalue[8] != '') { |
|
179
|
|
|
$str = $fieldvalue[7].",".$fieldvalue[8]; |
|
180
|
|
|
|
|
181
|
|
View Code Duplication |
if (isset($this->CI->input->post)) { |
|
182
|
|
|
$fieldvalue['value'] = ( ! $this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
183
|
|
|
} else { |
|
184
|
|
|
if (is_array($fieldvalue[1])) { |
|
185
|
|
|
$fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]['name']] : @$fieldvalue[1]; |
|
186
|
|
|
} else { |
|
187
|
|
|
$fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
188
|
|
|
} |
|
189
|
|
|
} |
|
190
|
|
|
$drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
|
|
|
|
|
|
191
|
|
|
|
|
192
|
|
|
if ($fieldset_key == gettext('System Configuration Information') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Force Trunk') || ($fieldset_key == 'Card Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Account') || $fieldset_key == 'Freeswitch Devices' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Origination Rate Add/Edit' && $fieldvalue[0] == 'Trunks' )||$fieldset_key== 'Billing Information' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #1') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #2') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Sip Profile') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Account')) { |
|
193
|
|
|
$form_contents.=form_dropdown_all($fieldvalue[1], $drp_array, $fieldvalue['value'],$extra); |
|
194
|
|
|
} else { |
|
195
|
|
|
$form_contents.=form_dropdown($fieldvalue[1], $drp_array, $fieldvalue['value'], $extra); |
|
196
|
|
|
} |
|
197
|
|
|
if(isset($fieldvalue[4]) && $fieldvalue[4] != ''){ |
|
198
|
|
|
if(is_array($fieldvalue[4])){ |
|
199
|
|
|
|
|
200
|
|
View Code Duplication |
if(isset($fieldvalue[1]['name'])){ |
|
201
|
|
|
$fieldvalue_pass=$fieldvalue[1]['name']; |
|
202
|
|
|
}else{ |
|
203
|
|
|
$fieldvalue_pass=$fieldvalue[1]; |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
$this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]['rules']); |
|
|
|
|
|
|
207
|
|
|
}else{ |
|
208
|
|
|
|
|
209
|
|
View Code Duplication |
if(isset($fieldvalue[1]['name'])){ |
|
210
|
|
|
$fieldvalue_pass=$fieldvalue[1]['name']; |
|
211
|
|
|
}else{ |
|
212
|
|
|
$fieldvalue_pass=$fieldvalue[1]; |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
$this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]); |
|
216
|
|
|
} |
|
217
|
|
|
} |
|
218
|
|
|
$form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1]).'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
219
|
|
|
$form_contents.= '<span class="popup_error error no-padding" id="'.(gettext(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1])).'_error"> |
|
220
|
|
|
</span></div>'; |
|
221
|
|
|
} else { |
|
222
|
|
View Code Duplication |
if (isset($this->CI->input->post)) { |
|
223
|
|
|
$fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
224
|
|
|
} else { |
|
225
|
|
|
if (is_array($fieldvalue[1])) { |
|
226
|
|
|
$fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]['name']] : @$fieldvalue[1]; |
|
227
|
|
|
} else { |
|
228
|
|
|
$fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
229
|
|
|
} |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
$str = $fieldvalue[7] . "," . $fieldvalue[8]; |
|
233
|
|
|
$drp_array = call_user_func_array(array($this->CI->common, $fieldvalue[10]), array($fieldvalue[9])); |
|
|
|
|
|
|
234
|
|
|
$form_contents.=form_dropdown($fieldvalue[1], $drp_array, $fieldvalue['value'],$extra); |
|
235
|
|
View Code Duplication |
if(isset($fieldvalue[4]) && $fieldvalue[4] != ''){ |
|
236
|
|
|
$this->CI->form_validation->set_rules($fieldvalue[1], $fieldvalue[0], $fieldvalue[4]); |
|
237
|
|
|
} |
|
238
|
|
|
$form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1]).'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
239
|
|
|
$form_contents.= '<span class="popup_error error no-padding" id="'.(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1]).'_error"> |
|
240
|
|
|
</span></div>'; |
|
241
|
|
|
} |
|
242
|
|
|
} else if (isset($fieldvalue[13]) && $fieldvalue[13] != '') { |
|
243
|
|
|
|
|
244
|
|
|
/* For multi select code */ |
|
245
|
|
|
$str = $fieldvalue[7] . "," . $fieldvalue[8]; |
|
246
|
|
|
|
|
247
|
|
|
if (isset($this->CI->input->post)) |
|
248
|
|
|
$fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
249
|
|
|
else |
|
250
|
|
|
$fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
251
|
|
|
|
|
252
|
|
|
$drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
|
253
|
|
|
if ($fieldset_key === 'System Configuration Information') { |
|
254
|
|
|
$form_contents.=form_dropdown_multiselect($fieldvalue[1], $drp_array, ''); |
|
|
|
|
|
|
255
|
|
|
} else { |
|
256
|
|
|
$form_contents.=form_dropdown_multiselect($fieldvalue[1] . "[]", $drp_array, $fieldvalue['value']); |
|
257
|
|
|
} |
|
258
|
|
View Code Duplication |
if(isset($fieldvalue[4]) && $fieldvalue[4] != ''){ |
|
259
|
|
|
$this->CI->form_validation->set_rules($fieldvalue[1], $fieldvalue[0], $fieldvalue[4]); |
|
260
|
|
|
} |
|
261
|
|
|
$form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[1].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
262
|
|
|
$form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[1].'_error"></span></div>'; |
|
263
|
|
|
/* End--------------------- For multi select code */ |
|
264
|
|
|
} else if ($fieldvalue[1] == 'INPUT') { |
|
265
|
|
|
|
|
266
|
|
|
|
|
267
|
|
View Code Duplication |
if (isset($this->CI->input->post)) |
|
268
|
|
|
$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
269
|
|
|
else{ |
|
270
|
|
|
$fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : ''):(isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] :''); |
|
271
|
|
|
} |
|
272
|
|
|
$form_contents.= form_input($fieldvalue[2], 'readonly'); |
|
273
|
|
|
if(isset($fieldvalue[6]) && !empty($fieldvalue[6])){ |
|
274
|
|
|
$form_contents.=$fieldvalue[6]; |
|
275
|
|
|
} |
|
276
|
|
|
$this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
|
277
|
|
|
$form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
278
|
|
|
$form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
279
|
|
|
</span></div>'; |
|
280
|
|
|
} |
|
281
|
|
|
/* |
|
282
|
|
|
* Image upload from invoice configuration code. |
|
283
|
|
|
*/ |
|
284
|
|
|
else if ($fieldvalue[1] == 'IMAGE') { |
|
285
|
|
View Code Duplication |
if (isset($this->CI->input->post)) |
|
286
|
|
|
$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
287
|
|
|
|
|
288
|
|
|
else |
|
289
|
|
|
$fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
290
|
|
|
$fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
|
291
|
|
|
$form_contents.= form_image($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
|
292
|
|
|
$form_contents.=@$fieldvalue[6]; |
|
293
|
|
|
$this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
|
294
|
|
|
$form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
295
|
|
|
$form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
296
|
|
|
</span></div>'; |
|
297
|
|
|
} |
|
298
|
|
|
else if ($fieldvalue[1] == 'DEL_BUTTON') { |
|
299
|
|
View Code Duplication |
if (isset($this->CI->input->post)) |
|
300
|
|
|
$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
301
|
|
|
|
|
302
|
|
|
else |
|
303
|
|
|
$fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
304
|
|
|
$fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
|
305
|
|
|
$form_contents.= form_img_delete($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
|
306
|
|
|
$form_contents.=@$fieldvalue[6]; |
|
307
|
|
|
$this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
|
308
|
|
|
$form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
309
|
|
|
$form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
310
|
|
|
</span></div>'; |
|
311
|
|
|
} |
|
312
|
|
|
/**********************************************************************************/ |
|
313
|
|
|
else if ($fieldvalue[1] == 'PASSWORD') { |
|
314
|
|
View Code Duplication |
if (isset($this->CI->input->post)) |
|
315
|
|
|
$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
316
|
|
|
else |
|
317
|
|
|
$fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
318
|
|
|
$form_contents.= form_password($fieldvalue[2]); |
|
319
|
|
|
$this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
|
320
|
|
|
$form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
321
|
|
|
$form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
322
|
|
|
</span></div>'; |
|
323
|
|
|
} else if ($fieldvalue[2] == 'CHECKBOX') { |
|
324
|
|
|
$OptionArray = array(); |
|
325
|
|
|
|
|
326
|
|
|
if(isset($fieldvalue[7]) && $fieldvalue[7] != '') |
|
327
|
|
|
$OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6])); |
|
328
|
|
View Code Duplication |
if (isset($this->CI->input->post)){ |
|
329
|
|
|
$fieldvalue[3]['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[3]['value'] : $this->CI->input->post($fieldvalue[1]); |
|
330
|
|
|
} |
|
331
|
|
|
else |
|
332
|
|
|
{ |
|
333
|
|
|
$fieldvalue[3]['value'] = ($values) ? (isset($values[$fieldvalue[1]]) && $values[$fieldvalue[1]] ? 1: 0) : @$fieldvalue[3]['value']; |
|
334
|
|
|
} |
|
335
|
|
|
if ($fieldvalue[3]['value'] == "1") { |
|
336
|
|
|
$checked = true; |
|
337
|
|
|
} else { |
|
338
|
|
|
$checked = false; |
|
339
|
|
|
}; |
|
340
|
|
|
if(isset($fieldvalue[3]['table_name']) && $fieldvalue[3]['table_name'] != ""){ |
|
341
|
|
|
|
|
342
|
|
|
$form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked , $OptionArray); |
|
343
|
|
|
}else{ |
|
344
|
|
|
$form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked ,$OptionArray); |
|
345
|
|
|
} |
|
346
|
|
|
} else if ($fieldvalue[1] == 'TEXTAREA') { |
|
347
|
|
|
|
|
348
|
|
View Code Duplication |
if (isset($this->CI->input->post)) |
|
349
|
|
|
$fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
350
|
|
|
else |
|
351
|
|
|
$fieldvalue[2]['value'] = ($values) ? $values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
352
|
|
|
$form_contents.= form_textarea($fieldvalue[2]); |
|
353
|
|
|
} |
|
354
|
|
|
else if ($fieldvalue[2] == 'RADIO') { |
|
355
|
|
|
|
|
356
|
|
|
$form_contents.= form_radio($fieldvalue[1], $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
|
357
|
|
|
} |
|
358
|
|
|
$form_contents.= '</li>'; |
|
359
|
|
|
} |
|
360
|
|
|
|
|
361
|
|
|
$form_contents.= '</ul>'; |
|
362
|
|
|
$form_contents.= '</div>'; |
|
363
|
|
|
$form_contents.= '</div>'; |
|
364
|
|
|
$i++; |
|
365
|
|
|
} |
|
366
|
|
|
|
|
367
|
|
|
$form_contents.= '<center><div class="col-md-12 margin-t-20 margin-b-20">'; |
|
368
|
|
|
|
|
369
|
|
|
$form_contents.= form_button($save); |
|
|
|
|
|
|
370
|
|
|
|
|
371
|
|
|
if (isset($cancel)) { |
|
372
|
|
|
$form_contents.= form_button($cancel); |
|
373
|
|
|
} |
|
374
|
|
|
$form_contents.= '</center></div>'; |
|
375
|
|
|
$form_contents.= form_fieldset_close(); |
|
376
|
|
|
$form_contents.= form_close(); |
|
377
|
|
|
$form_contents.= '</div>'; |
|
378
|
|
|
|
|
379
|
|
|
|
|
380
|
|
|
return $form_contents; |
|
381
|
|
|
} |
|
382
|
|
|
|
|
383
|
|
|
function build_serach_form($fields_array) { |
|
384
|
|
|
$form_contents = ''; |
|
385
|
|
|
$form_contents.= '<div>'; |
|
386
|
|
|
$form_contents.= form_open($fields_array['forms'][0], $fields_array['forms'][1]); |
|
387
|
|
|
unset($fields_array['forms']); |
|
388
|
|
|
$button_array = array(); |
|
389
|
|
|
/******* |
|
390
|
|
|
Batch Delete |
|
391
|
|
|
*******/ |
|
392
|
|
|
if (isset($fields_array['button_search']) || isset($fields_array['button_reset']) || isset($fields_array['button_search_delete']) || isset($fields_array['display_in'])) { |
|
393
|
|
|
$save = $fields_array['button_search']; |
|
394
|
|
|
unset($fields_array['button_search']); |
|
395
|
|
|
if ($fields_array['button_reset']) { |
|
396
|
|
|
$cancel = $fields_array['button_reset']; |
|
397
|
|
|
unset($fields_array['button_reset']); |
|
398
|
|
|
} |
|
399
|
|
|
$button_search_delete=''; |
|
400
|
|
|
if (isset($fields_array['button_search_delete'])) { |
|
401
|
|
|
$button_search_delete = $fields_array['button_search_delete']; |
|
402
|
|
|
unset($fields_array['button_search_delete']); |
|
403
|
|
|
} |
|
404
|
|
|
if(isset($fields_array['display_in'])){ |
|
405
|
|
|
$display_in=$fields_array['display_in']; |
|
406
|
|
|
unset($fields_array['display_in']); |
|
407
|
|
|
} |
|
408
|
|
|
} |
|
409
|
|
|
/**************************/ |
|
410
|
|
|
$i = 1; |
|
411
|
|
|
foreach ($fields_array as $fieldset_key => $form_fileds) { |
|
412
|
|
|
|
|
413
|
|
|
$form_contents.= '<ul class="padding-15">'; |
|
414
|
|
|
$form_contents.= form_fieldset(gettext($fieldset_key),array('style' => 'font-weight:bold;'),"search"); |
|
|
|
|
|
|
415
|
|
|
|
|
416
|
|
|
foreach ($form_fileds as $fieldkey => $fieldvalue) { |
|
417
|
|
|
if ($i == 0) { |
|
418
|
|
|
$form_contents.= '<li class="col-md-12">'; |
|
419
|
|
|
} |
|
420
|
|
|
$form_contents.= '<div class="col-md-3 no-padding">'; |
|
421
|
|
View Code Duplication |
if ($fieldvalue[1] == 'HIDDEN') { |
|
422
|
|
|
$form_contents.= form_hidden($fieldvalue[2], $fieldvalue[3]); |
|
423
|
|
|
} else { |
|
424
|
|
|
$form_contents.= form_label(gettext($fieldvalue[0]), "", array("class" => "search_label col-md-12 no-padding")); |
|
425
|
|
|
} |
|
426
|
|
|
if ($fieldvalue[1] == 'INPUT') { |
|
427
|
|
|
$form_contents.= form_input($fieldvalue[2]); |
|
428
|
|
|
} |
|
429
|
|
|
|
|
430
|
|
|
|
|
431
|
|
|
if ($fieldvalue[2] == 'SELECT' || $fieldvalue[5] == '1') { |
|
432
|
|
|
|
|
433
|
|
|
if ($fieldvalue[7] != '' && $fieldvalue[8] != '') { |
|
434
|
|
|
$str = $fieldvalue[7] . "," . $fieldvalue[8]; |
|
435
|
|
|
|
|
436
|
|
|
$drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
|
|
|
|
|
|
437
|
|
|
$form_contents.=form_dropdown_all(gettext($fieldvalue[1]), $drp_array, ''); |
|
|
|
|
|
|
438
|
|
|
} else { |
|
439
|
|
|
|
|
440
|
|
|
if ($fieldvalue[1] == 'INPUT') { |
|
441
|
|
|
$fieldvalue[1] = $fieldvalue[6]; |
|
442
|
|
|
} |
|
443
|
|
|
|
|
444
|
|
|
$drp_array = call_user_func_array(array($this->CI->common, $fieldvalue[10]), array($fieldvalue[9])); |
|
|
|
|
|
|
445
|
|
|
$form_contents.=form_dropdown_all_search(gettext($fieldvalue[1]), $drp_array, ''); |
|
|
|
|
|
|
446
|
|
|
} |
|
447
|
|
View Code Duplication |
} else if ($fieldvalue[1] == 'PASSWORD') { |
|
448
|
|
|
$form_contents.= form_password($fieldvalue[2]); |
|
449
|
|
|
} else if ($fieldvalue[2] == 'CHECKBOX') { |
|
450
|
|
|
$form_contents.= form_checkbox(gettext($fieldvalue[1]), $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
|
451
|
|
|
} |
|
452
|
|
|
$form_contents.= '</div>'; |
|
453
|
|
|
if ($i % 5 == 0) { |
|
454
|
|
|
$form_contents.= '</li>'; |
|
455
|
|
|
$i = 0; |
|
456
|
|
|
} |
|
457
|
|
|
$i++; |
|
458
|
|
|
} |
|
459
|
|
|
} |
|
460
|
|
|
$form_contents.= '<div class="col-md-12 margin-t-20 margin-b-20">'; |
|
461
|
|
|
$form_contents.= form_button($cancel); |
|
|
|
|
|
|
462
|
|
|
$form_contents.= form_button($save); |
|
|
|
|
|
|
463
|
|
|
if(!empty($display_in)){ |
|
464
|
|
|
$form_contents.="<div class='col-md-5 pull-right'>"; |
|
465
|
|
|
$form_contents.="<div class='col-md-3'></div>"; |
|
466
|
|
|
$extra_parameters['class']=$display_in['label_class']; |
|
|
|
|
|
|
467
|
|
|
$extra_parameters['style']=$display_in['label_style']; |
|
468
|
|
|
$form_contents.=form_label($display_in['content'], "",$extra_parameters); |
|
469
|
|
|
$drp_array = call_user_func_array(array($this->CI->common,$display_in['function']),array()); |
|
470
|
|
|
$extra_parameters['class']=$display_in['dropdown_class']; |
|
471
|
|
|
$extra_parameters['style']=$display_in['dropdown_style']; |
|
472
|
|
|
$form_contents.=form_dropdown_all_search($display_in, $drp_array, '',$extra_parameters); |
|
|
|
|
|
|
473
|
|
|
$form_contents.="</div>"; |
|
474
|
|
|
} |
|
475
|
|
|
if(isset($button_search_delete) && $button_search_delete != ''){ |
|
476
|
|
|
$form_contents.= form_button($button_search_delete); |
|
477
|
|
|
} |
|
478
|
|
|
$form_contents.='<div class="col-md-12 no-padding margin-t-15" style=""> |
|
479
|
|
|
<div class="pull-right btn-close" id="global_clearsearch_filter">Close</div> |
|
480
|
|
|
</div>'; |
|
481
|
|
|
$form_contents.= '</ul>'; |
|
482
|
|
|
$form_contents.= '</div>'; |
|
483
|
|
|
$form_contents.= form_fieldset_close(); |
|
484
|
|
|
$form_contents.= form_close(); |
|
485
|
|
|
$form_contents.= '</div>'; |
|
486
|
|
|
|
|
487
|
|
|
return $form_contents; |
|
488
|
|
|
} |
|
489
|
|
|
function build_batchupdate_form($fields_array) { |
|
490
|
|
|
$form_contents = ''; |
|
491
|
|
|
$form_contents.= '<div >'; |
|
492
|
|
|
$form_contents.= form_open($fields_array['forms'][0], $fields_array['forms'][1]); |
|
493
|
|
|
unset($fields_array['forms']); |
|
494
|
|
|
$button_array = array(); |
|
495
|
|
|
if (isset($fields_array['button_search']) || isset($fields_array['button_reset'])) { |
|
496
|
|
|
$save = $fields_array['button_search']; |
|
497
|
|
|
unset($fields_array['button_search']); |
|
498
|
|
|
if ($fields_array['button_reset']) { |
|
499
|
|
|
$cancel = $fields_array['button_reset']; |
|
500
|
|
|
unset($fields_array['button_reset']); |
|
501
|
|
|
} |
|
502
|
|
|
} |
|
503
|
|
|
$i = 1; |
|
504
|
|
|
foreach ($fields_array as $fieldset_key => $form_fileds) { |
|
505
|
|
|
|
|
506
|
|
|
$form_contents.= '<ul>'; |
|
507
|
|
|
$form_contents.= form_fieldset(gettext($fieldset_key), array('style' => 'margin-left:-22px;font-weight:bold;')); |
|
508
|
|
|
foreach ($form_fileds as $fieldkey => $fieldvalue) { |
|
509
|
|
|
if ($i == 0) { |
|
510
|
|
|
$form_contents.= '<li>'; |
|
511
|
|
|
} |
|
512
|
|
|
$form_contents.= '<div class="col-md-4 no-padding">'; |
|
513
|
|
View Code Duplication |
if ($fieldvalue[1] == 'HIDDEN') { |
|
514
|
|
|
$form_contents.= form_hidden($fieldvalue[2], $fieldvalue[3]); |
|
515
|
|
|
} else { |
|
516
|
|
|
$form_contents.= form_label(gettext($fieldvalue[0]), "", array("class" => "search_label col-md-12 no-padding")); |
|
517
|
|
|
} |
|
518
|
|
|
if ($fieldvalue[2] == 'SELECT' || $fieldvalue[5] == '1') { |
|
519
|
|
|
if ($fieldvalue[7] != '' && $fieldvalue[8] != '') { |
|
520
|
|
|
$str = $fieldvalue[7] . "," . $fieldvalue[8]; |
|
521
|
|
|
if(is_array($fieldvalue[13])){ |
|
522
|
|
|
$drp_array = call_user_func_array(array($this->CI->common, $fieldvalue[14]), array($fieldvalue[13])); |
|
|
|
|
|
|
523
|
|
|
$form_contents.=form_dropdown($fieldvalue[13], $drp_array, ''); |
|
|
|
|
|
|
524
|
|
|
} |
|
525
|
|
|
/** |
|
526
|
|
|
ASTPP 3.0 |
|
527
|
|
|
Reseller Batch Update |
|
528
|
|
|
**/ |
|
529
|
|
|
if($fieldvalue[10] == 'set_status'){ |
|
530
|
|
|
$drp_array =array('0'=>'Active','1'=>'Inactive'); |
|
531
|
|
|
} |
|
532
|
|
|
/************************************************************/ |
|
533
|
|
|
else{ |
|
534
|
|
|
$drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12]));} |
|
|
|
|
|
|
535
|
|
|
$form_contents.=form_dropdown_all($fieldvalue[1], $drp_array, ''); |
|
|
|
|
|
|
536
|
|
|
} else { |
|
537
|
|
|
if ($fieldvalue[1] == 'INPUT') { |
|
538
|
|
|
$drp_name = $fieldvalue[6]; |
|
539
|
|
|
} |
|
540
|
|
|
$drp_array = call_user_func_array(array($this->CI->common, $fieldvalue[10]), array($fieldvalue[9])); |
|
541
|
|
|
$form_contents.=form_dropdown($drp_name, $drp_array, ''); |
|
|
|
|
|
|
542
|
|
|
} |
|
543
|
|
|
} |
|
544
|
|
View Code Duplication |
if ($fieldvalue[1] == 'INPUT') { |
|
545
|
|
|
$form_contents.= form_input($fieldvalue[2]); |
|
546
|
|
|
} else if ($fieldvalue[2] == 'CHECKBOX') { |
|
547
|
|
|
$form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
|
548
|
|
|
} |
|
549
|
|
|
$form_contents.= '</div>'; |
|
550
|
|
|
if ($i % 5 == 0) { |
|
551
|
|
|
$form_contents.= '</li>'; |
|
552
|
|
|
$i = 0; |
|
553
|
|
|
} |
|
554
|
|
|
$i++; |
|
555
|
|
|
} |
|
556
|
|
|
} |
|
557
|
|
|
|
|
558
|
|
|
$form_contents.= '</ul>'; |
|
559
|
|
|
$form_contents.= '<div class="col-md-12 margin-t-20 margin-b-20">'; |
|
560
|
|
|
|
|
561
|
|
|
$form_contents.= form_button($cancel); |
|
|
|
|
|
|
562
|
|
|
$form_contents.= form_button($save); |
|
|
|
|
|
|
563
|
|
|
$form_contents.='<div class="col-md-12 no-padding margin-t-15" style="margin-bottom:10px; !important"> |
|
564
|
|
|
<div class="pull-right btn-close" id="global_clearbatchupdate_filter">Close</div></div>'; |
|
565
|
|
|
$form_contents.= form_fieldset_close(); |
|
566
|
|
|
$form_contents.= form_close(); |
|
567
|
|
|
$form_contents.= '</div>'; |
|
568
|
|
|
$form_contents.= '</div>'; |
|
569
|
|
|
|
|
570
|
|
|
return $form_contents; |
|
571
|
|
|
} |
|
572
|
|
|
|
|
573
|
|
|
function load_grid_config($count_all, $rp, $page) { |
|
574
|
|
|
$json_data = array(); |
|
575
|
|
|
$config['total_rows'] = $count_all; |
|
|
|
|
|
|
576
|
|
|
$config['per_page'] = $rp; |
|
577
|
|
|
|
|
578
|
|
|
$page_no = $page; |
|
579
|
|
|
$json_data["json_paging"]['page'] = $page_no; |
|
580
|
|
|
|
|
581
|
|
|
$json_data["json_paging"]['total'] = $config['total_rows']; |
|
582
|
|
|
$perpage = $config['per_page']; |
|
583
|
|
|
$start = ($page_no - 1) * $perpage; |
|
584
|
|
|
if ($start < 0) |
|
585
|
|
|
$start = 0; |
|
586
|
|
|
$json_data["paging"]['start'] = $start; |
|
587
|
|
|
$json_data["paging"]['page_no'] = $perpage; |
|
588
|
|
|
return $json_data; |
|
589
|
|
|
} |
|
590
|
|
|
|
|
591
|
|
|
function build_grid($query, $grid_fields) { |
|
592
|
|
|
$jsn_tmp = array(); |
|
593
|
|
|
$json_data = array(); |
|
594
|
|
|
if ($query->num_rows > 0) { |
|
595
|
|
|
foreach ($query->result_array() as $row) { |
|
596
|
|
|
/* |
|
597
|
|
|
ASTPP 3.0 |
|
598
|
|
|
For Edit on Account number or name |
|
599
|
|
|
*/ |
|
600
|
|
|
$row_id = isset($row['id']) ? $row["id"]: ''; |
|
601
|
|
|
/*****************************/ |
|
602
|
|
|
foreach ($grid_fields as $field_key => $field_arr) { |
|
603
|
|
|
/** |
|
604
|
|
|
ASTPP 3.0 |
|
605
|
|
|
For Edit on Account number or name |
|
606
|
|
|
**/ |
|
607
|
|
|
$Actionkey = array_search(gettext('Action'), $this->CI->common->array_column($grid_fields,0)); |
|
|
|
|
|
|
608
|
|
|
/*********************************/ |
|
609
|
|
|
if ($field_arr[2] != "") { |
|
610
|
|
View Code Duplication |
if ($field_arr[3] != "") { |
|
611
|
|
|
if($field_arr[2]=="status"){ |
|
612
|
|
|
$row['id'] = $row_id; |
|
613
|
|
|
$jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
|
614
|
|
|
}else{ |
|
615
|
|
|
$jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]])); |
|
616
|
|
|
} |
|
617
|
|
|
|
|
618
|
|
|
/** |
|
619
|
|
|
ASTPP 3.0 |
|
620
|
|
|
For Edit on Account number or name |
|
621
|
|
|
**/ |
|
622
|
|
|
$row[$field_arr[2]] = $jsn_tmp[$field_key]; |
|
623
|
|
|
} if(array_search("EDITABLE", $field_arr)){ |
|
624
|
|
|
$ActionArr = $grid_fields[$Actionkey]; |
|
625
|
|
View Code Duplication |
if($ActionArr[5]->EDIT->url =="accounts/customer_edit/" || $ActionArr[5]->EDIT->url =="accounts/provider_edit/"){ |
|
626
|
|
|
$ActionArr[5]->EDIT->url=$row['type']==0 ? "accounts/customer_edit/" : "accounts/provider_edit/"; |
|
627
|
|
|
} |
|
628
|
|
View Code Duplication |
if($ActionArr[5]->EDIT->url =="accounts/admin_edit/" || $ActionArr[5]->EDIT->url =="accounts/subadmin_edit/"){ |
|
629
|
|
|
$ActionArr[5]->EDIT->url=$row['type']==4 ? "accounts/subadmin_edit/" : "accounts/admin_edit/"; |
|
630
|
|
|
} |
|
631
|
|
|
$acctype = ""; |
|
632
|
|
|
if(isset($row["type"]) && ($row["type"] == '0' || $row["type"] == '1' || $row["type"] == '3')){ |
|
633
|
|
|
$acctype = (isset($row["posttoexternal"]) && $row["posttoexternal"] != '')? "<span class='label label-default pull-right'>".$this->CI->common->get_account_type("","",$row["posttoexternal"])."</span>":""; |
|
634
|
|
|
} |
|
635
|
|
|
|
|
636
|
|
|
$fieldstr = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
|
637
|
|
|
if($acctype != ''){ |
|
638
|
|
|
$jsn_tmp[$field_key] = $fieldstr."<br/>".$acctype; |
|
639
|
|
|
}else{ |
|
640
|
|
|
$jsn_tmp[$field_key] = $fieldstr; |
|
641
|
|
|
} |
|
642
|
|
|
|
|
643
|
|
|
|
|
644
|
|
|
/*********************************/ |
|
645
|
|
|
}else { |
|
646
|
|
|
$jsn_tmp[$field_key] = $row[$field_arr[2]]; |
|
647
|
|
|
} |
|
648
|
|
|
} else { |
|
649
|
|
|
if ($field_arr[0] == gettext("Action")) { |
|
650
|
|
|
if(isset($field_arr[5]) && isset($field_arr[5]->EDIT) && isset($field_arr[5]->DELETE)){ |
|
651
|
|
|
|
|
652
|
|
View Code Duplication |
if($field_arr[5]->EDIT->url == 'accounts/customer_edit/' || $field_arr[5]->EDIT->url == 'accounts/provider_edit/' || $field_arr[5]->DELETE->url == 'accounts/provider_delete/' ||$field_arr[5]->DELETE->url == 'accounts/customer_delete/'){ |
|
653
|
|
|
if( $row['type'] == '0'|| strtolower($row['type']) == 'customer'){ |
|
654
|
|
|
$field_arr[5]->EDIT->url ='accounts/customer_edit/'; |
|
655
|
|
|
$field_arr[5]->DELETE->url ='accounts/customer_delete/'; |
|
656
|
|
|
} |
|
657
|
|
|
if($row['type'] == 3 || strtolower($row['type']) == 'provider'){ |
|
658
|
|
|
$field_arr[5]->EDIT->url ='accounts/provider_edit/'; |
|
659
|
|
|
$field_arr[5]->DELETE->url ='accounts/provider_delete/'; |
|
660
|
|
|
} |
|
661
|
|
|
} |
|
662
|
|
View Code Duplication |
if($field_arr[5]->EDIT->url == 'accounts/admin_edit/' || $field_arr[5]->EDIT->url == 'accounts/subadmin_edit/' || $field_arr[5]->DELETE->url == 'accounts/admin_delete/' ||$field_arr[5]->DELETE->url == 'accounts/subadmin_delete/'){ |
|
663
|
|
|
if($row['type'] == 2 || strtolower($row['type']) == 'administrator'){ |
|
664
|
|
|
$field_arr[5]->EDIT->url ='accounts/admin_edit/'; |
|
665
|
|
|
$field_arr[5]->DELETE->url ='accounts/admin_delete/'; |
|
666
|
|
|
} |
|
667
|
|
|
if($row['type'] == 4 || strtolower($row['type']) == 'sub admin'){ |
|
668
|
|
|
$field_arr[5]->EDIT->url ='accounts/subadmin_edit/'; |
|
669
|
|
|
$field_arr[5]->DELETE->url ='accounts/subadmin_delete/'; |
|
670
|
|
|
} |
|
671
|
|
|
} |
|
672
|
|
|
} |
|
673
|
|
|
/* |
|
674
|
|
|
ASTPP 3.0 |
|
675
|
|
|
For edit on account number or name |
|
676
|
|
|
*/ |
|
677
|
|
|
$jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row_id); |
|
678
|
|
|
/****************************************************************************/ |
|
679
|
|
|
} |
|
680
|
|
|
elseif($field_arr[0] == gettext("Profile Action")) |
|
681
|
|
|
{ |
|
682
|
|
|
if(isset($field_arr[5]) && isset($field_arr[5]->START) && isset($field_arr[5]->STOP) && isset($field_arr[5]->RELOAD) && isset($field_arr[5]->RESCAN)){ |
|
|
|
|
|
|
683
|
|
|
} |
|
684
|
|
|
$jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
|
685
|
|
|
|
|
686
|
|
|
} |
|
687
|
|
|
else { |
|
688
|
|
|
$className = (isset($field_arr['9']) && $field_arr['9'] != '')?$field_arr['9']:"chkRefNos"; |
|
689
|
|
|
$jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace '.$className.'" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>'; } |
|
690
|
|
|
} |
|
691
|
|
|
} |
|
692
|
|
|
$json_data[] = array('cell' => $jsn_tmp); |
|
693
|
|
|
} |
|
694
|
|
|
} |
|
695
|
|
|
return $json_data; |
|
696
|
|
|
} |
|
697
|
|
|
|
|
698
|
|
|
function build_json_grid($query, $grid_fields) { |
|
699
|
|
|
$jsn_tmp = array(); |
|
700
|
|
|
$json_data = array(); |
|
701
|
|
|
foreach ($query as $row) { |
|
702
|
|
|
foreach ($grid_fields as $field_key => $field_arr) { |
|
703
|
|
|
$row_id = isset($row['id']) ? $row["id"]: ''; |
|
704
|
|
|
/** |
|
705
|
|
|
ASTPP 3.0 |
|
706
|
|
|
For Edit on Account number or name |
|
707
|
|
|
**/ |
|
708
|
|
|
$Actionkey = array_search('Action',$this->CI->common->array_column($grid_fields,0)); |
|
|
|
|
|
|
709
|
|
|
/*******************************/ |
|
710
|
|
|
|
|
711
|
|
|
if ($field_arr[2] != "") { |
|
712
|
|
View Code Duplication |
if ($field_arr[3] != "") { |
|
713
|
|
|
if($field_arr[2]=="status"){ |
|
714
|
|
|
$row['id'] = $row_id; |
|
715
|
|
|
$jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
|
716
|
|
|
}else{ |
|
717
|
|
|
$jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]])); |
|
718
|
|
|
} |
|
719
|
|
|
/** |
|
720
|
|
|
ASTPP 3.0 |
|
721
|
|
|
For Edit on Account number or name |
|
722
|
|
|
**/ |
|
723
|
|
|
$row[$field_arr[2]] = $jsn_tmp[$field_key]; |
|
724
|
|
|
} if(array_search("EDITABLE", $field_arr)){ |
|
725
|
|
|
$ActionArr = $grid_fields[$Actionkey]; |
|
726
|
|
View Code Duplication |
if($ActionArr[5]->EDIT->url =="accounts/customer_edit/" || $ActionArr[5]->EDIT->url =="accounts/provider_edit/"){ |
|
727
|
|
|
$ActionArr[5]->EDIT->url=$row['type']==0 ? "accounts/customer_edit/" : "accounts/provider_edit/"; |
|
728
|
|
|
} |
|
729
|
|
View Code Duplication |
if($ActionArr[5]->EDIT->url =="accounts/admin_edit/" || $ActionArr[5]->EDIT->url =="accounts/subadmin_edit/"){ |
|
730
|
|
|
$ActionArr[5]->EDIT->url=$row['type']==4 ? "accounts/subadmin_edit/" : "accounts/admin_edit/"; |
|
731
|
|
|
} |
|
732
|
|
|
$jsn_tmp[$field_key] = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
|
733
|
|
|
/*******************************/ |
|
734
|
|
|
}else { |
|
735
|
|
|
$jsn_tmp[$field_key] = isset($row[$field_arr[2]]) ? $row[$field_arr[2]] : ""; |
|
736
|
|
|
} |
|
737
|
|
|
} else { |
|
738
|
|
|
if ($field_arr[0] == "Action") { |
|
739
|
|
|
$jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
|
740
|
|
|
} |
|
741
|
|
|
else { |
|
742
|
|
|
$jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace chkRefNos" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>'; |
|
743
|
|
|
} |
|
744
|
|
|
} |
|
745
|
|
|
} |
|
746
|
|
|
$json_data[] = array('cell' => $jsn_tmp); |
|
747
|
|
|
} |
|
748
|
|
|
return $json_data; |
|
749
|
|
|
} |
|
750
|
|
|
|
|
751
|
|
|
} |
|
752
|
|
|
|
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.