@@ -22,125 +22,125 @@ |
||
22 | 22 | // ############################################################################## |
23 | 23 | class Animap extends MX_Controller { |
24 | 24 | function Animap() { |
25 | - parent::__construct (); |
|
25 | + parent::__construct(); |
|
26 | 26 | |
27 | - $this->load->helper ( 'template_inheritance' ); |
|
27 | + $this->load->helper('template_inheritance'); |
|
28 | 28 | |
29 | - $this->load->library ( 'session' ); |
|
30 | - $this->load->library ( "animap_form" ); |
|
31 | - $this->load->library ( 'astpp/form' ); |
|
32 | - $this->load->model ( 'animap_model' ); |
|
29 | + $this->load->library('session'); |
|
30 | + $this->load->library("animap_form"); |
|
31 | + $this->load->library('astpp/form'); |
|
32 | + $this->load->model('animap_model'); |
|
33 | 33 | |
34 | - if ($this->session->userdata ( 'user_login' ) == FALSE) |
|
35 | - redirect ( base_url () . '/astpp/login' ); |
|
34 | + if ($this->session->userdata('user_login') == FALSE) |
|
35 | + redirect(base_url().'/astpp/login'); |
|
36 | 36 | } |
37 | 37 | function animap_add() { |
38 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
38 | + $data ['username'] = $this->session->userdata('user_name'); |
|
39 | 39 | $data ['flag'] = 'create'; |
40 | - $data ['page_title'] = gettext ( 'Add Caller ID' ); |
|
40 | + $data ['page_title'] = gettext('Add Caller ID'); |
|
41 | 41 | $edit_id = ''; |
42 | - $data ['form'] = $this->form->build_form ( $this->animap_form->get_animap_form_fields ( $edit_id ), '' ); |
|
42 | + $data ['form'] = $this->form->build_form($this->animap_form->get_animap_form_fields($edit_id), ''); |
|
43 | 43 | |
44 | - $this->load->view ( 'animap_add_edit', $data ); |
|
44 | + $this->load->view('animap_add_edit', $data); |
|
45 | 45 | } |
46 | 46 | function animap_edit($edit_id = '') { |
47 | - $data ['page_title'] = gettext ( 'Edit Caller ID' ); |
|
48 | - $where = array ( |
|
47 | + $data ['page_title'] = gettext('Edit Caller ID'); |
|
48 | + $where = array( |
|
49 | 49 | 'id' => $edit_id |
50 | 50 | ); |
51 | - $account = $this->db_model->getSelect ( "*", "ani_map", $where ); |
|
52 | - foreach ( $account->result_array () as $key => $value ) { |
|
51 | + $account = $this->db_model->getSelect("*", "ani_map", $where); |
|
52 | + foreach ($account->result_array() as $key => $value) { |
|
53 | 53 | $edit_data = $value; |
54 | 54 | } |
55 | 55 | |
56 | - $data ['form'] = $this->form->build_form ( $this->animap_form->get_animap_form_fields ( $edit_id ), $edit_data ); |
|
57 | - $this->load->view ( 'animap_add_edit', $data ); |
|
56 | + $data ['form'] = $this->form->build_form($this->animap_form->get_animap_form_fields($edit_id), $edit_data); |
|
57 | + $this->load->view('animap_add_edit', $data); |
|
58 | 58 | } |
59 | 59 | function animap_save() { |
60 | - $add_array = $this->input->post (); |
|
60 | + $add_array = $this->input->post(); |
|
61 | 61 | |
62 | 62 | $edit_id = $add_array ['id']; |
63 | - $data ['form'] = $this->form->build_form ( $this->animap_form->get_animap_form_fields ( $edit_id ), $add_array ); |
|
63 | + $data ['form'] = $this->form->build_form($this->animap_form->get_animap_form_fields($edit_id), $add_array); |
|
64 | 64 | if ($add_array ['id'] != '') { |
65 | - $data ['page_title'] = gettext ( 'Add Caller ID' ); |
|
66 | - if ($this->form_validation->run () == FALSE) { |
|
67 | - $data ['validation_errors'] = validation_errors (); |
|
65 | + $data ['page_title'] = gettext('Add Caller ID'); |
|
66 | + if ($this->form_validation->run() == FALSE) { |
|
67 | + $data ['validation_errors'] = validation_errors(); |
|
68 | 68 | echo $data ['validation_errors']; |
69 | 69 | exit (); |
70 | 70 | } else { |
71 | 71 | |
72 | - $this->animap_model->edit_animap ( $add_array, $add_array ['id'] ); |
|
73 | - echo json_encode ( array ( |
|
72 | + $this->animap_model->edit_animap($add_array, $add_array ['id']); |
|
73 | + echo json_encode(array( |
|
74 | 74 | "SUCCESS" => " Caller ID updated successfully!" |
75 | - ) ); |
|
75 | + )); |
|
76 | 76 | exit (); |
77 | 77 | } |
78 | 78 | } else { |
79 | 79 | |
80 | - if ($this->form_validation->run () == FALSE) { |
|
81 | - $data ['validation_errors'] = validation_errors (); |
|
80 | + if ($this->form_validation->run() == FALSE) { |
|
81 | + $data ['validation_errors'] = validation_errors(); |
|
82 | 82 | echo $data ['validation_errors']; |
83 | 83 | exit (); |
84 | 84 | } else { |
85 | 85 | |
86 | - $ip_id = $this->animap_model->add_animap ( $add_array ); |
|
86 | + $ip_id = $this->animap_model->add_animap($add_array); |
|
87 | 87 | |
88 | - echo json_encode ( array ( |
|
88 | + echo json_encode(array( |
|
89 | 89 | "SUCCESS" => " Caller ID added successfully!" |
90 | - ) ); |
|
90 | + )); |
|
91 | 91 | exit (); |
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
95 | 95 | function animap_delete($id) { |
96 | - $this->animap_model->remove_animap ( $id ); |
|
97 | - $this->session->set_flashdata ( 'astpp_notification', 'Caller ID removed successfully!' ); |
|
98 | - redirect ( base_url () . 'animap/animap_detail/' ); |
|
96 | + $this->animap_model->remove_animap($id); |
|
97 | + $this->session->set_flashdata('astpp_notification', 'Caller ID removed successfully!'); |
|
98 | + redirect(base_url().'animap/animap_detail/'); |
|
99 | 99 | } |
100 | 100 | function animap_detail_search() { |
101 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
102 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
103 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
104 | - $action = $this->input->post (); |
|
105 | - unset ( $action ['action'] ); |
|
106 | - unset ( $action ['advance_search'] ); |
|
107 | - $this->session->set_userdata ( 'animap_list_search', $action ); |
|
101 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
102 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
103 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
104 | + $action = $this->input->post(); |
|
105 | + unset ($action ['action']); |
|
106 | + unset ($action ['advance_search']); |
|
107 | + $this->session->set_userdata('animap_list_search', $action); |
|
108 | 108 | } |
109 | 109 | if (@$ajax_search != 1) { |
110 | - redirect ( base_url () . 'animap/animap_list/' ); |
|
110 | + redirect(base_url().'animap/animap_list/'); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | function animap_detail_clearsearchfilter() { |
114 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
115 | - $this->session->set_userdata ( 'animap_list_search', "" ); |
|
114 | + $this->session->set_userdata('advance_search', 0); |
|
115 | + $this->session->set_userdata('animap_list_search', ""); |
|
116 | 116 | } |
117 | 117 | function animap_detail() { |
118 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
119 | - $data ['page_title'] = gettext ( 'Caller ID' ); |
|
118 | + $data ['username'] = $this->session->userdata('user_name'); |
|
119 | + $data ['page_title'] = gettext('Caller ID'); |
|
120 | 120 | $data ['search_flag'] = true; |
121 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
122 | - $data ['grid_fields'] = $this->animap_form->build_animap_list_for_admin (); |
|
123 | - $data ["grid_buttons"] = $this->animap_form->build_grid_buttons (); |
|
124 | - $data ['form_search'] = $this->form->build_serach_form ( $this->animap_form->get_animap_search_form () ); |
|
121 | + $this->session->set_userdata('advance_search', 0); |
|
122 | + $data ['grid_fields'] = $this->animap_form->build_animap_list_for_admin(); |
|
123 | + $data ["grid_buttons"] = $this->animap_form->build_grid_buttons(); |
|
124 | + $data ['form_search'] = $this->form->build_serach_form($this->animap_form->get_animap_search_form()); |
|
125 | 125 | |
126 | - $this->load->view ( 'animap_view', $data ); |
|
126 | + $this->load->view('animap_view', $data); |
|
127 | 127 | } |
128 | 128 | function animap_detail_json() { |
129 | - $json_data = array (); |
|
130 | - $count_all = $this->animap_model->animap_list ( false ); |
|
131 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
129 | + $json_data = array(); |
|
130 | + $count_all = $this->animap_model->animap_list(false); |
|
131 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
132 | 132 | $json_data = $paging_data ["json_paging"]; |
133 | - $query = $this->animap_model->animap_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
134 | - $grid_fields = json_decode ( $this->animap_form->build_animap_list_for_admin () ); |
|
135 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
133 | + $query = $this->animap_model->animap_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
134 | + $grid_fields = json_decode($this->animap_form->build_animap_list_for_admin()); |
|
135 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
136 | 136 | |
137 | - echo json_encode ( $json_data ); |
|
137 | + echo json_encode($json_data); |
|
138 | 138 | } |
139 | 139 | function animap_delete_multiple() { |
140 | - $ids = $this->input->post ( "selected_ids", true ); |
|
140 | + $ids = $this->input->post("selected_ids", true); |
|
141 | 141 | $where = "id IN ($ids)"; |
142 | - $this->db->where ( $where ); |
|
143 | - echo $this->db->delete ( "ani_map" ); |
|
142 | + $this->db->where($where); |
|
143 | + echo $this->db->delete("ani_map"); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 |
@@ -31,8 +31,9 @@ |
||
31 | 31 | $this->load->library ( 'astpp/form' ); |
32 | 32 | $this->load->model ( 'animap_model' ); |
33 | 33 | |
34 | - if ($this->session->userdata ( 'user_login' ) == FALSE) |
|
35 | - redirect ( base_url () . '/astpp/login' ); |
|
34 | + if ($this->session->userdata ( 'user_login' ) == FALSE) { |
|
35 | + redirect ( base_url () . '/astpp/login' ); |
|
36 | + } |
|
36 | 37 | } |
37 | 38 | function animap_add() { |
38 | 39 | $data ['username'] = $this->session->userdata ( 'user_name' ); |
@@ -21,28 +21,28 @@ discard block |
||
21 | 21 | // You should have received a copy of the GNU Affero General Public License |
22 | 22 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | // ############################################################################## |
24 | -if (! defined ( 'BASEPATH' )) |
|
25 | - exit ( 'No direct script access allowed' ); |
|
24 | +if ( ! defined('BASEPATH')) |
|
25 | + exit ('No direct script access allowed'); |
|
26 | 26 | class Animap_form { |
27 | 27 | function __construct($library_name = '') { |
28 | - $this->CI = & get_instance (); |
|
28 | + $this->CI = & get_instance(); |
|
29 | 29 | } |
30 | 30 | function get_animap_form_fields($edit_id) { |
31 | 31 | $id = $edit_id; |
32 | - $form ['forms'] = array ( |
|
33 | - base_url () . 'animap/animap_save/', |
|
34 | - array ( |
|
32 | + $form ['forms'] = array( |
|
33 | + base_url().'animap/animap_save/', |
|
34 | + array( |
|
35 | 35 | 'id' => 'animap_form', |
36 | 36 | 'method' => 'POST', |
37 | 37 | 'name' => 'animap_form' |
38 | 38 | ) |
39 | 39 | ); |
40 | - $val = $id > 0 ? 'ani_map.number.' . $id : 'ani_map.number'; |
|
41 | - $form [gettext ( 'Caller ID' )] = array ( |
|
42 | - array ( |
|
40 | + $val = $id > 0 ? 'ani_map.number.'.$id : 'ani_map.number'; |
|
41 | + $form [gettext('Caller ID')] = array( |
|
42 | + array( |
|
43 | 43 | '', |
44 | 44 | 'HIDDEN', |
45 | - array ( |
|
45 | + array( |
|
46 | 46 | 'name' => 'id' |
47 | 47 | ), |
48 | 48 | '', |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | '', |
51 | 51 | '' |
52 | 52 | ), |
53 | - array ( |
|
54 | - gettext ( 'Account' ), |
|
53 | + array( |
|
54 | + gettext('Account'), |
|
55 | 55 | 'accountid', |
56 | 56 | 'SELECT', |
57 | 57 | '', |
@@ -63,27 +63,27 @@ discard block |
||
63 | 63 | 'accounts', |
64 | 64 | 'build_concat_dropdown', |
65 | 65 | 'where_arr', |
66 | - array ( |
|
66 | + array( |
|
67 | 67 | "reseller_id" => "0", |
68 | 68 | "type" => "0,3", |
69 | 69 | "deleted" => "0", |
70 | 70 | "status" => "0" |
71 | 71 | ) |
72 | 72 | ), |
73 | - array ( |
|
74 | - gettext ( 'Caller ID' ), |
|
73 | + array( |
|
74 | + gettext('Caller ID'), |
|
75 | 75 | 'INPUT', |
76 | - array ( |
|
76 | + array( |
|
77 | 77 | 'name' => 'number', |
78 | 78 | 'size' => '20', |
79 | 79 | 'class' => "text field medium" |
80 | 80 | ), |
81 | - 'trim|required|is_unique[' . $val . ']|numeric|xss_clean', |
|
81 | + 'trim|required|is_unique['.$val.']|numeric|xss_clean', |
|
82 | 82 | 'tOOL TIP', |
83 | 83 | 'Please Enter ANI number' |
84 | 84 | ), |
85 | - array ( |
|
86 | - gettext ( 'Status' ), |
|
85 | + array( |
|
86 | + gettext('Status'), |
|
87 | 87 | 'status', |
88 | 88 | 'SELECT', |
89 | 89 | '', |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | ) |
98 | 98 | ) |
99 | 99 | ; |
100 | - $form ['button_cancel'] = array ( |
|
100 | + $form ['button_cancel'] = array( |
|
101 | 101 | 'name' => 'action', |
102 | - 'content' => gettext ( 'Close' ), |
|
102 | + 'content' => gettext('Close'), |
|
103 | 103 | 'value' => 'cancel', |
104 | 104 | 'type' => 'button', |
105 | 105 | 'class' => 'btn btn-line-sky margin-x-10', |
106 | 106 | 'onclick' => 'return redirect_page(\'NULL\')' |
107 | 107 | ); |
108 | - $form ['button_save'] = array ( |
|
108 | + $form ['button_save'] = array( |
|
109 | 109 | 'name' => 'action', |
110 | - 'content' => gettext ( 'Save' ), |
|
110 | + 'content' => gettext('Save'), |
|
111 | 111 | 'value' => 'save', |
112 | 112 | 'id' => 'submit', |
113 | 113 | 'type' => 'button', |
@@ -116,17 +116,17 @@ discard block |
||
116 | 116 | return $form; |
117 | 117 | } |
118 | 118 | function get_animap_search_form() { |
119 | - $logintype = $this->CI->session->userdata ( 'logintype' ); |
|
119 | + $logintype = $this->CI->session->userdata('logintype'); |
|
120 | 120 | |
121 | - $form ['forms'] = array ( |
|
121 | + $form ['forms'] = array( |
|
122 | 122 | "", |
123 | - array ( |
|
123 | + array( |
|
124 | 124 | 'id' => "animap_search" |
125 | 125 | ) |
126 | 126 | ); |
127 | - $form [gettext ( 'Search' )] = array ( |
|
128 | - array ( |
|
129 | - gettext ( 'Account' ), |
|
127 | + $form [gettext('Search')] = array( |
|
128 | + array( |
|
129 | + gettext('Account'), |
|
130 | 130 | 'accountid', |
131 | 131 | 'SELECT', |
132 | 132 | '', |
@@ -138,16 +138,16 @@ discard block |
||
138 | 138 | 'accounts', |
139 | 139 | 'build_concat_dropdown', |
140 | 140 | 'where_arr', |
141 | - array ( |
|
141 | + array( |
|
142 | 142 | "reseller_id" => "0", |
143 | 143 | "type" => "0", |
144 | 144 | "deleted" => "0" |
145 | 145 | ) |
146 | 146 | ), |
147 | - array ( |
|
148 | - gettext ( 'Caller ID' ), |
|
147 | + array( |
|
148 | + gettext('Caller ID'), |
|
149 | 149 | 'INPUT', |
150 | - array ( |
|
150 | + array( |
|
151 | 151 | 'name' => 'number[number]', |
152 | 152 | '', |
153 | 153 | 'size' => '20', |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | 'search_string_type', |
164 | 164 | '' |
165 | 165 | ), |
166 | - array ( |
|
167 | - gettext ( 'Status' ), |
|
166 | + array( |
|
167 | + gettext('Status'), |
|
168 | 168 | 'status', |
169 | 169 | 'SELECT', |
170 | 170 | '', |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | '', |
177 | 177 | 'set_search_status' |
178 | 178 | ), |
179 | - array ( |
|
179 | + array( |
|
180 | 180 | '', |
181 | 181 | 'HIDDEN', |
182 | 182 | 'ajax_search', |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | '' |
187 | 187 | ), |
188 | 188 | |
189 | - array ( |
|
189 | + array( |
|
190 | 190 | '', |
191 | 191 | 'HIDDEN', |
192 | 192 | 'advance_search', |
@@ -196,18 +196,18 @@ discard block |
||
196 | 196 | '' |
197 | 197 | ) |
198 | 198 | ); |
199 | - $form ['button_search'] = array ( |
|
199 | + $form ['button_search'] = array( |
|
200 | 200 | 'name' => 'action', |
201 | 201 | 'id' => "animap_search_btn", |
202 | - 'content' => gettext ( 'Search' ), |
|
202 | + 'content' => gettext('Search'), |
|
203 | 203 | 'value' => 'save', |
204 | 204 | 'type' => 'button', |
205 | 205 | 'class' => 'btn btn-line-parrot pull-right' |
206 | 206 | ); |
207 | - $form ['button_reset'] = array ( |
|
207 | + $form ['button_reset'] = array( |
|
208 | 208 | 'name' => 'action', |
209 | 209 | 'id' => "id_reset", |
210 | - 'content' => gettext ( 'Clear' ), |
|
210 | + 'content' => gettext('Clear'), |
|
211 | 211 | 'value' => 'cancel', |
212 | 212 | 'type' => 'reset', |
213 | 213 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | } |
218 | 218 | function build_animap_list_for_admin() { |
219 | 219 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
220 | - $grid_field_arr = json_encode ( array ( |
|
221 | - array ( |
|
220 | + $grid_field_arr = json_encode(array( |
|
221 | + array( |
|
222 | 222 | "<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", |
223 | 223 | "30", |
224 | 224 | "", |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | "false", |
230 | 230 | "center" |
231 | 231 | ), |
232 | - array ( |
|
233 | - gettext ( "Account" ), |
|
232 | + array( |
|
233 | + gettext("Account"), |
|
234 | 234 | "250", |
235 | 235 | "accountid", |
236 | 236 | "first_name,last_name,number", |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | "true", |
241 | 241 | "center" |
242 | 242 | ), |
243 | - array ( |
|
244 | - gettext ( "Caller ID" ), |
|
243 | + array( |
|
244 | + gettext("Caller ID"), |
|
245 | 245 | "250", |
246 | 246 | "number", |
247 | 247 | "", |
@@ -255,8 +255,8 @@ discard block |
||
255 | 255 | ASTPP 3.0 |
256 | 256 | creation field show in grid |
257 | 257 | */ |
258 | - array ( |
|
259 | - gettext ( "Status" ), |
|
258 | + array( |
|
259 | + gettext("Status"), |
|
260 | 260 | "180", |
261 | 261 | "status", |
262 | 262 | "status", |
@@ -266,8 +266,8 @@ discard block |
||
266 | 266 | "true", |
267 | 267 | "center" |
268 | 268 | ), |
269 | - array ( |
|
270 | - gettext ( "Created Date" ), |
|
269 | + array( |
|
270 | + gettext("Created Date"), |
|
271 | 271 | "220", |
272 | 272 | "creation_date", |
273 | 273 | "creation_date", |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | "true", |
278 | 278 | "center" |
279 | 279 | ), |
280 | - array ( |
|
281 | - gettext ( "Modified Date" ), |
|
280 | + array( |
|
281 | + gettext("Modified Date"), |
|
282 | 282 | "220", |
283 | 283 | "last_modified_date", |
284 | 284 | "last_modified_date", |
@@ -292,45 +292,45 @@ discard block |
||
292 | 292 | /** |
293 | 293 | * ***************************************************************** |
294 | 294 | */ |
295 | - array ( |
|
296 | - gettext ( "Action" ), |
|
295 | + array( |
|
296 | + gettext("Action"), |
|
297 | 297 | "100", |
298 | 298 | "", |
299 | 299 | "", |
300 | 300 | "", |
301 | - array ( |
|
302 | - "EDIT" => array ( |
|
301 | + array( |
|
302 | + "EDIT" => array( |
|
303 | 303 | "url" => "animap/animap_edit/", |
304 | 304 | "mode" => "popup", |
305 | 305 | 'popup' |
306 | 306 | ), |
307 | - "DELETE" => array ( |
|
307 | + "DELETE" => array( |
|
308 | 308 | "url" => "/animap/animap_delete/", |
309 | 309 | "mode" => "single" |
310 | 310 | ) |
311 | 311 | ) |
312 | 312 | ) |
313 | - ) ); |
|
313 | + )); |
|
314 | 314 | return $grid_field_arr; |
315 | 315 | } |
316 | 316 | function build_grid_buttons() { |
317 | - $buttons_json = json_encode ( array ( |
|
318 | - array ( |
|
319 | - gettext ( "Add" ), |
|
317 | + $buttons_json = json_encode(array( |
|
318 | + array( |
|
319 | + gettext("Add"), |
|
320 | 320 | "btn btn-line-warning btn", |
321 | 321 | "fa fa-plus-circle fa-lg", |
322 | 322 | "button_action", |
323 | 323 | "/animap/animap_add/", |
324 | 324 | "popup" |
325 | 325 | ), |
326 | - array ( |
|
327 | - gettext ( "Delete" ), |
|
326 | + array( |
|
327 | + gettext("Delete"), |
|
328 | 328 | "btn btn-line-danger", |
329 | 329 | "fa fa-times-circle fa-lg", |
330 | 330 | "button_action", |
331 | 331 | "/animap/animap_delete_multiple/" |
332 | 332 | ) |
333 | - ) ); |
|
333 | + )); |
|
334 | 334 | return $buttons_json; |
335 | 335 | } |
336 | 336 | } |
@@ -21,8 +21,9 @@ |
||
21 | 21 | // You should have received a copy of the GNU Affero General Public License |
22 | 22 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | // ############################################################################## |
24 | -if (! defined ( 'BASEPATH' )) |
|
24 | +if (! defined ( 'BASEPATH' )) { |
|
25 | 25 | exit ( 'No direct script access allowed' ); |
26 | +} |
|
26 | 27 | class Animap_form { |
27 | 28 | function __construct($library_name = '') { |
28 | 29 | $this->CI = & get_instance (); |
@@ -22,204 +22,204 @@ |
||
22 | 22 | // ############################################################################## |
23 | 23 | class System_model extends CI_Model { |
24 | 24 | function System_model() { |
25 | - parent::__construct (); |
|
25 | + parent::__construct(); |
|
26 | 26 | } |
27 | 27 | function getsystem_list($flag, $start, $limit) { |
28 | - $this->db_model->build_search ( 'configuration_search' ); |
|
28 | + $this->db_model->build_search('configuration_search'); |
|
29 | 29 | $where = "group_title NOT IN ('asterisk','osc','freepbx')"; |
30 | - $this->db->where ( $where ); |
|
30 | + $this->db->where($where); |
|
31 | 31 | if ($flag) { |
32 | - $query = $this->db_model->select ( "*", "system", "", "group_title,name", "ASC", $limit, $start ); |
|
32 | + $query = $this->db_model->select("*", "system", "", "group_title,name", "ASC", $limit, $start); |
|
33 | 33 | } else { |
34 | - $query = $this->db_model->countQuery ( "*", "system", "" ); |
|
34 | + $query = $this->db_model->countQuery("*", "system", ""); |
|
35 | 35 | } |
36 | 36 | return $query; |
37 | 37 | } |
38 | 38 | function gettemplate_list($flag = "", $start, $limit = "") { |
39 | - if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) { |
|
40 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
39 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
40 | + $account_data = $this->session->userdata("accountinfo"); |
|
41 | 41 | $reseller = $account_data ['id']; |
42 | - $this->db->where ( 'reseller_id', $reseller ); |
|
43 | - $query = $this->db_model->select ( "*", "default_templates", "", "", "", "", "" ); |
|
42 | + $this->db->where('reseller_id', $reseller); |
|
43 | + $query = $this->db_model->select("*", "default_templates", "", "", "", "", ""); |
|
44 | 44 | |
45 | - if ($query->num_rows () > 0) { |
|
46 | - $result = $query->result_array (); |
|
47 | - $match_array = array (); |
|
48 | - $unmatch_array = array (); |
|
45 | + if ($query->num_rows() > 0) { |
|
46 | + $result = $query->result_array(); |
|
47 | + $match_array = array(); |
|
48 | + $unmatch_array = array(); |
|
49 | 49 | $i = 0; |
50 | 50 | $str = 0; |
51 | - foreach ( $result as $value ) { |
|
52 | - $this->db->where ( 'name', $value ['name'] ); |
|
53 | - $this->db->where ( 'reseller_id', 0 ); |
|
54 | - $query = $this->db_model->select ( "id", "default_templates", "", "id", "ASC", $limit, $start ); |
|
55 | - $innerresult = $query->result_array (); |
|
56 | - foreach ( $innerresult as $value ) { |
|
57 | - $str .= $value ['id'] . ","; |
|
51 | + foreach ($result as $value) { |
|
52 | + $this->db->where('name', $value ['name']); |
|
53 | + $this->db->where('reseller_id', 0); |
|
54 | + $query = $this->db_model->select("id", "default_templates", "", "id", "ASC", $limit, $start); |
|
55 | + $innerresult = $query->result_array(); |
|
56 | + foreach ($innerresult as $value) { |
|
57 | + $str .= $value ['id'].","; |
|
58 | 58 | } |
59 | 59 | } |
60 | - $str = rtrim ( $str, ',' ); |
|
60 | + $str = rtrim($str, ','); |
|
61 | 61 | |
62 | 62 | $where = "id NOT IN ($str)"; |
63 | - $this->db->where ( 'reseller_id', $reseller ); |
|
64 | - $this->db->or_where ( 'reseller_id', 0 ); |
|
65 | - $this->db->where ( $where ); |
|
63 | + $this->db->where('reseller_id', $reseller); |
|
64 | + $this->db->or_where('reseller_id', 0); |
|
65 | + $this->db->where($where); |
|
66 | 66 | } else { |
67 | - $this->db->where ( 'reseller_id', 0 ); |
|
67 | + $this->db->where('reseller_id', 0); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | if ($flag) { |
71 | 71 | |
72 | - $query = $this->db_model->select ( "*", "default_templates", "", "id", "ASC", $limit, $start ); |
|
72 | + $query = $this->db_model->select("*", "default_templates", "", "id", "ASC", $limit, $start); |
|
73 | 73 | } else { |
74 | 74 | |
75 | - $query = $this->db_model->countQuery ( "*", "default_templates", "" ); |
|
75 | + $query = $this->db_model->countQuery("*", "default_templates", ""); |
|
76 | 76 | } |
77 | 77 | } else { |
78 | 78 | |
79 | - $where = array ( |
|
79 | + $where = array( |
|
80 | 80 | 'reseller_id' => 0 |
81 | 81 | ); |
82 | - $this->db->where ( $where ); |
|
83 | - $this->db_model->build_search ( 'template_search' ); |
|
82 | + $this->db->where($where); |
|
83 | + $this->db_model->build_search('template_search'); |
|
84 | 84 | if ($flag) { |
85 | - $query = $this->db_model->select ( "*", "default_templates", "", "id", "ASC", $limit, $start ); |
|
85 | + $query = $this->db_model->select("*", "default_templates", "", "id", "ASC", $limit, $start); |
|
86 | 86 | } else { |
87 | - $query = $this->db_model->countQuery ( "*", "default_templates", "" ); |
|
87 | + $query = $this->db_model->countQuery("*", "default_templates", ""); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | return $query; |
92 | 92 | } |
93 | 93 | function edit_configuration($add_array, $name) { |
94 | - unset ( $add_array ["action"] ); |
|
94 | + unset ($add_array ["action"]); |
|
95 | 95 | |
96 | - $this->db->where ( "name", $name ); |
|
97 | - $this->db->update ( "system", $add_array ); |
|
96 | + $this->db->where("name", $name); |
|
97 | + $this->db->update("system", $add_array); |
|
98 | 98 | if ($name == 'base_currency') { |
99 | 99 | |
100 | - $screen_path = getcwd () . "/cron"; |
|
101 | - $screen_filename = "CurrencyUpdate" . strtotime ( 'now' ); |
|
102 | - $command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S $screen_filename php cron.php CurrencyUpdate"; |
|
103 | - exec ( $command ); |
|
104 | - $this->db->update ( "currency", array ( |
|
100 | + $screen_path = getcwd()."/cron"; |
|
101 | + $screen_filename = "CurrencyUpdate".strtotime('now'); |
|
102 | + $command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php CurrencyUpdate"; |
|
103 | + exec($command); |
|
104 | + $this->db->update("currency", array( |
|
105 | 105 | "currencyrate" => '1' |
106 | - ), array ( |
|
106 | + ), array( |
|
107 | 107 | "currency" => "INR" |
108 | - ) ); |
|
108 | + )); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | function edit_template($data, $id) { |
112 | - unset ( $data ["action"] ); |
|
113 | - $data ["last_modified_date"] = date ( "Y-m-d H:i:s" ); |
|
114 | - $this->db->where ( "id", $id ); |
|
115 | - $this->db->update ( "default_templates", $data ); |
|
112 | + unset ($data ["action"]); |
|
113 | + $data ["last_modified_date"] = date("Y-m-d H:i:s"); |
|
114 | + $this->db->where("id", $id); |
|
115 | + $this->db->update("default_templates", $data); |
|
116 | 116 | } |
117 | 117 | function edit_resellertemplate($data, $id) { |
118 | 118 | $arraydata = $data; |
119 | - if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) { |
|
120 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
119 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
120 | + $account_data = $this->session->userdata("accountinfo"); |
|
121 | 121 | $reseller = $account_data ['id']; |
122 | 122 | $array = $data; |
123 | - $data = array ( |
|
123 | + $data = array( |
|
124 | 124 | 'reseller_id' => $reseller |
125 | 125 | ); |
126 | - $this->db->where ( "id", $id ); |
|
126 | + $this->db->where("id", $id); |
|
127 | 127 | } |
128 | - unset ( $arraydata ["action"] ); |
|
129 | - unset ( $arraydata ["form"] ); |
|
130 | - unset ( $arraydata ["page_title"] ); |
|
131 | - $this->db->update ( "default_templates", $arraydata ); |
|
128 | + unset ($arraydata ["action"]); |
|
129 | + unset ($arraydata ["form"]); |
|
130 | + unset ($arraydata ["page_title"]); |
|
131 | + $this->db->update("default_templates", $arraydata); |
|
132 | 132 | } |
133 | 133 | function remove_template($id) { |
134 | - $this->db->where ( "id", $id ); |
|
135 | - $this->db->update ( "default_templates", array ( |
|
134 | + $this->db->where("id", $id); |
|
135 | + $this->db->update("default_templates", array( |
|
136 | 136 | "status" => 2 |
137 | - ) ); |
|
137 | + )); |
|
138 | 138 | return true; |
139 | 139 | } |
140 | 140 | function add_resellertemplate($data) { |
141 | - unset ( $data ["action"] ); |
|
142 | - unset ( $data ['id'] ); |
|
143 | - $this->db->insert ( 'default_templates', $data ); |
|
141 | + unset ($data ["action"]); |
|
142 | + unset ($data ['id']); |
|
143 | + $this->db->insert('default_templates', $data); |
|
144 | 144 | return true; |
145 | 145 | } |
146 | 146 | function getcountry_list($flag, $start = 0, $limit = 0) { |
147 | - $this->db_model->build_search ( 'country_list_search' ); |
|
147 | + $this->db_model->build_search('country_list_search'); |
|
148 | 148 | if ($flag) { |
149 | - $query = $this->db_model->select ( "*", "countrycode", '', "id", "ASC", $limit, $start ); |
|
149 | + $query = $this->db_model->select("*", "countrycode", '', "id", "ASC", $limit, $start); |
|
150 | 150 | } else { |
151 | - $query = $this->db_model->countQuery ( "*", "countrycode", '' ); |
|
151 | + $query = $this->db_model->countQuery("*", "countrycode", ''); |
|
152 | 152 | } |
153 | 153 | return $query; |
154 | 154 | } |
155 | 155 | function add_country($add_array) { |
156 | - unset ( $add_array ["action"] ); |
|
157 | - $this->db->insert ( "countrycode", $add_array ); |
|
156 | + unset ($add_array ["action"]); |
|
157 | + $this->db->insert("countrycode", $add_array); |
|
158 | 158 | return true; |
159 | 159 | } |
160 | 160 | function edit_country($data, $id) { |
161 | - unset ( $data ["action"] ); |
|
162 | - $this->db->where ( "id", $id ); |
|
163 | - $this->db->update ( "countrycode", $data ); |
|
161 | + unset ($data ["action"]); |
|
162 | + $this->db->where("id", $id); |
|
163 | + $this->db->update("countrycode", $data); |
|
164 | 164 | } |
165 | 165 | function remove_country($id) { |
166 | - $this->db->where ( "id", $id ); |
|
167 | - $this->db->delete ( "countrycode" ); |
|
166 | + $this->db->where("id", $id); |
|
167 | + $this->db->delete("countrycode"); |
|
168 | 168 | return true; |
169 | 169 | } |
170 | 170 | function getcurrency_list($flag, $start = 0, $limit = 0) { |
171 | - $this->db_model->build_search ( 'currency_list_search' ); |
|
171 | + $this->db_model->build_search('currency_list_search'); |
|
172 | 172 | |
173 | - $where = array ( |
|
173 | + $where = array( |
|
174 | 174 | 'currency <>' => Common_model::$global_config ['system_config'] ['base_currency'] |
175 | 175 | ); |
176 | 176 | if ($flag) { |
177 | - $query = $this->db_model->select ( "*", "currency", $where, "id", "ASC", $limit, $start ); |
|
177 | + $query = $this->db_model->select("*", "currency", $where, "id", "ASC", $limit, $start); |
|
178 | 178 | } else { |
179 | - $query = $this->db_model->countQuery ( "*", "currency", $where ); |
|
179 | + $query = $this->db_model->countQuery("*", "currency", $where); |
|
180 | 180 | } |
181 | 181 | return $query; |
182 | 182 | } |
183 | 183 | function add_currency($add_array) { |
184 | - unset ( $add_array ["action"] ); |
|
185 | - $this->db->insert ( "currency", $add_array ); |
|
184 | + unset ($add_array ["action"]); |
|
185 | + $this->db->insert("currency", $add_array); |
|
186 | 186 | return true; |
187 | 187 | } |
188 | 188 | function edit_currency($data, $id) { |
189 | - unset ( $data ["action"] ); |
|
190 | - $this->db->where ( "id", $id ); |
|
191 | - $this->db->update ( "currency", $data ); |
|
189 | + unset ($data ["action"]); |
|
190 | + $this->db->where("id", $id); |
|
191 | + $this->db->update("currency", $data); |
|
192 | 192 | } |
193 | 193 | function remove_currency($id) { |
194 | - $this->db->where ( "id", $id ); |
|
195 | - $this->db->delete ( "currency" ); |
|
194 | + $this->db->where("id", $id); |
|
195 | + $this->db->delete("currency"); |
|
196 | 196 | return true; |
197 | 197 | } |
198 | 198 | function backup_insert($add_array = '') { |
199 | - unset ( $add_array ["action"] ); |
|
200 | - $this->db->insert ( "backup_database", $add_array ); |
|
199 | + unset ($add_array ["action"]); |
|
200 | + $this->db->insert("backup_database", $add_array); |
|
201 | 201 | return true; |
202 | 202 | } |
203 | 203 | function getbackup_list($flag, $start, $limit) { |
204 | 204 | if ($flag) { |
205 | - $query = $this->db_model->select ( "*", "backup_database", "", "date", "DESC", $limit, $start ); |
|
205 | + $query = $this->db_model->select("*", "backup_database", "", "date", "DESC", $limit, $start); |
|
206 | 206 | } else { |
207 | - $query = $this->db_model->countQuery ( "*", "backup_database", "" ); |
|
207 | + $query = $this->db_model->countQuery("*", "backup_database", ""); |
|
208 | 208 | } |
209 | 209 | return $query; |
210 | 210 | } |
211 | 211 | function get_backup_data($id) { |
212 | - $where = array ( |
|
212 | + $where = array( |
|
213 | 213 | 'id' => $id |
214 | 214 | ); |
215 | - $query = $this->db_model->getSelect ( "*", "backup_database", $where ); |
|
215 | + $query = $this->db_model->getSelect("*", "backup_database", $where); |
|
216 | 216 | return $query; |
217 | 217 | } |
218 | 218 | function import_database($filename, $target_path) { |
219 | - $this->db->insert ( "backup_database", array ( |
|
219 | + $this->db->insert("backup_database", array( |
|
220 | 220 | 'backup_name' => $filename, |
221 | 221 | 'path' => $target_path |
222 | - ) ); |
|
222 | + )); |
|
223 | 223 | return true; |
224 | 224 | } |
225 | 225 | } |
@@ -22,469 +22,469 @@ discard block |
||
22 | 22 | // ############################################################################## |
23 | 23 | class Systems extends CI_Controller { |
24 | 24 | function Systems() { |
25 | - parent::__construct (); |
|
25 | + parent::__construct(); |
|
26 | 26 | |
27 | - $this->load->helper ( 'template_inheritance' ); |
|
28 | - $this->load->helper ( 'file' ); |
|
29 | - $this->load->library ( 'session' ); |
|
30 | - $this->load->library ( "system_form" ); |
|
31 | - $this->load->library ( 'astpp/form' ); |
|
32 | - $this->load->model ( 'system_model' ); |
|
33 | - $this->load->dbutil (); |
|
27 | + $this->load->helper('template_inheritance'); |
|
28 | + $this->load->helper('file'); |
|
29 | + $this->load->library('session'); |
|
30 | + $this->load->library("system_form"); |
|
31 | + $this->load->library('astpp/form'); |
|
32 | + $this->load->model('system_model'); |
|
33 | + $this->load->dbutil(); |
|
34 | 34 | |
35 | - if ($this->session->userdata ( 'user_login' ) == FALSE) |
|
36 | - redirect ( base_url () . '/astpp/login' ); |
|
35 | + if ($this->session->userdata('user_login') == FALSE) |
|
36 | + redirect(base_url().'/astpp/login'); |
|
37 | 37 | } |
38 | 38 | function configuration_edit($edit_id = '') { |
39 | - $data ['page_title'] = gettext ( 'Edit Settings' ); |
|
40 | - $where = array ( |
|
39 | + $data ['page_title'] = gettext('Edit Settings'); |
|
40 | + $where = array( |
|
41 | 41 | 'id' => $edit_id |
42 | 42 | ); |
43 | - $account = $this->db_model->getSelect ( "*", "system", $where ); |
|
44 | - foreach ( $account->result_array () as $key => $value ) { |
|
43 | + $account = $this->db_model->getSelect("*", "system", $where); |
|
44 | + foreach ($account->result_array() as $key => $value) { |
|
45 | 45 | $edit_data = $value; |
46 | 46 | } |
47 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_configuration_form_fields (), $edit_data ); |
|
48 | - $this->load->view ( 'view_configuration_add_edit', $data ); |
|
47 | + $data ['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $edit_data); |
|
48 | + $this->load->view('view_configuration_add_edit', $data); |
|
49 | 49 | } |
50 | 50 | function configuration_search() { |
51 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
52 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
53 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
54 | - $action = $this->input->post (); |
|
55 | - unset ( $action ['action'] ); |
|
56 | - unset ( $action ['advance_search'] ); |
|
57 | - $this->session->set_userdata ( 'configuration_search', $action ); |
|
51 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
52 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
53 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
54 | + $action = $this->input->post(); |
|
55 | + unset ($action ['action']); |
|
56 | + unset ($action ['advance_search']); |
|
57 | + $this->session->set_userdata('configuration_search', $action); |
|
58 | 58 | } |
59 | 59 | if (@$ajax_search != 1) { |
60 | - redirect ( base_url () . 'systems/configuration/' ); |
|
60 | + redirect(base_url().'systems/configuration/'); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | function configuration_clearsearchfilter() { |
64 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
65 | - $this->session->set_userdata ( 'did_search', "" ); |
|
64 | + $this->session->set_userdata('advance_search', 0); |
|
65 | + $this->session->set_userdata('did_search', ""); |
|
66 | 66 | } |
67 | 67 | function configuration_save() { |
68 | - $add_array = $this->input->post (); |
|
69 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_configuration_form_fields (), $add_array ); |
|
68 | + $add_array = $this->input->post(); |
|
69 | + $data ['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $add_array); |
|
70 | 70 | if ($add_array ['id'] != '') { |
71 | - $data ['page_title'] = gettext ( 'Edit Settings' ); |
|
72 | - if ($this->form_validation->run () == FALSE) { |
|
73 | - $data ['validation_errors'] = validation_errors (); |
|
71 | + $data ['page_title'] = gettext('Edit Settings'); |
|
72 | + if ($this->form_validation->run() == FALSE) { |
|
73 | + $data ['validation_errors'] = validation_errors(); |
|
74 | 74 | echo $data ['validation_errors']; |
75 | 75 | exit (); |
76 | 76 | } else { |
77 | - $this->system_model->edit_configuration ( $add_array, $add_array ['id'] ); |
|
78 | - echo json_encode ( array ( |
|
77 | + $this->system_model->edit_configuration($add_array, $add_array ['id']); |
|
78 | + echo json_encode(array( |
|
79 | 79 | "SUCCESS" => "setting updated successfully!" |
80 | - ) ); |
|
80 | + )); |
|
81 | 81 | exit (); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
85 | 85 | function configuration($group_title = '') { |
86 | 86 | if ($group_title == "") { |
87 | - redirect ( base_url () . '/dashboard' ); |
|
87 | + redirect(base_url().'/dashboard'); |
|
88 | 88 | } |
89 | 89 | if ($group_title == "email") { |
90 | 90 | $data ['test_email_flag'] = true; |
91 | 91 | } |
92 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
93 | - $data ['page_title'] = gettext ( ucfirst ( $group_title ) ); |
|
92 | + $data ['username'] = $this->session->userdata('user_name'); |
|
93 | + $data ['page_title'] = gettext(ucfirst($group_title)); |
|
94 | 94 | $data ['group_title'] = $group_title; |
95 | - $where = array ( |
|
95 | + $where = array( |
|
96 | 96 | "group_title" => $group_title |
97 | 97 | ); |
98 | - $details = $this->db_model->getSelect ( "*", "system", $where ); |
|
99 | - $data ['details'] = $details->result_array (); |
|
100 | - $add_array = $this->input->post (); |
|
101 | - if (! empty ( $add_array )) { |
|
102 | - if (isset ( $add_array ['version'] )) { |
|
103 | - unset ( $add_array ['version'] ); |
|
98 | + $details = $this->db_model->getSelect("*", "system", $where); |
|
99 | + $data ['details'] = $details->result_array(); |
|
100 | + $add_array = $this->input->post(); |
|
101 | + if ( ! empty ($add_array)) { |
|
102 | + if (isset ($add_array ['version'])) { |
|
103 | + unset ($add_array ['version']); |
|
104 | 104 | } |
105 | - foreach ( $add_array as $key => $val ) { |
|
106 | - $update_array = array ( |
|
105 | + foreach ($add_array as $key => $val) { |
|
106 | + $update_array = array( |
|
107 | 107 | 'value' => $val |
108 | 108 | ); |
109 | - $this->system_model->edit_configuration ( $update_array, $key ); |
|
109 | + $this->system_model->edit_configuration($update_array, $key); |
|
110 | 110 | } |
111 | - $this->session->set_flashdata ( 'astpp_errormsg', ucfirst ( $group_title ) . ' Settings updated sucessfully!' ); |
|
112 | - redirect ( base_url () . 'systems/configuration/' . $group_title ); |
|
111 | + $this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!'); |
|
112 | + redirect(base_url().'systems/configuration/'.$group_title); |
|
113 | 113 | } else { |
114 | - $this->load->view ( 'view_systemconf', $data ); |
|
114 | + $this->load->view('view_systemconf', $data); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | function configuration_json() { |
118 | - $json_data = array (); |
|
119 | - $count_all = $this->system_model->getsystem_list ( false, "", "" ); |
|
120 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
118 | + $json_data = array(); |
|
119 | + $count_all = $this->system_model->getsystem_list(false, "", ""); |
|
120 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
121 | 121 | $json_data = $paging_data ["json_paging"]; |
122 | 122 | |
123 | - $query = $this->system_model->getsystem_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
124 | - $grid_fields = json_decode ( $this->system_form->build_system_list_for_admin () ); |
|
125 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
123 | + $query = $this->system_model->getsystem_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
124 | + $grid_fields = json_decode($this->system_form->build_system_list_for_admin()); |
|
125 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
126 | 126 | |
127 | - echo json_encode ( $json_data ); |
|
127 | + echo json_encode($json_data); |
|
128 | 128 | } |
129 | 129 | function template() { |
130 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
131 | - $data ['page_title'] = gettext ( 'Email Templates' ); |
|
130 | + $data ['username'] = $this->session->userdata('user_name'); |
|
131 | + $data ['page_title'] = gettext('Email Templates'); |
|
132 | 132 | $data ['search_flag'] = true; |
133 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
134 | - $data ['grid_fields'] = $this->system_form->build_template_list_for_admin (); |
|
135 | - $data ["grid_buttons"] = $this->system_form->build_grid_buttons (); |
|
136 | - $data ['form_search'] = $this->form->build_serach_form ( $this->system_form->get_template_search_form () ); |
|
137 | - $this->load->view ( 'view_template_list', $data ); |
|
133 | + $this->session->set_userdata('advance_search', 0); |
|
134 | + $data ['grid_fields'] = $this->system_form->build_template_list_for_admin(); |
|
135 | + $data ["grid_buttons"] = $this->system_form->build_grid_buttons(); |
|
136 | + $data ['form_search'] = $this->form->build_serach_form($this->system_form->get_template_search_form()); |
|
137 | + $this->load->view('view_template_list', $data); |
|
138 | 138 | } |
139 | 139 | function template_json() { |
140 | - $json_data = array (); |
|
141 | - $count_all = $this->system_model->gettemplate_list ( false, "", "" ); |
|
142 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
140 | + $json_data = array(); |
|
141 | + $count_all = $this->system_model->gettemplate_list(false, "", ""); |
|
142 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
143 | 143 | $json_data = $paging_data ["json_paging"]; |
144 | 144 | |
145 | - $query = $this->system_model->gettemplate_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
146 | - $grid_fields = json_decode ( $this->system_form->build_template_list_for_admin () ); |
|
147 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
145 | + $query = $this->system_model->gettemplate_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
146 | + $grid_fields = json_decode($this->system_form->build_template_list_for_admin()); |
|
147 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
148 | 148 | |
149 | - echo json_encode ( $json_data ); |
|
149 | + echo json_encode($json_data); |
|
150 | 150 | } |
151 | 151 | function template_edit($edit_id = '') { |
152 | - $data ['page_title'] = gettext ( 'Edit Email template' ); |
|
153 | - $where = array ( |
|
152 | + $data ['page_title'] = gettext('Edit Email template'); |
|
153 | + $where = array( |
|
154 | 154 | 'id' => $edit_id |
155 | 155 | ); |
156 | - $account = $this->db_model->getSelect ( "*", "default_templates", $where ); |
|
157 | - foreach ( $account->result_array () as $key => $value ) { |
|
156 | + $account = $this->db_model->getSelect("*", "default_templates", $where); |
|
157 | + foreach ($account->result_array() as $key => $value) { |
|
158 | 158 | $edit_data = $value; |
159 | 159 | } |
160 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_template_form_fields (), $edit_data ); |
|
161 | - $this->load->view ( 'view_template_add_edit', $data ); |
|
160 | + $data ['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $edit_data); |
|
161 | + $this->load->view('view_template_add_edit', $data); |
|
162 | 162 | } |
163 | 163 | function template_save() { |
164 | - $add_array = $this->input->post (); |
|
164 | + $add_array = $this->input->post(); |
|
165 | 165 | // ITPLATP 22_05_2017 |
166 | - $template = preg_replace ( '<!-- (.|\s)*? -->', '', $add_array ['template'] ); |
|
167 | - $add_array ['template'] = str_replace ( "<", "", str_replace ( ">", "", $template ) ); |
|
166 | + $template = preg_replace('<!-- (.|\s)*? -->', '', $add_array ['template']); |
|
167 | + $add_array ['template'] = str_replace("<", "", str_replace(">", "", $template)); |
|
168 | 168 | // end |
169 | - if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) { |
|
170 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
169 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
170 | + $account_data = $this->session->userdata("accountinfo"); |
|
171 | 171 | $reseller = $account_data ['id']; |
172 | - $this->resellertemplate_save ( $add_array, $reseller ); |
|
172 | + $this->resellertemplate_save($add_array, $reseller); |
|
173 | 173 | } else { |
174 | - $this->admintemplate_save ( $add_array ); |
|
174 | + $this->admintemplate_save($add_array); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | function resellertemplate_save($data, $resellerid) { |
178 | - $where = array ( |
|
178 | + $where = array( |
|
179 | 179 | 'name' => $data ['name'], |
180 | 180 | 'reseller_id' => $resellerid |
181 | 181 | ); |
182 | - $count = $this->db_model->countQuery ( "*", "default_templates", $where ); |
|
183 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_template_form_fields (), $data ); |
|
182 | + $count = $this->db_model->countQuery("*", "default_templates", $where); |
|
183 | + $data ['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
184 | 184 | if ($count > 0) { |
185 | - $data ['page_title'] = gettext ( 'Edit Template' ); |
|
186 | - if ($this->form_validation->run () == FALSE) { |
|
187 | - $data ['validation_errors'] = validation_errors (); |
|
185 | + $data ['page_title'] = gettext('Edit Template'); |
|
186 | + if ($this->form_validation->run() == FALSE) { |
|
187 | + $data ['validation_errors'] = validation_errors(); |
|
188 | 188 | } else { |
189 | 189 | |
190 | - $this->system_model->edit_resellertemplate ( $data, $data ['id'] ); |
|
191 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Template updated successfully!' ); |
|
192 | - redirect ( base_url () . 'systems/template/' ); |
|
190 | + $this->system_model->edit_resellertemplate($data, $data ['id']); |
|
191 | + $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
192 | + redirect(base_url().'systems/template/'); |
|
193 | 193 | exit (); |
194 | 194 | } |
195 | 195 | } else { |
196 | - if ($this->form_validation->run () == FALSE) { |
|
197 | - $data ['validation_errors'] = validation_errors (); |
|
196 | + if ($this->form_validation->run() == FALSE) { |
|
197 | + $data ['validation_errors'] = validation_errors(); |
|
198 | 198 | } else { |
199 | - unset ( $data ['form'] ); |
|
199 | + unset ($data ['form']); |
|
200 | 200 | $data ['reseller_id'] = $resellerid; |
201 | - $this->system_model->add_resellertemplate ( $data ); |
|
202 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Template added successfully!' ); |
|
203 | - redirect ( base_url () . 'systems/template/' ); |
|
201 | + $this->system_model->add_resellertemplate($data); |
|
202 | + $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
203 | + redirect(base_url().'systems/template/'); |
|
204 | 204 | exit (); |
205 | 205 | } |
206 | 206 | } |
207 | - $this->load->view ( 'view_template_add_edit', $data ); |
|
207 | + $this->load->view('view_template_add_edit', $data); |
|
208 | 208 | } |
209 | 209 | function admintemplate_save($data) { |
210 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_template_form_fields (), $data ); |
|
210 | + $data ['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
211 | 211 | if ($data ['id'] != '') { |
212 | - $data ['page_title'] = gettext ( 'Edit Template' ); |
|
213 | - if ($this->form_validation->run () == FALSE) { |
|
214 | - $data ['validation_errors'] = validation_errors (); |
|
212 | + $data ['page_title'] = gettext('Edit Template'); |
|
213 | + if ($this->form_validation->run() == FALSE) { |
|
214 | + $data ['validation_errors'] = validation_errors(); |
|
215 | 215 | } else { |
216 | - unset ( $data ['form'] ); |
|
217 | - unset ( $data ['page_title'] ); |
|
218 | - $this->system_model->edit_template ( $data, $data ['id'] ); |
|
219 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Template updated successfully!' ); |
|
220 | - redirect ( base_url () . 'systems/template/' ); |
|
216 | + unset ($data ['form']); |
|
217 | + unset ($data ['page_title']); |
|
218 | + $this->system_model->edit_template($data, $data ['id']); |
|
219 | + $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
220 | + redirect(base_url().'systems/template/'); |
|
221 | 221 | exit (); |
222 | 222 | } |
223 | 223 | } else { |
224 | - $data ['page_title'] = gettext ( 'Termination Details' ); |
|
225 | - if ($this->form_validation->run () == FALSE) { |
|
226 | - $data ['validation_errors'] = validation_errors (); |
|
224 | + $data ['page_title'] = gettext('Termination Details'); |
|
225 | + if ($this->form_validation->run() == FALSE) { |
|
226 | + $data ['validation_errors'] = validation_errors(); |
|
227 | 227 | } else { |
228 | - unset ( $data ['form'] ); |
|
229 | - $this->system_model->add_template ( $data ); |
|
230 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Template added successfully!' ); |
|
231 | - redirect ( base_url () . 'systems/template/' ); |
|
228 | + unset ($data ['form']); |
|
229 | + $this->system_model->add_template($data); |
|
230 | + $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
231 | + redirect(base_url().'systems/template/'); |
|
232 | 232 | exit (); |
233 | 233 | } |
234 | 234 | } |
235 | - $this->load->view ( 'view_template_add_edit', $data ); |
|
235 | + $this->load->view('view_template_add_edit', $data); |
|
236 | 236 | } |
237 | 237 | function template_search() { |
238 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
238 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
239 | 239 | |
240 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
241 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
242 | - $action = $this->input->post (); |
|
243 | - unset ( $action ['action'] ); |
|
244 | - unset ( $action ['advance_search'] ); |
|
245 | - $this->session->set_userdata ( 'template_search', $action ); |
|
240 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
241 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
242 | + $action = $this->input->post(); |
|
243 | + unset ($action ['action']); |
|
244 | + unset ($action ['advance_search']); |
|
245 | + $this->session->set_userdata('template_search', $action); |
|
246 | 246 | } |
247 | 247 | if (@$ajax_search != 1) { |
248 | - redirect ( base_url () . 'systems/template/' ); |
|
248 | + redirect(base_url().'systems/template/'); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | function template_clearsearchfilter() { |
252 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
253 | - $this->session->set_userdata ( 'did_search', "" ); |
|
252 | + $this->session->set_userdata('advance_search', 0); |
|
253 | + $this->session->set_userdata('did_search', ""); |
|
254 | 254 | } |
255 | 255 | function country_list() { |
256 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
257 | - $data ['page_title'] = gettext ( 'Countries' ); |
|
256 | + $data ['username'] = $this->session->userdata('user_name'); |
|
257 | + $data ['page_title'] = gettext('Countries'); |
|
258 | 258 | $data ['search_flag'] = true; |
259 | 259 | $data ['cur_menu_no'] = 4; |
260 | - $this->session->set_userdata ( 'country_search', 0 ); |
|
261 | - $data ['grid_fields'] = $this->system_form->build_country_list_for_admin (); |
|
262 | - if ($this->session->userdata ( 'logintype' ) == 2) { |
|
263 | - $data ["grid_buttons"] = $this->system_form->build_admin_grid_buttons (); |
|
260 | + $this->session->set_userdata('country_search', 0); |
|
261 | + $data ['grid_fields'] = $this->system_form->build_country_list_for_admin(); |
|
262 | + if ($this->session->userdata('logintype') == 2) { |
|
263 | + $data ["grid_buttons"] = $this->system_form->build_admin_grid_buttons(); |
|
264 | 264 | } else { |
265 | - $data ["grid_buttons"] = json_encode ( array () ); |
|
265 | + $data ["grid_buttons"] = json_encode(array()); |
|
266 | 266 | } |
267 | - $data ['form_search'] = $this->form->build_serach_form ( $this->system_form->get_search_country_form () ); |
|
268 | - $this->load->view ( 'view_country_list', $data ); |
|
267 | + $data ['form_search'] = $this->form->build_serach_form($this->system_form->get_search_country_form()); |
|
268 | + $this->load->view('view_country_list', $data); |
|
269 | 269 | } |
270 | 270 | function country_list_json() { |
271 | - $json_data = array (); |
|
272 | - $count_all = $this->system_model->getcountry_list ( false ); |
|
273 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
271 | + $json_data = array(); |
|
272 | + $count_all = $this->system_model->getcountry_list(false); |
|
273 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
274 | 274 | $json_data = $paging_data ["json_paging"]; |
275 | - $query = $this->system_model->getcountry_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
276 | - $grid_fields = json_decode ( $this->system_form->build_country_list_for_admin () ); |
|
277 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
275 | + $query = $this->system_model->getcountry_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
276 | + $grid_fields = json_decode($this->system_form->build_country_list_for_admin()); |
|
277 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
278 | 278 | |
279 | - echo json_encode ( $json_data ); |
|
279 | + echo json_encode($json_data); |
|
280 | 280 | } |
281 | 281 | function country_list_search() { |
282 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
282 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
283 | 283 | |
284 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
285 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
286 | - $action = $this->input->post (); |
|
287 | - unset ( $action ['action'] ); |
|
288 | - unset ( $action ['advance_search'] ); |
|
289 | - $this->session->set_userdata ( 'country_list_search', $action ); |
|
284 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
285 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
286 | + $action = $this->input->post(); |
|
287 | + unset ($action ['action']); |
|
288 | + unset ($action ['advance_search']); |
|
289 | + $this->session->set_userdata('country_list_search', $action); |
|
290 | 290 | } |
291 | 291 | if (@$ajax_search != 1) { |
292 | - redirect ( base_url () . 'systems/country_list/' ); |
|
292 | + redirect(base_url().'systems/country_list/'); |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | function country_list_clearsearchfilter() { |
296 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
297 | - $this->session->set_userdata ( 'country_search', "" ); |
|
296 | + $this->session->set_userdata('advance_search', 0); |
|
297 | + $this->session->set_userdata('country_search', ""); |
|
298 | 298 | } |
299 | 299 | function country_add() { |
300 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
300 | + $data ['username'] = $this->session->userdata('user_name'); |
|
301 | 301 | $data ['flag'] = 'create'; |
302 | - $data ['page_title'] = gettext ( 'Add Country' ); |
|
303 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_country_form_fields (), '' ); |
|
304 | - $this->load->view ( 'view_country_add_edit', $data ); |
|
302 | + $data ['page_title'] = gettext('Add Country'); |
|
303 | + $data ['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), ''); |
|
304 | + $this->load->view('view_country_add_edit', $data); |
|
305 | 305 | } |
306 | 306 | function country_list_edit($edit_id = '') { |
307 | - $data ['page_title'] = gettext ( 'Edit Country' ); |
|
308 | - $where = array ( |
|
307 | + $data ['page_title'] = gettext('Edit Country'); |
|
308 | + $where = array( |
|
309 | 309 | 'id' => $edit_id |
310 | 310 | ); |
311 | - $account = $this->db_model->getSelect ( "*", "countrycode", $where ); |
|
312 | - foreach ( $account->result_array () as $key => $value ) { |
|
311 | + $account = $this->db_model->getSelect("*", "countrycode", $where); |
|
312 | + foreach ($account->result_array() as $key => $value) { |
|
313 | 313 | $edit_data = $value; |
314 | 314 | } |
315 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_country_form_fields (), $edit_data ); |
|
316 | - $this->load->view ( 'view_country_add_edit', $data ); |
|
315 | + $data ['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $edit_data); |
|
316 | + $this->load->view('view_country_add_edit', $data); |
|
317 | 317 | } |
318 | 318 | function country_save() { |
319 | - $add_array = $this->input->post (); |
|
320 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_country_form_fields (), $add_array ); |
|
319 | + $add_array = $this->input->post(); |
|
320 | + $data ['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $add_array); |
|
321 | 321 | if ($add_array ['id'] != '') { |
322 | - $data ['page_title'] = gettext ( 'Edit Country' ); |
|
323 | - if ($this->form_validation->run () == FALSE) { |
|
324 | - $data ['validation_errors'] = validation_errors (); |
|
322 | + $data ['page_title'] = gettext('Edit Country'); |
|
323 | + if ($this->form_validation->run() == FALSE) { |
|
324 | + $data ['validation_errors'] = validation_errors(); |
|
325 | 325 | echo $data ['validation_errors']; |
326 | 326 | exit (); |
327 | 327 | } else { |
328 | - $this->system_model->edit_country ( $add_array, $add_array ['id'] ); |
|
329 | - echo json_encode ( array ( |
|
330 | - "SUCCESS" => $add_array ["country"] . " country updated successfully!" |
|
331 | - ) ); |
|
328 | + $this->system_model->edit_country($add_array, $add_array ['id']); |
|
329 | + echo json_encode(array( |
|
330 | + "SUCCESS" => $add_array ["country"]." country updated successfully!" |
|
331 | + )); |
|
332 | 332 | exit (); |
333 | 333 | } |
334 | 334 | } else { |
335 | - $data ['page_title'] = gettext ( 'Add Country' ); |
|
336 | - if ($this->form_validation->run () == FALSE) { |
|
337 | - $data ['validation_errors'] = validation_errors (); |
|
335 | + $data ['page_title'] = gettext('Add Country'); |
|
336 | + if ($this->form_validation->run() == FALSE) { |
|
337 | + $data ['validation_errors'] = validation_errors(); |
|
338 | 338 | echo $data ['validation_errors']; |
339 | 339 | exit (); |
340 | 340 | } else { |
341 | - $response = $this->system_model->add_country ( $add_array ); |
|
342 | - echo json_encode ( array ( |
|
343 | - "SUCCESS" => $add_array ["country"] . " country added successfully!" |
|
344 | - ) ); |
|
341 | + $response = $this->system_model->add_country($add_array); |
|
342 | + echo json_encode(array( |
|
343 | + "SUCCESS" => $add_array ["country"]." country added successfully!" |
|
344 | + )); |
|
345 | 345 | exit (); |
346 | 346 | } |
347 | 347 | } |
348 | 348 | } |
349 | 349 | function country_remove($id) { |
350 | - $this->system_model->remove_country ( $id ); |
|
351 | - $country = $this->common->get_field_name ( 'country', 'countrycode', $id ); |
|
352 | - $this->session->set_flashdata ( 'astpp_notification', $country . 'Country removed successfully!' ); |
|
353 | - redirect ( base_url () . 'systems/country_list/' ); |
|
350 | + $this->system_model->remove_country($id); |
|
351 | + $country = $this->common->get_field_name('country', 'countrycode', $id); |
|
352 | + $this->session->set_flashdata('astpp_notification', $country.'Country removed successfully!'); |
|
353 | + redirect(base_url().'systems/country_list/'); |
|
354 | 354 | } |
355 | 355 | function country_delete_multiple() { |
356 | - $ids = $this->input->post ( "selected_ids", true ); |
|
356 | + $ids = $this->input->post("selected_ids", true); |
|
357 | 357 | $where = "id IN ($ids)"; |
358 | - $this->db->where ( $where ); |
|
359 | - echo $this->db->delete ( "countrycode" ); |
|
358 | + $this->db->where($where); |
|
359 | + echo $this->db->delete("countrycode"); |
|
360 | 360 | } |
361 | 361 | function currency_list() { |
362 | 362 | $base_currency = Common_model::$global_config ['system_config'] ['base_currency']; |
363 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
364 | - $data ['page_title'] = gettext ( 'Currencies' ); |
|
363 | + $data ['username'] = $this->session->userdata('user_name'); |
|
364 | + $data ['page_title'] = gettext('Currencies'); |
|
365 | 365 | $data ['search_flag'] = true; |
366 | 366 | $data ['cur_menu_no'] = 4; |
367 | - $this->session->set_userdata ( 'currency_search', 0 ); |
|
368 | - $data ['grid_fields'] = $this->system_form->build_currency_list_for_admin (); |
|
369 | - if ($this->session->userdata ( 'logintype' ) == 2) { |
|
370 | - $data ["grid_buttons"] = $this->system_form->build_admin_currency_grid_buttons (); |
|
367 | + $this->session->set_userdata('currency_search', 0); |
|
368 | + $data ['grid_fields'] = $this->system_form->build_currency_list_for_admin(); |
|
369 | + if ($this->session->userdata('logintype') == 2) { |
|
370 | + $data ["grid_buttons"] = $this->system_form->build_admin_currency_grid_buttons(); |
|
371 | 371 | } else { |
372 | - $data ["grid_buttons"] = json_encode ( array () ); |
|
372 | + $data ["grid_buttons"] = json_encode(array()); |
|
373 | 373 | } |
374 | - $data ['form_search'] = $this->form->build_serach_form ( $this->system_form->get_search_currency_form () ); |
|
375 | - $this->load->view ( 'view_currency_list', $data ); |
|
374 | + $data ['form_search'] = $this->form->build_serach_form($this->system_form->get_search_currency_form()); |
|
375 | + $this->load->view('view_currency_list', $data); |
|
376 | 376 | } |
377 | 377 | function currency_list_json() { |
378 | - $json_data = array (); |
|
378 | + $json_data = array(); |
|
379 | 379 | |
380 | - $count_all = $this->system_model->getcurrency_list ( false ); |
|
381 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
380 | + $count_all = $this->system_model->getcurrency_list(false); |
|
381 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
382 | 382 | $json_data = $paging_data ["json_paging"]; |
383 | 383 | |
384 | - $query = $this->system_model->getcurrency_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
385 | - $grid_fields = json_decode ( $this->system_form->build_currency_list_for_admin () ); |
|
386 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
384 | + $query = $this->system_model->getcurrency_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
385 | + $grid_fields = json_decode($this->system_form->build_currency_list_for_admin()); |
|
386 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
387 | 387 | |
388 | - echo json_encode ( $json_data ); |
|
388 | + echo json_encode($json_data); |
|
389 | 389 | } |
390 | 390 | function currency_list_search() { |
391 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
391 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
392 | 392 | |
393 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
394 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
395 | - $action = $this->input->post (); |
|
396 | - unset ( $action ['action'] ); |
|
397 | - unset ( $action ['advance_search'] ); |
|
398 | - $this->session->set_userdata ( 'currency_list_search', $action ); |
|
393 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
394 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
395 | + $action = $this->input->post(); |
|
396 | + unset ($action ['action']); |
|
397 | + unset ($action ['advance_search']); |
|
398 | + $this->session->set_userdata('currency_list_search', $action); |
|
399 | 399 | } |
400 | 400 | if (@$ajax_search != 1) { |
401 | - redirect ( base_url () . 'systems/currency_list/' ); |
|
401 | + redirect(base_url().'systems/currency_list/'); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | function currency_list_clearsearchfilter() { |
405 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
406 | - $this->session->set_userdata ( 'currency_search', "" ); |
|
405 | + $this->session->set_userdata('advance_search', 0); |
|
406 | + $this->session->set_userdata('currency_search', ""); |
|
407 | 407 | } |
408 | 408 | function currency_add() { |
409 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
409 | + $data ['username'] = $this->session->userdata('user_name'); |
|
410 | 410 | $data ['flag'] = 'create'; |
411 | - $data ['page_title'] = gettext ( 'Add Currency' ); |
|
412 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_currency_form_fields (), '' ); |
|
413 | - $this->load->view ( 'view_currency_add_edit', $data ); |
|
411 | + $data ['page_title'] = gettext('Add Currency'); |
|
412 | + $data ['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), ''); |
|
413 | + $this->load->view('view_currency_add_edit', $data); |
|
414 | 414 | } |
415 | 415 | function currency_list_edit($edit_id = '') { |
416 | - $data ['page_title'] = gettext ( 'Edit Currency' ); |
|
417 | - $where = array ( |
|
416 | + $data ['page_title'] = gettext('Edit Currency'); |
|
417 | + $where = array( |
|
418 | 418 | 'id' => $edit_id |
419 | 419 | ); |
420 | - $account = $this->db_model->getSelect ( "*", "currency", $where ); |
|
421 | - foreach ( $account->result_array () as $key => $value ) { |
|
420 | + $account = $this->db_model->getSelect("*", "currency", $where); |
|
421 | + foreach ($account->result_array() as $key => $value) { |
|
422 | 422 | $edit_data = $value; |
423 | 423 | } |
424 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_currency_form_fields (), $edit_data ); |
|
425 | - $this->load->view ( 'view_country_add_edit', $data ); |
|
424 | + $data ['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $edit_data); |
|
425 | + $this->load->view('view_country_add_edit', $data); |
|
426 | 426 | } |
427 | 427 | function currency_save() { |
428 | - $add_array = $this->input->post (); |
|
429 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_currency_form_fields (), $add_array ); |
|
428 | + $add_array = $this->input->post(); |
|
429 | + $data ['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $add_array); |
|
430 | 430 | if ($add_array ['id'] != '') { |
431 | - $data ['page_title'] = gettext ( 'Edit Currency' ); |
|
432 | - $data ['page_title'] = gettext ( 'Edit Currency' ); |
|
433 | - if ($this->form_validation->run () == FALSE) { |
|
434 | - $data ['validation_errors'] = validation_errors (); |
|
431 | + $data ['page_title'] = gettext('Edit Currency'); |
|
432 | + $data ['page_title'] = gettext('Edit Currency'); |
|
433 | + if ($this->form_validation->run() == FALSE) { |
|
434 | + $data ['validation_errors'] = validation_errors(); |
|
435 | 435 | echo $data ['validation_errors']; |
436 | 436 | exit (); |
437 | 437 | } else { |
438 | - $this->system_model->edit_currency ( $add_array, $add_array ['id'] ); |
|
439 | - echo json_encode ( array ( |
|
440 | - "SUCCESS" => $add_array ["currencyname"] . " currency updated successfully!" |
|
441 | - ) ); |
|
438 | + $this->system_model->edit_currency($add_array, $add_array ['id']); |
|
439 | + echo json_encode(array( |
|
440 | + "SUCCESS" => $add_array ["currencyname"]." currency updated successfully!" |
|
441 | + )); |
|
442 | 442 | exit (); |
443 | 443 | } |
444 | 444 | } else { |
445 | - $data ['page_title'] = gettext ( 'Create Currency' ); |
|
446 | - if ($this->form_validation->run () == FALSE) { |
|
447 | - $data ['validation_errors'] = validation_errors (); |
|
445 | + $data ['page_title'] = gettext('Create Currency'); |
|
446 | + if ($this->form_validation->run() == FALSE) { |
|
447 | + $data ['validation_errors'] = validation_errors(); |
|
448 | 448 | echo $data ['validation_errors']; |
449 | 449 | exit (); |
450 | 450 | } else { |
451 | - $response = $this->system_model->add_currency ( $add_array ); |
|
452 | - echo json_encode ( array ( |
|
453 | - "SUCCESS" => $add_array ["currencyname"] . " currency added successfully!" |
|
454 | - ) ); |
|
451 | + $response = $this->system_model->add_currency($add_array); |
|
452 | + echo json_encode(array( |
|
453 | + "SUCCESS" => $add_array ["currencyname"]." currency added successfully!" |
|
454 | + )); |
|
455 | 455 | exit (); |
456 | 456 | } |
457 | 457 | } |
458 | 458 | } |
459 | 459 | function currency_remove($id) { |
460 | - $currencyname = $this->common->get_field_name ( 'currencyname', 'currency', $id ); |
|
461 | - $this->system_model->remove_currency ( $id ); |
|
462 | - $this->session->set_flashdata ( 'astpp_notification', $currencyname . ' Currency removed successfully!' ); |
|
463 | - redirect ( base_url () . 'systems/currency_list/' ); |
|
460 | + $currencyname = $this->common->get_field_name('currencyname', 'currency', $id); |
|
461 | + $this->system_model->remove_currency($id); |
|
462 | + $this->session->set_flashdata('astpp_notification', $currencyname.' Currency removed successfully!'); |
|
463 | + redirect(base_url().'systems/currency_list/'); |
|
464 | 464 | } |
465 | 465 | function currency_delete_multiple() { |
466 | - $ids = $this->input->post ( "selected_ids", true ); |
|
466 | + $ids = $this->input->post("selected_ids", true); |
|
467 | 467 | $where = "id IN ($ids)"; |
468 | - $this->db->where ( $where ); |
|
469 | - echo $this->db->delete ( "currency" ); |
|
468 | + $this->db->where($where); |
|
469 | + echo $this->db->delete("currency"); |
|
470 | 470 | } |
471 | 471 | function database_backup() { |
472 | - $data = array (); |
|
473 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
474 | - $data ['page_title'] = gettext ( 'Database Backup' ); |
|
475 | - $filename = $this->db->database . "_" . date ( "YmdHms" ) . ".sql.gz"; |
|
476 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_backup_database_form_fields ( $filename ), '' ); |
|
477 | - $this->load->view ( 'view_database_backup', $data ); |
|
472 | + $data = array(); |
|
473 | + $data ['username'] = $this->session->userdata('user_name'); |
|
474 | + $data ['page_title'] = gettext('Database Backup'); |
|
475 | + $filename = $this->db->database."_".date("YmdHms").".sql.gz"; |
|
476 | + $data ['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($filename), ''); |
|
477 | + $this->load->view('view_database_backup', $data); |
|
478 | 478 | } |
479 | 479 | function database_backup_save() { |
480 | - $add_array = $this->input->post (); |
|
480 | + $add_array = $this->input->post(); |
|
481 | 481 | |
482 | - $data ['form'] = $this->form->build_form ( $this->system_form->get_backup_database_form_fields ( $add_array ['path'], $add_array ['id'] ), $add_array ); |
|
483 | - $data ['page_title'] = gettext ( 'Database Backup' ); |
|
482 | + $data ['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array ['path'], $add_array ['id']), $add_array); |
|
483 | + $data ['page_title'] = gettext('Database Backup'); |
|
484 | 484 | if ($add_array ['id'] != '') { |
485 | 485 | } else { |
486 | - if ($this->form_validation->run () == FALSE) { |
|
487 | - $data ['validation_errors'] = validation_errors (); |
|
486 | + if ($this->form_validation->run() == FALSE) { |
|
487 | + $data ['validation_errors'] = validation_errors(); |
|
488 | 488 | echo $data ['validation_errors']; |
489 | 489 | exit (); |
490 | 490 | } else { |
@@ -493,26 +493,26 @@ discard block |
||
493 | 493 | $db_password = $this->db->password; |
494 | 494 | $db_hostname = $this->db->hostname; |
495 | 495 | $filename = $add_array ['path']; |
496 | - $backup_file = DATABASE_DIRECTORY . $filename; |
|
497 | - if (substr ( $backup_file, - 3 ) == '.gz') { |
|
498 | - $backup_file = substr ( $backup_file, 0, - 3 ); |
|
496 | + $backup_file = DATABASE_DIRECTORY.$filename; |
|
497 | + if (substr($backup_file, - 3) == '.gz') { |
|
498 | + $backup_file = substr($backup_file, 0, - 3); |
|
499 | 499 | $do_gzip = 1; |
500 | 500 | } |
501 | 501 | |
502 | - $run_backup = "/usr/bin/mysqldump -all --databases " . $db_name . " -u'" . $db_username . "' -p'" . $db_password . "' > '$backup_file'"; |
|
502 | + $run_backup = "/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'"; |
|
503 | 503 | $error_zip = 0; |
504 | - exec ( $run_backup, $output, $error ); |
|
504 | + exec($run_backup, $output, $error); |
|
505 | 505 | if ($do_gzip) { |
506 | - $gzip = $this->config->item ( 'gzip-path' ); |
|
507 | - $run_gzip = $gzip . " " . $backup_file; |
|
508 | - exec ( $run_gzip, $output, $error_zip ); |
|
506 | + $gzip = $this->config->item('gzip-path'); |
|
507 | + $run_gzip = $gzip." ".$backup_file; |
|
508 | + exec($run_gzip, $output, $error_zip); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | if ($error == 0 && $error_zip == 0) { |
512 | - $this->system_model->backup_insert ( $add_array ); |
|
513 | - echo json_encode ( array ( |
|
514 | - "SUCCESS" => $add_array ['backup_name'] . " backup exported successfully!" |
|
515 | - ) ); |
|
512 | + $this->system_model->backup_insert($add_array); |
|
513 | + echo json_encode(array( |
|
514 | + "SUCCESS" => $add_array ['backup_name']." backup exported successfully!" |
|
515 | + )); |
|
516 | 516 | exit (); |
517 | 517 | } else { |
518 | 518 | echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section'; |
@@ -522,108 +522,108 @@ discard block |
||
522 | 522 | } |
523 | 523 | } |
524 | 524 | function database_restore() { |
525 | - $data ['page_title'] = gettext ( 'Database Restore' ); |
|
526 | - $data ['grid_fields'] = $this->system_form->build_backupdastabase_list (); |
|
527 | - $data ["grid_buttons"] = $this->system_form->build_backupdastabase_buttons (); |
|
528 | - $this->load->view ( 'view_database_list', $data ); |
|
525 | + $data ['page_title'] = gettext('Database Restore'); |
|
526 | + $data ['grid_fields'] = $this->system_form->build_backupdastabase_list(); |
|
527 | + $data ["grid_buttons"] = $this->system_form->build_backupdastabase_buttons(); |
|
528 | + $this->load->view('view_database_list', $data); |
|
529 | 529 | } |
530 | 530 | function database_restore_json() { |
531 | - $json_data = array (); |
|
532 | - $count_all = $this->system_model->getbackup_list ( false, "", "" ); |
|
533 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
531 | + $json_data = array(); |
|
532 | + $count_all = $this->system_model->getbackup_list(false, "", ""); |
|
533 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
534 | 534 | $json_data = $paging_data ["json_paging"]; |
535 | 535 | |
536 | - $query = $this->system_model->getbackup_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
537 | - $grid_fields = json_decode ( $this->system_form->build_backupdastabase_list () ); |
|
538 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
536 | + $query = $this->system_model->getbackup_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
537 | + $grid_fields = json_decode($this->system_form->build_backupdastabase_list()); |
|
538 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
539 | 539 | |
540 | - echo json_encode ( $json_data ); |
|
540 | + echo json_encode($json_data); |
|
541 | 541 | exit (); |
542 | 542 | } |
543 | 543 | function database_restore_one($id = '') { |
544 | - $result = $this->system_model->get_backup_data ( $id ); |
|
545 | - $result_array = $result->result_array (); |
|
546 | - if ($result->num_rows () > 0) { |
|
544 | + $result = $this->system_model->get_backup_data($id); |
|
545 | + $result_array = $result->result_array(); |
|
546 | + if ($result->num_rows() > 0) { |
|
547 | 547 | $db_name = $this->db->database; |
548 | 548 | $db_username = $this->db->username; |
549 | 549 | $db_password = $this->db->password; |
550 | 550 | $db_hostname = $this->db->hostname; |
551 | - $path = DATABASE_DIRECTORY . $result_array [0] ['path']; |
|
552 | - if (file_exists ( $path )) { |
|
553 | - if (substr ( $path, - 3 ) == '.gz') { |
|
554 | - $GUNZIP_EXE = $this->config->item ( 'gunzip-path' ); |
|
555 | - $run_gzip = $GUNZIP_EXE . " < " . $path . " | "; |
|
551 | + $path = DATABASE_DIRECTORY.$result_array [0] ['path']; |
|
552 | + if (file_exists($path)) { |
|
553 | + if (substr($path, - 3) == '.gz') { |
|
554 | + $GUNZIP_EXE = $this->config->item('gunzip-path'); |
|
555 | + $run_gzip = $GUNZIP_EXE." < ".$path." | "; |
|
556 | 556 | } |
557 | 557 | $MYSQL = "/usr/bin/mysql"; |
558 | - $run_restore = $run_gzip . $MYSQL . " -h" . $db_hostname . " -u" . $db_username . " -p" . $db_password . " " . $db_name; |
|
559 | - exec ( $run_restore ); |
|
560 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Database Restore successfully.' ); |
|
561 | - redirect ( base_url () . 'systems/database_restore/' ); |
|
558 | + $run_restore = $run_gzip.$MYSQL." -h".$db_hostname." -u".$db_username." -p".$db_password." ".$db_name; |
|
559 | + exec($run_restore); |
|
560 | + $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.'); |
|
561 | + redirect(base_url().'systems/database_restore/'); |
|
562 | 562 | } else { |
563 | - $this->session->set_flashdata ( 'astpp_notification', 'File not exists!' ); |
|
564 | - redirect ( base_url () . 'systems/database_restore/' ); |
|
563 | + $this->session->set_flashdata('astpp_notification', 'File not exists!'); |
|
564 | + redirect(base_url().'systems/database_restore/'); |
|
565 | 565 | } |
566 | 566 | } |
567 | - redirect ( base_url () . 'systems/database_restore/' ); |
|
567 | + redirect(base_url().'systems/database_restore/'); |
|
568 | 568 | } |
569 | 569 | function database_download($id = '') { |
570 | - $result = $this->system_model->get_backup_data ( $id ); |
|
571 | - $result_array = $result->result_array (); |
|
572 | - if ($result->num_rows () > 0) { |
|
573 | - $path = DATABASE_DIRECTORY. $result_array [0] ['path']; |
|
574 | - $filename = basename ( $path ); |
|
575 | - $len = filesize ( $path ); |
|
570 | + $result = $this->system_model->get_backup_data($id); |
|
571 | + $result_array = $result->result_array(); |
|
572 | + if ($result->num_rows() > 0) { |
|
573 | + $path = DATABASE_DIRECTORY.$result_array [0] ['path']; |
|
574 | + $filename = basename($path); |
|
575 | + $len = filesize($path); |
|
576 | 576 | |
577 | - header ( "Content-Encoding: binary" ); |
|
578 | - header ( "Content-Type: application/octet-stream" ); |
|
579 | - header ( "content-length: " . $len ); |
|
580 | - header ( "content-disposition: attachment; filename=" . $filename ); |
|
581 | - header ( "Expires: 0" ); |
|
582 | - header ( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); |
|
583 | - header ( "Cache-Control: private" ); |
|
584 | - header ( "Pragma: public" ); |
|
585 | - ob_clean (); |
|
586 | - $fp = fopen ( $path, "r" ); |
|
587 | - fpassthru ( $fp ); |
|
577 | + header("Content-Encoding: binary"); |
|
578 | + header("Content-Type: application/octet-stream"); |
|
579 | + header("content-length: ".$len); |
|
580 | + header("content-disposition: attachment; filename=".$filename); |
|
581 | + header("Expires: 0"); |
|
582 | + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
|
583 | + header("Cache-Control: private"); |
|
584 | + header("Pragma: public"); |
|
585 | + ob_clean(); |
|
586 | + $fp = fopen($path, "r"); |
|
587 | + fpassthru($fp); |
|
588 | 588 | exit (); |
589 | 589 | } |
590 | 590 | } |
591 | 591 | function database_import() { |
592 | - $data ['page_title'] = gettext ( 'Import Database' ); |
|
593 | - $this->load->view ( 'view_import_database', $data ); |
|
592 | + $data ['page_title'] = gettext('Import Database'); |
|
593 | + $this->load->view('view_import_database', $data); |
|
594 | 594 | } |
595 | 595 | function database_import_file() { |
596 | 596 | $filename = $_POST ['fname']; |
597 | - $upload_greeting_file = strtolower ( $_FILES ['userfile'] ['name'] ); |
|
598 | - $db_file = explode ( ".", $upload_greeting_file ); |
|
599 | - $last_key = array_pop ( $db_file ); |
|
597 | + $upload_greeting_file = strtolower($_FILES ['userfile'] ['name']); |
|
598 | + $db_file = explode(".", $upload_greeting_file); |
|
599 | + $last_key = array_pop($db_file); |
|
600 | 600 | if ($last_key == 'csv' || $last_key == 'tar' || $last_key == 'sql') { |
601 | - $target_path = basename ( $_FILES ['userfile'] ['name'] ); |
|
602 | - move_uploaded_file ( $_FILES ["userfile"] ["tmp_name"], $target_path ); |
|
601 | + $target_path = basename($_FILES ['userfile'] ['name']); |
|
602 | + move_uploaded_file($_FILES ["userfile"] ["tmp_name"], $target_path); |
|
603 | 603 | |
604 | - $query = $this->system_model->import_database ( $filename, $_FILES ['userfile'] ['name'] ); |
|
605 | - $this->session->set_flashdata ( 'astpp_errormsg', "The file " . basename ( $_FILES ['userfile'] ['name'] ) . " has been uploaded" ); |
|
606 | - redirect ( base_url () . "systems/database_restore/" ); |
|
604 | + $query = $this->system_model->import_database($filename, $_FILES ['userfile'] ['name']); |
|
605 | + $this->session->set_flashdata('astpp_errormsg', "The file ".basename($_FILES ['userfile'] ['name'])." has been uploaded"); |
|
606 | + redirect(base_url()."systems/database_restore/"); |
|
607 | 607 | } else { |
608 | - $this->session->set_flashdata ( 'astpp_notification', "There is a some issue or invalid file format." ); |
|
609 | - redirect ( base_url () . "systems/database_restore/" ); |
|
608 | + $this->session->set_flashdata('astpp_notification', "There is a some issue or invalid file format."); |
|
609 | + redirect(base_url()."systems/database_restore/"); |
|
610 | 610 | } |
611 | 611 | } |
612 | 612 | function database_delete($id) { |
613 | - $where = array ( |
|
613 | + $where = array( |
|
614 | 614 | "id" => $id |
615 | 615 | ); |
616 | - $this->db->where ( $where ); |
|
617 | - $this->db->delete ( "backup_database" ); |
|
618 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Database backup deleted successfully.' ); |
|
619 | - redirect ( base_url () . 'systems/database_restore/' ); |
|
616 | + $this->db->where($where); |
|
617 | + $this->db->delete("backup_database"); |
|
618 | + $this->session->set_flashdata('astpp_errormsg', 'Database backup deleted successfully.'); |
|
619 | + redirect(base_url().'systems/database_restore/'); |
|
620 | 620 | return true; |
621 | 621 | } |
622 | 622 | function database_backup_delete_multiple() { |
623 | - $ids = $this->input->post ( "selected_ids", true ); |
|
623 | + $ids = $this->input->post("selected_ids", true); |
|
624 | 624 | $where = "id IN ($ids)"; |
625 | - $this->db->where ( $where ); |
|
626 | - echo $this->db->delete ( "backup_database" ); |
|
625 | + $this->db->where($where); |
|
626 | + echo $this->db->delete("backup_database"); |
|
627 | 627 | } |
628 | 628 | } |
629 | 629 |
@@ -32,8 +32,9 @@ |
||
32 | 32 | $this->load->model ( 'system_model' ); |
33 | 33 | $this->load->dbutil (); |
34 | 34 | |
35 | - if ($this->session->userdata ( 'user_login' ) == FALSE) |
|
36 | - redirect ( base_url () . '/astpp/login' ); |
|
35 | + if ($this->session->userdata ( 'user_login' ) == FALSE) { |
|
36 | + redirect ( base_url () . '/astpp/login' ); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | function configuration_edit($edit_id = '') { |
39 | 40 | $data ['page_title'] = gettext ( 'Edit Settings' ); |
@@ -20,22 +20,22 @@ discard block |
||
20 | 20 | // You should have received a copy of the GNU Affero General Public License |
21 | 21 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | // ############################################################################## |
23 | -if (! defined ( 'BASEPATH' )) |
|
24 | - exit ( 'No direct script access allowed' ); |
|
23 | +if ( ! defined('BASEPATH')) |
|
24 | + exit ('No direct script access allowed'); |
|
25 | 25 | class System_form { |
26 | 26 | function get_template_form_fields() { |
27 | - $form ['forms'] = array ( |
|
28 | - base_url () . 'systems/template_save/', |
|
29 | - array ( |
|
27 | + $form ['forms'] = array( |
|
28 | + base_url().'systems/template_save/', |
|
29 | + array( |
|
30 | 30 | "template_form", |
31 | 31 | "name" => "template_form" |
32 | 32 | ) |
33 | 33 | ); |
34 | - $form ['Email Template'] = array ( |
|
35 | - array ( |
|
34 | + $form ['Email Template'] = array( |
|
35 | + array( |
|
36 | 36 | '', |
37 | 37 | 'HIDDEN', |
38 | - array ( |
|
38 | + array( |
|
39 | 39 | 'name' => 'id' |
40 | 40 | ), |
41 | 41 | '', |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | '', |
44 | 44 | '' |
45 | 45 | ), |
46 | - array ( |
|
47 | - gettext ( ' Name' ), |
|
46 | + array( |
|
47 | + gettext(' Name'), |
|
48 | 48 | 'INPUT', |
49 | - array ( |
|
49 | + array( |
|
50 | 50 | 'name' => 'name', |
51 | 51 | 'size' => '20', |
52 | 52 | 'readonly' => true, |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | 'tOOL TIP', |
57 | 57 | '' |
58 | 58 | ), |
59 | - array ( |
|
60 | - gettext ( 'Subject' ), |
|
59 | + array( |
|
60 | + gettext('Subject'), |
|
61 | 61 | 'INPUT', |
62 | - array ( |
|
62 | + array( |
|
63 | 63 | 'name' => 'subject', |
64 | 64 | 'size' => '20', |
65 | 65 | 'class' => "text field medium" |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | 'tOOL TIP', |
69 | 69 | '' |
70 | 70 | ), |
71 | - array ( |
|
72 | - gettext ( 'Body' ), |
|
71 | + array( |
|
72 | + gettext('Body'), |
|
73 | 73 | 'TEXTAREA', |
74 | - array ( |
|
74 | + array( |
|
75 | 75 | 'name' => 'template', |
76 | 76 | 'id' => 'template', |
77 | 77 | 'size' => '20', |
@@ -82,17 +82,17 @@ discard block |
||
82 | 82 | '' |
83 | 83 | ) |
84 | 84 | ); |
85 | - $form ['button_cancel'] = array ( |
|
85 | + $form ['button_cancel'] = array( |
|
86 | 86 | 'name' => 'action', |
87 | - 'content' => gettext ( 'Cancel' ), |
|
87 | + 'content' => gettext('Cancel'), |
|
88 | 88 | 'value' => 'cancel', |
89 | 89 | 'type' => 'button', |
90 | 90 | 'class' => 'btn btn-line-sky margin-x-10', |
91 | 91 | 'onclick' => 'return redirect_page(\'systems/template/\')' |
92 | 92 | ); |
93 | - $form ['button_save'] = array ( |
|
93 | + $form ['button_save'] = array( |
|
94 | 94 | 'name' => 'action', |
95 | - 'content' => gettext ( 'Save' ), |
|
95 | + 'content' => gettext('Save'), |
|
96 | 96 | 'value' => 'save', |
97 | 97 | 'type' => 'submit', |
98 | 98 | 'class' => 'btn btn-line-parrot' |
@@ -101,18 +101,18 @@ discard block |
||
101 | 101 | return $form; |
102 | 102 | } |
103 | 103 | function get_template_search_form() { |
104 | - $form ['forms'] = array ( |
|
104 | + $form ['forms'] = array( |
|
105 | 105 | "", |
106 | - array ( |
|
106 | + array( |
|
107 | 107 | 'id' => "template_search" |
108 | 108 | ) |
109 | 109 | ); |
110 | - $form ['Search'] = array ( |
|
110 | + $form ['Search'] = array( |
|
111 | 111 | |
112 | - array ( |
|
113 | - gettext ( 'Name' ), |
|
112 | + array( |
|
113 | + gettext('Name'), |
|
114 | 114 | 'INPUT', |
115 | - array ( |
|
115 | + array( |
|
116 | 116 | 'name' => 'name[name]', |
117 | 117 | '', |
118 | 118 | 'size' => '20', |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | 'search_string_type', |
129 | 129 | '' |
130 | 130 | ), |
131 | - array ( |
|
132 | - gettext ( 'Subject' ), |
|
131 | + array( |
|
132 | + gettext('Subject'), |
|
133 | 133 | 'INPUT', |
134 | - array ( |
|
134 | + array( |
|
135 | 135 | 'name' => 'subject[subject]', |
136 | 136 | '', |
137 | 137 | 'size' => '20', |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | 'search_string_type', |
148 | 148 | '' |
149 | 149 | ), |
150 | - array ( |
|
150 | + array( |
|
151 | 151 | '', |
152 | 152 | 'HIDDEN', |
153 | 153 | 'ajax_search', |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | '', |
157 | 157 | '' |
158 | 158 | ), |
159 | - array ( |
|
159 | + array( |
|
160 | 160 | '', |
161 | 161 | 'HIDDEN', |
162 | 162 | 'advance_search', |
@@ -166,18 +166,18 @@ discard block |
||
166 | 166 | '' |
167 | 167 | ) |
168 | 168 | ); |
169 | - $form ['button_search'] = array ( |
|
169 | + $form ['button_search'] = array( |
|
170 | 170 | 'name' => 'action', |
171 | 171 | 'id' => "template_search_btn", |
172 | - 'content' => gettext ( 'Search' ), |
|
172 | + 'content' => gettext('Search'), |
|
173 | 173 | 'value' => 'save', |
174 | 174 | 'type' => 'button', |
175 | 175 | 'class' => 'btn btn-line-parrot pull-right' |
176 | 176 | ); |
177 | - $form ['button_reset'] = array ( |
|
177 | + $form ['button_reset'] = array( |
|
178 | 178 | 'name' => 'action', |
179 | 179 | 'id' => "id_reset", |
180 | - 'content' => gettext ( 'Clear' ), |
|
180 | + 'content' => gettext('Clear'), |
|
181 | 181 | 'value' => 'cancel', |
182 | 182 | 'type' => 'reset', |
183 | 183 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -185,18 +185,18 @@ discard block |
||
185 | 185 | return $form; |
186 | 186 | } |
187 | 187 | function get_configuration_form_fields() { |
188 | - $form ['forms'] = array ( |
|
189 | - base_url () . 'systems/configuration_save/', |
|
190 | - array ( |
|
188 | + $form ['forms'] = array( |
|
189 | + base_url().'systems/configuration_save/', |
|
190 | + array( |
|
191 | 191 | "id" => "config_form", |
192 | 192 | "name" => "config_form" |
193 | 193 | ) |
194 | 194 | ); |
195 | - $form ['Edit Settings '] = array ( |
|
196 | - array ( |
|
195 | + $form ['Edit Settings '] = array( |
|
196 | + array( |
|
197 | 197 | '', |
198 | 198 | 'HIDDEN', |
199 | - array ( |
|
199 | + array( |
|
200 | 200 | 'name' => 'id' |
201 | 201 | ), |
202 | 202 | '', |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | '', |
205 | 205 | '' |
206 | 206 | ), |
207 | - array ( |
|
208 | - gettext ( 'Name' ), |
|
207 | + array( |
|
208 | + gettext('Name'), |
|
209 | 209 | 'INPUT', |
210 | - array ( |
|
210 | + array( |
|
211 | 211 | 'name' => 'name', |
212 | 212 | 'size' => '20', |
213 | 213 | 'readonly' => true, |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | 'tOOL TIP', |
218 | 218 | '' |
219 | 219 | ), |
220 | - array ( |
|
221 | - gettext ( 'Value' ), |
|
220 | + array( |
|
221 | + gettext('Value'), |
|
222 | 222 | 'INPUT', |
223 | - array ( |
|
223 | + array( |
|
224 | 224 | 'name' => 'value', |
225 | 225 | 'size' => '20', |
226 | 226 | 'class' => "text field medium" |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | 'tOOL TIP', |
230 | 230 | '' |
231 | 231 | ), |
232 | - array ( |
|
233 | - gettext ( 'Comment' ), |
|
232 | + array( |
|
233 | + gettext('Comment'), |
|
234 | 234 | 'INPUT', |
235 | - array ( |
|
235 | + array( |
|
236 | 236 | 'name' => 'comment', |
237 | 237 | 'size' => '20', |
238 | 238 | 'class' => "text field medium" |
@@ -243,17 +243,17 @@ discard block |
||
243 | 243 | ) |
244 | 244 | ); |
245 | 245 | |
246 | - $form ['button_cancel'] = array ( |
|
246 | + $form ['button_cancel'] = array( |
|
247 | 247 | 'name' => 'action', |
248 | - 'content' => gettext ( 'Cancel' ), |
|
248 | + 'content' => gettext('Cancel'), |
|
249 | 249 | 'value' => 'cancel', |
250 | 250 | 'type' => 'button', |
251 | 251 | 'class' => 'btn btn-line-sky margin-x-10', |
252 | 252 | 'onclick' => 'return redirect_page(\'NULL\')' |
253 | 253 | ); |
254 | - $form ['button_save'] = array ( |
|
254 | + $form ['button_save'] = array( |
|
255 | 255 | 'name' => 'action', |
256 | - 'content' => gettext ( 'Save' ), |
|
256 | + 'content' => gettext('Save'), |
|
257 | 257 | 'value' => 'save', |
258 | 258 | 'id' => 'submit', |
259 | 259 | 'type' => 'button', |
@@ -263,18 +263,18 @@ discard block |
||
263 | 263 | return $form; |
264 | 264 | } |
265 | 265 | function get_configuration_search_form() { |
266 | - $form ['forms'] = array ( |
|
266 | + $form ['forms'] = array( |
|
267 | 267 | "", |
268 | - array ( |
|
268 | + array( |
|
269 | 269 | 'id' => "configuration_search" |
270 | 270 | ) |
271 | 271 | ); |
272 | - $form ['Search'] = array ( |
|
272 | + $form ['Search'] = array( |
|
273 | 273 | |
274 | - array ( |
|
275 | - gettext ( 'Name' ), |
|
274 | + array( |
|
275 | + gettext('Name'), |
|
276 | 276 | 'INPUT', |
277 | - array ( |
|
277 | + array( |
|
278 | 278 | 'name' => 'name[name]', |
279 | 279 | '', |
280 | 280 | 'size' => '20', |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | 'search_string_type', |
291 | 291 | '' |
292 | 292 | ), |
293 | - array ( |
|
294 | - gettext ( 'Value' ), |
|
293 | + array( |
|
294 | + gettext('Value'), |
|
295 | 295 | 'INPUT', |
296 | - array ( |
|
296 | + array( |
|
297 | 297 | 'name' => 'value[value]', |
298 | 298 | '', |
299 | 299 | 'size' => '20', |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | 'search_string_type', |
310 | 310 | '' |
311 | 311 | ), |
312 | - array ( |
|
313 | - gettext ( 'Description' ), |
|
312 | + array( |
|
313 | + gettext('Description'), |
|
314 | 314 | 'INPUT', |
315 | - array ( |
|
315 | + array( |
|
316 | 316 | 'name' => 'comment[comment]', |
317 | 317 | '', |
318 | 318 | 'size' => '20', |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | 'search_string_type', |
329 | 329 | '' |
330 | 330 | ), |
331 | - array ( |
|
332 | - gettext ( 'Group' ), |
|
331 | + array( |
|
332 | + gettext('Group'), |
|
333 | 333 | 'group_title', |
334 | 334 | 'SELECT', |
335 | 335 | '', |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | 'group_by', |
346 | 346 | 'group_title' |
347 | 347 | ), |
348 | - array ( |
|
348 | + array( |
|
349 | 349 | '', |
350 | 350 | 'HIDDEN', |
351 | 351 | 'ajax_search', |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | '', |
355 | 355 | '' |
356 | 356 | ), |
357 | - array ( |
|
357 | + array( |
|
358 | 358 | '', |
359 | 359 | 'HIDDEN', |
360 | 360 | 'advance_search', |
@@ -364,18 +364,18 @@ discard block |
||
364 | 364 | '' |
365 | 365 | ) |
366 | 366 | ); |
367 | - $form ['button_search'] = array ( |
|
367 | + $form ['button_search'] = array( |
|
368 | 368 | 'name' => 'action', |
369 | 369 | 'id' => "configuration_search_btn", |
370 | - 'content' => gettext ( 'Search' ), |
|
370 | + 'content' => gettext('Search'), |
|
371 | 371 | 'value' => 'save', |
372 | 372 | 'type' => 'button', |
373 | 373 | 'class' => 'btn btn-line-parrot pull-right' |
374 | 374 | ); |
375 | - $form ['button_reset'] = array ( |
|
375 | + $form ['button_reset'] = array( |
|
376 | 376 | 'name' => 'action', |
377 | 377 | 'id' => "id_reset", |
378 | - 'content' => gettext ( 'Clear' ), |
|
378 | + 'content' => gettext('Clear'), |
|
379 | 379 | 'value' => 'cancel', |
380 | 380 | 'type' => 'reset', |
381 | 381 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -383,63 +383,63 @@ discard block |
||
383 | 383 | return $form; |
384 | 384 | } |
385 | 385 | function build_system_list_for_admin() { |
386 | - $grid_field_arr = json_encode ( array ( |
|
387 | - array ( |
|
388 | - gettext ( "Name" ), |
|
386 | + $grid_field_arr = json_encode(array( |
|
387 | + array( |
|
388 | + gettext("Name"), |
|
389 | 389 | "190", |
390 | 390 | "name", |
391 | 391 | "", |
392 | 392 | "", |
393 | 393 | "" |
394 | 394 | ), |
395 | - array ( |
|
396 | - gettext ( "Value" ), |
|
395 | + array( |
|
396 | + gettext("Value"), |
|
397 | 397 | "190", |
398 | 398 | "value", |
399 | 399 | "", |
400 | 400 | "", |
401 | 401 | "" |
402 | 402 | ), |
403 | - array ( |
|
404 | - gettext ( "Description" ), |
|
403 | + array( |
|
404 | + gettext("Description"), |
|
405 | 405 | "320", |
406 | 406 | "comment", |
407 | 407 | "", |
408 | 408 | "", |
409 | 409 | "" |
410 | 410 | ), |
411 | - array ( |
|
412 | - gettext ( "Group" ), |
|
411 | + array( |
|
412 | + gettext("Group"), |
|
413 | 413 | "120", |
414 | 414 | "group_title", |
415 | 415 | "", |
416 | 416 | "", |
417 | 417 | "" |
418 | 418 | ), |
419 | - array ( |
|
420 | - gettext ( "Action" ), |
|
419 | + array( |
|
420 | + gettext("Action"), |
|
421 | 421 | "442", |
422 | 422 | "", |
423 | 423 | "", |
424 | 424 | "", |
425 | - array ( |
|
426 | - "EDIT" => array ( |
|
425 | + array( |
|
426 | + "EDIT" => array( |
|
427 | 427 | "url" => "systems/configuration_edit/", |
428 | 428 | "mode" => "popup" |
429 | 429 | ) |
430 | 430 | ) |
431 | 431 | ) |
432 | - ) ); |
|
432 | + )); |
|
433 | 433 | return $grid_field_arr; |
434 | 434 | } |
435 | 435 | function build_grid_buttons() { |
436 | - $buttons_json = json_encode ( array () ); |
|
436 | + $buttons_json = json_encode(array()); |
|
437 | 437 | return $buttons_json; |
438 | 438 | } |
439 | 439 | function build_template_list_for_admin() { |
440 | - $grid_field_arr = json_encode ( array ( |
|
441 | - array ( |
|
442 | - gettext ( "Name" ), |
|
440 | + $grid_field_arr = json_encode(array( |
|
441 | + array( |
|
442 | + gettext("Name"), |
|
443 | 443 | "425", |
444 | 444 | "name", |
445 | 445 | "", |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | "true", |
450 | 450 | "center" |
451 | 451 | ), |
452 | - array ( |
|
453 | - gettext ( "Subject" ), |
|
452 | + array( |
|
453 | + gettext("Subject"), |
|
454 | 454 | "650", |
455 | 455 | "subject", |
456 | 456 | "", |
@@ -460,28 +460,28 @@ discard block |
||
460 | 460 | "true", |
461 | 461 | "center" |
462 | 462 | ), |
463 | - array ( |
|
464 | - gettext ( "Action" ), |
|
463 | + array( |
|
464 | + gettext("Action"), |
|
465 | 465 | "200", |
466 | 466 | "", |
467 | 467 | "", |
468 | 468 | "", |
469 | - array ( |
|
470 | - "EDIT" => array ( |
|
469 | + array( |
|
470 | + "EDIT" => array( |
|
471 | 471 | "url" => "systems/template_edit/", |
472 | 472 | "mode" => "single" |
473 | 473 | ) |
474 | 474 | ) |
475 | 475 | ) |
476 | - ) ); |
|
476 | + )); |
|
477 | 477 | return $grid_field_arr; |
478 | 478 | } |
479 | 479 | function build_country_list_for_admin() { |
480 | 480 | $action = 'systems/country_list_edit/'; |
481 | 481 | $action_remove = 'systems/country_remove/'; |
482 | 482 | $mode = "popup"; |
483 | - $grid_field_arr = json_encode ( array ( |
|
484 | - array ( |
|
483 | + $grid_field_arr = json_encode(array( |
|
484 | + array( |
|
485 | 485 | "<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", |
486 | 486 | "50", |
487 | 487 | "", |
@@ -492,8 +492,8 @@ discard block |
||
492 | 492 | "false", |
493 | 493 | "center" |
494 | 494 | ), |
495 | - array ( |
|
496 | - gettext ( "Name" ), |
|
495 | + array( |
|
496 | + gettext("Name"), |
|
497 | 497 | "705", |
498 | 498 | "country", |
499 | 499 | "", |
@@ -503,56 +503,56 @@ discard block |
||
503 | 503 | "true", |
504 | 504 | "center" |
505 | 505 | ), |
506 | - array ( |
|
507 | - gettext ( "Action" ), |
|
506 | + array( |
|
507 | + gettext("Action"), |
|
508 | 508 | "100", |
509 | 509 | "", |
510 | 510 | "", |
511 | 511 | "", |
512 | - array ( |
|
513 | - "EDIT" => array ( |
|
512 | + array( |
|
513 | + "EDIT" => array( |
|
514 | 514 | "url" => "$action", |
515 | 515 | "mode" => "$mode" |
516 | 516 | ), |
517 | - "DELETE" => array ( |
|
517 | + "DELETE" => array( |
|
518 | 518 | "url" => "$action_remove", |
519 | 519 | "mode" => "single" |
520 | 520 | ) |
521 | 521 | ) |
522 | 522 | ) |
523 | - ) ); |
|
523 | + )); |
|
524 | 524 | return $grid_field_arr; |
525 | 525 | } |
526 | 526 | function build_admin_grid_buttons() { |
527 | - $buttons_json = json_encode ( array ( |
|
528 | - array ( |
|
529 | - gettext ( "Create" ), |
|
527 | + $buttons_json = json_encode(array( |
|
528 | + array( |
|
529 | + gettext("Create"), |
|
530 | 530 | "btn btn-line-warning btn", |
531 | 531 | "fa fa-plus-circle fa-lg", |
532 | 532 | "button_action", |
533 | 533 | "systems/country_add/", |
534 | 534 | "popup" |
535 | 535 | ), |
536 | - array ( |
|
537 | - gettext ( "Delete" ), |
|
536 | + array( |
|
537 | + gettext("Delete"), |
|
538 | 538 | "btn btn-line-danger", |
539 | 539 | "fa fa-times-circle fa-lg", |
540 | 540 | "button_action", |
541 | 541 | "systems/country_delete_multiple" |
542 | 542 | ) |
543 | - ) ); |
|
543 | + )); |
|
544 | 544 | return $buttons_json; |
545 | 545 | } |
546 | 546 | function get_search_country_form() { |
547 | - $form ['forms'] = array ( |
|
547 | + $form ['forms'] = array( |
|
548 | 548 | "", |
549 | - array ( |
|
549 | + array( |
|
550 | 550 | 'id' => "country_search" |
551 | 551 | ) |
552 | 552 | ); |
553 | - $form ['Search'] = array ( |
|
554 | - array ( |
|
555 | - gettext ( 'Name' ), |
|
553 | + $form ['Search'] = array( |
|
554 | + array( |
|
555 | + gettext('Name'), |
|
556 | 556 | 'id', |
557 | 557 | 'SELECT', |
558 | 558 | '', |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | '', |
567 | 567 | '' |
568 | 568 | ), |
569 | - array ( |
|
569 | + array( |
|
570 | 570 | '', |
571 | 571 | 'HIDDEN', |
572 | 572 | 'ajax_search', |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | '', |
576 | 576 | '' |
577 | 577 | ), |
578 | - array ( |
|
578 | + array( |
|
579 | 579 | '', |
580 | 580 | 'HIDDEN', |
581 | 581 | 'advance_search', |
@@ -587,18 +587,18 @@ discard block |
||
587 | 587 | ) |
588 | 588 | ; |
589 | 589 | |
590 | - $form ['button_search'] = array ( |
|
590 | + $form ['button_search'] = array( |
|
591 | 591 | 'name' => 'action', |
592 | 592 | 'id' => "country_search_btn", |
593 | - 'content' => gettext ( 'Search' ), |
|
593 | + 'content' => gettext('Search'), |
|
594 | 594 | 'value' => 'save', |
595 | 595 | 'type' => 'button', |
596 | 596 | 'class' => 'btn btn-line-parrot pull-right' |
597 | 597 | ); |
598 | - $form ['button_reset'] = array ( |
|
598 | + $form ['button_reset'] = array( |
|
599 | 599 | 'name' => 'action', |
600 | 600 | 'id' => "id_reset", |
601 | - 'content' => gettext ( 'Clear' ), |
|
601 | + 'content' => gettext('Clear'), |
|
602 | 602 | 'value' => 'cancel', |
603 | 603 | 'type' => 'reset', |
604 | 604 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -607,19 +607,19 @@ discard block |
||
607 | 607 | return $form; |
608 | 608 | } |
609 | 609 | function get_country_form_fields() { |
610 | - $form ['forms'] = array ( |
|
611 | - base_url () . 'systems/country_save/', |
|
612 | - array ( |
|
610 | + $form ['forms'] = array( |
|
611 | + base_url().'systems/country_save/', |
|
612 | + array( |
|
613 | 613 | 'id' => 'system_form', |
614 | 614 | 'method' => 'POST', |
615 | 615 | 'name' => 'system_form' |
616 | 616 | ) |
617 | 617 | ); |
618 | - $form ['Country List'] = array ( |
|
619 | - array ( |
|
618 | + $form ['Country List'] = array( |
|
619 | + array( |
|
620 | 620 | '', |
621 | 621 | 'HIDDEN', |
622 | - array ( |
|
622 | + array( |
|
623 | 623 | 'name' => 'id' |
624 | 624 | ), |
625 | 625 | '', |
@@ -627,10 +627,10 @@ discard block |
||
627 | 627 | '', |
628 | 628 | '' |
629 | 629 | ), |
630 | - array ( |
|
631 | - gettext ( 'Name' ), |
|
630 | + array( |
|
631 | + gettext('Name'), |
|
632 | 632 | 'INPUT', |
633 | - array ( |
|
633 | + array( |
|
634 | 634 | 'name' => 'country', |
635 | 635 | 'size' => '20', |
636 | 636 | 'class' => "text field medium" |
@@ -641,17 +641,17 @@ discard block |
||
641 | 641 | ) |
642 | 642 | ) |
643 | 643 | ; |
644 | - $form ['button_save'] = array ( |
|
644 | + $form ['button_save'] = array( |
|
645 | 645 | 'name' => 'action', |
646 | - 'content' => gettext ( 'Save' ), |
|
646 | + 'content' => gettext('Save'), |
|
647 | 647 | 'value' => 'save', |
648 | 648 | 'id' => 'submit', |
649 | 649 | 'type' => 'button', |
650 | 650 | 'class' => 'btn btn-line-parrot' |
651 | 651 | ); |
652 | - $form ['button_cancel'] = array ( |
|
652 | + $form ['button_cancel'] = array( |
|
653 | 653 | 'name' => 'action', |
654 | - 'content' => gettext ( 'Close' ), |
|
654 | + 'content' => gettext('Close'), |
|
655 | 655 | 'value' => 'cancel', |
656 | 656 | 'type' => 'button', |
657 | 657 | 'class' => 'btn btn-line-sky margin-x-10', |
@@ -664,8 +664,8 @@ discard block |
||
664 | 664 | $action_remove = 'systems/currency_remove/'; |
665 | 665 | $mode = "popup"; |
666 | 666 | |
667 | - $grid_field_arr = json_encode ( array ( |
|
668 | - array ( |
|
667 | + $grid_field_arr = json_encode(array( |
|
668 | + array( |
|
669 | 669 | "<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", |
670 | 670 | "70", |
671 | 671 | "", |
@@ -676,8 +676,8 @@ discard block |
||
676 | 676 | "false", |
677 | 677 | "center" |
678 | 678 | ), |
679 | - array ( |
|
680 | - gettext ( "Name" ), |
|
679 | + array( |
|
680 | + gettext("Name"), |
|
681 | 681 | "320", |
682 | 682 | "currencyname", |
683 | 683 | "", |
@@ -687,8 +687,8 @@ discard block |
||
687 | 687 | "true", |
688 | 688 | "center" |
689 | 689 | ), |
690 | - array ( |
|
691 | - gettext ( "Code" ), |
|
690 | + array( |
|
691 | + gettext("Code"), |
|
692 | 692 | "290", |
693 | 693 | "currency", |
694 | 694 | "", |
@@ -698,8 +698,8 @@ discard block |
||
698 | 698 | "true", |
699 | 699 | "center" |
700 | 700 | ), |
701 | - array ( |
|
702 | - gettext ( "Rate" ), |
|
701 | + array( |
|
702 | + gettext("Rate"), |
|
703 | 703 | "330", |
704 | 704 | "currencyrate", |
705 | 705 | "", |
@@ -709,39 +709,39 @@ discard block |
||
709 | 709 | "true", |
710 | 710 | "right" |
711 | 711 | ), |
712 | - array ( |
|
713 | - gettext ( "Action" ), |
|
712 | + array( |
|
713 | + gettext("Action"), |
|
714 | 714 | "265", |
715 | 715 | "", |
716 | 716 | "", |
717 | 717 | "", |
718 | - array ( |
|
719 | - "EDIT" => array ( |
|
718 | + array( |
|
719 | + "EDIT" => array( |
|
720 | 720 | "url" => "$action", |
721 | 721 | "mode" => "$mode" |
722 | 722 | ), |
723 | - "DELETE" => array ( |
|
723 | + "DELETE" => array( |
|
724 | 724 | "url" => "$action_remove", |
725 | 725 | "mode" => "single" |
726 | 726 | ) |
727 | 727 | ) |
728 | 728 | ) |
729 | - ) ); |
|
729 | + )); |
|
730 | 730 | return $grid_field_arr; |
731 | 731 | } |
732 | 732 | function get_search_currency_form() { |
733 | - $form ['forms'] = array ( |
|
733 | + $form ['forms'] = array( |
|
734 | 734 | "", |
735 | - array ( |
|
735 | + array( |
|
736 | 736 | 'id' => "currency_search" |
737 | 737 | ) |
738 | 738 | ); |
739 | - $form ['Search'] = array ( |
|
739 | + $form ['Search'] = array( |
|
740 | 740 | |
741 | - array ( |
|
742 | - gettext ( 'Name' ), |
|
741 | + array( |
|
742 | + gettext('Name'), |
|
743 | 743 | 'INPUT', |
744 | - array ( |
|
744 | + array( |
|
745 | 745 | 'name' => 'currencyname[currencyname]', |
746 | 746 | '', |
747 | 747 | 'size' => '20', |
@@ -757,10 +757,10 @@ discard block |
||
757 | 757 | 'search_string_type', |
758 | 758 | '' |
759 | 759 | ), |
760 | - array ( |
|
761 | - gettext ( 'Code' ), |
|
760 | + array( |
|
761 | + gettext('Code'), |
|
762 | 762 | 'INPUT', |
763 | - array ( |
|
763 | + array( |
|
764 | 764 | 'name' => 'currency[currency]', |
765 | 765 | '', |
766 | 766 | 'size' => '20', |
@@ -776,10 +776,10 @@ discard block |
||
776 | 776 | 'search_string_type', |
777 | 777 | '' |
778 | 778 | ), |
779 | - array ( |
|
780 | - gettext ( 'Rate' ), |
|
779 | + array( |
|
780 | + gettext('Rate'), |
|
781 | 781 | 'INPUT', |
782 | - array ( |
|
782 | + array( |
|
783 | 783 | 'name' => 'currencyrate[currencyrate]', |
784 | 784 | '', |
785 | 785 | 'size' => '20', |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | 'search_int_type', |
796 | 796 | '' |
797 | 797 | ), |
798 | - array ( |
|
798 | + array( |
|
799 | 799 | '', |
800 | 800 | 'HIDDEN', |
801 | 801 | 'ajax_search', |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | '', |
805 | 805 | '' |
806 | 806 | ), |
807 | - array ( |
|
807 | + array( |
|
808 | 808 | '', |
809 | 809 | 'HIDDEN', |
810 | 810 | 'advance_search', |
@@ -815,18 +815,18 @@ discard block |
||
815 | 815 | ) |
816 | 816 | ); |
817 | 817 | |
818 | - $form ['button_search'] = array ( |
|
818 | + $form ['button_search'] = array( |
|
819 | 819 | 'name' => 'action', |
820 | 820 | 'id' => "currency_search_btn", |
821 | - 'content' => gettext ( 'Search' ), |
|
821 | + 'content' => gettext('Search'), |
|
822 | 822 | 'value' => 'save', |
823 | 823 | 'type' => 'button', |
824 | 824 | 'class' => 'btn btn-line-parrot pull-right' |
825 | 825 | ); |
826 | - $form ['button_reset'] = array ( |
|
826 | + $form ['button_reset'] = array( |
|
827 | 827 | 'name' => 'action', |
828 | 828 | 'id' => "id_reset", |
829 | - 'content' => gettext ( 'Clear' ), |
|
829 | + 'content' => gettext('Clear'), |
|
830 | 830 | 'value' => 'cancel', |
831 | 831 | 'type' => 'reset', |
832 | 832 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -835,19 +835,19 @@ discard block |
||
835 | 835 | return $form; |
836 | 836 | } |
837 | 837 | function get_currency_form_fields() { |
838 | - $form ['forms'] = array ( |
|
839 | - base_url () . 'systems/currency_save/', |
|
840 | - array ( |
|
838 | + $form ['forms'] = array( |
|
839 | + base_url().'systems/currency_save/', |
|
840 | + array( |
|
841 | 841 | 'id' => 'system_form', |
842 | 842 | 'method' => 'POST', |
843 | 843 | 'name' => 'system_form' |
844 | 844 | ) |
845 | 845 | ); |
846 | - $form ['Currency List'] = array ( |
|
847 | - array ( |
|
846 | + $form ['Currency List'] = array( |
|
847 | + array( |
|
848 | 848 | '', |
849 | 849 | 'HIDDEN', |
850 | - array ( |
|
850 | + array( |
|
851 | 851 | 'name' => 'id' |
852 | 852 | ), |
853 | 853 | '', |
@@ -855,10 +855,10 @@ discard block |
||
855 | 855 | '', |
856 | 856 | '' |
857 | 857 | ), |
858 | - array ( |
|
859 | - gettext ( 'Name' ), |
|
858 | + array( |
|
859 | + gettext('Name'), |
|
860 | 860 | 'INPUT', |
861 | - array ( |
|
861 | + array( |
|
862 | 862 | 'name' => 'currencyname', |
863 | 863 | 'size' => '20', |
864 | 864 | 'maxlength' => '40', |
@@ -868,10 +868,10 @@ discard block |
||
868 | 868 | 'tOOL TIP', |
869 | 869 | 'Please Enter country' |
870 | 870 | ), |
871 | - array ( |
|
872 | - gettext ( 'Code' ), |
|
871 | + array( |
|
872 | + gettext('Code'), |
|
873 | 873 | 'INPUT', |
874 | - array ( |
|
874 | + array( |
|
875 | 875 | 'name' => 'currency', |
876 | 876 | 'size' => '20', |
877 | 877 | 'maxlength' => '3', |
@@ -881,10 +881,10 @@ discard block |
||
881 | 881 | 'tOOL TIP', |
882 | 882 | 'Please Enter country' |
883 | 883 | ), |
884 | - array ( |
|
885 | - gettext ( 'Rate' ), |
|
884 | + array( |
|
885 | + gettext('Rate'), |
|
886 | 886 | 'INPUT', |
887 | - array ( |
|
887 | + array( |
|
888 | 888 | 'name' => 'currencyrate', |
889 | 889 | 'size' => '20', |
890 | 890 | 'maxlength' => '7', |
@@ -896,17 +896,17 @@ discard block |
||
896 | 896 | ) |
897 | 897 | ) |
898 | 898 | ; |
899 | - $form ['button_save'] = array ( |
|
899 | + $form ['button_save'] = array( |
|
900 | 900 | 'name' => 'action', |
901 | - 'content' => gettext ( 'Save' ), |
|
901 | + 'content' => gettext('Save'), |
|
902 | 902 | 'value' => 'save', |
903 | 903 | 'id' => 'submit', |
904 | 904 | 'type' => 'button', |
905 | 905 | 'class' => 'btn btn-line-parrot' |
906 | 906 | ); |
907 | - $form ['button_cancel'] = array ( |
|
907 | + $form ['button_cancel'] = array( |
|
908 | 908 | 'name' => 'action', |
909 | - 'content' => gettext ( 'Close' ), |
|
909 | + 'content' => gettext('Close'), |
|
910 | 910 | 'value' => 'cancel', |
911 | 911 | 'type' => 'button', |
912 | 912 | 'class' => 'btn btn-line-sky margin-x-10', |
@@ -915,48 +915,48 @@ discard block |
||
915 | 915 | return $form; |
916 | 916 | } |
917 | 917 | function build_admin_currency_grid_buttons() { |
918 | - $buttons_json = json_encode ( array ( |
|
919 | - array ( |
|
920 | - gettext ( "Create" ), |
|
918 | + $buttons_json = json_encode(array( |
|
919 | + array( |
|
920 | + gettext("Create"), |
|
921 | 921 | "btn btn-line-warning btn", |
922 | 922 | "fa fa-plus-circle fa-lg", |
923 | 923 | "button_action", |
924 | 924 | "systems/currency_add/", |
925 | 925 | "popup" |
926 | 926 | ), |
927 | - array ( |
|
928 | - gettext ( "Update Currencies" ), |
|
927 | + array( |
|
928 | + gettext("Update Currencies"), |
|
929 | 929 | "btn btn-line-blue", |
930 | 930 | "fa fa-upload fa-lg", |
931 | 931 | "button_action", |
932 | 932 | "currencyupdate/update_currency/", |
933 | 933 | 'single' |
934 | 934 | ), |
935 | - array ( |
|
936 | - gettext ( "Delete" ), |
|
935 | + array( |
|
936 | + gettext("Delete"), |
|
937 | 937 | "btn btn-line-danger", |
938 | 938 | "fa fa-times-circle fa-lg", |
939 | 939 | "button_action", |
940 | 940 | "systems/currency_delete_multiple" |
941 | 941 | ) |
942 | - ) ); |
|
942 | + )); |
|
943 | 943 | return $buttons_json; |
944 | 944 | } |
945 | 945 | function get_backup_database_form_fields($file_name, $id = '') { |
946 | 946 | $val = $id > 0 ? "backup_database.path.$id" : 'backup_database.path'; |
947 | - $form ['forms'] = array ( |
|
948 | - base_url () . 'systems/database_backup_save/', |
|
949 | - array ( |
|
947 | + $form ['forms'] = array( |
|
948 | + base_url().'systems/database_backup_save/', |
|
949 | + array( |
|
950 | 950 | 'id' => 'backup_form', |
951 | 951 | 'method' => 'POST', |
952 | 952 | 'name' => 'backup_form' |
953 | 953 | ) |
954 | 954 | ); |
955 | - $form ['Database Information'] = array ( |
|
956 | - array ( |
|
955 | + $form ['Database Information'] = array( |
|
956 | + array( |
|
957 | 957 | '', |
958 | 958 | 'HIDDEN', |
959 | - array ( |
|
959 | + array( |
|
960 | 960 | 'name' => 'id' |
961 | 961 | ), |
962 | 962 | '', |
@@ -964,10 +964,10 @@ discard block |
||
964 | 964 | '', |
965 | 965 | '' |
966 | 966 | ), |
967 | - array ( |
|
968 | - gettext ( 'Name' ), |
|
967 | + array( |
|
968 | + gettext('Name'), |
|
969 | 969 | 'INPUT', |
970 | - array ( |
|
970 | + array( |
|
971 | 971 | 'name' => 'backup_name', |
972 | 972 | 'size' => '20', |
973 | 973 | 'class' => "text field medium" |
@@ -976,31 +976,31 @@ discard block |
||
976 | 976 | 'tOOL TIP', |
977 | 977 | '' |
978 | 978 | ), |
979 | - array ( |
|
980 | - gettext ( 'File Name' ), |
|
979 | + array( |
|
980 | + gettext('File Name'), |
|
981 | 981 | 'INPUT', |
982 | - array ( |
|
982 | + array( |
|
983 | 983 | 'name' => 'path', |
984 | 984 | 'size' => '20', |
985 | 985 | 'value' => $file_name, |
986 | 986 | 'class' => "text field medium" |
987 | 987 | ), |
988 | - 'trim|required|is_unique[' . $val . ']', |
|
988 | + 'trim|required|is_unique['.$val.']', |
|
989 | 989 | 'tOOL TIP', |
990 | 990 | '' |
991 | 991 | ) |
992 | 992 | ); |
993 | - $form ['button_cancel'] = array ( |
|
993 | + $form ['button_cancel'] = array( |
|
994 | 994 | 'name' => 'action', |
995 | - 'content' => gettext ( 'Close' ), |
|
995 | + 'content' => gettext('Close'), |
|
996 | 996 | 'value' => 'cancel', |
997 | 997 | 'type' => 'button', |
998 | 998 | 'class' => 'btn btn-line-sky margin-x-10', |
999 | 999 | 'onclick' => 'return redirect_page(\'NULL\')' |
1000 | 1000 | ); |
1001 | - $form ['button_save'] = array ( |
|
1001 | + $form ['button_save'] = array( |
|
1002 | 1002 | 'name' => 'action', |
1003 | - 'content' => gettext ( 'Save' ), |
|
1003 | + 'content' => gettext('Save'), |
|
1004 | 1004 | 'value' => 'save', |
1005 | 1005 | 'id' => 'submit', |
1006 | 1006 | 'type' => 'button', |
@@ -1009,8 +1009,8 @@ discard block |
||
1009 | 1009 | return $form; |
1010 | 1010 | } |
1011 | 1011 | function build_backupdastabase_list() { |
1012 | - $grid_field_arr = json_encode ( array ( |
|
1013 | - array ( |
|
1012 | + $grid_field_arr = json_encode(array( |
|
1013 | + array( |
|
1014 | 1014 | "<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", |
1015 | 1015 | "50", |
1016 | 1016 | "", |
@@ -1021,8 +1021,8 @@ discard block |
||
1021 | 1021 | "false", |
1022 | 1022 | "center" |
1023 | 1023 | ), |
1024 | - array ( |
|
1025 | - gettext ( "Date" ), |
|
1024 | + array( |
|
1025 | + gettext("Date"), |
|
1026 | 1026 | "260", |
1027 | 1027 | "date", |
1028 | 1028 | "date", |
@@ -1032,8 +1032,8 @@ discard block |
||
1032 | 1032 | "true", |
1033 | 1033 | "center" |
1034 | 1034 | ), |
1035 | - array ( |
|
1036 | - gettext ( "Name" ), |
|
1035 | + array( |
|
1036 | + gettext("Name"), |
|
1037 | 1037 | "295", |
1038 | 1038 | "backup_name", |
1039 | 1039 | "", |
@@ -1043,8 +1043,8 @@ discard block |
||
1043 | 1043 | "true", |
1044 | 1044 | "center" |
1045 | 1045 | ), |
1046 | - array ( |
|
1047 | - gettext ( "File Name" ), |
|
1046 | + array( |
|
1047 | + gettext("File Name"), |
|
1048 | 1048 | "480", |
1049 | 1049 | "path", |
1050 | 1050 | "", |
@@ -1054,56 +1054,56 @@ discard block |
||
1054 | 1054 | "true", |
1055 | 1055 | "center" |
1056 | 1056 | ), |
1057 | - array ( |
|
1058 | - gettext ( "Action" ), |
|
1057 | + array( |
|
1058 | + gettext("Action"), |
|
1059 | 1059 | "185", |
1060 | 1060 | "", |
1061 | 1061 | "", |
1062 | 1062 | "", |
1063 | - array ( |
|
1064 | - "EDIT_RESTORE" => array ( |
|
1063 | + array( |
|
1064 | + "EDIT_RESTORE" => array( |
|
1065 | 1065 | "url" => "systems/database_restore_one/", |
1066 | 1066 | "mode" => "" |
1067 | 1067 | ), |
1068 | - "DOWNLOAD_DATABASE" => array ( |
|
1068 | + "DOWNLOAD_DATABASE" => array( |
|
1069 | 1069 | "url" => "systems/database_download/", |
1070 | 1070 | "mode" => "" |
1071 | 1071 | ), |
1072 | - "Delete" => array ( |
|
1072 | + "Delete" => array( |
|
1073 | 1073 | "url" => "systems/database_delete/", |
1074 | 1074 | "mode" => "" |
1075 | 1075 | ) |
1076 | 1076 | ) |
1077 | 1077 | ) |
1078 | - ) ); |
|
1078 | + )); |
|
1079 | 1079 | return $grid_field_arr; |
1080 | 1080 | } |
1081 | 1081 | function build_backupdastabase_buttons() { |
1082 | - $buttons_json = json_encode ( array ( |
|
1083 | - array ( |
|
1084 | - gettext ( "Create" ), |
|
1082 | + $buttons_json = json_encode(array( |
|
1083 | + array( |
|
1084 | + gettext("Create"), |
|
1085 | 1085 | "btn btn-line-warning btn", |
1086 | 1086 | "fa fa-plus-circle fa-lg", |
1087 | 1087 | "button_action", |
1088 | 1088 | "systems/database_backup/", |
1089 | 1089 | "popup" |
1090 | 1090 | ), |
1091 | - array ( |
|
1092 | - gettext ( "import" ), |
|
1091 | + array( |
|
1092 | + gettext("import"), |
|
1093 | 1093 | "btn btn-line-blue", |
1094 | 1094 | "fa fa-upload fa-lg", |
1095 | 1095 | "button_action", |
1096 | 1096 | "systems/database_import/", |
1097 | 1097 | "popup" |
1098 | 1098 | ), |
1099 | - array ( |
|
1100 | - gettext ( "Delete" ), |
|
1099 | + array( |
|
1100 | + gettext("Delete"), |
|
1101 | 1101 | "btn btn-line-danger", |
1102 | 1102 | "fa fa-times-circle fa-lg", |
1103 | 1103 | "button_action", |
1104 | 1104 | "systems/database_backup_delete_multiple" |
1105 | 1105 | ) |
1106 | - ) ); |
|
1106 | + )); |
|
1107 | 1107 | return $buttons_json; |
1108 | 1108 | } |
1109 | 1109 | } |
@@ -20,8 +20,9 @@ |
||
20 | 20 | // You should have received a copy of the GNU Affero General Public License |
21 | 21 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | // ############################################################################## |
23 | -if (! defined ( 'BASEPATH' )) |
|
23 | +if (! defined ( 'BASEPATH' )) { |
|
24 | 24 | exit ( 'No direct script access allowed' ); |
25 | +} |
|
25 | 26 | class System_form { |
26 | 27 | function get_template_form_fields() { |
27 | 28 | $form ['forms'] = array ( |
@@ -23,35 +23,35 @@ discard block |
||
23 | 23 | // ############################################################################## |
24 | 24 | class Summary_model extends CI_Model { |
25 | 25 | function Summary_model() { |
26 | - parent::__construct (); |
|
26 | + parent::__construct(); |
|
27 | 27 | } |
28 | 28 | function get_resellersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export = false) { |
29 | - $this->db_model->build_search ( 'summary_reseller_search' ); |
|
30 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
29 | + $this->db_model->build_search('summary_reseller_search'); |
|
30 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
31 | 31 | $reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
32 | 32 | $where ['reseller_id'] = $reseller_id; |
33 | - if ($this->session->userdata ( 'advance_search' ) != 1) { |
|
34 | - $where ['callstart >='] = date ( 'Y-m-d' ) . " 00:00:00"; |
|
35 | - $where ['callstart <='] = date ( 'Y-m-d' ) . " 23:59:59"; |
|
33 | + if ($this->session->userdata('advance_search') != 1) { |
|
34 | + $where ['callstart >='] = date('Y-m-d')." 00:00:00"; |
|
35 | + $where ['callstart <='] = date('Y-m-d')." 23:59:59"; |
|
36 | 36 | } |
37 | - $this->db->where ( $where ); |
|
38 | - if (! empty ( $group_by )) { |
|
37 | + $this->db->where($where); |
|
38 | + if ( ! empty ($group_by)) { |
|
39 | 39 | $this->db->_protect_identifiers = false; |
40 | - $this->db->group_by ( $group_by, false ); |
|
40 | + $this->db->group_by($group_by, false); |
|
41 | 41 | $this->db->_protect_identifiers = true; |
42 | 42 | } |
43 | 43 | if ($flag) { |
44 | - $this->db->select ( $select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", false ); |
|
45 | - $this->db->order_by ( $order, "ASC" ); |
|
46 | - if (! $export) { |
|
47 | - $this->db->limit ( $limit, $start ); |
|
44 | + $this->db->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", false); |
|
45 | + $this->db->order_by($order, "ASC"); |
|
46 | + if ( ! $export) { |
|
47 | + $this->db->limit($limit, $start); |
|
48 | 48 | } |
49 | - $this->db->from ( "reseller_cdrs" ); |
|
50 | - $result = $this->db->get (); |
|
49 | + $this->db->from("reseller_cdrs"); |
|
50 | + $result = $this->db->get(); |
|
51 | 51 | } else { |
52 | - $result = $this->db_model->getSelect ( "count(*) as total_count", "reseller_cdrs", '' ); |
|
53 | - if ($result->num_rows () > 0) { |
|
54 | - return $result->num_rows (); |
|
52 | + $result = $this->db_model->getSelect("count(*) as total_count", "reseller_cdrs", ''); |
|
53 | + if ($result->num_rows() > 0) { |
|
54 | + return $result->num_rows(); |
|
55 | 55 | } else { |
56 | 56 | return 0; |
57 | 57 | } |
@@ -59,30 +59,30 @@ discard block |
||
59 | 59 | return $result; |
60 | 60 | } |
61 | 61 | function get_providersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export = false) { |
62 | - $this->db_model->build_search ( 'summary_provider_search' ); |
|
62 | + $this->db_model->build_search('summary_provider_search'); |
|
63 | 63 | $where ['provider_id >'] = 0; |
64 | - if ($this->session->userdata ( 'advance_search' ) != 1) { |
|
65 | - $where ['callstart >='] = date ( 'Y-m-d' ) . " 00:00:00"; |
|
66 | - $where ['callstart <='] = date ( 'Y-m-d' ) . " 23:59:59"; |
|
64 | + if ($this->session->userdata('advance_search') != 1) { |
|
65 | + $where ['callstart >='] = date('Y-m-d')." 00:00:00"; |
|
66 | + $where ['callstart <='] = date('Y-m-d')." 23:59:59"; |
|
67 | 67 | } |
68 | - $this->db->where ( $where ); |
|
69 | - if (! empty ( $group_by )) { |
|
68 | + $this->db->where($where); |
|
69 | + if ( ! empty ($group_by)) { |
|
70 | 70 | $this->db->_protect_identifiers = false; |
71 | - $this->db->group_by ( $group_by, false ); |
|
71 | + $this->db->group_by($group_by, false); |
|
72 | 72 | $this->db->_protect_identifiers = true; |
73 | 73 | } |
74 | 74 | if ($flag) { |
75 | - $this->db->select ( $select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", false ); |
|
76 | - $this->db->order_by ( $order, "ASC" ); |
|
77 | - if (! $export) { |
|
78 | - $this->db->limit ( $limit, $start ); |
|
75 | + $this->db->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", false); |
|
76 | + $this->db->order_by($order, "ASC"); |
|
77 | + if ( ! $export) { |
|
78 | + $this->db->limit($limit, $start); |
|
79 | 79 | } |
80 | - $this->db->from ( 'cdrs' ); |
|
81 | - $result = $this->db->get (); |
|
80 | + $this->db->from('cdrs'); |
|
81 | + $result = $this->db->get(); |
|
82 | 82 | } else { |
83 | - $result = $this->db_model->getSelect ( "count(*) as total_count", "cdrs", '' ); |
|
84 | - if ($result->num_rows () > 0) { |
|
85 | - return $result->num_rows (); |
|
83 | + $result = $this->db_model->getSelect("count(*) as total_count", "cdrs", ''); |
|
84 | + if ($result->num_rows() > 0) { |
|
85 | + return $result->num_rows(); |
|
86 | 86 | } else { |
87 | 87 | return 0; |
88 | 88 | } |
@@ -90,37 +90,37 @@ discard block |
||
90 | 90 | return $result; |
91 | 91 | } |
92 | 92 | function get_customersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export) { |
93 | - $this->db_model->build_search ( 'summary_customer_search' ); |
|
94 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
93 | + $this->db_model->build_search('summary_customer_search'); |
|
94 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
95 | 95 | $reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
96 | 96 | $where ['reseller_id'] = $reseller_id; |
97 | - if ($this->session->userdata ( 'advance_search' ) != 1) { |
|
98 | - $where ['callstart >='] = date ( 'Y-m-d' ) . " 00:00:00"; |
|
99 | - $where ['callstart <='] = date ( 'Y-m-d' ) . " 23:59:59"; |
|
97 | + if ($this->session->userdata('advance_search') != 1) { |
|
98 | + $where ['callstart >='] = date('Y-m-d')." 00:00:00"; |
|
99 | + $where ['callstart <='] = date('Y-m-d')." 23:59:59"; |
|
100 | 100 | } |
101 | - $this->db->where ( $where ); |
|
102 | - $types = array ( |
|
101 | + $this->db->where($where); |
|
102 | + $types = array( |
|
103 | 103 | '0', |
104 | 104 | '3' |
105 | 105 | ); |
106 | - $this->db->where_in ( 'type', $types ); |
|
107 | - if (! empty ( $group_by )) { |
|
106 | + $this->db->where_in('type', $types); |
|
107 | + if ( ! empty ($group_by)) { |
|
108 | 108 | $this->db->_protect_identifiers = false; |
109 | - $this->db->group_by ( $group_by, false ); |
|
109 | + $this->db->group_by($group_by, false); |
|
110 | 110 | $this->db->_protect_identifiers = true; |
111 | 111 | } |
112 | 112 | if ($flag) { |
113 | - $this->db->select ( $select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", false ); |
|
114 | - $this->db->order_by ( $order, "ASC" ); |
|
115 | - if (! $export) { |
|
116 | - $this->db->limit ( $limit, $start ); |
|
113 | + $this->db->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", false); |
|
114 | + $this->db->order_by($order, "ASC"); |
|
115 | + if ( ! $export) { |
|
116 | + $this->db->limit($limit, $start); |
|
117 | 117 | } |
118 | - $this->db->from ( "cdrs" ); |
|
119 | - $result = $this->db->get (); |
|
118 | + $this->db->from("cdrs"); |
|
119 | + $result = $this->db->get(); |
|
120 | 120 | } else { |
121 | - $result = $this->db_model->getSelect ( "count(*) as total_count", "cdrs", '' ); |
|
122 | - if ($result->num_rows () > 0) { |
|
123 | - return $result->num_rows (); |
|
121 | + $result = $this->db_model->getSelect("count(*) as total_count", "cdrs", ''); |
|
122 | + if ($result->num_rows() > 0) { |
|
123 | + return $result->num_rows(); |
|
124 | 124 | } else { |
125 | 125 | return 0; |
126 | 126 | } |
@@ -23,54 +23,54 @@ discard block |
||
23 | 23 | // ############################################################################## |
24 | 24 | class Summary extends MX_Controller { |
25 | 25 | function Summary() { |
26 | - parent::__construct (); |
|
26 | + parent::__construct(); |
|
27 | 27 | |
28 | - $this->load->helper ( 'template_inheritance' ); |
|
28 | + $this->load->helper('template_inheritance'); |
|
29 | 29 | |
30 | - $this->load->library ( 'session' ); |
|
31 | - $this->load->library ( 'astpp/form' ); |
|
32 | - $this->load->library ( "summary_form" ); |
|
33 | - $this->load->model ( 'summary_model' ); |
|
34 | - $this->load->library ( 'fpdf' ); |
|
35 | - $this->load->library ( 'pdf' ); |
|
36 | - $this->fpdf = new PDF ( 'P', 'pt' ); |
|
37 | - $this->fpdf->initialize ( 'P', 'mm', 'A4' ); |
|
30 | + $this->load->library('session'); |
|
31 | + $this->load->library('astpp/form'); |
|
32 | + $this->load->library("summary_form"); |
|
33 | + $this->load->model('summary_model'); |
|
34 | + $this->load->library('fpdf'); |
|
35 | + $this->load->library('pdf'); |
|
36 | + $this->fpdf = new PDF('P', 'pt'); |
|
37 | + $this->fpdf->initialize('P', 'mm', 'A4'); |
|
38 | 38 | |
39 | - if ($this->session->userdata ( 'user_login' ) == FALSE) |
|
40 | - redirect ( base_url () . '/astpp/login' ); |
|
39 | + if ($this->session->userdata('user_login') == FALSE) |
|
40 | + redirect(base_url().'/astpp/login'); |
|
41 | 41 | } |
42 | 42 | function customer() { |
43 | - $data ['page_title'] = gettext ( 'Customer Summary Report' ); |
|
43 | + $data ['page_title'] = gettext('Customer Summary Report'); |
|
44 | 44 | $data ['search_flag'] = true; |
45 | - $session_info = $this->session->userdata ( 'customersummary_reports_search' ); |
|
46 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
45 | + $session_info = $this->session->userdata('customersummary_reports_search'); |
|
46 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
47 | 47 | $reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
48 | - $accountlist = $this->db_model->build_dropdown_deleted ( 'id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array ( |
|
48 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array( |
|
49 | 49 | 'reseller_id' => $reseller_id, |
50 | 50 | "type" => "GLOBAL" |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | $data ['accountlist'] = $accountlist; |
53 | 53 | $data ['session_info'] = $session_info; |
54 | - $data ['search_string_type'] = $this->common->search_string_type (); |
|
55 | - $data ['search_report'] = $this->common->search_report_in (); |
|
56 | - $new_column_arr = $this->summary_column_arr ( 'customer' ); |
|
57 | - $data ['grid_fields'] = $this->summary_form->build_customersummary ( $new_column_arr ); |
|
58 | - $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_customersummary (); |
|
59 | - $data ['groupby_field'] = $this->common->set_summarycustomer_groupby (); |
|
60 | - $data ['groupby_time'] = $this->common->group_by_time (); |
|
61 | - $this->load->view ( 'view_customersummary_report', $data ); |
|
54 | + $data ['search_string_type'] = $this->common->search_string_type(); |
|
55 | + $data ['search_report'] = $this->common->search_report_in(); |
|
56 | + $new_column_arr = $this->summary_column_arr('customer'); |
|
57 | + $data ['grid_fields'] = $this->summary_form->build_customersummary($new_column_arr); |
|
58 | + $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_customersummary(); |
|
59 | + $data ['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
60 | + $data ['groupby_time'] = $this->common->group_by_time(); |
|
61 | + $this->load->view('view_customersummary_report', $data); |
|
62 | 62 | } |
63 | 63 | function customer_json() { |
64 | - $search_arr = $this->summary_search_info ( 'customer' ); |
|
65 | - $count_all = $this->summary_model->get_customersummary_report_list ( false, 0, 0, $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
66 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
64 | + $search_arr = $this->summary_search_info('customer'); |
|
65 | + $count_all = $this->summary_model->get_customersummary_report_list(false, 0, 0, $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
66 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
67 | 67 | $json_data = $paging_data ["json_paging"]; |
68 | - $query = $this->summary_model->get_customersummary_report_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
69 | - if ($query->num_rows () > 0) { |
|
70 | - $json_data ['rows'] = $this->summary_report_grid ( $search_arr, $query, 'customer', 'grid' ); |
|
68 | + $query = $this->summary_model->get_customersummary_report_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
69 | + if ($query->num_rows() > 0) { |
|
70 | + $json_data ['rows'] = $this->summary_report_grid($search_arr, $query, 'customer', 'grid'); |
|
71 | 71 | } |
72 | - $this->session->set_userdata ( 'customersummary_reports_export', $search_arr ); |
|
73 | - echo json_encode ( $json_data ); |
|
72 | + $this->session->set_userdata('customersummary_reports_export', $search_arr); |
|
73 | + echo json_encode($json_data); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -78,26 +78,26 @@ discard block |
||
78 | 78 | * @param string $entity |
79 | 79 | */ |
80 | 80 | function summary_column_arr($entity) { |
81 | - $new_column_arr = array (); |
|
81 | + $new_column_arr = array(); |
|
82 | 82 | $total_width = '322'; |
83 | 83 | $column_name = 'accountid'; |
84 | - if ($this->session->userdata ( 'advance_search' ) == '1') { |
|
85 | - $search_array = $this->session->userdata ( $entity . 'summary_reports_search' ); |
|
86 | - if (isset ( $search_array ['time'] ) && ! empty ( $search_array ['time'] )) { |
|
87 | - $new_column_arr [] = array ( |
|
88 | - ucfirst ( strtolower ( $search_array ['time'] ) ), |
|
84 | + if ($this->session->userdata('advance_search') == '1') { |
|
85 | + $search_array = $this->session->userdata($entity.'summary_reports_search'); |
|
86 | + if (isset ($search_array ['time']) && ! empty ($search_array ['time'])) { |
|
87 | + $new_column_arr [] = array( |
|
88 | + ucfirst(strtolower($search_array ['time'])), |
|
89 | 89 | "58", |
90 | - $search_array ['time'] . "(callstart)", |
|
90 | + $search_array ['time']."(callstart)", |
|
91 | 91 | "", |
92 | 92 | "", |
93 | 93 | "" |
94 | 94 | ); |
95 | 95 | } |
96 | - if (isset ( $search_array ['groupby_1'] ) && ! empty ( $search_array ['groupby_1'] )) { |
|
96 | + if (isset ($search_array ['groupby_1']) && ! empty ($search_array ['groupby_1'])) { |
|
97 | 97 | $first_column_groupby = $search_array ['groupby_1']; |
98 | 98 | |
99 | 99 | if ($first_column_groupby == 'accountid') { |
100 | - $new_column_arr [] = array ( |
|
100 | + $new_column_arr [] = array( |
|
101 | 101 | "Account", |
102 | 102 | "105", |
103 | 103 | 'accountid', |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | "build_concat_string" |
107 | 107 | ); |
108 | 108 | } elseif ($first_column_groupby == 'pattern') { |
109 | - $new_column_arr [] = array ( |
|
109 | + $new_column_arr [] = array( |
|
110 | 110 | "Code", |
111 | 111 | "45", |
112 | 112 | "pattern", |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | "", |
115 | 115 | "get_only_numeric_val" |
116 | 116 | ); |
117 | - $new_column_arr [] = array ( |
|
117 | + $new_column_arr [] = array( |
|
118 | 118 | "Destination", |
119 | 119 | "59", |
120 | 120 | "notes", |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | "" |
124 | 124 | ); |
125 | 125 | } elseif ($first_column_groupby == 'package_id') { |
126 | - $new_column_arr [] = array ( |
|
126 | + $new_column_arr [] = array( |
|
127 | 127 | "Package", |
128 | 128 | "105", |
129 | 129 | 'package_id', |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | ); |
134 | 134 | } |
135 | 135 | } |
136 | - if (isset ( $search_array ['groupby_2'] ) && ! empty ( $search_array ['groupby_2'] )) { |
|
136 | + if (isset ($search_array ['groupby_2']) && ! empty ($search_array ['groupby_2'])) { |
|
137 | 137 | $third_column_groupby = $search_array ['groupby_2']; |
138 | 138 | if ($third_column_groupby == 'accountid') { |
139 | - $new_column_arr [] = array ( |
|
139 | + $new_column_arr [] = array( |
|
140 | 140 | "Account", |
141 | 141 | "105", |
142 | 142 | 'accountid', |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | "build_concat_string" |
146 | 146 | ); |
147 | 147 | } elseif ($third_column_groupby == 'pattern') { |
148 | - $new_column_arr [] = array ( |
|
148 | + $new_column_arr [] = array( |
|
149 | 149 | "Code", |
150 | 150 | "45", |
151 | 151 | "pattern", |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | "", |
154 | 154 | "get_only_numeric_val" |
155 | 155 | ); |
156 | - $new_column_arr [] = array ( |
|
156 | + $new_column_arr [] = array( |
|
157 | 157 | "Destination", |
158 | 158 | "59", |
159 | 159 | "notes", |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | "" |
163 | 163 | ); |
164 | 164 | } elseif ($third_column_groupby == 'package_id') { |
165 | - $new_column_arr [] = array ( |
|
165 | + $new_column_arr [] = array( |
|
166 | 166 | "Package", |
167 | 167 | "105", |
168 | 168 | 'package_id', |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | ); |
173 | 173 | } |
174 | 174 | } |
175 | - if (isset ( $search_array ['groupby_3'] ) && ! empty ( $search_array ['groupby_3'] )) { |
|
175 | + if (isset ($search_array ['groupby_3']) && ! empty ($search_array ['groupby_3'])) { |
|
176 | 176 | $fifth_column_groupby = $search_array ['groupby_3']; |
177 | 177 | if ($fifth_column_groupby == 'accountid') { |
178 | - $new_column_arr [] = array ( |
|
178 | + $new_column_arr [] = array( |
|
179 | 179 | "Account", |
180 | 180 | "105", |
181 | 181 | 'accountid', |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | "build_concat_string" |
185 | 185 | ); |
186 | 186 | } elseif ($fifth_column_groupby == 'pattern') { |
187 | - $new_column_arr [] = array ( |
|
187 | + $new_column_arr [] = array( |
|
188 | 188 | "Code", |
189 | 189 | "45", |
190 | 190 | "pattern", |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | "", |
193 | 193 | "get_only_numeric_val" |
194 | 194 | ); |
195 | - $new_column_arr [] = array ( |
|
195 | + $new_column_arr [] = array( |
|
196 | 196 | "Destination", |
197 | 197 | "59", |
198 | 198 | "notes", |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | "" |
202 | 202 | ); |
203 | 203 | } elseif ($fifth_column_groupby == 'package_id') { |
204 | - $new_column_arr [] = array ( |
|
204 | + $new_column_arr [] = array( |
|
205 | 205 | "Package", |
206 | 206 | "105", |
207 | 207 | 'package_id', |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | ); |
212 | 212 | } |
213 | 213 | } |
214 | - if (empty ( $new_column_arr )) { |
|
215 | - $new_column_arr [] = array ( |
|
214 | + if (empty ($new_column_arr)) { |
|
215 | + $new_column_arr [] = array( |
|
216 | 216 | "Account", |
217 | 217 | '322', |
218 | 218 | 'accountid', |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | ); |
223 | 223 | } |
224 | 224 | } else { |
225 | - $new_column_arr [] = array ( |
|
225 | + $new_column_arr [] = array( |
|
226 | 226 | "Account", |
227 | 227 | '322', |
228 | 228 | 'accountid', |
@@ -241,89 +241,89 @@ discard block |
||
241 | 241 | * @param string $purpose |
242 | 242 | */ |
243 | 243 | function summary_report_grid($search_arr, $query, $entity, $purpose) { |
244 | - $export_arr = array (); |
|
244 | + $export_arr = array(); |
|
245 | 245 | $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
246 | - $show_seconds = (! empty ( $search_arr ['search_in'] )) ? $search_arr ['search_in'] : 'minutes'; |
|
247 | - $currency_info = $this->common->get_currency_info (); |
|
248 | - foreach ( $query->result_array () as $row1 ) { |
|
246 | + $show_seconds = ( ! empty ($search_arr ['search_in'])) ? $search_arr ['search_in'] : 'minutes'; |
|
247 | + $currency_info = $this->common->get_currency_info(); |
|
248 | + foreach ($query->result_array() as $row1) { |
|
249 | 249 | $atmpt = $row1 ['attempts']; |
250 | 250 | $cmplt = ($row1 ['completed'] != 0) ? $row1 ['completed'] : 0; |
251 | - $acd = ($row1 ['completed'] > 0) ? round ( $row1 ['billable'] / $row1 ['completed'] ) : 0; |
|
251 | + $acd = ($row1 ['completed'] > 0) ? round ($row1 ['billable'] / $row1 ['completed']) : 0; |
|
252 | 252 | $mcd = $row1 ['mcd']; |
253 | 253 | if ($show_seconds == 'minutes') { |
254 | - $avgsec = $acd > 0 ? sprintf ( '%02d', $acd / 60 ) . ":" . sprintf ( '%02d', ($acd % 60) ) : "00:00"; |
|
255 | - $maxsec = $mcd > 0 ? sprintf ( '%02d', $mcd / 60 ) . ":" . sprintf ( '%02d', ($mcd % 60) ) : "00:00"; |
|
256 | - $duration = ($row1 ['duration'] > 0) ? sprintf ( '%02d', $row1 ['duration'] / 60 ) . ":" . sprintf ( '%02d', ($row1 ['duration'] % 60) ) : "00:00"; |
|
257 | - $billsec = ($row1 ['billable'] > 0) ? sprintf ( '%02d', $row1 ['billable'] / 60 ) . ":" . sprintf ( '%02d', ($row1 ['billable'] % 60) ) : "00:00"; |
|
254 | + $avgsec = $acd > 0 ? sprintf ('%02d', $acd / 60).":".sprintf('%02d', ($acd % 60)) : "00:00"; |
|
255 | + $maxsec = $mcd > 0 ? sprintf ('%02d', $mcd / 60).":".sprintf('%02d', ($mcd % 60)) : "00:00"; |
|
256 | + $duration = ($row1 ['duration'] > 0) ? sprintf ('%02d', $row1 ['duration'] / 60).":".sprintf('%02d', ($row1 ['duration'] % 60)) : "00:00"; |
|
257 | + $billsec = ($row1 ['billable'] > 0) ? sprintf ('%02d', $row1 ['billable'] / 60).":".sprintf('%02d', ($row1 ['billable'] % 60)) : "00:00"; |
|
258 | 258 | } else { |
259 | - $duration = sprintf ( '%02d', $row1 ['duration'] ); |
|
259 | + $duration = sprintf('%02d', $row1 ['duration']); |
|
260 | 260 | $avgsec = $acd; |
261 | 261 | $maxsec = $mcd; |
262 | - $billsec = sprintf ( '%02d', $row1 ['billable'] ); |
|
262 | + $billsec = sprintf('%02d', $row1 ['billable']); |
|
263 | 263 | } |
264 | 264 | if ($entity != 'provider') { |
265 | - $profit = $this->common->calculate_currency_manually ( $currency_info, $row1 ['debit'] - $row1 ['cost'], false ); |
|
266 | - $debit = $this->common->calculate_currency_manually ( $currency_info, $row1 ['debit'], false ); |
|
265 | + $profit = $this->common->calculate_currency_manually($currency_info, $row1 ['debit'] - $row1 ['cost'], false); |
|
266 | + $debit = $this->common->calculate_currency_manually($currency_info, $row1 ['debit'], false); |
|
267 | 267 | } |
268 | - $cost = $this->common->calculate_currency_manually ( $currency_info, $row1 ['cost'], false ); |
|
269 | - $asr = ($atmpt > 0) ? (round ( ($cmplt / $atmpt) * 100, 2 )) : '0.00'; |
|
270 | - $new_arr = array (); |
|
271 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
272 | - if (! empty ( $search_arr ['groupby_time'] )) { |
|
268 | + $cost = $this->common->calculate_currency_manually($currency_info, $row1 ['cost'], false); |
|
269 | + $asr = ($atmpt > 0) ? (round(($cmplt / $atmpt) * 100, 2)) : '0.00'; |
|
270 | + $new_arr = array(); |
|
271 | + if ($this->session->userdata('advance_search') == 1) { |
|
272 | + if ( ! empty ($search_arr ['groupby_time'])) { |
|
273 | 273 | $time = $row1 [$search_arr ['groupby_time']]; |
274 | 274 | if ($search_arr ['groupby_time'] == "HOUR" || $search_arr ['groupby_time'] == "DAY") { |
275 | - $time = sprintf ( '%02d', $time ); |
|
275 | + $time = sprintf('%02d', $time); |
|
276 | 276 | } |
277 | 277 | if ($search_arr ['groupby_time'] == "MONTH") { |
278 | - $dateObj = DateTime::createFromFormat ( '!m', $time ); |
|
279 | - $time = $dateObj->format ( 'F' ); |
|
278 | + $dateObj = DateTime::createFromFormat('!m', $time); |
|
279 | + $time = $dateObj->format('F'); |
|
280 | 280 | } |
281 | 281 | $new_arr [] = $time; |
282 | 282 | } |
283 | 283 | if ($search_arr ['groupby_1'] == $db_field_name) { |
284 | - $new_arr [] = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $row1 [$db_field_name] ); |
|
284 | + $new_arr [] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1 [$db_field_name]); |
|
285 | 285 | } elseif ($search_arr ['groupby_1'] == 'pattern') { |
286 | - $new_arr [] = filter_var ( $row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT ); |
|
286 | + $new_arr [] = filter_var($row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
287 | 287 | $new_arr [] = $row1 ['notes']; |
288 | 288 | } elseif ($search_arr ['groupby_1'] == 'trunk_id') { |
289 | - $new_arr [] = $this->common->get_field_name ( 'name', 'trunks', $row1 ['trunk_id'] ); |
|
289 | + $new_arr [] = $this->common->get_field_name('name', 'trunks', $row1 ['trunk_id']); |
|
290 | 290 | } elseif ($search_arr ['groupby_1'] == 'package_id') { |
291 | - $new_arr [] = $this->common->get_field_name ( 'package_name', 'packages', $row1 ['package_id'] ); |
|
291 | + $new_arr [] = $this->common->get_field_name('package_name', 'packages', $row1 ['package_id']); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | if ($search_arr ['groupby_2'] == $db_field_name) { |
295 | - $new_arr [] = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $row1 [$db_field_name] ); |
|
295 | + $new_arr [] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1 [$db_field_name]); |
|
296 | 296 | } elseif ($search_arr ['groupby_2'] == 'pattern') { |
297 | - $new_arr [] = filter_var ( $row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT ); |
|
297 | + $new_arr [] = filter_var($row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
298 | 298 | $new_arr [] = $row1 ['notes']; |
299 | 299 | } elseif ($search_arr ['groupby_2'] == 'trunk_id') { |
300 | - $new_arr [] = $this->common->get_field_name ( 'name', 'trunks', $row1 ['trunk_id'] ); |
|
300 | + $new_arr [] = $this->common->get_field_name('name', 'trunks', $row1 ['trunk_id']); |
|
301 | 301 | } elseif ($search_arr ['groupby_2'] == 'package_id') { |
302 | - $new_arr [] = $this->common->get_field_name ( 'package_name', 'packages', $row1 ['package_id'] ); |
|
302 | + $new_arr [] = $this->common->get_field_name('package_name', 'packages', $row1 ['package_id']); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | if ($search_arr ['groupby_3'] == $db_field_name) { |
306 | - $new_arr [] = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $row1 [$db_field_name] ); |
|
306 | + $new_arr [] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1 [$db_field_name]); |
|
307 | 307 | } elseif ($search_arr ['groupby_3'] == 'pattern') { |
308 | - $new_arr [] = filter_var ( $row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT ); |
|
308 | + $new_arr [] = filter_var($row1 ['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
309 | 309 | $new_arr [] = $row1 ['notes']; |
310 | 310 | } elseif ($search_arr ['groupby_3'] == 'trunk_id') { |
311 | - $new_arr [] = $this->common->get_field_name ( 'name', 'trunks', $row1 ['trunk_id'] ); |
|
311 | + $new_arr [] = $this->common->get_field_name('name', 'trunks', $row1 ['trunk_id']); |
|
312 | 312 | } elseif ($search_arr ['groupby_3'] == 'package_id') { |
313 | - $new_arr [] = $this->common->get_field_name ( 'package_name', 'packages', $row1 ['package_id'] ); |
|
313 | + $new_arr [] = $this->common->get_field_name('package_name', 'packages', $row1 ['package_id']); |
|
314 | 314 | } |
315 | - if (empty ( $new_arr )) { |
|
316 | - $new_arr [] = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $row1 [$db_field_name] ); |
|
315 | + if (empty ($new_arr)) { |
|
316 | + $new_arr [] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1 [$db_field_name]); |
|
317 | 317 | } |
318 | 318 | } else { |
319 | - $new_arr [] = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $row1 [$db_field_name] ); |
|
319 | + $new_arr [] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1 [$db_field_name]); |
|
320 | 320 | } |
321 | 321 | if ($entity != 'provider') { |
322 | - $custom_array = array ( |
|
322 | + $custom_array = array( |
|
323 | 323 | $atmpt, |
324 | 324 | $cmplt, |
325 | 325 | $duration, |
326 | - round ( $asr, 2 ), |
|
326 | + round($asr, 2), |
|
327 | 327 | $avgsec, |
328 | 328 | $maxsec, |
329 | 329 | $billsec, |
@@ -332,95 +332,95 @@ discard block |
||
332 | 332 | $profit |
333 | 333 | ); |
334 | 334 | } else { |
335 | - $custom_array = array ( |
|
335 | + $custom_array = array( |
|
336 | 336 | $atmpt, |
337 | 337 | $cmplt, |
338 | 338 | $duration, |
339 | - round ( $asr, 2 ), |
|
339 | + round($asr, 2), |
|
340 | 340 | $avgsec, |
341 | 341 | $maxsec, |
342 | 342 | $billsec, |
343 | 343 | $cost |
344 | 344 | ); |
345 | 345 | } |
346 | - $final_array = array_merge ( $new_arr, $custom_array ); |
|
347 | - $json_data [] = array ( |
|
346 | + $final_array = array_merge($new_arr, $custom_array); |
|
347 | + $json_data [] = array( |
|
348 | 348 | 'cell' => $final_array |
349 | 349 | ); |
350 | 350 | $export_arr [] = $final_array; |
351 | 351 | } |
352 | - $function_name = 'get_' . $entity . 'summary_report_list'; |
|
353 | - $total_info = $this->summary_model->$function_name ( true, '', '', '', $search_arr ['select_str'], $search_arr ['order_str'], true ); |
|
354 | - $total_info = $total_info->result_array (); |
|
352 | + $function_name = 'get_'.$entity.'summary_report_list'; |
|
353 | + $total_info = $this->summary_model->$function_name(true, '', '', '', $search_arr ['select_str'], $search_arr ['order_str'], true); |
|
354 | + $total_info = $total_info->result_array(); |
|
355 | 355 | $total_info = $total_info [0]; |
356 | - $total_asr = ($total_info ['attempts'] > 0) ? round ( ($total_info ['completed'] / $total_info ['attempts']) * 100, 2 ) : 0; |
|
357 | - $total_acd = ($total_info ['completed'] > 0) ? round ( $total_info ['billable'] / $total_info ['completed'] ) : 0; |
|
356 | + $total_asr = ($total_info ['attempts'] > 0) ? round (($total_info ['completed'] / $total_info ['attempts']) * 100, 2) : 0; |
|
357 | + $total_acd = ($total_info ['completed'] > 0) ? round ($total_info ['billable'] / $total_info ['completed']) : 0; |
|
358 | 358 | if ($show_seconds == 'minutes') { |
359 | - $total_info ['duration'] = $total_info ['duration'] > 0 ? sprintf ( '%02d', $total_info ['duration'] / 60 ) . ":" . sprintf ( '%02d', ($total_info ['duration'] % 60) ) : "00:00"; |
|
360 | - $total_info ['billable'] = $total_info ['billable'] > 0 ? sprintf ( '%02d', $total_info ['billable'] / 60 ) . ":" . sprintf ( '%02d', ($total_info ['billable'] % 60) ) : "00:00"; |
|
361 | - $total_acd = $total_acd > 0 ? sprintf ( '%02d', $total_acd / 60 ) . ":" . sprintf ( '%02d', ($total_acd % 60) ) : "00:00"; |
|
362 | - $total_info ['mcd'] = $total_info ['mcd'] > 0 ? sprintf ( '%02d', $total_info ['mcd'] / 60 ) . ":" . sprintf ( '%02d', ($total_info ['mcd'] % 60) ) : "00:00"; |
|
359 | + $total_info ['duration'] = $total_info ['duration'] > 0 ? sprintf ('%02d', $total_info ['duration'] / 60).":".sprintf('%02d', ($total_info ['duration'] % 60)) : "00:00"; |
|
360 | + $total_info ['billable'] = $total_info ['billable'] > 0 ? sprintf ('%02d', $total_info ['billable'] / 60).":".sprintf('%02d', ($total_info ['billable'] % 60)) : "00:00"; |
|
361 | + $total_acd = $total_acd > 0 ? sprintf ('%02d', $total_acd / 60).":".sprintf('%02d', ($total_acd % 60)) : "00:00"; |
|
362 | + $total_info ['mcd'] = $total_info ['mcd'] > 0 ? sprintf ('%02d', $total_info ['mcd'] / 60).":".sprintf('%02d', ($total_info ['mcd'] % 60)) : "00:00"; |
|
363 | 363 | } |
364 | 364 | if ($entity != 'provider') { |
365 | - $total_profit = $this->common->calculate_currency_manually ( $currency_info, $total_info ['debit'] - $total_info ['cost'], false ); |
|
366 | - $total_debit = $this->common->calculate_currency_manually ( $currency_info, $total_info ['debit'], false ); |
|
365 | + $total_profit = $this->common->calculate_currency_manually($currency_info, $total_info ['debit'] - $total_info ['cost'], false); |
|
366 | + $total_debit = $this->common->calculate_currency_manually($currency_info, $total_info ['debit'], false); |
|
367 | 367 | } |
368 | - $total_cost = $this->common->calculate_currency_manually ( $currency_info, $total_info ['cost'], false ); |
|
368 | + $total_cost = $this->common->calculate_currency_manually($currency_info, $total_info ['cost'], false); |
|
369 | 369 | if ($entity != 'provider') { |
370 | - $last_array = array ( |
|
371 | - "<b>" . $total_info ['attempts'] . "</b>", |
|
372 | - "<b>" . $total_info ['completed'] . "</b>", |
|
373 | - "<b>" . $total_info ['duration'] . "</b>", |
|
374 | - "<b>" . $total_asr . "</b>", |
|
375 | - "<b>" . $total_acd . "</b>", |
|
376 | - "<b>" . $total_info ['mcd'] . "</b>", |
|
377 | - "<b>" . $total_info ['billable'] . "</b>", |
|
378 | - "<b>" . $total_debit . "</b>", |
|
379 | - "<b>" . $total_cost . "</b>", |
|
380 | - "<b>" . $total_profit . "</b>" |
|
370 | + $last_array = array( |
|
371 | + "<b>".$total_info ['attempts']."</b>", |
|
372 | + "<b>".$total_info ['completed']."</b>", |
|
373 | + "<b>".$total_info ['duration']."</b>", |
|
374 | + "<b>".$total_asr."</b>", |
|
375 | + "<b>".$total_acd."</b>", |
|
376 | + "<b>".$total_info ['mcd']."</b>", |
|
377 | + "<b>".$total_info ['billable']."</b>", |
|
378 | + "<b>".$total_debit."</b>", |
|
379 | + "<b>".$total_cost."</b>", |
|
380 | + "<b>".$total_profit."</b>" |
|
381 | 381 | ); |
382 | 382 | } else { |
383 | - $last_array = array ( |
|
384 | - "<b>" . $total_info ['attempts'] . "</b>", |
|
385 | - "<b>" . $total_info ['completed'] . "</b>", |
|
386 | - "<b>" . $total_info ['duration'] . "</b>", |
|
387 | - "<b>" . $total_asr . "</b>", |
|
388 | - "<b>" . $total_acd . "</b>", |
|
389 | - "<b>" . $total_info ['mcd'] . "</b>", |
|
390 | - "<b>" . $total_info ['billable'] . "</b>", |
|
391 | - "<b>" . $total_cost . "</b>" |
|
383 | + $last_array = array( |
|
384 | + "<b>".$total_info ['attempts']."</b>", |
|
385 | + "<b>".$total_info ['completed']."</b>", |
|
386 | + "<b>".$total_info ['duration']."</b>", |
|
387 | + "<b>".$total_asr."</b>", |
|
388 | + "<b>".$total_acd."</b>", |
|
389 | + "<b>".$total_info ['mcd']."</b>", |
|
390 | + "<b>".$total_info ['billable']."</b>", |
|
391 | + "<b>".$total_cost."</b>" |
|
392 | 392 | ); |
393 | 393 | } |
394 | 394 | if ($purpose == 'export') { |
395 | 395 | $search_arr ['custom_total_array'] [0] = "Grand Total"; |
396 | 396 | } |
397 | - $new_export_array = array (); |
|
398 | - foreach ( $last_array as $key => $value ) { |
|
399 | - $value = str_replace ( "<b>", "", $value ); |
|
400 | - $value = str_replace ( "</b>", '', $value ); |
|
397 | + $new_export_array = array(); |
|
398 | + foreach ($last_array as $key => $value) { |
|
399 | + $value = str_replace("<b>", "", $value); |
|
400 | + $value = str_replace("</b>", '', $value); |
|
401 | 401 | if ($key == 7 || $key == 8 || $key == 9) { |
402 | - $value = sprintf ( "%." . $currency_info ['decimalpoints'] . "f", floatval ( preg_replace ( '/[^\d.]/', '', $value ) ) ); |
|
402 | + $value = sprintf("%.".$currency_info ['decimalpoints']."f", floatval(preg_replace('/[^\d.]/', '', $value))); |
|
403 | 403 | } |
404 | 404 | $new_export_array [$key] = $value; |
405 | 405 | } |
406 | - $total_array = array_merge ( $search_arr ['custom_total_array'], $last_array ); |
|
407 | - $custom_export_arr = array_merge ( $search_arr ['custom_total_array'], $new_export_array ); |
|
406 | + $total_array = array_merge($search_arr ['custom_total_array'], $last_array); |
|
407 | + $custom_export_arr = array_merge($search_arr ['custom_total_array'], $new_export_array); |
|
408 | 408 | $export_arr [] = $custom_export_arr; |
409 | - $json_data [] = array ( |
|
409 | + $json_data [] = array( |
|
410 | 410 | 'cell' => $total_array |
411 | 411 | ); |
412 | 412 | return $purpose == 'grid' ? $json_data : $export_arr; |
413 | 413 | } |
414 | 414 | function customer_export_csv() { |
415 | - $account_info = $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
415 | + $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
|
416 | 416 | $currency_id = $account_info ['currency_id']; |
417 | - $currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
418 | - $search_arr = $this->session->userdata ( 'customersummary_reports_export' ); |
|
419 | - $data_arr = array (); |
|
420 | - $query = $this->summary_model->get_customersummary_report_list ( true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true ); |
|
421 | - $search_header = explode ( ",", $search_arr ['export_str'] ); |
|
422 | - ob_clean (); |
|
423 | - $fixed_header = array ( |
|
417 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
418 | + $search_arr = $this->session->userdata('customersummary_reports_export'); |
|
419 | + $data_arr = array(); |
|
420 | + $query = $this->summary_model->get_customersummary_report_list(true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true); |
|
421 | + $search_header = explode(",", $search_arr ['export_str']); |
|
422 | + ob_clean(); |
|
423 | + $fixed_header = array( |
|
424 | 424 | 'Attempted Calls', |
425 | 425 | 'Completed Calls', |
426 | 426 | 'Duration', |
@@ -428,33 +428,33 @@ discard block |
||
428 | 428 | 'ACD', |
429 | 429 | 'MCD', |
430 | 430 | 'Billable', |
431 | - 'Debit(' . $currency . ')', |
|
432 | - 'Cost(' . $currency . ')', |
|
431 | + 'Debit('.$currency.')', |
|
432 | + 'Cost('.$currency.')', |
|
433 | 433 | 'Profit' |
434 | 434 | ); |
435 | - $header_arr [] = array_merge ( $search_header, $fixed_header ); |
|
436 | - if ($query->num_rows () > 0) { |
|
437 | - $data_arr = $this->summary_report_grid ( $search_arr, $query, 'customer', 'export' ); |
|
435 | + $header_arr [] = array_merge($search_header, $fixed_header); |
|
436 | + if ($query->num_rows() > 0) { |
|
437 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'customer', 'export'); |
|
438 | 438 | } |
439 | - $customer_array = array_merge ( $header_arr, $data_arr ); |
|
439 | + $customer_array = array_merge($header_arr, $data_arr); |
|
440 | 440 | |
441 | - $this->load->helper ( 'csv' ); |
|
442 | - array_to_csv ( $customer_array, 'Customer_Summary_Report_' . date ( "Y-m-d" ) . '.csv' ); |
|
441 | + $this->load->helper('csv'); |
|
442 | + array_to_csv($customer_array, 'Customer_Summary_Report_'.date("Y-m-d").'.csv'); |
|
443 | 443 | } |
444 | 444 | function customer_search() { |
445 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
446 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
447 | - unset ( $_POST ['action'] ); |
|
448 | - unset ( $_POST ['advance_search'] ); |
|
449 | - $this->session->set_userdata ( 'customersummary_reports_search', $this->input->post () ); |
|
445 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
446 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
447 | + unset ($_POST ['action']); |
|
448 | + unset ($_POST ['advance_search']); |
|
449 | + $this->session->set_userdata('customersummary_reports_search', $this->input->post()); |
|
450 | 450 | } |
451 | - redirect ( base_url () . 'summary/customer/' ); |
|
451 | + redirect(base_url().'summary/customer/'); |
|
452 | 452 | } |
453 | 453 | function customer_clearsearchfilter() { |
454 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
455 | - $this->session->set_userdata ( 'customersummary_reports_search', "" ); |
|
456 | - $this->session->set_userdata ( 'customersummary_reports_export', "" ); |
|
457 | - redirect ( base_url () . 'summary/customer/' ); |
|
454 | + $this->session->set_userdata('advance_search', 0); |
|
455 | + $this->session->set_userdata('customersummary_reports_search', ""); |
|
456 | + $this->session->set_userdata('customersummary_reports_export', ""); |
|
457 | + redirect(base_url().'summary/customer/'); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -462,17 +462,17 @@ discard block |
||
462 | 462 | * @param string $entity |
463 | 463 | */ |
464 | 464 | function summary_search_info($entity) { |
465 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
466 | - $this->db->select ( 'gmttime' ); |
|
467 | - $timezone_info = ( array ) $this->db->get_where ( 'timezone', array ( |
|
465 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
466 | + $this->db->select('gmttime'); |
|
467 | + $timezone_info = (array)$this->db->get_where('timezone', array( |
|
468 | 468 | "id" => $accountinfo ['timezone_id'] |
469 | - ) )->first_row (); |
|
470 | - if (! empty ( $timezone_info ['gmttime'] )) { |
|
469 | + ))->first_row(); |
|
470 | + if ( ! empty ($timezone_info ['gmttime'])) { |
|
471 | 471 | $user_timezone = $timezone_info ['gmttime']; |
472 | 472 | } else { |
473 | 473 | $user_timezone = "GMT+00:00"; |
474 | 474 | } |
475 | - $user_timezone_arr = explode ( "GMT", $user_timezone ); |
|
475 | + $user_timezone_arr = explode("GMT", $user_timezone); |
|
476 | 476 | $user_timezone_gmttime = $user_timezone_arr [1]; |
477 | 477 | $group_by_str = null; |
478 | 478 | $select_str = null; |
@@ -481,26 +481,26 @@ discard block |
||
481 | 481 | $group_by_2 = null; |
482 | 482 | $group_by_3 = null; |
483 | 483 | $order_str = null; |
484 | - $custom_total_array = array (); |
|
485 | - $custom_search = array (); |
|
484 | + $custom_total_array = array(); |
|
485 | + $custom_search = array(); |
|
486 | 486 | $export_select_str = null; |
487 | 487 | $new_arr ['search_in'] = 'minutes'; |
488 | 488 | $i = 0; |
489 | 489 | $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
490 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
491 | - $custom_search = $this->session->userdata ( $entity . 'summary_reports_search' ); |
|
492 | - if (isset ( $custom_search ['time'] ) && ! empty ( $custom_search ['time'] )) { |
|
493 | - $group_by_str .= $custom_search ['time'] . "(convert_tz(callstart,'+00:00','$user_timezone_gmttime')),"; |
|
494 | - $select_str .= $custom_search ['time'] . "(convert_tz(callstart,'+00:00','$user_timezone_gmttime')) as " . $order_str .= $custom_search ['time'] . ","; |
|
490 | + if ($this->session->userdata('advance_search') == 1) { |
|
491 | + $custom_search = $this->session->userdata($entity.'summary_reports_search'); |
|
492 | + if (isset ($custom_search ['time']) && ! empty ($custom_search ['time'])) { |
|
493 | + $group_by_str .= $custom_search ['time']."(convert_tz(callstart,'+00:00','$user_timezone_gmttime')),"; |
|
494 | + $select_str .= $custom_search ['time']."(convert_tz(callstart,'+00:00','$user_timezone_gmttime')) as ".$order_str .= $custom_search ['time'].","; |
|
495 | 495 | $group_by_time = $custom_search ['time']; |
496 | - $export_select_str .= $custom_search ['time'] . ","; |
|
496 | + $export_select_str .= $custom_search ['time'].","; |
|
497 | 497 | $custom_total_array [$i] = null; |
498 | - $i ++; |
|
498 | + $i++; |
|
499 | 499 | } |
500 | - if (isset ( $custom_search ['groupby_1'] ) && ! empty ( $custom_search ['groupby_1'] )) { |
|
501 | - $group_by_str .= $custom_search ['groupby_1'] . ","; |
|
502 | - $select_str .= $custom_search ['groupby_1'] . ","; |
|
503 | - $order_str .= $custom_search ['groupby_1'] . ","; |
|
500 | + if (isset ($custom_search ['groupby_1']) && ! empty ($custom_search ['groupby_1'])) { |
|
501 | + $group_by_str .= $custom_search ['groupby_1'].","; |
|
502 | + $select_str .= $custom_search ['groupby_1'].","; |
|
503 | + $order_str .= $custom_search ['groupby_1'].","; |
|
504 | 504 | $group_by_1 = $custom_search ['groupby_1']; |
505 | 505 | if ($custom_search ['groupby_1'] == $db_field_name) { |
506 | 506 | $export_select_str .= 'Account,'; |
@@ -511,18 +511,18 @@ discard block |
||
511 | 511 | $order_str .= 'notes,'; |
512 | 512 | $export_select_str .= "Code,Destination,"; |
513 | 513 | $custom_total_array [$i] = null; |
514 | - $i ++; |
|
514 | + $i++; |
|
515 | 515 | } elseif ($custom_search ['groupby_1'] == 'package_id') { |
516 | 516 | $export_select_str .= 'Package,'; |
517 | 517 | } |
518 | 518 | $custom_total_array [$i] = null; |
519 | - $i ++; |
|
519 | + $i++; |
|
520 | 520 | } |
521 | 521 | |
522 | - if (isset ( $custom_search ['groupby_2'] ) && ! empty ( $custom_search ['groupby_2'] )) { |
|
523 | - $group_by_str .= $custom_search ['groupby_2'] . ","; |
|
524 | - $select_str .= $custom_search ['groupby_2'] . ","; |
|
525 | - $order_str .= $custom_search ['groupby_2'] . ","; |
|
522 | + if (isset ($custom_search ['groupby_2']) && ! empty ($custom_search ['groupby_2'])) { |
|
523 | + $group_by_str .= $custom_search ['groupby_2'].","; |
|
524 | + $select_str .= $custom_search ['groupby_2'].","; |
|
525 | + $order_str .= $custom_search ['groupby_2'].","; |
|
526 | 526 | $group_by_2 = $custom_search ['groupby_2']; |
527 | 527 | if ($custom_search ['groupby_2'] == $db_field_name) { |
528 | 528 | $export_select_str .= 'Account,'; |
@@ -533,18 +533,18 @@ discard block |
||
533 | 533 | $order_str .= 'notes,'; |
534 | 534 | $export_select_str .= "Code,Destination,"; |
535 | 535 | $custom_total_array [$i] = null; |
536 | - $i ++; |
|
536 | + $i++; |
|
537 | 537 | } elseif ($custom_search ['groupby_2'] == 'package_id') { |
538 | 538 | $export_select_str .= 'Package,'; |
539 | 539 | } |
540 | 540 | $custom_total_array [$i] = null; |
541 | - $i ++; |
|
541 | + $i++; |
|
542 | 542 | } |
543 | 543 | |
544 | - if (isset ( $custom_search ['groupby_3'] ) && ! empty ( $custom_search ['groupby_3'] )) { |
|
545 | - $group_by_str .= $custom_search ['groupby_3'] . ","; |
|
546 | - $select_str .= $custom_search ['groupby_3'] . ","; |
|
547 | - $order_str .= $custom_search ['groupby_3'] . ","; |
|
544 | + if (isset ($custom_search ['groupby_3']) && ! empty ($custom_search ['groupby_3'])) { |
|
545 | + $group_by_str .= $custom_search ['groupby_3'].","; |
|
546 | + $select_str .= $custom_search ['groupby_3'].","; |
|
547 | + $order_str .= $custom_search ['groupby_3'].","; |
|
548 | 548 | $group_by_3 = $custom_search ['groupby_3']; |
549 | 549 | if ($custom_search ['groupby_3'] == 'accountid' || $custom_search ['groupby_3'] == 'provider_id') { |
550 | 550 | $export_select_str .= 'Account,'; |
@@ -555,22 +555,22 @@ discard block |
||
555 | 555 | $order_str .= 'notes,'; |
556 | 556 | $export_select_str .= "Code,Destination,"; |
557 | 557 | $custom_total_array [$i] = null; |
558 | - $i ++; |
|
558 | + $i++; |
|
559 | 559 | } elseif ($custom_search ['groupby_3'] == 'package_id') { |
560 | 560 | $export_select_str .= 'Package,'; |
561 | 561 | } |
562 | 562 | $custom_total_array [$i] = null; |
563 | - $i ++; |
|
563 | + $i++; |
|
564 | 564 | } |
565 | - $new_arr ['search_in'] = (isset ( $custom_search ['search_in'] ) && ! empty ( $custom_search ['search_in'] )) ? $custom_search ['search_in'] : 'minutes'; |
|
566 | - unset ( $custom_search ['groupby_1'], $custom_search ['groupby_2'], $custom_search ['groupby_3'], $custom_search ['search_in'] ); |
|
567 | - $this->session->set_userdata ( 'summary_' . $entity . '_search', $custom_search ); |
|
565 | + $new_arr ['search_in'] = (isset ($custom_search ['search_in']) && ! empty ($custom_search ['search_in'])) ? $custom_search ['search_in'] : 'minutes'; |
|
566 | + unset ($custom_search ['groupby_1'], $custom_search ['groupby_2'], $custom_search ['groupby_3'], $custom_search ['search_in']); |
|
567 | + $this->session->set_userdata('summary_'.$entity.'_search', $custom_search); |
|
568 | 568 | } |
569 | - if (! empty ( $group_by_str )) { |
|
570 | - $group_by_str = rtrim ( $group_by_str, "," ); |
|
571 | - $select_str = rtrim ( $select_str, "," ); |
|
572 | - $order_str = rtrim ( $order_str, "," ); |
|
573 | - $export_select_str = rtrim ( $export_select_str, "," ); |
|
569 | + if ( ! empty ($group_by_str)) { |
|
570 | + $group_by_str = rtrim($group_by_str, ","); |
|
571 | + $select_str = rtrim($select_str, ","); |
|
572 | + $order_str = rtrim($order_str, ","); |
|
573 | + $export_select_str = rtrim($export_select_str, ","); |
|
574 | 574 | } else { |
575 | 575 | $select_str = $db_field_name; |
576 | 576 | $order_str = $db_field_name; |
@@ -578,8 +578,8 @@ discard block |
||
578 | 578 | $export_select_str = "Account"; |
579 | 579 | } |
580 | 580 | |
581 | - array_pop ( $custom_total_array ); |
|
582 | - array_unshift ( $custom_total_array, '<b>Grand Total</b>' ); |
|
581 | + array_pop($custom_total_array); |
|
582 | + array_unshift($custom_total_array, '<b>Grand Total</b>'); |
|
583 | 583 | $new_arr ['export_str'] = $export_select_str; |
584 | 584 | $new_arr ['select_str'] = $select_str; |
585 | 585 | $new_arr ['order_str'] = $order_str; |
@@ -592,47 +592,47 @@ discard block |
||
592 | 592 | return $new_arr; |
593 | 593 | } |
594 | 594 | function provider() { |
595 | - $data ['page_title'] = gettext ( 'Provider Summary Report' ); |
|
595 | + $data ['page_title'] = gettext('Provider Summary Report'); |
|
596 | 596 | $data ['search_flag'] = true; |
597 | - $session_info = $this->session->userdata ( 'providersummary_reports_search' ); |
|
598 | - $accountlist = $this->db_model->build_dropdown_deleted ( 'id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array ( |
|
597 | + $session_info = $this->session->userdata('providersummary_reports_search'); |
|
598 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array( |
|
599 | 599 | "type" => "3" |
600 | - ) ); |
|
601 | - $trunklist = $this->db_model->build_dropdown ( 'id,name', 'trunks', '', array () ); |
|
600 | + )); |
|
601 | + $trunklist = $this->db_model->build_dropdown('id,name', 'trunks', '', array()); |
|
602 | 602 | $data ['trunklist'] = $trunklist; |
603 | 603 | $data ['accountlist'] = $accountlist; |
604 | 604 | $data ['session_info'] = $session_info; |
605 | - $data ['seconds'] = $this->session->userdata ( 'provider_seconds' ); |
|
606 | - $data ['search_report'] = $this->common->search_report_in (); |
|
607 | - $data ['grid_fields'] = $this->summary_form->build_providersummary (); |
|
608 | - $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_providersummary (); |
|
609 | - $data ['search_string_type'] = $this->common->search_string_type (); |
|
610 | - $data ['groupby_field'] = $this->common->set_summaryprovider_groupby (); |
|
611 | - $data ['groupby_time'] = $this->common->group_by_time (); |
|
612 | - $this->load->view ( 'view_providersummary_report', $data ); |
|
605 | + $data ['seconds'] = $this->session->userdata('provider_seconds'); |
|
606 | + $data ['search_report'] = $this->common->search_report_in(); |
|
607 | + $data ['grid_fields'] = $this->summary_form->build_providersummary(); |
|
608 | + $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_providersummary(); |
|
609 | + $data ['search_string_type'] = $this->common->search_string_type(); |
|
610 | + $data ['groupby_field'] = $this->common->set_summaryprovider_groupby(); |
|
611 | + $data ['groupby_time'] = $this->common->group_by_time(); |
|
612 | + $this->load->view('view_providersummary_report', $data); |
|
613 | 613 | } |
614 | 614 | function provider_json() { |
615 | - $search_arr = $this->summary_search_info ( 'provider' ); |
|
616 | - $count_all = $this->summary_model->get_providersummary_report_list ( false, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
617 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
615 | + $search_arr = $this->summary_search_info('provider'); |
|
616 | + $count_all = $this->summary_model->get_providersummary_report_list(false, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
617 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
618 | 618 | $json_data = $paging_data ["json_paging"]; |
619 | - $query = $this->summary_model->get_providersummary_report_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
620 | - if ($query->num_rows () > 0) { |
|
621 | - $json_data ['rows'] = $this->summary_report_grid ( $search_arr, $query, 'provider', 'grid' ); |
|
619 | + $query = $this->summary_model->get_providersummary_report_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
620 | + if ($query->num_rows() > 0) { |
|
621 | + $json_data ['rows'] = $this->summary_report_grid($search_arr, $query, 'provider', 'grid'); |
|
622 | 622 | } |
623 | - $this->session->set_userdata ( 'providersummary_reports_export', $search_arr ); |
|
624 | - echo json_encode ( $json_data ); |
|
623 | + $this->session->set_userdata('providersummary_reports_export', $search_arr); |
|
624 | + echo json_encode($json_data); |
|
625 | 625 | } |
626 | 626 | function provider_export_csv() { |
627 | - $account_info = $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
627 | + $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
|
628 | 628 | $currency_id = $account_info ['currency_id']; |
629 | - $currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
630 | - $search_arr = $this->session->userdata ( 'providersummary_reports_export' ); |
|
631 | - $data_arr = array (); |
|
632 | - $query = $this->summary_model->get_providersummary_report_list ( true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true ); |
|
633 | - $search_header = explode ( ",", $search_arr ['export_str'] ); |
|
634 | - ob_clean (); |
|
635 | - $fixed_header = array ( |
|
629 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
630 | + $search_arr = $this->session->userdata('providersummary_reports_export'); |
|
631 | + $data_arr = array(); |
|
632 | + $query = $this->summary_model->get_providersummary_report_list(true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true); |
|
633 | + $search_header = explode(",", $search_arr ['export_str']); |
|
634 | + ob_clean(); |
|
635 | + $fixed_header = array( |
|
636 | 636 | "Attempted Calls", |
637 | 637 | "Completed Calls", |
638 | 638 | "Duration", |
@@ -642,89 +642,89 @@ discard block |
||
642 | 642 | "Billable", |
643 | 643 | "Cost($currency)" |
644 | 644 | ); |
645 | - $header_arr [] = array_merge ( $search_header, $fixed_header ); |
|
646 | - if ($query->num_rows () > 0) { |
|
647 | - $data_arr = $this->summary_report_grid ( $search_arr, $query, 'provider', 'export' ); |
|
645 | + $header_arr [] = array_merge($search_header, $fixed_header); |
|
646 | + if ($query->num_rows() > 0) { |
|
647 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'provider', 'export'); |
|
648 | 648 | } |
649 | - $provider_array = array_merge ( $header_arr, $data_arr ); |
|
649 | + $provider_array = array_merge($header_arr, $data_arr); |
|
650 | 650 | |
651 | - $this->load->helper ( 'csv' ); |
|
652 | - array_to_csv ( $provider_array, 'Provider_Summary_Report_' . date ( "Y-m-d" ) . '.csv' ); |
|
651 | + $this->load->helper('csv'); |
|
652 | + array_to_csv($provider_array, 'Provider_Summary_Report_'.date("Y-m-d").'.csv'); |
|
653 | 653 | } |
654 | 654 | function provider_search() { |
655 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
656 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
657 | - unset ( $_POST ['action'], $_POST ['advance_search'] ); |
|
658 | - $this->session->set_userdata ( 'providersummary_reports_search', $this->input->post () ); |
|
655 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
656 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
657 | + unset ($_POST ['action'], $_POST ['advance_search']); |
|
658 | + $this->session->set_userdata('providersummary_reports_search', $this->input->post()); |
|
659 | 659 | } |
660 | - redirect ( base_url () . 'summary/provider/' ); |
|
660 | + redirect(base_url().'summary/provider/'); |
|
661 | 661 | } |
662 | 662 | function provider_clearsearchfilter() { |
663 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
664 | - $this->session->set_userdata ( 'providersummary_reports_search', "" ); |
|
665 | - $this->session->set_userdata ( 'providersummary_reports_export', "" ); |
|
666 | - redirect ( base_url () . "summary/provider/" ); |
|
663 | + $this->session->set_userdata('advance_search', 0); |
|
664 | + $this->session->set_userdata('providersummary_reports_search', ""); |
|
665 | + $this->session->set_userdata('providersummary_reports_export', ""); |
|
666 | + redirect(base_url()."summary/provider/"); |
|
667 | 667 | } |
668 | 668 | function reseller() { |
669 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
670 | - $data ['page_title'] = gettext ( 'Reseller Summary Report' ); |
|
669 | + $data ['username'] = $this->session->userdata('user_name'); |
|
670 | + $data ['page_title'] = gettext('Reseller Summary Report'); |
|
671 | 671 | $data ['search_flag'] = true; |
672 | - $session_info = $this->session->userdata ( 'resellersummary_reports_search' ); |
|
673 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
672 | + $session_info = $this->session->userdata('resellersummary_reports_search'); |
|
673 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
674 | 674 | $reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
675 | - $accountlist = $this->db_model->build_dropdown_deleted ( 'id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array ( |
|
675 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array( |
|
676 | 676 | 'reseller_id' => $reseller_id, |
677 | 677 | "type" => "1" |
678 | - ) ); |
|
678 | + )); |
|
679 | 679 | $data ['accountlist'] = $accountlist; |
680 | - $data ['seconds'] = $this->session->userdata ( 'reseller_seconds' ); |
|
680 | + $data ['seconds'] = $this->session->userdata('reseller_seconds'); |
|
681 | 681 | $data ['session_info'] = $session_info; |
682 | - $data ['search_report'] = $this->common->search_report_in (); |
|
683 | - $data ['search_string_type'] = $this->common->search_string_type (); |
|
684 | - $new_column_arr = $this->summary_column_arr ( 'reseller' ); |
|
685 | - $data ['grid_fields'] = $this->summary_form->build_resellersummary ( $new_column_arr ); |
|
686 | - $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_resellersummary (); |
|
687 | - $data ['groupby_field'] = $this->common->set_summarycustomer_groupby (); |
|
688 | - $data ['groupby_time'] = $this->common->group_by_time (); |
|
689 | - $this->load->view ( 'view_resellersummary_report', $data ); |
|
682 | + $data ['search_report'] = $this->common->search_report_in(); |
|
683 | + $data ['search_string_type'] = $this->common->search_string_type(); |
|
684 | + $new_column_arr = $this->summary_column_arr('reseller'); |
|
685 | + $data ['grid_fields'] = $this->summary_form->build_resellersummary($new_column_arr); |
|
686 | + $data ["grid_buttons"] = $this->summary_form->build_grid_buttons_resellersummary(); |
|
687 | + $data ['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
688 | + $data ['groupby_time'] = $this->common->group_by_time(); |
|
689 | + $this->load->view('view_resellersummary_report', $data); |
|
690 | 690 | } |
691 | 691 | function reseller_json() { |
692 | - $search_arr = $this->summary_search_info ( 'reseller' ); |
|
693 | - $count_all = $this->summary_model->get_resellersummary_report_list ( false, 0, 0, $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
694 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
692 | + $search_arr = $this->summary_search_info('reseller'); |
|
693 | + $count_all = $this->summary_model->get_resellersummary_report_list(false, 0, 0, $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
694 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
695 | 695 | $json_data = $paging_data ["json_paging"]; |
696 | - $query = $this->summary_model->get_resellersummary_report_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false ); |
|
697 | - if ($query->num_rows () > 0) { |
|
698 | - $json_data ['rows'] = $this->summary_report_grid ( $search_arr, $query, 'reseller', 'grid' ); |
|
696 | + $query = $this->summary_model->get_resellersummary_report_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], false); |
|
697 | + if ($query->num_rows() > 0) { |
|
698 | + $json_data ['rows'] = $this->summary_report_grid($search_arr, $query, 'reseller', 'grid'); |
|
699 | 699 | } |
700 | - $this->session->set_userdata ( 'resellersummary_reports_export', $search_arr ); |
|
701 | - echo json_encode ( $json_data ); |
|
700 | + $this->session->set_userdata('resellersummary_reports_export', $search_arr); |
|
701 | + echo json_encode($json_data); |
|
702 | 702 | } |
703 | 703 | function reseller_search() { |
704 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
705 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
706 | - unset ( $_POST ['action'], $_POST ['advance_search'] ); |
|
707 | - $this->session->set_userdata ( 'resellersummary_reports_search', $this->input->post () ); |
|
704 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
705 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
706 | + unset ($_POST ['action'], $_POST ['advance_search']); |
|
707 | + $this->session->set_userdata('resellersummary_reports_search', $this->input->post()); |
|
708 | 708 | } |
709 | - redirect ( base_url () . "summary/reseller/" ); |
|
709 | + redirect(base_url()."summary/reseller/"); |
|
710 | 710 | } |
711 | 711 | function reseller_clearsearchfilter() { |
712 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
713 | - $this->session->set_userdata ( 'resellersummary_reports_search', "" ); |
|
714 | - $this->session->set_userdata ( 'resellersummary_reports_export', "" ); |
|
715 | - redirect ( base_url () . "summary/reseller/" ); |
|
712 | + $this->session->set_userdata('advance_search', 0); |
|
713 | + $this->session->set_userdata('resellersummary_reports_search', ""); |
|
714 | + $this->session->set_userdata('resellersummary_reports_export', ""); |
|
715 | + redirect(base_url()."summary/reseller/"); |
|
716 | 716 | } |
717 | 717 | function reseller_export_csv() { |
718 | - $account_info = $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
718 | + $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
|
719 | 719 | $currency_id = $account_info ['currency_id']; |
720 | - $currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
720 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
721 | 721 | |
722 | - $search_arr = $this->session->userdata ( 'resellersummary_reports_export' ); |
|
723 | - $data_arr = array (); |
|
724 | - $query = $this->summary_model->get_resellersummary_report_list ( true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true ); |
|
725 | - $search_header = explode ( ",", $search_arr ['export_str'] ); |
|
726 | - ob_clean (); |
|
727 | - $fixed_header = array ( |
|
722 | + $search_arr = $this->session->userdata('resellersummary_reports_export'); |
|
723 | + $data_arr = array(); |
|
724 | + $query = $this->summary_model->get_resellersummary_report_list(true, '', '', $search_arr ['group_by_str'], $search_arr ['select_str'], $search_arr ['order_str'], true); |
|
725 | + $search_header = explode(",", $search_arr ['export_str']); |
|
726 | + ob_clean(); |
|
727 | + $fixed_header = array( |
|
728 | 728 | "Attempted Calls", |
729 | 729 | "Completed Calls", |
730 | 730 | "Duration", |
@@ -736,13 +736,13 @@ discard block |
||
736 | 736 | "Cost($currency)", |
737 | 737 | "Profit" |
738 | 738 | ); |
739 | - $header_arr [] = array_merge ( $search_header, $fixed_header ); |
|
740 | - if ($query->num_rows () > 0) { |
|
741 | - $data_arr = $this->summary_report_grid ( $search_arr, $query, 'reseller', 'export' ); |
|
739 | + $header_arr [] = array_merge($search_header, $fixed_header); |
|
740 | + if ($query->num_rows() > 0) { |
|
741 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'reseller', 'export'); |
|
742 | 742 | } |
743 | - $reseller_array = array_merge ( $header_arr, $data_arr ); |
|
744 | - $this->load->helper ( 'csv' ); |
|
745 | - array_to_csv ( $reseller_array, 'Reseller_Summary_Report_' . date ( "Y-m-d" ) . '.csv' ); |
|
743 | + $reseller_array = array_merge($header_arr, $data_arr); |
|
744 | + $this->load->helper('csv'); |
|
745 | + array_to_csv($reseller_array, 'Reseller_Summary_Report_'.date("Y-m-d").'.csv'); |
|
746 | 746 | } |
747 | 747 | } |
748 | 748 | ?> |
@@ -36,8 +36,9 @@ |
||
36 | 36 | $this->fpdf = new PDF ( 'P', 'pt' ); |
37 | 37 | $this->fpdf->initialize ( 'P', 'mm', 'A4' ); |
38 | 38 | |
39 | - if ($this->session->userdata ( 'user_login' ) == FALSE) |
|
40 | - redirect ( base_url () . '/astpp/login' ); |
|
39 | + if ($this->session->userdata ( 'user_login' ) == FALSE) { |
|
40 | + redirect ( base_url () . '/astpp/login' ); |
|
41 | + } |
|
41 | 42 | } |
42 | 43 | function customer() { |
43 | 44 | $data ['page_title'] = gettext ( 'Customer Summary Report' ); |
@@ -19,24 +19,24 @@ discard block |
||
19 | 19 | // You should have received a copy of the GNU General Public License |
20 | 20 | // along with this program. If not, see <http://www.gnu.org/licenses/> |
21 | 21 | // ########################################################################### |
22 | -if (! defined ( 'BASEPATH' )) |
|
23 | - exit ( 'No direct script access allowed' ); |
|
22 | +if ( ! defined('BASEPATH')) |
|
23 | + exit ('No direct script access allowed'); |
|
24 | 24 | class Summary_form { |
25 | 25 | function __construct() { |
26 | - $this->CI = & get_instance (); |
|
26 | + $this->CI = & get_instance(); |
|
27 | 27 | } |
28 | 28 | function get_providersummary_search_form() { |
29 | - $form ['forms'] = array ( |
|
29 | + $form ['forms'] = array( |
|
30 | 30 | '', |
31 | - array ( |
|
31 | + array( |
|
32 | 32 | 'id' => "providersummary_search" |
33 | 33 | ) |
34 | 34 | ); |
35 | - $form ['Search'] = array ( |
|
36 | - array ( |
|
35 | + $form ['Search'] = array( |
|
36 | + array( |
|
37 | 37 | 'From Date', |
38 | 38 | 'INPUT', |
39 | - array ( |
|
39 | + array( |
|
40 | 40 | 'name' => 'callstart[]', |
41 | 41 | 'id' => 'customer_from_date', |
42 | 42 | 'size' => '20', |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | '', |
48 | 48 | 'start_date[start_date-date]' |
49 | 49 | ), |
50 | - array ( |
|
50 | + array( |
|
51 | 51 | 'To Date', |
52 | 52 | 'INPUT', |
53 | - array ( |
|
53 | + array( |
|
54 | 54 | 'name' => 'callstart[]', |
55 | 55 | 'id' => 'customer_to_date', |
56 | 56 | 'size' => '20', |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | '', |
62 | 62 | 'end_date[end_date-date]' |
63 | 63 | ), |
64 | - array ( |
|
64 | + array( |
|
65 | 65 | 'Account', |
66 | 66 | 'provider_id', |
67 | 67 | 'SELECT', |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | 'accounts', |
75 | 75 | 'build_dropdown_deleted', |
76 | 76 | 'where_arr', |
77 | - array ( |
|
77 | + array( |
|
78 | 78 | "reseller_id" => "0", |
79 | 79 | "type" => "3" |
80 | 80 | ) |
81 | 81 | ), |
82 | - array ( |
|
82 | + array( |
|
83 | 83 | 'Trunk', |
84 | 84 | 'trunk_id', |
85 | 85 | 'SELECT', |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | 'trunks', |
93 | 93 | 'build_dropdown_deleted', |
94 | 94 | '', |
95 | - array ( |
|
95 | + array( |
|
96 | 96 | "status" => "1" |
97 | 97 | ) |
98 | 98 | ), |
99 | - array ( |
|
99 | + array( |
|
100 | 100 | 'Code ', |
101 | 101 | 'INPUT', |
102 | - array ( |
|
102 | + array( |
|
103 | 103 | 'name' => 'pattern[pattern]', |
104 | 104 | 'value' => '', |
105 | 105 | 'size' => '20', |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | 'search_string_type', |
116 | 116 | '' |
117 | 117 | ), |
118 | - array ( |
|
118 | + array( |
|
119 | 119 | ' Code Destination ', |
120 | 120 | 'INPUT', |
121 | - array ( |
|
121 | + array( |
|
122 | 122 | 'name' => 'notes[notes]', |
123 | 123 | 'value' => '', |
124 | 124 | 'size' => '20', |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'search_string_type', |
135 | 135 | '' |
136 | 136 | ), |
137 | - array ( |
|
137 | + array( |
|
138 | 138 | '', |
139 | 139 | 'HIDDEN', |
140 | 140 | 'ajax_search', |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | '', |
144 | 144 | '' |
145 | 145 | ), |
146 | - array ( |
|
146 | + array( |
|
147 | 147 | '', |
148 | 148 | 'HIDDEN', |
149 | 149 | 'advance_search', |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | '' |
154 | 154 | ) |
155 | 155 | ); |
156 | - $form ['button_search'] = array ( |
|
156 | + $form ['button_search'] = array( |
|
157 | 157 | 'name' => 'action', |
158 | 158 | 'id' => "providersummary_search_btn", |
159 | 159 | 'content' => 'Search', |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | 'type' => 'button', |
162 | 162 | 'class' => 'btn btn-line-parrot pull-right' |
163 | 163 | ); |
164 | - $form ['button_reset'] = array ( |
|
164 | + $form ['button_reset'] = array( |
|
165 | 165 | 'name' => 'action', |
166 | 166 | 'id' => "id_reset", |
167 | 167 | 'content' => 'Clear', |
@@ -173,27 +173,27 @@ discard block |
||
173 | 173 | return $form; |
174 | 174 | } |
175 | 175 | function build_providersummary() { |
176 | - $account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' ); |
|
176 | + $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
177 | 177 | $currency_id = $account_info ['currency_id']; |
178 | - $currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
178 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
179 | 179 | |
180 | - $new_arr = array (); |
|
181 | - if ($this->CI->session->userdata ( 'advance_search' ) == '1') { |
|
182 | - $search_array = $this->CI->session->userdata ( 'providersummary_reports_search' ); |
|
183 | - if (isset ( $search_array ['time'] ) && ! empty ( $search_array ['time'] )) { |
|
184 | - $new_arr [] = array ( |
|
180 | + $new_arr = array(); |
|
181 | + if ($this->CI->session->userdata('advance_search') == '1') { |
|
182 | + $search_array = $this->CI->session->userdata('providersummary_reports_search'); |
|
183 | + if (isset ($search_array ['time']) && ! empty ($search_array ['time'])) { |
|
184 | + $new_arr [] = array( |
|
185 | 185 | $search_array ['time'], |
186 | 186 | "151", |
187 | - $search_array ['time'] . "(callstart)", |
|
187 | + $search_array ['time']."(callstart)", |
|
188 | 188 | "", |
189 | 189 | "", |
190 | 190 | "" |
191 | 191 | ); |
192 | 192 | } |
193 | - if (isset ( $search_array ['groupby_1'] ) && ! empty ( $search_array ['groupby_1'] )) { |
|
193 | + if (isset ($search_array ['groupby_1']) && ! empty ($search_array ['groupby_1'])) { |
|
194 | 194 | $first_column_groupby = $search_array ['groupby_1']; |
195 | 195 | if ($first_column_groupby == 'provider_id') { |
196 | - $new_arr [] = array ( |
|
196 | + $new_arr [] = array( |
|
197 | 197 | "Account", |
198 | 198 | "151", |
199 | 199 | "provider_id", |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | "build_concat_string" |
203 | 203 | ); |
204 | 204 | } elseif ($first_column_groupby == 'pattern') { |
205 | - $new_arr [] = array ( |
|
205 | + $new_arr [] = array( |
|
206 | 206 | "Code", |
207 | 207 | "65", |
208 | 208 | "pattern", |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | "", |
211 | 211 | "get_only_numeric_val" |
212 | 212 | ); |
213 | - $new_arr [] = array ( |
|
213 | + $new_arr [] = array( |
|
214 | 214 | "Destination", |
215 | 215 | "85", |
216 | 216 | "notes", |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | "" |
220 | 220 | ); |
221 | 221 | } elseif ($first_column_groupby == 'trunk_id') { |
222 | - $new_arr [] = array ( |
|
222 | + $new_arr [] = array( |
|
223 | 223 | "Trunk", |
224 | 224 | "151", |
225 | 225 | "trunk_id", |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | "get_field_name" |
229 | 229 | ); |
230 | 230 | } elseif ($first_column_groupby == 'package_id') { |
231 | - $new_arr [] = array ( |
|
231 | + $new_arr [] = array( |
|
232 | 232 | "Package", |
233 | 233 | "151", |
234 | 234 | "package_id", |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | ); |
239 | 239 | } |
240 | 240 | } |
241 | - if (isset ( $search_array ['groupby_2'] ) && ! empty ( $search_array ['groupby_2'] )) { |
|
241 | + if (isset ($search_array ['groupby_2']) && ! empty ($search_array ['groupby_2'])) { |
|
242 | 242 | $third_column_groupby = $search_array ['groupby_2']; |
243 | 243 | if ($third_column_groupby == 'provider_id') { |
244 | - $new_arr [] = array ( |
|
244 | + $new_arr [] = array( |
|
245 | 245 | "Account", |
246 | 246 | "151", |
247 | 247 | "provider_id", |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | "build_concat_string" |
251 | 251 | ); |
252 | 252 | } elseif ($third_column_groupby == 'pattern') { |
253 | - $new_arr [] = array ( |
|
253 | + $new_arr [] = array( |
|
254 | 254 | "Code", |
255 | 255 | "65", |
256 | 256 | "pattern", |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | "", |
259 | 259 | "get_only_numeric_val" |
260 | 260 | ); |
261 | - $new_arr [] = array ( |
|
261 | + $new_arr [] = array( |
|
262 | 262 | "Destination", |
263 | 263 | "85", |
264 | 264 | "notes", |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | "" |
268 | 268 | ); |
269 | 269 | } elseif ($third_column_groupby == 'trunk_id') { |
270 | - $new_arr [] = array ( |
|
270 | + $new_arr [] = array( |
|
271 | 271 | "Trunk", |
272 | 272 | "151", |
273 | 273 | "trunk_id", |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | "get_field_name" |
277 | 277 | ); |
278 | 278 | } elseif ($third_column_groupby == 'package_id') { |
279 | - $new_arr [] = array ( |
|
279 | + $new_arr [] = array( |
|
280 | 280 | "Package", |
281 | 281 | "151", |
282 | 282 | "package_id", |
@@ -286,10 +286,10 @@ discard block |
||
286 | 286 | ); |
287 | 287 | } |
288 | 288 | } |
289 | - if (isset ( $search_array ['groupby_3'] ) && ! empty ( $search_array ['groupby_3'] )) { |
|
289 | + if (isset ($search_array ['groupby_3']) && ! empty ($search_array ['groupby_3'])) { |
|
290 | 290 | $fifth_column_groupby = $search_array ['groupby_3']; |
291 | 291 | if ($fifth_column_groupby == 'provider_id') { |
292 | - $new_arr [] = array ( |
|
292 | + $new_arr [] = array( |
|
293 | 293 | "Account", |
294 | 294 | "151", |
295 | 295 | "provider_id", |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | "build_concat_string" |
299 | 299 | ); |
300 | 300 | } elseif ($fifth_column_groupby == 'pattern') { |
301 | - $new_arr [] = array ( |
|
301 | + $new_arr [] = array( |
|
302 | 302 | "Code", |
303 | 303 | "65", |
304 | 304 | "pattern", |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | "", |
307 | 307 | "get_only_numeric_val" |
308 | 308 | ); |
309 | - $new_arr [] = array ( |
|
309 | + $new_arr [] = array( |
|
310 | 310 | "Destination", |
311 | 311 | "85", |
312 | 312 | "notes", |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | "" |
316 | 316 | ); |
317 | 317 | } elseif ($fifth_column_groupby == 'trunk_id') { |
318 | - $new_arr [] = array ( |
|
318 | + $new_arr [] = array( |
|
319 | 319 | "Trunk", |
320 | 320 | "151", |
321 | 321 | "trunk_id", |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | "get_field_name" |
325 | 325 | ); |
326 | 326 | } elseif ($fifth_column_groupby == 'package_id') { |
327 | - $new_arr [] = array ( |
|
327 | + $new_arr [] = array( |
|
328 | 328 | "Package", |
329 | 329 | "151", |
330 | 330 | "package_id", |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | } |
336 | 336 | } |
337 | 337 | } |
338 | - if (empty ( $new_arr )) |
|
339 | - $new_arr [] = array ( |
|
338 | + if (empty ($new_arr)) |
|
339 | + $new_arr [] = array( |
|
340 | 340 | "Account", |
341 | 341 | "453", |
342 | 342 | "provider_id", |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | "accounts", |
345 | 345 | "build_concat_string" |
346 | 346 | ); |
347 | - $fixed_arr = array ( |
|
348 | - array ( |
|
347 | + $fixed_arr = array( |
|
348 | + array( |
|
349 | 349 | "Attempted Calls", |
350 | 350 | "130", |
351 | 351 | "attempted_calls", |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | "", |
354 | 354 | "" |
355 | 355 | ), |
356 | - array ( |
|
356 | + array( |
|
357 | 357 | "Completed Calls", |
358 | 358 | "130", |
359 | 359 | "description", |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | "", |
362 | 362 | "" |
363 | 363 | ), |
364 | - array ( |
|
364 | + array( |
|
365 | 365 | "Duration", |
366 | 366 | "85", |
367 | 367 | "billable", |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | '', |
370 | 370 | '' |
371 | 371 | ), |
372 | - array ( |
|
372 | + array( |
|
373 | 373 | "ASR", |
374 | 374 | "83", |
375 | 375 | "asr", |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | '', |
378 | 378 | '' |
379 | 379 | ), |
380 | - array ( |
|
380 | + array( |
|
381 | 381 | "ACD", |
382 | 382 | "83", |
383 | 383 | "acd ", |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | '', |
386 | 386 | '' |
387 | 387 | ), |
388 | - array ( |
|
388 | + array( |
|
389 | 389 | "MCD", |
390 | 390 | "83", |
391 | 391 | "mcd", |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | '', |
394 | 394 | '' |
395 | 395 | ), |
396 | - array ( |
|
396 | + array( |
|
397 | 397 | "Billable", |
398 | 398 | "102", |
399 | 399 | "billable", |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | '', |
402 | 402 | '' |
403 | 403 | ), |
404 | - array ( |
|
404 | + array( |
|
405 | 405 | "Cost($currency)", |
406 | 406 | "117", |
407 | 407 | "cost", |
@@ -410,12 +410,12 @@ discard block |
||
410 | 410 | '' |
411 | 411 | ) |
412 | 412 | ); |
413 | - $grid_field_arr = json_encode ( array_merge ( $new_arr, $fixed_arr ) ); |
|
413 | + $grid_field_arr = json_encode(array_merge($new_arr, $fixed_arr)); |
|
414 | 414 | return $grid_field_arr; |
415 | 415 | } |
416 | 416 | function build_grid_buttons_providersummary() { |
417 | - $buttons_json = json_encode ( array ( |
|
418 | - array ( |
|
417 | + $buttons_json = json_encode(array( |
|
418 | + array( |
|
419 | 419 | "Export", |
420 | 420 | "btn btn-xing", |
421 | 421 | " fa fa-download fa-lg", |
@@ -423,21 +423,21 @@ discard block |
||
423 | 423 | "/summary/provider_export_csv/", |
424 | 424 | 'single' |
425 | 425 | ) |
426 | - ) ); |
|
426 | + )); |
|
427 | 427 | return $buttons_json; |
428 | 428 | } |
429 | 429 | function get_resellersummary_search_form() { |
430 | - $form ['forms'] = array ( |
|
430 | + $form ['forms'] = array( |
|
431 | 431 | "", |
432 | - array ( |
|
432 | + array( |
|
433 | 433 | 'id' => "resellersummary_search" |
434 | 434 | ) |
435 | 435 | ); |
436 | - $form ['Search'] = array ( |
|
437 | - array ( |
|
436 | + $form ['Search'] = array( |
|
437 | + array( |
|
438 | 438 | 'From Date', |
439 | 439 | 'INPUT', |
440 | - array ( |
|
440 | + array( |
|
441 | 441 | 'name' => 'callstart[]', |
442 | 442 | 'id' => 'customer_from_date', |
443 | 443 | 'size' => '20', |
@@ -448,10 +448,10 @@ discard block |
||
448 | 448 | '', |
449 | 449 | 'start_date[start_date-date]' |
450 | 450 | ), |
451 | - array ( |
|
451 | + array( |
|
452 | 452 | 'To Date', |
453 | 453 | 'INPUT', |
454 | - array ( |
|
454 | + array( |
|
455 | 455 | 'name' => 'callstart[]', |
456 | 456 | 'id' => 'customer_to_date', |
457 | 457 | 'size' => '20', |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | '', |
463 | 463 | 'end_date[end_date-date]' |
464 | 464 | ), |
465 | - array ( |
|
465 | + array( |
|
466 | 466 | 'Account', |
467 | 467 | 'reseller_id', |
468 | 468 | 'SELECT', |
@@ -475,15 +475,15 @@ discard block |
||
475 | 475 | 'accounts', |
476 | 476 | 'build_dropdown_deleted', |
477 | 477 | 'where_arr', |
478 | - array ( |
|
478 | + array( |
|
479 | 479 | "reseller_id" => "0", |
480 | 480 | "type" => "1" |
481 | 481 | ) |
482 | 482 | ), |
483 | - array ( |
|
483 | + array( |
|
484 | 484 | 'Code ', |
485 | 485 | 'INPUT', |
486 | - array ( |
|
486 | + array( |
|
487 | 487 | 'name' => 'pattern[pattern]', |
488 | 488 | 'value' => '', |
489 | 489 | 'size' => '20', |
@@ -499,10 +499,10 @@ discard block |
||
499 | 499 | 'search_string_type', |
500 | 500 | '' |
501 | 501 | ), |
502 | - array ( |
|
502 | + array( |
|
503 | 503 | 'Destination ', |
504 | 504 | 'INPUT', |
505 | - array ( |
|
505 | + array( |
|
506 | 506 | 'name' => 'notes[notes]', |
507 | 507 | 'value' => '', |
508 | 508 | 'size' => '20', |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | 'search_string_type', |
519 | 519 | '' |
520 | 520 | ), |
521 | - array ( |
|
521 | + array( |
|
522 | 522 | '', |
523 | 523 | 'HIDDEN', |
524 | 524 | 'ajax_search', |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | '', |
528 | 528 | '' |
529 | 529 | ), |
530 | - array ( |
|
530 | + array( |
|
531 | 531 | '', |
532 | 532 | 'HIDDEN', |
533 | 533 | 'advance_search', |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | '' |
538 | 538 | ) |
539 | 539 | ); |
540 | - $form ['button_search'] = array ( |
|
540 | + $form ['button_search'] = array( |
|
541 | 541 | 'name' => 'action', |
542 | 542 | 'id' => "resellersummary_search_btn", |
543 | 543 | 'content' => 'Search', |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | 'type' => 'button', |
546 | 546 | 'class' => 'btn btn-line-parrot pull-right' |
547 | 547 | ); |
548 | - $form ['button_reset'] = array ( |
|
548 | + $form ['button_reset'] = array( |
|
549 | 549 | 'name' => 'action', |
550 | 550 | 'id' => "id_reset", |
551 | 551 | 'content' => 'Clear', |
@@ -557,12 +557,12 @@ discard block |
||
557 | 557 | return $form; |
558 | 558 | } |
559 | 559 | function build_resellersummary($new_column_arr) { |
560 | - $account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' ); |
|
560 | + $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
561 | 561 | $currency_id = $account_info ['currency_id']; |
562 | - $currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
562 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
563 | 563 | |
564 | - $column_arr = array ( |
|
565 | - array ( |
|
564 | + $column_arr = array( |
|
565 | + array( |
|
566 | 566 | "Attempted Calls", |
567 | 567 | "120", |
568 | 568 | "attempted_calls", |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | "true", |
574 | 574 | "center" |
575 | 575 | ), |
576 | - array ( |
|
576 | + array( |
|
577 | 577 | "Completed Calls", |
578 | 578 | "120", |
579 | 579 | "description", |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | "true", |
585 | 585 | "center" |
586 | 586 | ), |
587 | - array ( |
|
587 | + array( |
|
588 | 588 | "Duration", |
589 | 589 | "91", |
590 | 590 | "billable", |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | "true", |
596 | 596 | "center" |
597 | 597 | ), |
598 | - array ( |
|
598 | + array( |
|
599 | 599 | "ASR", |
600 | 600 | "78", |
601 | 601 | "asr", |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | "true", |
607 | 607 | "center" |
608 | 608 | ), |
609 | - array ( |
|
609 | + array( |
|
610 | 610 | "ACD", |
611 | 611 | "78", |
612 | 612 | "acd ", |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | "true", |
618 | 618 | "center" |
619 | 619 | ), |
620 | - array ( |
|
620 | + array( |
|
621 | 621 | "MCD", |
622 | 622 | "78", |
623 | 623 | "mcd", |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | "true", |
629 | 629 | "center" |
630 | 630 | ), |
631 | - array ( |
|
631 | + array( |
|
632 | 632 | "Billable", |
633 | 633 | "80", |
634 | 634 | "billable", |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | "true", |
640 | 640 | "center" |
641 | 641 | ), |
642 | - array ( |
|
642 | + array( |
|
643 | 643 | "Debit($currency)", |
644 | 644 | "100", |
645 | 645 | "cost", |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | "true", |
651 | 651 | "right" |
652 | 652 | ), |
653 | - array ( |
|
653 | + array( |
|
654 | 654 | "Cost($currency)", |
655 | 655 | "100", |
656 | 656 | "price", |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | "true", |
662 | 662 | "right" |
663 | 663 | ), |
664 | - array ( |
|
664 | + array( |
|
665 | 665 | "Profit($currency)", |
666 | 666 | "100", |
667 | 667 | "profit", |
@@ -673,12 +673,12 @@ discard block |
||
673 | 673 | "right" |
674 | 674 | ) |
675 | 675 | ); |
676 | - $grid_field_arr = json_encode ( array_merge ( $new_column_arr, $column_arr ) ); |
|
676 | + $grid_field_arr = json_encode(array_merge($new_column_arr, $column_arr)); |
|
677 | 677 | return $grid_field_arr; |
678 | 678 | } |
679 | 679 | function build_grid_buttons_resellersummary() { |
680 | - $buttons_json = json_encode ( array ( |
|
681 | - array ( |
|
680 | + $buttons_json = json_encode(array( |
|
681 | + array( |
|
682 | 682 | "Export", |
683 | 683 | "btn btn-xing", |
684 | 684 | " fa fa-download fa-lg", |
@@ -686,22 +686,22 @@ discard block |
||
686 | 686 | "/summary/reseller_export_csv/", |
687 | 687 | 'single' |
688 | 688 | ) |
689 | - ) ); |
|
689 | + )); |
|
690 | 690 | return $buttons_json; |
691 | 691 | } |
692 | 692 | function get_customersummary_search_form() { |
693 | - $form ['forms'] = array ( |
|
694 | - base_url () . 'summary/customer_search', |
|
695 | - array ( |
|
693 | + $form ['forms'] = array( |
|
694 | + base_url().'summary/customer_search', |
|
695 | + array( |
|
696 | 696 | 'id' => "customersummary_search", |
697 | 697 | "name" => "customersummary_search" |
698 | 698 | ) |
699 | 699 | ); |
700 | - $form ['Search'] = array ( |
|
701 | - array ( |
|
700 | + $form ['Search'] = array( |
|
701 | + array( |
|
702 | 702 | 'From Date', |
703 | 703 | 'INPUT', |
704 | - array ( |
|
704 | + array( |
|
705 | 705 | 'name' => 'callstart[]', |
706 | 706 | 'id' => 'customer_from_date', |
707 | 707 | 'size' => '20', |
@@ -712,10 +712,10 @@ discard block |
||
712 | 712 | '', |
713 | 713 | 'start_date[start_date-date]' |
714 | 714 | ), |
715 | - array ( |
|
715 | + array( |
|
716 | 716 | 'To Date', |
717 | 717 | 'INPUT', |
718 | - array ( |
|
718 | + array( |
|
719 | 719 | 'name' => 'callstart[]', |
720 | 720 | 'id' => 'customer_to_date', |
721 | 721 | 'size' => '20', |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | '', |
727 | 727 | 'end_date[end_date-date]' |
728 | 728 | ), |
729 | - array ( |
|
729 | + array( |
|
730 | 730 | 'Accounts', |
731 | 731 | 'accountid', |
732 | 732 | 'SELECT', |
@@ -739,15 +739,15 @@ discard block |
||
739 | 739 | 'accounts', |
740 | 740 | 'build_dropdown_deleted', |
741 | 741 | 'where_arr', |
742 | - array ( |
|
742 | + array( |
|
743 | 743 | "reseller_id" => "0", |
744 | 744 | "type" => "GLOBAL" |
745 | 745 | ) |
746 | 746 | ), |
747 | - array ( |
|
747 | + array( |
|
748 | 748 | 'Code ', |
749 | 749 | 'INPUT', |
750 | - array ( |
|
750 | + array( |
|
751 | 751 | 'name' => 'pattern[pattern]', |
752 | 752 | 'value' => '', |
753 | 753 | 'size' => '20', |
@@ -763,10 +763,10 @@ discard block |
||
763 | 763 | 'search_string_type', |
764 | 764 | '' |
765 | 765 | ), |
766 | - array ( |
|
766 | + array( |
|
767 | 767 | 'Code Destination ', |
768 | 768 | 'INPUT', |
769 | - array ( |
|
769 | + array( |
|
770 | 770 | 'name' => 'notes[notes]', |
771 | 771 | 'value' => '', |
772 | 772 | 'size' => '20', |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | 'search_string_type', |
783 | 783 | '' |
784 | 784 | ), |
785 | - array ( |
|
785 | + array( |
|
786 | 786 | '', |
787 | 787 | 'HIDDEN', |
788 | 788 | 'ajax_search', |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | '', |
792 | 792 | '' |
793 | 793 | ), |
794 | - array ( |
|
794 | + array( |
|
795 | 795 | '', |
796 | 796 | 'HIDDEN', |
797 | 797 | 'advance_search', |
@@ -801,8 +801,8 @@ discard block |
||
801 | 801 | '' |
802 | 802 | ) |
803 | 803 | ); |
804 | - $form ['Group'] = array ( |
|
805 | - array ( |
|
804 | + $form ['Group'] = array( |
|
805 | + array( |
|
806 | 806 | 'Group By #1', |
807 | 807 | 'groupby_1', |
808 | 808 | 'SELECT', |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | '', |
816 | 816 | 'set_summarycustomer_groupby' |
817 | 817 | ), |
818 | - array ( |
|
818 | + array( |
|
819 | 819 | 'Group By #2', |
820 | 820 | 'groupby_2', |
821 | 821 | 'SELECT', |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | '', |
829 | 829 | 'set_summarycustomer_groupby' |
830 | 830 | ), |
831 | - array ( |
|
831 | + array( |
|
832 | 832 | 'Group By #3', |
833 | 833 | 'groupby_3', |
834 | 834 | 'SELECT', |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | 'set_summarycustomer_groupby' |
843 | 843 | ) |
844 | 844 | ); |
845 | - $form ['button_search'] = array ( |
|
845 | + $form ['button_search'] = array( |
|
846 | 846 | 'name' => 'action', |
847 | 847 | 'id' => "customersummary_search_btn", |
848 | 848 | 'content' => 'Search', |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | 'type' => 'button', |
851 | 851 | 'class' => 'btn btn-line-parrot pull-right' |
852 | 852 | ); |
853 | - $form ['button_reset'] = array ( |
|
853 | + $form ['button_reset'] = array( |
|
854 | 854 | 'name' => 'action', |
855 | 855 | 'id' => "id_reset", |
856 | 856 | 'content' => 'Clear', |
@@ -862,12 +862,12 @@ discard block |
||
862 | 862 | return $form; |
863 | 863 | } |
864 | 864 | function build_customersummary($new_column_arr) { |
865 | - $account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' ); |
|
865 | + $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
866 | 866 | $currency_id = $account_info ['currency_id']; |
867 | - $currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
867 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
868 | 868 | |
869 | - $column_arr = array ( |
|
870 | - array ( |
|
869 | + $column_arr = array( |
|
870 | + array( |
|
871 | 871 | "Attempted Calls", |
872 | 872 | "120", |
873 | 873 | "attempted_calls", |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | "true", |
879 | 879 | "center" |
880 | 880 | ), |
881 | - array ( |
|
881 | + array( |
|
882 | 882 | "Completed Calls", |
883 | 883 | "120", |
884 | 884 | "description", |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | "true", |
890 | 890 | "center" |
891 | 891 | ), |
892 | - array ( |
|
892 | + array( |
|
893 | 893 | "Duration", |
894 | 894 | "95", |
895 | 895 | "billable", |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | "true", |
901 | 901 | "center" |
902 | 902 | ), |
903 | - array ( |
|
903 | + array( |
|
904 | 904 | "ASR", |
905 | 905 | "85", |
906 | 906 | "asr", |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | "true", |
912 | 912 | "center" |
913 | 913 | ), |
914 | - array ( |
|
914 | + array( |
|
915 | 915 | "ACD", |
916 | 916 | "85", |
917 | 917 | "acd ", |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | "true", |
923 | 923 | "center" |
924 | 924 | ), |
925 | - array ( |
|
925 | + array( |
|
926 | 926 | "MCD", |
927 | 927 | "85", |
928 | 928 | "mcd", |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | "true", |
934 | 934 | "center" |
935 | 935 | ), |
936 | - array ( |
|
936 | + array( |
|
937 | 937 | "Billable", |
938 | 938 | "90", |
939 | 939 | "billable", |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | "true", |
945 | 945 | "right" |
946 | 946 | ), |
947 | - array ( |
|
947 | + array( |
|
948 | 948 | "Debit($currency)", |
949 | 949 | "87", |
950 | 950 | "cost", |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | "true", |
956 | 956 | "right" |
957 | 957 | ), |
958 | - array ( |
|
958 | + array( |
|
959 | 959 | "Cost($currency)", |
960 | 960 | "85", |
961 | 961 | "price", |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | "true", |
967 | 967 | "right" |
968 | 968 | ), |
969 | - array ( |
|
969 | + array( |
|
970 | 970 | "Profit($currency)", |
971 | 971 | "93", |
972 | 972 | "profit", |
@@ -978,12 +978,12 @@ discard block |
||
978 | 978 | "right" |
979 | 979 | ) |
980 | 980 | ); |
981 | - $grid_field_arr = json_encode ( array_merge ( $new_column_arr, $column_arr ) ); |
|
981 | + $grid_field_arr = json_encode(array_merge($new_column_arr, $column_arr)); |
|
982 | 982 | return $grid_field_arr; |
983 | 983 | } |
984 | 984 | function build_grid_buttons_customersummary() { |
985 | - $buttons_json = json_encode ( array ( |
|
986 | - array ( |
|
985 | + $buttons_json = json_encode(array( |
|
986 | + array( |
|
987 | 987 | "Export", |
988 | 988 | "btn btn-xing", |
989 | 989 | " fa fa-download fa-lg", |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | "/summary/customer_export_csv/", |
992 | 992 | 'single' |
993 | 993 | ) |
994 | - ) ); |
|
994 | + )); |
|
995 | 995 | return $buttons_json; |
996 | 996 | } |
997 | 997 | } |
@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | // You should have received a copy of the GNU General Public License |
20 | 20 | // along with this program. If not, see <http://www.gnu.org/licenses/> |
21 | 21 | // ########################################################################### |
22 | -if (! defined ( 'BASEPATH' )) |
|
22 | +if (! defined ( 'BASEPATH' )) { |
|
23 | 23 | exit ( 'No direct script access allowed' ); |
24 | +} |
|
24 | 25 | class Summary_form { |
25 | 26 | function __construct() { |
26 | 27 | $this->CI = & get_instance (); |
@@ -335,8 +336,8 @@ discard block |
||
335 | 336 | } |
336 | 337 | } |
337 | 338 | } |
338 | - if (empty ( $new_arr )) |
|
339 | - $new_arr [] = array ( |
|
339 | + if (empty ( $new_arr )) { |
|
340 | + $new_arr [] = array ( |
|
340 | 341 | "Account", |
341 | 342 | "453", |
342 | 343 | "provider_id", |
@@ -344,6 +345,7 @@ discard block |
||
344 | 345 | "accounts", |
345 | 346 | "build_concat_string" |
346 | 347 | ); |
348 | + } |
|
347 | 349 | $fixed_arr = array ( |
348 | 350 | array ( |
349 | 351 | "Attempted Calls", |
@@ -23,56 +23,56 @@ discard block |
||
23 | 23 | // ############################################################################## |
24 | 24 | class DID_model extends CI_Model { |
25 | 25 | function DID_model() { |
26 | - parent::__construct (); |
|
26 | + parent::__construct(); |
|
27 | 27 | } |
28 | 28 | function add_did($add_array) { |
29 | 29 | if ($add_array ['accountid'] > 0) { |
30 | - $add_array ['assign_date'] = gmdate ( 'Y-m-d H:i:s' ); |
|
30 | + $add_array ['assign_date'] = gmdate('Y-m-d H:i:s'); |
|
31 | 31 | } |
32 | - unset ( $add_array ["action"] ); |
|
33 | - $this->db->insert ( "dids", $add_array ); |
|
34 | - $last_id = $this->db->insert_id (); |
|
32 | + unset ($add_array ["action"]); |
|
33 | + $this->db->insert("dids", $add_array); |
|
34 | + $last_id = $this->db->insert_id(); |
|
35 | 35 | if ($add_array ['accountid'] > 0) { |
36 | - $accountinfo = ( array ) $this->db->get_where ( 'accounts', array ( |
|
36 | + $accountinfo = (array)$this->db->get_where('accounts', array( |
|
37 | 37 | "id" => $add_array ['accountid'] |
38 | - ) )->first_row (); |
|
39 | - $currency_name = $this->common->get_field_name ( 'currency', "currency", array ( |
|
38 | + ))->first_row(); |
|
39 | + $currency_name = $this->common->get_field_name('currency', "currency", array( |
|
40 | 40 | 'id' => $accountinfo ['currency_id'] |
41 | - ) ); |
|
42 | - $available_bal = $this->db_model->update_balance ( $add_array ["setup"], $add_array ['accountid'], "debit" ); |
|
43 | - $this->common->add_invoice_details ( $accountinfo, "DIDCHRG", $add_array ["setup"], $add_array ['number'] ); |
|
41 | + )); |
|
42 | + $available_bal = $this->db_model->update_balance($add_array ["setup"], $add_array ['accountid'], "debit"); |
|
43 | + $this->common->add_invoice_details($accountinfo, "DIDCHRG", $add_array ["setup"], $add_array ['number']); |
|
44 | 44 | |
45 | - require_once (APPPATH . 'controllers/ProcessCharges.php'); |
|
46 | - $ProcessCharges = new ProcessCharges (); |
|
47 | - $Params = array ( |
|
45 | + require_once (APPPATH.'controllers/ProcessCharges.php'); |
|
46 | + $ProcessCharges = new ProcessCharges(); |
|
47 | + $Params = array( |
|
48 | 48 | "DIDid" => $last_id |
49 | 49 | ); |
50 | - $ProcessCharges->BillAccountCharges ( "DIDs", $Params ); |
|
50 | + $ProcessCharges->BillAccountCharges("DIDs", $Params); |
|
51 | 51 | |
52 | 52 | $accountinfo ['did_number'] = $add_array ['number']; |
53 | - $country_id = $this->common->get_field_name ( 'country', 'countrycode', $add_array ['country_id'] ); |
|
53 | + $country_id = $this->common->get_field_name('country', 'countrycode', $add_array ['country_id']); |
|
54 | 54 | $accountinfo ['did_country_id'] = $country_id; |
55 | - $accountinfo ['did_setup'] = $this->common_model->calculate_currency ( $add_array ['setup'], '', $currency_name, true, true ); |
|
56 | - $accountinfo ['did_monthlycost'] = $this->common_model->calculate_currency ( $add_array ['monthlycost'], '', $currency_name, true, true ); |
|
55 | + $accountinfo ['did_setup'] = $this->common_model->calculate_currency($add_array ['setup'], '', $currency_name, true, true); |
|
56 | + $accountinfo ['did_monthlycost'] = $this->common_model->calculate_currency($add_array ['monthlycost'], '', $currency_name, true, true); |
|
57 | 57 | $accountinfo ['did_maxchannels'] = $add_array ['maxchannels']; |
58 | - $this->common->mail_to_users ( 'email_add_did', $accountinfo ); |
|
58 | + $this->common->mail_to_users('email_add_did', $accountinfo); |
|
59 | 59 | } |
60 | 60 | return true; |
61 | 61 | } |
62 | 62 | function insert_pricelist() { |
63 | - $insert_array = array ( |
|
63 | + $insert_array = array( |
|
64 | 64 | 'name' => 'default', |
65 | 65 | 'markup' => '', |
66 | 66 | 'inc' => '' |
67 | 67 | ); |
68 | - return $this->db->insert_id (); |
|
68 | + return $this->db->insert_id(); |
|
69 | 69 | } |
70 | 70 | function edit_did($data, $id, $number) { |
71 | - unset ( $data ["action"] ); |
|
72 | - $this->db->where ( 'number', $number ); |
|
73 | - $this->db->select ( 'parent_id,accountid' ); |
|
74 | - $did_result = $this->db->get ( 'dids' ); |
|
75 | - $did_result = ( array ) $did_result->first_row (); |
|
71 | + unset ($data ["action"]); |
|
72 | + $this->db->where('number', $number); |
|
73 | + $this->db->select('parent_id,accountid'); |
|
74 | + $did_result = $this->db->get('dids'); |
|
75 | + $did_result = (array)$did_result->first_row(); |
|
76 | 76 | if ($did_result ['accountid'] > 0 || $did_result ['parent_id'] > 0) { |
77 | 77 | $data ['accountid'] = $did_result ['accountid']; |
78 | 78 | $data ['parent_id'] = $did_result ['parent_id']; |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | * ASTPP 3.0 |
82 | 82 | * In did edit last modified date and assign date update |
83 | 83 | */ |
84 | - $data ['last_modified_date'] = gmdate ( "Y-m-d H:i:s" ); |
|
84 | + $data ['last_modified_date'] = gmdate("Y-m-d H:i:s"); |
|
85 | 85 | if ($did_result ['accountid'] == 0 && $data ['accountid'] > 0) { |
86 | - $data ['assign_date'] = gmdate ( "Y-m-d H:i:s" ); |
|
86 | + $data ['assign_date'] = gmdate("Y-m-d H:i:s"); |
|
87 | 87 | } |
88 | - $this->db->where ( "number", $number ); |
|
89 | - $this->db->where ( "id", $id ); |
|
90 | - $this->db->update ( "dids", $data ); |
|
88 | + $this->db->where("number", $number); |
|
89 | + $this->db->where("id", $id); |
|
90 | + $this->db->update("dids", $data); |
|
91 | 91 | /** |
92 | 92 | * *********************************** |
93 | 93 | */ |
@@ -95,77 +95,77 @@ discard block |
||
95 | 95 | $update_array ['call_type'] = $data ['call_type']; |
96 | 96 | $update_array ['extensions'] = $data ['extensions']; |
97 | 97 | $update_array ['note'] = $data ['number']; |
98 | - $this->db->where ( "note", $number ); |
|
99 | - $this->db->update ( "reseller_pricing", $update_array ); |
|
98 | + $this->db->where("note", $number); |
|
99 | + $this->db->update("reseller_pricing", $update_array); |
|
100 | 100 | } |
101 | 101 | if ($did_result ['accountid'] == 0 && $data ['accountid'] > 0) { |
102 | - $accountinfo = ( array ) $this->db->get_where ( 'accounts', array ( |
|
102 | + $accountinfo = (array)$this->db->get_where('accounts', array( |
|
103 | 103 | "id" => $data ['accountid'] |
104 | - ) )->first_row (); |
|
105 | - $currency_name = $this->common->get_field_name ( 'currency', "currency", array ( |
|
104 | + ))->first_row(); |
|
105 | + $currency_name = $this->common->get_field_name('currency', "currency", array( |
|
106 | 106 | 'id' => $accountinfo ['currency_id'] |
107 | - ) ); |
|
108 | - $available_bal = $this->db_model->update_balance ( $data ["setup"], $data ['accountid'], "debit" ); |
|
109 | - $this->common->add_invoice_details ( $accountinfo, "DIDCHRG", $data ["setup"], $number ); |
|
110 | - require_once (APPPATH . 'controllers/ProcessCharges.php'); |
|
111 | - $ProcessCharges = new ProcessCharges (); |
|
112 | - $Params = array ( |
|
107 | + )); |
|
108 | + $available_bal = $this->db_model->update_balance($data ["setup"], $data ['accountid'], "debit"); |
|
109 | + $this->common->add_invoice_details($accountinfo, "DIDCHRG", $data ["setup"], $number); |
|
110 | + require_once (APPPATH.'controllers/ProcessCharges.php'); |
|
111 | + $ProcessCharges = new ProcessCharges(); |
|
112 | + $Params = array( |
|
113 | 113 | "DIDid" => $id |
114 | 114 | ); |
115 | - $ProcessCharges->BillAccountCharges ( "DIDs", $Params ); |
|
115 | + $ProcessCharges->BillAccountCharges("DIDs", $Params); |
|
116 | 116 | |
117 | 117 | $accountinfo ['did_number'] = $number; |
118 | - $country_id = $this->common->get_field_name ( 'country', 'countrycode', $data ['country_id'] ); |
|
118 | + $country_id = $this->common->get_field_name('country', 'countrycode', $data ['country_id']); |
|
119 | 119 | $accountinfo ['did_country_id'] = $country_id; |
120 | - $accountinfo ['did_setup'] = $this->common_model->calculate_currency ( $data ['setup'], '', $currency_name, true, true ); |
|
121 | - $accountinfo ['did_monthlycost'] = $this->common_model->calculate_currency ( $data ['monthlycost'], '', $currency_name, true, true ); |
|
120 | + $accountinfo ['did_setup'] = $this->common_model->calculate_currency($data ['setup'], '', $currency_name, true, true); |
|
121 | + $accountinfo ['did_monthlycost'] = $this->common_model->calculate_currency($data ['monthlycost'], '', $currency_name, true, true); |
|
122 | 122 | $accountinfo ['did_maxchannels'] = $data ['maxchannels']; |
123 | - $this->common->mail_to_users ( 'email_add_did', $accountinfo ); |
|
123 | + $this->common->mail_to_users('email_add_did', $accountinfo); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | function getdid_list($flag, $start = 0, $limit = 0) { |
127 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
127 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
128 | 128 | $parent_id = $accountinfo ['type'] == 1 ? $accountinfo ['reseller_id'] : 0; |
129 | 129 | |
130 | 130 | if ($accountinfo ['type'] == 1) { |
131 | - $where = array ( |
|
131 | + $where = array( |
|
132 | 132 | 'reseller_id' => $accountinfo ['id'], |
133 | 133 | "parent_id" => $parent_id |
134 | 134 | ); |
135 | 135 | if ($flag) { |
136 | 136 | if ($accountinfo ['reseller_id'] > 0) { |
137 | - $search_string = $this->db_model->build_search_string ( 'did_list_search' ); |
|
138 | - $search_string = ! empty ( $search_string ) ? " AND " . $search_string : null; |
|
139 | - if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
|
140 | - $this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
|
137 | + $search_string = $this->db_model->build_search_string('did_list_search'); |
|
138 | + $search_string = ! empty ($search_string) ? " AND ".$search_string : null; |
|
139 | + if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') { |
|
140 | + $this->db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']); |
|
141 | 141 | } |
142 | - $this->db->limit ( $limit, $start ); |
|
143 | - $query = $this->db->query ( "SELECT a.note AS number,a.*,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =" . $accountinfo ['id'] . " AND a.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = a.note AND c.parent_id =" . $accountinfo ['id'] . "), (SELECT accountid from dids as d where d.parent_id = " . $accountinfo ['id'] . " AND d.number=a.note)) AS accountid FROM reseller_pricing AS a where a.reseller_id=" . $accountinfo ['id'] . " AND a.parent_id =" . $accountinfo ['reseller_id'] . $search_string ); |
|
142 | + $this->db->limit($limit, $start); |
|
143 | + $query = $this->db->query("SELECT a.note AS number,a.*,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo ['id']." AND a.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = a.note AND c.parent_id =".$accountinfo ['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo ['id']." AND d.number=a.note)) AS accountid FROM reseller_pricing AS a where a.reseller_id=".$accountinfo ['id']." AND a.parent_id =".$accountinfo ['reseller_id'].$search_string); |
|
144 | 144 | } else { |
145 | - $this->db_model->build_search ( 'did_list_search' ); |
|
146 | - $query = $this->db_model->select ( "*,note as number,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =" . $accountinfo ['id'] . " AND reseller_pricing.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = reseller_pricing.note AND c.parent_id =" . $accountinfo ['id'] . "), (SELECT accountid from dids as d where d.parent_id = " . $accountinfo ['id'] . " AND d.number=reseller_pricing.note)) AS accountid", "reseller_pricing", $where, "note", "desc", $limit, $start ); |
|
145 | + $this->db_model->build_search('did_list_search'); |
|
146 | + $query = $this->db_model->select("*,note as number,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo ['id']." AND reseller_pricing.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = reseller_pricing.note AND c.parent_id =".$accountinfo ['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo ['id']." AND d.number=reseller_pricing.note)) AS accountid", "reseller_pricing", $where, "note", "desc", $limit, $start); |
|
147 | 147 | } |
148 | 148 | } else { |
149 | - $this->db_model->build_search ( 'did_list_search' ); |
|
150 | - $query = $this->db_model->countQuery ( "*", "reseller_pricing", $where ); |
|
149 | + $this->db_model->build_search('did_list_search'); |
|
150 | + $query = $this->db_model->countQuery("*", "reseller_pricing", $where); |
|
151 | 151 | } |
152 | 152 | } else { |
153 | - $this->db_model->build_search ( 'did_list_search' ); |
|
153 | + $this->db_model->build_search('did_list_search'); |
|
154 | 154 | if ($flag) { |
155 | 155 | /* |
156 | 156 | * ASTPP 3.0 last_modified_date,assign_date put in query. |
157 | 157 | */ |
158 | - $this->db->select ( 'dids.id,dids.connectcost,dids.includedseconds,dids.last_modified_date,dids.assign_date,dids.number,dids.extensions,dids.call_type,dids.country_id,dids.init_inc,dids.inc,dids.cost,dids.setup,dids.monthlycost,dids.status,(CASE when parent_id > 0 THEN (SELECT reseller_id as accountid from reseller_pricing where dids.number=reseller_pricing.note AND reseller_pricing.parent_id=0) ELSE dids.accountid END ) as accountid' ); |
|
159 | - if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
|
160 | - $this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
|
158 | + $this->db->select('dids.id,dids.connectcost,dids.includedseconds,dids.last_modified_date,dids.assign_date,dids.number,dids.extensions,dids.call_type,dids.country_id,dids.init_inc,dids.inc,dids.cost,dids.setup,dids.monthlycost,dids.status,(CASE when parent_id > 0 THEN (SELECT reseller_id as accountid from reseller_pricing where dids.number=reseller_pricing.note AND reseller_pricing.parent_id=0) ELSE dids.accountid END ) as accountid'); |
|
159 | + if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') { |
|
160 | + $this->db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']); |
|
161 | 161 | } |
162 | 162 | /** |
163 | 163 | * *******************************************************88 |
164 | 164 | */ |
165 | - $this->db->limit ( $limit, $start ); |
|
166 | - $query = $this->db->get ( 'dids' ); |
|
165 | + $this->db->limit($limit, $start); |
|
166 | + $query = $this->db->get('dids'); |
|
167 | 167 | } else { |
168 | - $query = $this->db_model->countQuery ( "*", "dids" ); |
|
168 | + $query = $this->db_model->countQuery("*", "dids"); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | return $query; |
@@ -176,117 +176,117 @@ discard block |
||
176 | 176 | * For Email broadcast |
177 | 177 | * * |
178 | 178 | */ |
179 | - $where = array ( |
|
179 | + $where = array( |
|
180 | 180 | 'id' => $id |
181 | 181 | ); |
182 | - $this->db->where ( $where ); |
|
183 | - $this->db->select ( 'accountid,number,parent_id' ); |
|
184 | - $did_info = ( array ) $this->db->get ( 'dids' )->first_row (); |
|
185 | - $this->db->where ( "id", $id ); |
|
186 | - $this->db->delete ( "dids" ); |
|
187 | - $this->db->where ( "note", $did_info ['number'] ); |
|
188 | - $this->db->delete ( "reseller_pricing" ); |
|
182 | + $this->db->where($where); |
|
183 | + $this->db->select('accountid,number,parent_id'); |
|
184 | + $did_info = (array)$this->db->get('dids')->first_row(); |
|
185 | + $this->db->where("id", $id); |
|
186 | + $this->db->delete("dids"); |
|
187 | + $this->db->where("note", $did_info ['number']); |
|
188 | + $this->db->delete("reseller_pricing"); |
|
189 | 189 | if ($did_info ['accountid'] == 0 && $did_info ['parent_id'] > 0) { |
190 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
190 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
191 | 191 | $did_info ['accountid'] = $accouninfo ['id']; |
192 | - $accountinfo = ( array ) $this->db->get_where ( 'accounts', array ( |
|
192 | + $accountinfo = (array)$this->db->get_where('accounts', array( |
|
193 | 193 | "id" => $did_info ['parent_id'] |
194 | - ) )->first_row (); |
|
194 | + ))->first_row(); |
|
195 | 195 | $accountinfo ['did_number'] = $accountinfo ['number']; |
196 | - $this->common->mail_to_users ( 'email_remove_did', $accountinfo ); |
|
196 | + $this->common->mail_to_users('email_remove_did', $accountinfo); |
|
197 | 197 | } elseif ($did_info ['accountid'] > 0) { |
198 | - $accountinfo = ( array ) $this->db->get_where ( 'accounts', array ( |
|
198 | + $accountinfo = (array)$this->db->get_where('accounts', array( |
|
199 | 199 | "id" => $did_info ['accountid'] |
200 | - ) )->first_row (); |
|
200 | + ))->first_row(); |
|
201 | 201 | $accountinfo ['did_number'] = $did_info ['number']; |
202 | - $this->common->mail_to_users ( 'email_remove_did', $accountinfo ); |
|
202 | + $this->common->mail_to_users('email_remove_did', $accountinfo); |
|
203 | 203 | } |
204 | 204 | return true; |
205 | 205 | } |
206 | 206 | function get_coutry_id_by_name($field_value) { |
207 | - $this->db->where ( "country", ucfirst ( $field_value ) ); |
|
208 | - $query = $this->db->get ( 'countrycode' ); |
|
209 | - $data = $query->result (); |
|
207 | + $this->db->where("country", ucfirst($field_value)); |
|
208 | + $query = $this->db->get('countrycode'); |
|
209 | + $data = $query->result(); |
|
210 | 210 | if ($query->num_rows > 0) |
211 | 211 | return $data [0]->id; |
212 | 212 | else |
213 | 213 | return ''; |
214 | 214 | } |
215 | 215 | function bulk_insert_dids($field_value) { |
216 | - $this->db->insert_batch ( 'dids', $field_value ); |
|
217 | - $affected_row = $this->db->affected_rows (); |
|
216 | + $this->db->insert_batch('dids', $field_value); |
|
217 | + $affected_row = $this->db->affected_rows(); |
|
218 | 218 | return $affected_row; |
219 | 219 | } |
220 | 220 | function get_account($accountdata) { |
221 | - $q = "SELECT * FROM accounts WHERE number = '" . $this->db->escape_str ( $accountdata ) . "' AND status = 0"; |
|
222 | - $query = $this->db->query ( $q ); |
|
223 | - if ($query->num_rows () > 0) { |
|
224 | - $row = $query->row_array (); |
|
221 | + $q = "SELECT * FROM accounts WHERE number = '".$this->db->escape_str($accountdata)."' AND status = 0"; |
|
222 | + $query = $this->db->query($q); |
|
223 | + if ($query->num_rows() > 0) { |
|
224 | + $row = $query->row_array(); |
|
225 | 225 | return $row; |
226 | 226 | } |
227 | 227 | |
228 | - $q = "SELECT * FROM accounts WHERE cc = '" . $this->db->escape_str ( $accountdata ) . "' AND status = 0"; |
|
229 | - $query = $this->db->query ( $q ); |
|
230 | - if ($query->num_rows () > 0) { |
|
231 | - $row = $query->row_array (); |
|
228 | + $q = "SELECT * FROM accounts WHERE cc = '".$this->db->escape_str($accountdata)."' AND status = 0"; |
|
229 | + $query = $this->db->query($q); |
|
230 | + if ($query->num_rows() > 0) { |
|
231 | + $row = $query->row_array(); |
|
232 | 232 | return $row; |
233 | 233 | } |
234 | 234 | |
235 | - $q = "SELECT * FROM accounts WHERE accountid = '" . $this->db->escape_str ( $accountdata ) . "' AND status = 0"; |
|
236 | - $query = $this->db->query ( $q ); |
|
237 | - if ($query->num_rows () > 0) { |
|
238 | - $row = $query->row_array (); |
|
235 | + $q = "SELECT * FROM accounts WHERE accountid = '".$this->db->escape_str($accountdata)."' AND status = 0"; |
|
236 | + $query = $this->db->query($q); |
|
237 | + if ($query->num_rows() > 0) { |
|
238 | + $row = $query->row_array(); |
|
239 | 239 | return $row; |
240 | 240 | } |
241 | 241 | |
242 | 242 | return NULL; |
243 | 243 | } |
244 | 244 | function get_did_reseller_new($did, $reseller_id = "") { |
245 | - $sql = "SELECT dids.number AS number, " . "reseller_pricing.monthlycost AS monthlycost, " . "reseller_pricing.prorate AS prorate, " . "reseller_pricing.setup AS setup, " . "reseller_pricing.cost AS cost, " . "reseller_pricing.connectcost AS connectcost, " . "reseller_pricing.includedseconds AS includedseconds, " . "reseller_pricing.inc AS inc, " . "reseller_pricing.disconnectionfee AS disconnectionfee, " . "dids.provider_id AS provider_id, " . "dids.country_id AS country_id, " . "dids.city AS city, " . "dids.province AS province, " . "dids.extensions AS extensions, " . "dids.accountid AS account, " . "dids.variables AS variables, " . "dids.options AS options, " . "dids.maxchannels AS maxchannels, " . "dids.chargeonallocation AS chargeonallocation, " . "dids.allocation_bill_status AS allocation_bill_status, " . "dids.limittime AS limittime, " . "dids.dial_as AS dial_as, " . "dids.status AS status " . "FROM dids, reseller_pricing " . "WHERE dids.id = " . $did . " AND reseller_pricing.type = '1' AND reseller_pricing.reseller_id = " . $reseller_id; |
|
246 | - $query = $this->db->query ( $sql ); |
|
247 | - if ($query->num_rows () > 0) { |
|
248 | - return $query->row_array (); |
|
245 | + $sql = "SELECT dids.number AS number, "."reseller_pricing.monthlycost AS monthlycost, "."reseller_pricing.prorate AS prorate, "."reseller_pricing.setup AS setup, "."reseller_pricing.cost AS cost, "."reseller_pricing.connectcost AS connectcost, "."reseller_pricing.includedseconds AS includedseconds, "."reseller_pricing.inc AS inc, "."reseller_pricing.disconnectionfee AS disconnectionfee, "."dids.provider_id AS provider_id, "."dids.country_id AS country_id, "."dids.city AS city, "."dids.province AS province, "."dids.extensions AS extensions, "."dids.accountid AS account, "."dids.variables AS variables, "."dids.options AS options, "."dids.maxchannels AS maxchannels, "."dids.chargeonallocation AS chargeonallocation, "."dids.allocation_bill_status AS allocation_bill_status, "."dids.limittime AS limittime, "."dids.dial_as AS dial_as, "."dids.status AS status "."FROM dids, reseller_pricing "."WHERE dids.id = ".$did." AND reseller_pricing.type = '1' AND reseller_pricing.reseller_id = ".$reseller_id; |
|
246 | + $query = $this->db->query($sql); |
|
247 | + if ($query->num_rows() > 0) { |
|
248 | + return $query->row_array(); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | function get_did_by_number($number) { |
252 | - $this->db->where ( "id", $number ); |
|
253 | - $this->db->or_where ( "number", $number ); |
|
254 | - $query = $this->db->get ( "dids" ); |
|
255 | - if ($query->num_rows () > 0) |
|
256 | - return $query->row_array (); |
|
252 | + $this->db->where("id", $number); |
|
253 | + $this->db->or_where("number", $number); |
|
254 | + $query = $this->db->get("dids"); |
|
255 | + if ($query->num_rows() > 0) |
|
256 | + return $query->row_array(); |
|
257 | 257 | else |
258 | 258 | return false; |
259 | 259 | } |
260 | 260 | function edit_did_reseller($did_id, $post) { |
261 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
261 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
262 | 262 | |
263 | - $where_array = array ( |
|
263 | + $where_array = array( |
|
264 | 264 | 'reseller_id' => $accountinfo ['id'], |
265 | 265 | 'note' => $post ['number'], |
266 | 266 | 'type' => '1' |
267 | 267 | ); |
268 | - $this->db->where ( $where_array ); |
|
268 | + $this->db->where($where_array); |
|
269 | 269 | $flag = '0'; |
270 | - $query = $this->db->get ( 'reseller_pricing' ); |
|
271 | - if ($query->num_rows () > 0) { |
|
270 | + $query = $this->db->get('reseller_pricing'); |
|
271 | + if ($query->num_rows() > 0) { |
|
272 | 272 | $flag = '1'; |
273 | 273 | } |
274 | 274 | |
275 | - $this->insert_reseller_pricing ( $accountinfo, $post ); |
|
275 | + $this->insert_reseller_pricing($accountinfo, $post); |
|
276 | 276 | return $flag; |
277 | 277 | } |
278 | 278 | function delete_pricing_reseller($username, $number) { |
279 | - $where = array ( |
|
279 | + $where = array( |
|
280 | 280 | 'reseller_id' => $username, |
281 | 281 | 'note' => $number, |
282 | 282 | 'type' => '1' |
283 | 283 | ); |
284 | - $this->db->where ( $where ); |
|
285 | - $this->db->delete ( 'reseller_pricing' ); |
|
284 | + $this->db->where($where); |
|
285 | + $this->db->delete('reseller_pricing'); |
|
286 | 286 | return true; |
287 | 287 | } |
288 | 288 | function insert_reseller_pricing($accountinfo, $post) { |
289 | - $insert_array = array ( |
|
289 | + $insert_array = array( |
|
290 | 290 | 'reseller_id' => $accountinfo ['id'], |
291 | 291 | 'type' => '1', |
292 | 292 | 'did_id' => $post ['id'], |
@@ -303,36 +303,36 @@ discard block |
||
303 | 303 | 'connectcost' => $post ['connectcost'], |
304 | 304 | 'includedseconds' => $post ['includedseconds'], |
305 | 305 | 'status' => '0', |
306 | - 'assign_date' => gmdate ( 'Y-m-d H:i:s' ) |
|
306 | + 'assign_date' => gmdate('Y-m-d H:i:s') |
|
307 | 307 | ); |
308 | 308 | |
309 | - $this->db->insert ( 'reseller_pricing', $insert_array ); |
|
309 | + $this->db->insert('reseller_pricing', $insert_array); |
|
310 | 310 | return true; |
311 | 311 | } |
312 | 312 | function update_dids_reseller($post) { |
313 | - $where = array ( |
|
313 | + $where = array( |
|
314 | 314 | 'id' => $post ['did_id'] |
315 | 315 | ); |
316 | - $update_array = array ( |
|
316 | + $update_array = array( |
|
317 | 317 | 'dial_as' => $post ['dial_as'], |
318 | 318 | 'extensions' => $post ['extension'] |
319 | 319 | ); |
320 | - $this->db->where ( $where ); |
|
321 | - $this->db->update ( 'dids', $update_array ); |
|
320 | + $this->db->where($where); |
|
321 | + $this->db->update('dids', $update_array); |
|
322 | 322 | } |
323 | 323 | function delete_routes($id, $number, $pricelist_id) { |
324 | - $number = "^" . $number . ".*"; |
|
325 | - $where = array ( |
|
324 | + $number = "^".$number.".*"; |
|
325 | + $where = array( |
|
326 | 326 | 'pricelist_id' => $pricelist_id, |
327 | 327 | 'pattern' => $number |
328 | 328 | ); |
329 | - $this->db->where ( $where ); |
|
330 | - $this->db->delete ( 'routes' ); |
|
329 | + $this->db->where($where); |
|
330 | + $this->db->delete('routes'); |
|
331 | 331 | } |
332 | 332 | function insert_routes($post, $pricelist_id) { |
333 | - $commment = "DID:" . $post ['country'] . "," . $post ['province'] . "," . $post ['city']; |
|
334 | - $insert_array = array ( |
|
335 | - 'pattern' => "^" . $post ['number'] . ".*", |
|
333 | + $commment = "DID:".$post ['country'].",".$post ['province'].",".$post ['city']; |
|
334 | + $insert_array = array( |
|
335 | + 'pattern' => "^".$post ['number'].".*", |
|
336 | 336 | 'comment' => $commment, |
337 | 337 | 'pricelist_id' => $pricelist_id, |
338 | 338 | 'connectcost' => $post ['connectcost'], |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | 'cost' => $post ['cost'], |
341 | 341 | 'inc' => $post ['inc'] |
342 | 342 | ); |
343 | - $this->db->insert ( 'routes', $insert_array ); |
|
343 | + $this->db->insert('routes', $insert_array); |
|
344 | 344 | return true; |
345 | 345 | } |
346 | 346 | function add_invoice_data($accountid, $charge_type, $description, $credit) { |
347 | - $insert_array = array ( |
|
347 | + $insert_array = array( |
|
348 | 348 | 'accountid' => $accountid, |
349 | 349 | 'charge_type' => $charge_type, |
350 | 350 | 'description' => $description, |
@@ -353,14 +353,14 @@ discard block |
||
353 | 353 | 'package_id' => '0' |
354 | 354 | ); |
355 | 355 | |
356 | - $this->db->insert ( 'invoice_item', $insert_array ); |
|
356 | + $this->db->insert('invoice_item', $insert_array); |
|
357 | 357 | return true; |
358 | 358 | } |
359 | 359 | function check_unique_did($number) { |
360 | - $where = array ( |
|
360 | + $where = array( |
|
361 | 361 | 'number' => $number |
362 | 362 | ); |
363 | - $query = $this->db_model->countQuery ( "*", "dids", $where ); |
|
363 | + $query = $this->db_model->countQuery("*", "dids", $where); |
|
364 | 364 | return $query; |
365 | 365 | } |
366 | 366 | } |
@@ -207,10 +207,11 @@ discard block |
||
207 | 207 | $this->db->where ( "country", ucfirst ( $field_value ) ); |
208 | 208 | $query = $this->db->get ( 'countrycode' ); |
209 | 209 | $data = $query->result (); |
210 | - if ($query->num_rows > 0) |
|
211 | - return $data [0]->id; |
|
212 | - else |
|
213 | - return ''; |
|
210 | + if ($query->num_rows > 0) { |
|
211 | + return $data [0]->id; |
|
212 | + } else { |
|
213 | + return ''; |
|
214 | + } |
|
214 | 215 | } |
215 | 216 | function bulk_insert_dids($field_value) { |
216 | 217 | $this->db->insert_batch ( 'dids', $field_value ); |
@@ -252,10 +253,11 @@ discard block |
||
252 | 253 | $this->db->where ( "id", $number ); |
253 | 254 | $this->db->or_where ( "number", $number ); |
254 | 255 | $query = $this->db->get ( "dids" ); |
255 | - if ($query->num_rows () > 0) |
|
256 | - return $query->row_array (); |
|
257 | - else |
|
258 | - return false; |
|
256 | + if ($query->num_rows () > 0) { |
|
257 | + return $query->row_array (); |
|
258 | + } else { |
|
259 | + return false; |
|
260 | + } |
|
259 | 261 | } |
260 | 262 | function edit_did_reseller($did_id, $post) { |
261 | 263 | $accountinfo = $this->session->userdata ( 'accountinfo' ); |