Completed
Push — v3.0 ( 23635d...e28df5 )
by Samir
23s
created
web_interface/astpp/application/modules/opensips/controllers/opensips.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
         $this->load->library('astpp/form');
32 32
         $this->load->model('opensips_model');
33 33
         $db_config = Common_model::$global_config['system_config'];
34
-        $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
34
+        $opensipdsn = "mysql://".$db_config['opensips_dbuser'].":".$db_config['opensips_dbpass']."@".$db_config['opensips_dbhost']."/".$db_config['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
35 35
         $this->opensips_db = $this->load->database($opensipdsn, true);
36 36
         if ($this->session->userdata('user_login') == FALSE)
37
-            redirect(base_url() . '/astpp/login');
37
+            redirect(base_url().'/astpp/login');
38 38
     }
39 39
 
40 40
     function opensips_add() {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($accountid), $edit_data);
70 70
         $this->load->view('view_opensips_add_edit', $data);
71 71
     }
72
-     function customer_opensips_add($accountid='') {
72
+     function customer_opensips_add($accountid = '') {
73 73
         $data['username'] = $this->session->userdata('user_name');
74 74
         $data['flag'] = 'create';
75 75
         $data['page_title'] = 'Create Opensips';
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
                 exit;
89 89
             } else {
90 90
                 $auth_flag = $this->validate_device_data($add_array);
91
-                if($auth_flag == "TRUE"){
91
+                if ($auth_flag == "TRUE") {
92 92
                         $this->opensips_model->edit_opensipsdevices($add_array, $add_array['id']);
93 93
                         echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!"));
94 94
                         exit;
95
-                }else{
95
+                } else {
96 96
                        echo json_encode($auth_flag);
97 97
                        exit;
98 98
                 }
@@ -105,36 +105,36 @@  discard block
 block discarded – undo
105 105
                 exit;
106 106
             } else {
107 107
                 $auth_flag = $this->validate_device_data($add_array);
108
-                if($auth_flag == "TRUE"){
108
+                if ($auth_flag == "TRUE") {
109 109
                         $this->opensips_model->add_opensipsdevices($add_array);
110 110
                         echo json_encode(array("SUCCESS"=> "OpenSips added successfully!"));
111 111
                         exit;
112
-                }else{
112
+                } else {
113 113
                        echo json_encode($auth_flag);
114 114
                         exit;
115 115
                 }
116 116
             }
117 117
         }
118 118
     }
119
-    function validate_device_data($data){
119
+    function validate_device_data($data) {
120 120
 
121
-        if(isset($data["username"]) && $data["username"] != ""){
121
+        if (isset($data["username"]) && $data["username"] != "") {
122 122
                 $db_config = Common_model::$global_config['system_config'];
123
-                $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
123
+                $opensipdsn = "mysql://".$db_config['opensips_dbuser'].":".$db_config['opensips_dbpass']."@".$db_config['opensips_dbhost']."/".$db_config['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
124 124
                 $this->opensips_db = $this->load->database($opensipdsn, true);
125 125
                 $where = array("username"=>$data["username"]);
126
-                if($data['id'] != ""){
127
-                    $this->opensips_db->where("id <>",$data['id']);
126
+                if ($data['id'] != "") {
127
+                    $this->opensips_db->where("id <>", $data['id']);
128 128
                 }
129 129
                 $this->opensips_db->where($where);
130 130
                 $auth_flag = $this->opensips_db->get("subscriber");
131 131
                 $auth_flag = $auth_flag->num_rows();
132
-                if($auth_flag == 0){
132
+                if ($auth_flag == 0) {
133 133
                     return "TRUE";
134
-                }else{
134
+                } else {
135 135
                     return array("username_error"=>"Duplicate Email Address Found Email Must Be Unique.");
136 136
                 }
137
-        }else{
137
+        } else {
138 138
           return array("username_error"=>"User name is required field.");
139 139
         }
140 140
         return "0";
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
                 echo json_encode(array("SUCCESS"=> "Opensips Updated Successfully!"));
156 156
                 exit;
157 157
             }
158
-        }else{
158
+        } else {
159 159
 	      $data['page_title'] = 'Add Opensips';
160 160
 	      if ($this->form_validation->run() == FALSE) {
161 161
                 $data['validation_errors'] = validation_errors();
162 162
                 echo $data['validation_errors'];
163 163
                 exit;
164
-            }else{
164
+            } else {
165 165
 		$this->opensips_model->add_opensipsdevices($array_add);
166 166
                 echo json_encode(array("SUCCESS"=> "Opensips Added Successfully!"));
167 167
                 exit;
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
                 echo json_encode(array("SUCCESS"=> "OpenSips Updated Successfully!"));
185 185
                 exit;
186 186
             }
187
-        }else{
187
+        } else {
188 188
               $data['page_title'] = 'Add Opensips';
189 189
 	      if ($this->form_validation->run() == FALSE) {
190 190
                 $data['validation_errors'] = validation_errors();
191 191
                 echo $data['validation_errors'];
192 192
                 exit;
193
-             }else{
193
+             } else {
194 194
 		$this->opensips_model->add_opensipsdevices($add_array);
195 195
                 echo json_encode(array("SUCCESS"=> "OpenSips Added Successfully!"));
196 196
                 exit;
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
         }
199 199
     }
200 200
 
201
-    function customer_opensips_json($accountid,$accounttype) {
201
+    function customer_opensips_json($accountid, $accounttype) {
202 202
 	
203 203
         $json_data = array();
204
-        $count_all = $this->opensips_model->getopensipsdevice_customer_list(false, $accountid,$accounttype);
204
+        $count_all = $this->opensips_model->getopensipsdevice_customer_list(false, $accountid, $accounttype);
205 205
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
206 206
         $json_data = $paging_data["json_paging"];
207 207
 
208
-        $query = $this->opensips_model->getopensipsdevice_customer_list(true, $accountid,$accounttype, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
208
+        $query = $this->opensips_model->getopensipsdevice_customer_list(true, $accountid, $accounttype, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
209 209
         $grid_fields = json_decode($this->opensips_form->opensips_customer_build_opensips_list($accountid));
210 210
         $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
211 211
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     function opensips_remove($id) {
221 221
         $this->opensips_model->remove_opensips($id);
222 222
         $this->session->set_flashdata('astpp_notification', 'OpenSips Removed Successfully!');
223
-        redirect(base_url() . 'opensips/opensips_list/');
223
+        redirect(base_url().'opensips/opensips_list/');
224 224
     }
225 225
 
226 226
     function opensips_list() {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         $grid_fields = json_decode($this->opensips_form->build_opensips_list());
249 249
         $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
250 250
         $result = $this->opensips_db->get("subscriber");
251
-        if($result->num_rows() <= 0){
251
+        if ($result->num_rows() <= 0) {
252 252
             $json_data['page'] = 0;
253 253
             $json_data['total'] = 0;
254 254
         }
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
             $this->session->set_userdata('opensipsdevice_list_search', $action);
268 268
         }
269 269
         if (@$ajax_search != 1) {
270
-            redirect(base_url() . 'opensips/opensips_list/');
270
+            redirect(base_url().'opensips/opensips_list/');
271 271
         }
272 272
     }
273 273
     function opensips_list_clearsearchfilter() {
274
-            $this->session->set_userdata('advance_search','');
275
-            $this->session->set_userdata('opensipsdevice_list_search','');
274
+            $this->session->set_userdata('advance_search', '');
275
+            $this->session->set_userdata('opensipsdevice_list_search', '');
276 276
     }
277 277
 
278 278
 //    dispather List add edit delete
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             $data['page_title'] = 'Edit Dispatcher';
304 304
             if ($this->form_validation->run() == FALSE) {
305 305
                 $data['validation_errors'] = validation_errors();
306
-                echo $data['validation_errors'];exit;
306
+                echo $data['validation_errors']; exit;
307 307
             } else {
308 308
                 $this->opensips_model->edit_opensipsdispatcher($add_array, $add_array['id']);
309 309
                 echo json_encode(array("SUCCESS"=> "Dispatcher Updated Successfully!"));
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             $data['page_title'] = 'Add Dispatcher';
314 314
             if ($this->form_validation->run() == FALSE) {
315 315
                 $data['validation_errors'] = validation_errors();
316
-                 echo $data['validation_errors'];exit;
316
+                 echo $data['validation_errors']; exit;
317 317
             } else {
318 318
                 $this->opensips_model->add_opensipsdispatcher($add_array);
319 319
                 echo json_encode(array("SUCCESS"=> "Dispatcher Added Successfully!"));
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     function dispatcher_remove($id) {
326 326
         $this->opensips_model->remove_dispatcher($id);
327 327
         $this->session->set_flashdata('astpp_notification', 'Dispatcher Removed Successfully!');
328
-        redirect(base_url() . 'opensips/dispatcher_list/');
328
+        redirect(base_url().'opensips/dispatcher_list/');
329 329
     }
330 330
 
331 331
     function dispatcher_list() {
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
         $grid_fields = json_decode($this->opensips_form->build_opensipsdispatcher_list());
354 354
         $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
355 355
         $result = $this->opensips_db->get("subscriber");
356
-        if($result->num_rows() <= 0){
356
+        if ($result->num_rows() <= 0) {
357 357
             $json_data['page'] = 0;
358 358
             $json_data['total'] = 0;
359 359
         }
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
             $this->session->set_userdata('opensipsdispatcher_list_search', $this->input->post());
370 370
         }
371 371
         if (@$ajax_search != 1) {
372
-            redirect(base_url() . 'opensips/dispatcher_list/');
372
+            redirect(base_url().'opensips/dispatcher_list/');
373 373
         }
374 374
     }
375 375
 
Please login to merge, or discard this patch.
astpp/application/modules/opensips/libraries/opensips_form.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if ( ! defined('BASEPATH'))
25 25
     exit('No direct script access allowed');
26 26
 
27 27
 class Opensips_form {
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
 
36 36
         $uname_user = $this->CI->common->find_uniq_rendno('10', '', '');
37 37
         $password = $this->CI->common->generate_password();
38
-        $val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username';
38
+        $val = $id > 0 ? 'subscriber.username.'.$id : 'subscriber.username';
39 39
 
40 40
         // echo '<pre>'; print_r($val); exit;
41 41
         $loginid = $this->CI->session->userdata('logintype') == 2 ? 0 : $accountinfo['id'];
42
-        $form['forms'] = array(base_url() . 'opensips/opensips_save/', array("id" => "opensips_form", "name" => "opensips_form"));
42
+        $form['forms'] = array(base_url().'opensips/opensips_save/', array("id" => "opensips_form", "name" => "opensips_form"));
43 43
         $form['Opensips Device'] = array(
44 44
             array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
45
-            array('Username', 'INPUT', array('name' => 'username', 'size' => '30',  'value' => $uname_user, 'id' => 'username', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_number fa fa-refresh"></i>'),
46
-            array('Password', 'INPUT', array('name' => 'password', 'size' => '30',  'value' => $password, 'id' => 'password', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_pass fa fa-refresh"></i>'),
45
+            array('Username', 'INPUT', array('name' => 'username', 'size' => '30', 'value' => $uname_user, 'id' => 'username', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_number fa fa-refresh"></i>'),
46
+            array('Password', 'INPUT', array('name' => 'password', 'size' => '30', 'value' => $password, 'id' => 'password', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_pass fa fa-refresh"></i>'),
47 47
             array('Account', 'accountcode', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'number', 'number', 'accounts', 'build_dropdown', 'where_arr', array("reseller_id" => $loginid, "type" => "GLOBAL", "deleted" => "0")),
48 48
             array('Domain', 'INPUT', array('name' => 'domain', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
49
-            array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
49
+            array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
50 50
             array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
51 51
             array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
52 52
         );
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
 
59 59
     function get_dispatcher_form_fields() {
60 60
 
61
-        $form['forms'] = array(base_url() . 'opensips/dispatcher_save/', array("id" => "opensips_dispatcher_form", "name" => "opensips_dispatcher_form"));
61
+        $form['forms'] = array(base_url().'opensips/dispatcher_save/', array("id" => "opensips_dispatcher_form", "name" => "opensips_dispatcher_form"));
62 62
         $form['Dispatcher Information'] = array(
63 63
             array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
64 64
             array('Setid', 'INPUT', array('name' => 'setid', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
65 65
             array('Destination', 'INPUT', array('name' => 'destination', 'size' => '20', 'class' => "text field medium"), 'trim|required', 'tOOL TIP', ''),
66
-            array('Weight', 'INPUT', array('name' => 'weight', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
66
+            array('Weight', 'INPUT', array('name' => 'weight', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
67 67
             array('Attrs', 'INPUT', array('name' => 'attrs', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
68
-            array('Description', 'INPUT', array('name' => 'description', 'size' => '100',  'class' => "text field medium"), '', 'tOOL TIP', ''),
68
+            array('Description', 'INPUT', array('name' => 'description', 'size' => '100', 'class' => "text field medium"), '', 'tOOL TIP', ''),
69 69
         );
70 70
         $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'button', 'id' => 'submit', 'class' => 'btn btn-line-parrot');
71 71
         $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/opensips/dispatcher_list/\')');
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
     function build_opensips_list() {
104 104
         // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
105 105
         $grid_field_arr = json_encode(array(
106
-            array("Username", "150", "username", "", "", "","","true","center"),
107
-            array("Password", "150", "password", "", "", "","","true","center"),
108
-            array("Account", "150", "accountcode", "", "", "","","true","center"),
109
-            array("Domain", "317", "domain", "", "", "","","true","center"),
110
-            array("Caller Name", "200", "effective_caller_id_name", "", "", "","","true","center"),
111
-            array("Caller Number", "200", "effective_caller_id_number", "", "", "","","true","center"),
106
+            array("Username", "150", "username", "", "", "", "", "true", "center"),
107
+            array("Password", "150", "password", "", "", "", "", "true", "center"),
108
+            array("Account", "150", "accountcode", "", "", "", "", "true", "center"),
109
+            array("Domain", "317", "domain", "", "", "", "", "true", "center"),
110
+            array("Caller Name", "200", "effective_caller_id_name", "", "", "", "", "true", "center"),
111
+            array("Caller Number", "200", "effective_caller_id_number", "", "", "", "", "true", "center"),
112 112
             array("Action", "100", "", "", "", array("EDIT" => array("url" => "/opensips/opensips_edit/", "mode" => "popup"),
113 113
                     "DELETE" => array("url" => "/opensips/opensips_remove/", "mode" => "single")))
114 114
                 ));
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
     function build_opensipsdispatcher_list() {
119 119
         // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
120 120
         $grid_field_arr = json_encode(array(
121
-            array("Set Id", "160", "setid", "", "", "","","true","center"),
122
-            array("Destination", "160", "destination", "", "", "","","true","center"),
123
-            array("Weight", "190", "weight", "", "", "","","true","center"),
124
-            array("Attrs", "180", "attrs", "", "", "","","true","center"),
125
-            array("Description", "190", "description", "", "", "","","true","center"),
121
+            array("Set Id", "160", "setid", "", "", "", "", "true", "center"),
122
+            array("Destination", "160", "destination", "", "", "", "", "true", "center"),
123
+            array("Weight", "190", "weight", "", "", "", "", "true", "center"),
124
+            array("Attrs", "180", "attrs", "", "", "", "", "true", "center"),
125
+            array("Description", "190", "description", "", "", "", "", "true", "center"),
126 126
             array("Action", "170", "", "", "", array("EDIT" => array("url" => "/opensips/dispatcher_edit/", "mode" => "popup"),
127 127
                     "DELETE" => array("url" => "/opensips/dispatcher_remove/", "mode" => "single")))
128 128
                 ));
@@ -144,19 +144,19 @@  discard block
 block discarded – undo
144 144
     }
145 145
 
146 146
     function get_opensips_form_fields_for_customer($accountid, $id = false) {
147
-        $val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username';
147
+        $val = $id > 0 ? 'subscriber.username.'.$id : 'subscriber.username';
148 148
         $uname_user = $this->CI->common->find_uniq_rendno('10', '', '');
149 149
         $password = $this->CI->common->generate_password();
150 150
         $accountinfo = $this->CI->session->userdata('accountinfo');
151
-        $link = ($accountinfo['type']==1 || $accountinfo['type']==3 )? base_url() . 'opensips/user_opensips_save/true/' : base_url() . 'opensips/customer_opensips_save/true/';    
151
+        $link = ($accountinfo['type'] == 1 || $accountinfo['type'] == 3) ? base_url().'opensips/user_opensips_save/true/' : base_url().'opensips/customer_opensips_save/true/';    
152 152
             $form['forms'] = array($link, array("id" => "opensips_form", "name" => "opensips_form"));
153 153
             $form['Opensips Device'] = array(
154 154
                 array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
155 155
                 array('', 'HIDDEN', array('name' => 'accountcode', 'value' => $this->CI->common->get_field_name('number', 'accounts', array('id' => $accountid))), '', '', '', ''),
156
-                array('Username', 'INPUT', array('name' => 'username', 'size' => '20',  'id' => 'username', 'value' => $uname_user, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_number fa fa-refresh"></i>'),
156
+                array('Username', 'INPUT', array('name' => 'username', 'size' => '20', 'id' => 'username', 'value' => $uname_user, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_number fa fa-refresh"></i>'),
157 157
                 array('Password', 'PASSWORD', array('name' => 'password', 'size' => '20', 'id' => 'password1', 'value' => $password, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_pass fa fa-refresh"></i>'),
158
-                array('Domain', 'INPUT', array('name' => 'domain', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
159
-                array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
158
+                array('Domain', 'INPUT', array('name' => 'domain', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
159
+                array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
160 160
                 array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
161 161
                 array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),                
162 162
             );
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
             array("Username", "200", "username", "", "", ""),
193 193
             array("Password", "200", "password", "", "", ""),
194 194
             array("Domain", "200", "domain", "", "", ""),
195
-            array("Caller Name", "150", "effective_caller_id_name", "", "", "","","true","center"),
196
-            array("Caller Number", "150", "effective_caller_id_number", "", "", "","","true","center"),
197
-            array("Action", "100", "", "", "", array("EDIT" => array("url" => 'accounts/customer_opensips_action/edit/' . $accountid . '/', "mode" => "popup"),
198
-                    "DELETE" => array("url" => 'accounts/customer_opensips_action/delete/' . $accountid . "/", "mode" => "popup")))
195
+            array("Caller Name", "150", "effective_caller_id_name", "", "", "", "", "true", "center"),
196
+            array("Caller Number", "150", "effective_caller_id_number", "", "", "", "", "true", "center"),
197
+            array("Action", "100", "", "", "", array("EDIT" => array("url" => 'accounts/customer_opensips_action/edit/'.$accountid.'/', "mode" => "popup"),
198
+                    "DELETE" => array("url" => 'accounts/customer_opensips_action/delete/'.$accountid."/", "mode" => "popup")))
199 199
                 ));
200 200
 
201 201
         return $grid_field_arr;
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/opensips/models/opensips_model.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -25,21 +25,21 @@  discard block
 block discarded – undo
25 25
     function Opensips_model() {
26 26
         parent::__construct();
27 27
         $db_config = Common_model::$global_config['system_config'];
28
-        $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
28
+        $opensipdsn = "mysql://".$db_config['opensips_dbuser'].":".$db_config['opensips_dbpass']."@".$db_config['opensips_dbhost']."/".$db_config['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
29 29
         $this->opensips_db = $this->load->database($opensipdsn, true);
30 30
     }
31 31
     
32 32
     function getopensipsdevice_list($flag, $start = 0, $limit = 0) {
33
-        $this->db_model->build_search_opensips($this->opensips_db,'opensipsdevice_list_search');
34
-        $accountinfo=$this->session->userdata('accountinfo');
35
-	$reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0;
36
-        $this->opensips_db->where('reseller_id',$reseller_id);
33
+        $this->db_model->build_search_opensips($this->opensips_db, 'opensipsdevice_list_search');
34
+        $accountinfo = $this->session->userdata('accountinfo');
35
+	$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
36
+        $this->opensips_db->where('reseller_id', $reseller_id);
37 37
         if ($flag) {
38
-            $this->opensips_db->limit($limit,$start);
39
-            if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
40
-		$this->opensips_db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
41
-	    }else{
42
-            $this->opensips_db->order_by('username','asc');
38
+            $this->opensips_db->limit($limit, $start);
39
+            if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
40
+		$this->opensips_db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
41
+	    } else {
42
+            $this->opensips_db->order_by('username', 'asc');
43 43
 	    }
44 44
             $query = $this->opensips_db->get("subscriber");
45 45
         } else {
@@ -49,52 +49,52 @@  discard block
 block discarded – undo
49 49
         return $query;
50 50
     }
51 51
     
52
-    function getopensipsdevice_customer_list($flag, $accountid = "",$accounttype, $start = "0", $limit = "0") {
52
+    function getopensipsdevice_customer_list($flag, $accountid = "", $accounttype, $start = "0", $limit = "0") {
53 53
 
54 54
         if ($accountid != "") {
55 55
             $where = array("accountcode" => $this->common->get_field_name('number', 'accounts', array('id' => $accountid)));
56 56
         }
57
-        $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_opensips');
58
-        $like_str=!empty($instant_search) ? "(username like '%$instant_search%'
57
+        $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_opensips');
58
+        $like_str = ! empty($instant_search) ? "(username like '%$instant_search%'
59 59
                                             OR  password like '%$instant_search%'
60 60
                                             OR  domain like '%$instant_search%'
61 61
                                             OR  effective_caller_id_name like '%$instant_search%'
62 62
                                             OR  effective_caller_id_number like '%$instant_search%'
63 63
                                                 )"
64 64
                                            :null;
65
-        if(!empty($like_str))
65
+        if ( ! empty($like_str))
66 66
         $this->opensips_db->where($like_str);
67 67
         $this->opensips_db->where($where);
68 68
         if ($flag) {
69
-	      $this->opensips_db->limit($limit,$start);            
69
+	      $this->opensips_db->limit($limit, $start);            
70 70
         }
71 71
         $result = $this->opensips_db->get("subscriber");
72
-        if($result->num_rows() > 0){
73
-	  if($flag){
72
+        if ($result->num_rows() > 0) {
73
+	  if ($flag) {
74 74
 	    return $result;
75 75
 	  }
76
-	  else{
76
+	  else {
77 77
 	    return $result->num_rows();
78 78
 	  }
79
-        }else{
80
-         if($flag){
81
-	      $result=(object)array('num_rows'=>0);
79
+        } else {
80
+         if ($flag) {
81
+	      $result = (object)array('num_rows'=>0);
82 82
 	  }
83
-	  else{
84
-	      $result=0;
83
+	  else {
84
+	      $result = 0;
85 85
 	  }
86 86
 	  return $result;
87 87
         }
88 88
     }
89 89
 
90 90
     function getopensipsdispatcher_list($flag, $start = '', $limit = '') {
91
-       $this->db_model->build_search_opensips($this->opensips_db,'opensipsdispatcher_list_search');
91
+       $this->db_model->build_search_opensips($this->opensips_db, 'opensipsdispatcher_list_search');
92 92
 	  if ($flag) {
93
-            $this->opensips_db->limit( $limit,$start);
94
-            if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
95
-		$this->opensips_db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
96
-	    }else{
97
-            $this->opensips_db->order_by('setid','asc');
93
+            $this->opensips_db->limit($limit, $start);
94
+            if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
95
+		$this->opensips_db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
96
+	    } else {
97
+            $this->opensips_db->order_by('setid', 'asc');
98 98
 	    }
99 99
             $query = $this->opensips_db->get("dispatcher");
100 100
         } else {
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
 
110 110
  function add_opensipsdevices($data) {
111 111
         unset($data["action"]);
112
-        $data['creation_date']=gmdate("Y-m-d H:i:s");
113
-        $accountinfo=$this->session->userdata('accountinfo');
114
-		$data['reseller_id']=$accountinfo['type']==1 ? $accountinfo['id'] : 0;
112
+        $data['creation_date'] = gmdate("Y-m-d H:i:s");
113
+        $accountinfo = $this->session->userdata('accountinfo');
114
+		$data['reseller_id'] = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
115 115
         unset($data["id"]);	
116 116
         $this->opensips_db->insert("subscriber", $data);
117 117
     }
118 118
 
119 119
     function edit_opensipsdevices($data, $id) {
120 120
       unset($data["action"]);
121
-      $data=array("username"=>$data['username'],"password"=>$data['password'],"accountcode"=>$data['accountcode'],"domain"=>$data['domain'],"effective_caller_id_name"=>$data['effective_caller_id_name'],"effective_caller_id_number"=>$data['effective_caller_id_number'],"status"=>$data['status']);
121
+      $data = array("username"=>$data['username'], "password"=>$data['password'], "accountcode"=>$data['accountcode'], "domain"=>$data['domain'], "effective_caller_id_name"=>$data['effective_caller_id_name'], "effective_caller_id_number"=>$data['effective_caller_id_number'], "status"=>$data['status']);
122 122
       $this->opensips_db->where("id", $id);
123
-      $data['last_modified_date']=gmdate("Y-m-d H:i:s");
123
+      $data['last_modified_date'] = gmdate("Y-m-d H:i:s");
124 124
       $this->opensips_db->update("subscriber", $data);
125 125
     }
126 126
     function delete_opensips_devices($id) {
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
             foreach ($account_search as $key => $value) {
161 161
                 if ($value != "") {
162 162
                     if (is_array($value)) {
163
-                        if (array_key_exists($key . "-integer", $value)) {
164
-                            $this->get_interger_array($key, $value[$key . "-integer"], $value[$key]);
163
+                        if (array_key_exists($key."-integer", $value)) {
164
+                            $this->get_interger_array($key, $value[$key."-integer"], $value[$key]);
165 165
                         }
166
-                        if (array_key_exists($key . "-string", $value)) {
167
-                            $this->get_string_array($key, $value[$key . "-string"], $value[$key]);
166
+                        if (array_key_exists($key."-string", $value)) {
167
+                            $this->get_string_array($key, $value[$key."-string"], $value[$key]);
168 168
                         }
169 169
                     } else {
170 170
                         $this->opensips_db->where($key, $value);
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
                     $this->opensips_db->where($field, $search_array);
182 182
                     break;
183 183
                 case "2":
184
-                    $this->opensips_db->where($field . ' <>', $search_array);
184
+                    $this->opensips_db->where($field.' <>', $search_array);
185 185
                     break;
186 186
                 case "3":
187
-                    $this->opensips_db->where($field . ' > ', $search_array);
187
+                    $this->opensips_db->where($field.' > ', $search_array);
188 188
                     break;
189 189
                 case "4":
190
-                    $this->opensips_db->where($field . ' < ', $search_array);
190
+                    $this->opensips_db->where($field.' < ', $search_array);
191 191
                     break;
192 192
                 case "5":
193
-                    $this->opensips_db->where($field . ' >= ', $search_array);
193
+                    $this->opensips_db->where($field.' >= ', $search_array);
194 194
                     break;
195 195
                 case "6":
196
-                    $this->opensips_db->where($field . ' <= ', $search_array);
196
+                    $this->opensips_db->where($field.' <= ', $search_array);
197 197
                     break;
198 198
             }
199 199
         }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                     $this->opensips_db->where($field, $search_array);
213 213
                     break;
214 214
                 case "4":
215
-                    $this->opensips_db->where($field . ' <>', $search_array);
215
+                    $this->opensips_db->where($field.' <>', $search_array);
216 216
                     break;
217 217
             }
218 218
         }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/controllers/ipmap.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         $this->load->library('astpp/form');
33 33
         $this->load->model('ipmap_model');
34 34
         if ($this->session->userdata('user_login') == FALSE)
35
-            redirect(base_url() . '/astpp/login');
35
+            redirect(base_url().'/astpp/login');
36 36
          }
37 37
     function ipmap_add() {
38 38
         $data['username'] = $this->session->userdata('user_name');
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
      	ASTPP  3.0 
53 53
    	in customer login show ipmap (ACL) module
54 54
    	*****************************************/
55
-         $ip=explode("/",$value['ip']);
55
+         $ip = explode("/", $value['ip']);
56 56
          $edit_data = $value;
57
-         $edit_data['ip']=$ip[0];
57
+         $edit_data['ip'] = $ip[0];
58 58
         }
59 59
         /*************************************************************************************************/
60 60
         $data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $edit_data);
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
     function ipmap_save() {
65 65
         $add_array = $this->input->post();
66 66
         $ip = $add_array['ip'];
67
-        if (strpos($ip,'/') !== false) {
68
-           $add_array['ip']=$add_array['ip'];
67
+        if (strpos($ip, '/') !== false) {
68
+           $add_array['ip'] = $add_array['ip'];
69 69
         }
70
-        else{
71
-           $add_array['ip']=$add_array['ip'].'/32';
70
+        else {
71
+           $add_array['ip'] = $add_array['ip'].'/32';
72 72
         }
73 73
         $data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $add_array);
74 74
         if ($add_array['id'] != '') {
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
                 echo $data['validation_errors'];
79 79
                 exit;
80 80
             } else {
81
-                 $ip_free= $this->ipmap_model->edit_ipmap($add_array, $add_array['id']);
81
+                 $ip_free = $this->ipmap_model->edit_ipmap($add_array, $add_array['id']);
82 82
                  if ($ip_free) {
83 83
                     $this->load->library('freeswitch_lib');
84 84
                     $this->load->module('freeswitch/freeswitch');
85 85
                     $command = "api reloadacl";
86 86
                     $response = $this->freeswitch_model->reload_freeswitch($command);
87
-                    $this->session->set_userdata('astpp_notification',$response);
87
+                    $this->session->set_userdata('astpp_notification', $response);
88 88
                 }
89 89
                 echo json_encode(array("SUCCESS"=> " IP Map updated successfully!"));
90 90
                 exit;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                     $this->load->module('freeswitch/freeswitch');
103 103
                     $command = "api reloadacl";
104 104
                     $response = $this->freeswitch_model->reload_freeswitch($command);
105
-                    $this->session->set_userdata('astpp_notification',$response);
105
+                    $this->session->set_userdata('astpp_notification', $response);
106 106
                 }               
107 107
                 echo json_encode(array("SUCCESS"=> " IP Map added successfully!"));
108 108
                 exit;
@@ -110,24 +110,24 @@  discard block
 block discarded – undo
110 110
         }
111 111
     }
112 112
       function ipmap_delete($id) {
113
-        $ip_free=$this->ipmap_model-> remove_ipmap($id);
113
+        $ip_free = $this->ipmap_model-> remove_ipmap($id);
114 114
          if ($ip_free) {
115 115
                     $this->load->library('freeswitch_lib');
116 116
                     $this->load->module('freeswitch/freeswitch');
117 117
                     $command = "api reloadacl";
118 118
                     $response = $this->freeswitch_model->reload_freeswitch($command);
119
-                    $this->session->set_userdata('astpp_notification',$response);
119
+                    $this->session->set_userdata('astpp_notification', $response);
120 120
                 }
121 121
         $this->session->set_flashdata('astpp_notification', 'IP Map removed successfully!');
122 122
         /*********************
123 123
      	ASTPP  3.0 
124 124
    	in customer login show ipmap (ACL) module
125 125
    	*****************************************/
126
-   	$accountdata=$this->session->userdata['accountinfo'];
127
-        if($accountdata['type'] == '0'){
128
-        redirect(base_url() . 'user/user_ipmap_detail/');
129
-        }else{
130
-        redirect(base_url() . 'ipmap/ipmap_detail/');
126
+   	$accountdata = $this->session->userdata['accountinfo'];
127
+        if ($accountdata['type'] == '0') {
128
+        redirect(base_url().'user/user_ipmap_detail/');
129
+        } else {
130
+        redirect(base_url().'ipmap/ipmap_detail/');
131 131
         }
132 132
         /*********************************************************************/
133 133
     }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             $this->session->set_userdata('ipmap_list_search', $action);
143 143
         }
144 144
         if (@$ajax_search != 1) {
145
-            redirect(base_url() . 'ipmap/ipmap_list/');
145
+            redirect(base_url().'ipmap/ipmap_list/');
146 146
         }
147 147
     }
148 148
 
@@ -173,35 +173,35 @@  discard block
 block discarded – undo
173 173
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
174 174
         $json_data = $paging_data["json_paging"];
175 175
         $query = $this->ipmap_model->ipmap_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
176
-        $query =$query->result_array();
176
+        $query = $query->result_array();
177 177
         foreach ($query as $key => $value) {
178
-         $ipmap_checkbox='<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>';
179
-         if($account_data['type'] == '0'){
180
-         $ret_url = '<a href="'. base_url() .'user/user_ipmap_edit/'.$value['id'].'" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="'. base_url() .'user/user_ipmap_delete/' . $value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
181
-         $account_name='';
178
+         $ipmap_checkbox = '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value='.$value['id'].'><lable class="lbl"></lable>';
179
+         if ($account_data['type'] == '0') {
180
+         $ret_url = '<a href="'.base_url().'user/user_ipmap_edit/'.$value['id'].'" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="'.base_url().'user/user_ipmap_delete/'.$value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
181
+         $account_name = '';
182 182
          $json_data['rows'][] = array('cell' => array(
183 183
          $ipmap_checkbox,
184 184
          $value['name'],
185 185
          $value['ip'],
186 186
          $value['prefix'],
187
-         $this->common->get_status('status', 'ip_map',$value),
188
-         $this->common->convert_GMT_to('','',$value['created_date']),
189
-         $this->common->convert_GMT_to('','',$value['last_modified_date']),
187
+         $this->common->get_status('status', 'ip_map', $value),
188
+         $this->common->convert_GMT_to('', '', $value['created_date']),
189
+         $this->common->convert_GMT_to('', '', $value['last_modified_date']),
190 190
          $ret_url,
191 191
          
192 192
           ));
193
-         }else{
194
-         $ret_url = '<a href="'. base_url() .'ipmap/ipmap_edit/'.$value['id'].'" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="'. base_url() .'ipmap/ipmap_delete/' . $value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
195
-         $account_name =$this->common->build_concat_string("first_name,last_name,number", "accounts",$value['accountid']);
193
+         } else {
194
+         $ret_url = '<a href="'.base_url().'ipmap/ipmap_edit/'.$value['id'].'" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="'.base_url().'ipmap/ipmap_delete/'.$value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
195
+         $account_name = $this->common->build_concat_string("first_name,last_name,number", "accounts", $value['accountid']);
196 196
          $json_data['rows'][] = array('cell' => array(
197 197
          $ipmap_checkbox,
198 198
          $account_name,
199 199
          $value['name'],
200 200
          $value['ip'],
201 201
          $value['prefix'],
202
-         $this->common->get_status('status', 'ip_map',$value),
203
-         $this->common->convert_GMT_to('','',$value['created_date']),
204
-         $this->common->convert_GMT_to('','',$value['last_modified_date']),
202
+         $this->common->get_status('status', 'ip_map', $value),
203
+         $this->common->convert_GMT_to('', '', $value['created_date']),
204
+         $this->common->convert_GMT_to('', '', $value['last_modified_date']),
205 205
          $ret_url,
206 206
          
207 207
           ));
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/libraries/ipmap_form.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
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 26
 class Ipmap_form {
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
      in customer login show ipmap (ACL) module
40 40
      *****************************************/
41 41
         $logintype = $this->CI->session->userdata('logintype');
42
-       if($account_type == '0' || $logintype == '0'){
43
-        $account=null;
44
-        $form['forms'] = array(base_url() . 'user/user_ipmap_save/', array('id' => 'ipmap_form', 'method' => 'POST', 'name' => 'ipmap_form'));
45
-       }else{
46
-       $account=array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0","status" => "0"));
47
-        $form['forms'] = array(base_url() . 'ipmap/ipmap_save/', array('id' => 'ipmap_form', 'method' => 'POST', 'name' => 'ipmap_form'));
42
+       if ($account_type == '0' || $logintype == '0') {
43
+        $account = null;
44
+        $form['forms'] = array(base_url().'user/user_ipmap_save/', array('id' => 'ipmap_form', 'method' => 'POST', 'name' => 'ipmap_form'));
45
+       } else {
46
+       $account = array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0", "status" => "0"));
47
+        $form['forms'] = array(base_url().'ipmap/ipmap_save/', array('id' => 'ipmap_form', 'method' => 'POST', 'name' => 'ipmap_form'));
48 48
        }
49 49
        /***********************************************************************************************/
50 50
         $form['IP map'] = array(
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
    	    *****************************************/
56 56
             $account,
57 57
             /**********************************************************************************************/
58
-            array('Name', 'INPUT', array('name' => 'name', 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
58
+            array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
59 59
            /*ASTPP  3.0 
60 60
    	    in customer login show ipmap (ACL) module
61 61
    	    *****************************************/
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
     }
72 72
 
73 73
     function get_ipmap_search_form($account_data = '') {
74
-        $accountinfo=$this->CI->session->userdata('accountinfo');
75
-        $reseller_id=$accountinfo['type']==1 ? $accountinfo['id']:0;
74
+        $accountinfo = $this->CI->session->userdata('accountinfo');
75
+        $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
76 76
     /*********************
77 77
      	    ASTPP  3.0 
78 78
    	    in customer login show ipmap (ACL) module
79 79
    	    *****************************************/
80
-     if($account_data =='0'){
81
-           $account=null;
82
-        }else{
83
-         $account=array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => $reseller_id,"type"=>"0", "deleted" => "0"));
80
+     if ($account_data == '0') {
81
+           $account = null;
82
+        } else {
83
+         $account = array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => $reseller_id, "type"=>"0", "deleted" => "0"));
84 84
         }
85 85
         /***************************************************************************************/
86 86
         $form['forms'] = array("", array('id' => "ipmap_search"));
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
     in customer Add/Edit show Ipmap (ACL) module.
111 111
     *******/
112 112
     function build_ipmap_list_for_admin($account_data = '') {
113
-            if($account_data == '0'){
113
+            if ($account_data == '0') {
114 114
             $grid_field_arr = json_encode(array(
115
-            array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
115
+            array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
116 116
 			array("Name", "100", "name", "", "", ""),
117 117
             array("IP", "240", "ip", "", "", ""),
118 118
             array("Prefix", "240", "prefix", "", "", ""),
119 119
              /*
120 120
             ASTPP  3.0  creation field show in grid
121 121
             */
122
-            array("Status", "180", "status", "status", "ip_map", "get_status","","true","center"),
122
+            array("Status", "180", "status", "status", "ip_map", "get_status", "", "true", "center"),
123 123
             array("Created Date", "150", "creation_date", "creation_date", "creation_date", "convert_GMT_to"),
124 124
             array("Modified Date Date", "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to"),
125 125
             
@@ -127,19 +127,19 @@  discard block
 block discarded – undo
127 127
             array("Action", "205", "", "", "", array("EDIT" => array("url" => "ipmap/ipmap_edit/", "mode" => "popup", 'popup'),
128 128
                     "DELETE" => array("url" => "ipmap/ipmap_delete/", "mode" => "single")))
129 129
                 ));
130
-            }else{
130
+            } else {
131 131
            $grid_field_arr = json_encode(array(
132
-           array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "","","","false","center"),
133
-		   array("Account", "200", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"),
134
-           array("Name", "190", "name", "", "", "","","true","center"),
135
-           array("IP", "170", "ip", "", "", "","","true","center"),
136
-           array("Prefix", "100", "prefix", "", "", "","","true","center"),
132
+           array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
133
+		   array("Account", "200", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new", "", "true", "center"),
134
+           array("Name", "190", "name", "", "", "", "", "true", "center"),
135
+           array("IP", "170", "ip", "", "", "", "", "true", "center"),
136
+           array("Prefix", "100", "prefix", "", "", "", "", "true", "center"),
137 137
             /*
138 138
             ASTPP  3.0  creation field show in grid
139 139
             */
140
-            array("Status", "160", "status", "status", "ip_map", "get_status","","true","center"),
141
-            array("Created Date", "150", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
142
-            array("Modified Date", "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
140
+            array("Status", "160", "status", "status", "ip_map", "get_status", "", "true", "center"),
141
+            array("Created Date", "150", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"),
142
+            array("Modified Date", "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
143 143
             /********************************************************************/
144 144
            array("Action", "100", "", "", "", array("EDIT" => array("url" => "ipmap/ipmap_edit/", "mode" => "popup", 'popup'),
145 145
                     "DELETE" => array("url" => "ipmap/ipmap_delete/", "mode" => "single")))
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
     /**********************************************************************************************************/
151 151
 
152 152
     function build_grid_buttons() {
153
-        $buttons_json = json_encode(array(array("Add" , "btn btn-line-warning btn" , "fa fa-plus-circle fa-lg", "button_action", "/ipmap/ipmap_add/", "popup"),
154
-            array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg",  "button_action", "/ipmap/ipmap_delete_multiple/")
153
+        $buttons_json = json_encode(array(array("Add", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/ipmap/ipmap_add/", "popup"),
154
+            array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/ipmap/ipmap_delete_multiple/")
155 155
             ));
156 156
         return $buttons_json;
157 157
     }
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
     in customer Add/Edit show Ipmap (ACL) module.
162 162
     *******/
163 163
     
164
-    function build_grid_buttons_user(){
165
-     $buttons_json = json_encode(array(array("Create" , "btn btn-line-warning btn" , "fa fa-plus-circle fa-lg", "button_action", "/user/user_ipmap_add/", "popup"),
166
-            array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg",  "button_action", "/user/user_ipmap_delete_multiple/")
164
+    function build_grid_buttons_user() {
165
+     $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/user/user_ipmap_add/", "popup"),
166
+            array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/user/user_ipmap_delete_multiple/")
167 167
             ));
168 168
         return $buttons_json;
169 169
     }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/models/ipmap_model.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
          	foreach ($result as $value1) {
37 37
                 $value[] = $value1['id'];
38 38
 		 	}
39
-		 	if(!empty($value)){
39
+		 	if ( ! empty($value)) {
40 40
 		 		$this->db->where_in('accountid', $value);	
41
-		 	}else{
41
+		 	} else {
42 42
 		 		$this->db->where_in('accountid', '0');
43 43
 		 	}
44 44
             
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
                 $value[] = $value1['id'];
52 52
             }
53 53
             //$this->db->where_in('accountid', $value);
54
-			if(!empty($value)){
54
+			if ( ! empty($value)) {
55 55
 		 		$this->db->where_in('accountid', $value);	
56
-		 	}else{
56
+		 	} else {
57 57
 		 		$this->db->where_in('accountid', '0');
58 58
 		 	}            
59 59
         }
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
          ASTPP  3.0 
63 63
 	 in customer login show ipmap (ACL) module
64 64
  	 *******/
65
-        if( $accountinfo['type'] == '0'){
66
-        $where=array('accountid'=>$accountinfo['id']);
67
-        }else{
68
-        $where='';
65
+        if ($accountinfo['type'] == '0') {
66
+        $where = array('accountid'=>$accountinfo['id']);
67
+        } else {
68
+        $where = '';
69 69
         }
70 70
         /**************************************************************************************************************/
71 71
         if ($flag) {
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
     in customer login show ipmap (ACL) module
94 94
     *******/
95 95
     $account_data = $this->session->userdata("accountinfo");
96
-    if($account_data['type'] == '0'){
96
+    if ($account_data['type'] == '0') {
97 97
     $add_array['accountid'] = $account_data['id'];
98 98
      }
99 99
      /*******************************************************************/
100
-	$data = array('created_date'=>gmdate('Y-m-d H:i:s'),'name' => $add_array['name'], 'ip' => $add_array['ip'], 'prefix' => $add_array['prefix'], 'accountid' => $add_array['accountid'],'status' => $add_array['status'] ,'context' => 'default');
100
+	$data = array('created_date'=>gmdate('Y-m-d H:i:s'), 'name' => $add_array['name'], 'ip' => $add_array['ip'], 'prefix' => $add_array['prefix'], 'accountid' => $add_array['accountid'], 'status' => $add_array['status'], 'context' => 'default');
101 101
     $this->db->insert("ip_map", $data);
102 102
     return $this->db->insert_id();
103 103
     }
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
     in customer login show ipmap (ACL) module
109 109
     *******/
110 110
      $account_data = $this->session->userdata("accountinfo");
111
-       if($account_data['type'] == '0'){
111
+       if ($account_data['type'] == '0') {
112 112
        $add_array['accountid'] = $account_data['id'];
113 113
        }
114 114
        /************************************************************************************************/
115
-		$data = array('last_modified_date'=>gmdate('Y-m-d H:i:s'),'name' => $add_array['name'], 'ip' => $add_array['ip'], 'prefix' => $add_array['prefix'], 'accountid' => $add_array['accountid'],'status' => $add_array['status'] , 'context' => 'default');
115
+		$data = array('last_modified_date'=>gmdate('Y-m-d H:i:s'), 'name' => $add_array['name'], 'ip' => $add_array['ip'], 'prefix' => $add_array['prefix'], 'accountid' => $add_array['accountid'], 'status' => $add_array['status'], 'context' => 'default');
116 116
         $this->db->where("id", $id);
117 117
         return $this->db->update("ip_map", $data);
118 118
        
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/summary/controllers/summary.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $this->fpdf->initialize('P', 'mm', 'A4');
40 40
 
41 41
         if ($this->session->userdata('user_login') == FALSE)
42
-            redirect(base_url() . '/astpp/login');
42
+            redirect(base_url().'/astpp/login');
43 43
     }
44 44
     function customer() {
45 45
         $data['page_title'] = 'Customer Summary Report';
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
     function customer_json() {
64 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);
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 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);
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 69
         if ($query->num_rows() > 0) {
70 70
             $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'customer', 'grid');
71 71
         }
@@ -78,42 +78,42 @@  discard block
 block discarded – undo
78 78
         $total_width = '322';
79 79
         $column_name = 'accountid';
80 80
         if ($this->session->userdata('advance_search') == '1') {
81
-            $search_array = $this->session->userdata($entity . 'summary_reports_search');
82
-            if(isset($search_array['time']) && !empty($search_array['time'])){
83
-                   $new_column_arr[]=array(ucfirst(strtolower($search_array['time'])), "58", $search_array['time']."(callstart)", "", "", "");
81
+            $search_array = $this->session->userdata($entity.'summary_reports_search');
82
+            if (isset($search_array['time']) && ! empty($search_array['time'])) {
83
+                   $new_column_arr[] = array(ucfirst(strtolower($search_array['time'])), "58", $search_array['time']."(callstart)", "", "", "");
84 84
             }
85
-            if (isset($search_array['groupby_1']) && !empty($search_array['groupby_1'])) {
85
+            if (isset($search_array['groupby_1']) && ! empty($search_array['groupby_1'])) {
86 86
                 $first_column_groupby = $search_array['groupby_1'];
87 87
 
88 88
                 if ($first_column_groupby == 'accountid') {
89
-                    $new_column_arr[] = array("Account", "105",'accountid', "first_name,last_name,number", "accounts", "build_concat_string");
89
+                    $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string");
90 90
                 } elseif ($first_column_groupby == 'pattern') {
91 91
                     $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val");
92 92
                     $new_column_arr[] = array("Destination", "59", "notes", "", "", "");
93
-                } elseif($first_column_groupby =='package_id'){
94
-		    $new_column_arr[] = array("Package", "105",'package_id', "package_name", "packages", "get_field_name");
93
+                } elseif ($first_column_groupby == 'package_id') {
94
+		    $new_column_arr[] = array("Package", "105", 'package_id', "package_name", "packages", "get_field_name");
95 95
                 }
96 96
             }
97
-            if (isset($search_array['groupby_2']) && !empty($search_array['groupby_2'])) {
97
+            if (isset($search_array['groupby_2']) && ! empty($search_array['groupby_2'])) {
98 98
                 $third_column_groupby = $search_array['groupby_2'];
99 99
                 if ($third_column_groupby == 'accountid') {
100 100
                     $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string");
101 101
                 } elseif ($third_column_groupby == 'pattern') {
102 102
                     $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val");
103 103
                     $new_column_arr[] = array("Destination", "59", "notes", "", "", "");
104
-                } elseif($third_column_groupby	 =='package_id'){
105
-		    $new_column_arr[] = array("Package", "105",'package_id', "package_name", "packages", "get_field_name");
104
+                } elseif ($third_column_groupby == 'package_id') {
105
+		    $new_column_arr[] = array("Package", "105", 'package_id', "package_name", "packages", "get_field_name");
106 106
                 }
107 107
             }
108
-            if (isset($search_array['groupby_3']) && !empty($search_array['groupby_3'])) {
108
+            if (isset($search_array['groupby_3']) && ! empty($search_array['groupby_3'])) {
109 109
                 $fifth_column_groupby = $search_array['groupby_3'];
110 110
                 if ($fifth_column_groupby == 'accountid') {
111 111
                     $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string");
112 112
                 } elseif ($fifth_column_groupby == 'pattern') {
113 113
                     $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val");
114 114
                     $new_column_arr[] = array("Destination", "59", "notes", "", "", "");
115
-                } elseif($fifth_column_groupby	 =='package_id'){
116
-		    $new_column_arr[] = array("Package", "105",'package_id', "package_name", "packages", "get_field_name");
115
+                } elseif ($fifth_column_groupby == 'package_id') {
116
+		    $new_column_arr[] = array("Package", "105", 'package_id', "package_name", "packages", "get_field_name");
117 117
                 }
118 118
             }
119 119
             if (empty($new_column_arr)) {
@@ -129,40 +129,40 @@  discard block
 block discarded – undo
129 129
     function summary_report_grid($search_arr, $query, $entity, $purpose) {
130 130
         $export_arr = array();
131 131
         $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid';
132
-        $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
133
-        $currency_info =$this->common->get_currency_info();
132
+        $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
133
+        $currency_info = $this->common->get_currency_info();
134 134
         foreach ($query->result_array() as $row1) {
135 135
             $atmpt = $row1['attempts'];
136 136
             $cmplt = ($row1['completed'] != 0) ? $row1['completed'] : 0;
137
-            $acd = ($row1['completed'] > 0 ) ? round($row1['billable'] / $row1['completed']) : 0;
137
+            $acd = ($row1['completed'] > 0) ? round($row1['billable'] / $row1['completed']) : 0;
138 138
             $mcd = $row1['mcd'];
139 139
             if ($show_seconds == 'minutes') {
140
-                $avgsec = $acd > 0 ? sprintf('%02d',$acd / 60) . ":" . sprintf('%02d',($acd % 60)) : "00:00";
141
-                $maxsec = $mcd > 0 ? sprintf('%02d',$mcd / 60) . ":" . sprintf('%02d',($mcd % 60))  : "00:00";
142
-                $duration = ($row1['duration'] > 0 ) ? sprintf('%02d',$row1['duration'] / 60) . ":" . sprintf('%02d',($row1['duration'] % 60)) : "00:00";
143
-                $billsec = ($row1['billable'] > 0 ) ? sprintf('%02d',$row1['billable'] / 60) . ":" . sprintf('%02d',($row1['billable'] % 60)) : "00:00";
140
+                $avgsec = $acd > 0 ? sprintf('%02d', $acd / 60).":".sprintf('%02d', ($acd % 60)) : "00:00";
141
+                $maxsec = $mcd > 0 ? sprintf('%02d', $mcd / 60).":".sprintf('%02d', ($mcd % 60)) : "00:00";
142
+                $duration = ($row1['duration'] > 0) ? sprintf('%02d', $row1['duration'] / 60).":".sprintf('%02d', ($row1['duration'] % 60)) : "00:00";
143
+                $billsec = ($row1['billable'] > 0) ? sprintf('%02d', $row1['billable'] / 60).":".sprintf('%02d', ($row1['billable'] % 60)) : "00:00";
144 144
             } else {
145
-                $duration = sprintf('%02d',$row1['duration']);
145
+                $duration = sprintf('%02d', $row1['duration']);
146 146
                 $avgsec = $acd;
147 147
                 $maxsec = $mcd;
148
-                $billsec = sprintf('%02d',$row1['billable']);
148
+                $billsec = sprintf('%02d', $row1['billable']);
149 149
             }
150 150
             if ($entity != 'provider') {
151
-                $profit = $this->common->calculate_currency_manually($currency_info,$row1['debit'] - $row1['cost'],false);
152
-                $debit  = $this->common->calculate_currency_manually($currency_info,$row1['debit'],false);
151
+                $profit = $this->common->calculate_currency_manually($currency_info, $row1['debit'] - $row1['cost'], false);
152
+                $debit  = $this->common->calculate_currency_manually($currency_info, $row1['debit'], false);
153 153
             }
154
-            $cost  = $this->common->calculate_currency_manually($currency_info,$row1['cost'],false);
155
-            $asr = ($atmpt > 0 ) ? (round(($cmplt / $atmpt) * 100,2)) : '0.00' ;
154
+            $cost = $this->common->calculate_currency_manually($currency_info, $row1['cost'], false);
155
+            $asr = ($atmpt > 0) ? (round(($cmplt / $atmpt) * 100, 2)) : '0.00';
156 156
             $new_arr = array();
157 157
             if ($this->session->userdata('advance_search') == 1) {
158
-                if (!empty($search_arr['groupby_time'])) {
159
-                       $time =$row1[$search_arr['groupby_time']];
160
-                       if($search_arr['groupby_time']== "HOUR"|| $search_arr['groupby_time']== "DAY"){
161
-			  $time=sprintf('%02d',$time);
158
+                if ( ! empty($search_arr['groupby_time'])) {
159
+                       $time = $row1[$search_arr['groupby_time']];
160
+                       if ($search_arr['groupby_time'] == "HOUR" || $search_arr['groupby_time'] == "DAY") {
161
+			  $time = sprintf('%02d', $time);
162 162
                        }
163
-                       if($search_arr['groupby_time']== "MONTH"){
164
-			  $dateObj   = DateTime::createFromFormat('!m',$time);
165
-			  $time= $dateObj->format('F');
163
+                       if ($search_arr['groupby_time'] == "MONTH") {
164
+			  $dateObj = DateTime::createFromFormat('!m', $time);
165
+			  $time = $dateObj->format('F');
166 166
                        }
167 167
                     $new_arr[] = $time;
168 168
                 }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
                     $new_arr[] = $row1['notes'];
174 174
                 } elseif ($search_arr['groupby_1'] == 'trunk_id') {
175 175
                     $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']);
176
-                } elseif($search_arr['groupby_1'] == 'package_id'){
176
+                } elseif ($search_arr['groupby_1'] == 'package_id') {
177 177
 		    $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']);
178 178
                 }
179 179
                 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                     $new_arr[] = $row1['notes'];
185 185
                 } elseif ($search_arr['groupby_2'] == 'trunk_id') {
186 186
                     $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']);
187
-                } elseif($search_arr['groupby_2'] == 'package_id'){
187
+                } elseif ($search_arr['groupby_2'] == 'package_id') {
188 188
 		    $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']);
189 189
                 }
190 190
                 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                     $new_arr[] = $row1['notes'];
196 196
                 } elseif ($search_arr['groupby_3'] == 'trunk_id') {
197 197
                     $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']);
198
-                }  elseif($search_arr['groupby_3'] == 'package_id'){
198
+                }  elseif ($search_arr['groupby_3'] == 'package_id') {
199 199
 		    $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']);
200 200
                 }
201 201
                 if (empty($new_arr)) {
@@ -232,23 +232,23 @@  discard block
 block discarded – undo
232 232
             $json_data[] = array('cell' => $final_array);
233 233
             $export_arr[] = $final_array;
234 234
         }
235
-        $function_name = 'get_' . $entity . 'summary_report_list';
236
-        $total_info = $this->summary_model->$function_name(true, '', '', '', $search_arr['select_str'],  $search_arr['order_str'],true);
235
+        $function_name = 'get_'.$entity.'summary_report_list';
236
+        $total_info = $this->summary_model->$function_name(true, '', '', '', $search_arr['select_str'], $search_arr['order_str'], true);
237 237
         $total_info = $total_info->result_array();
238 238
         $total_info = $total_info[0];
239
-        $total_asr = ($total_info['attempts'] > 0 ) ? round(($total_info['completed'] / $total_info['attempts']) * 100, 2) : 0;
240
-        $total_acd = ($total_info['completed']> 0 ) ?round($total_info['billable'] / $total_info['completed']) : 0 ;
239
+        $total_asr = ($total_info['attempts'] > 0) ? round(($total_info['completed'] / $total_info['attempts']) * 100, 2) : 0;
240
+        $total_acd = ($total_info['completed'] > 0) ? round($total_info['billable'] / $total_info['completed']) : 0;
241 241
         if ($show_seconds == 'minutes') {
242
-            $total_info['duration'] = $total_info['duration'] > 0 ? sprintf('%02d',$total_info['duration'] / 60) . ":" . sprintf('%02d',($total_info['duration'] % 60)) : "00:00";
243
-            $total_info['billable'] = $total_info['billable'] > 0 ? sprintf('%02d',$total_info['billable'] / 60) . ":" . sprintf('%02d',($total_info['billable'] % 60)) : "00:00";
244
-            $total_acd = $total_acd > 0 ? sprintf('%02d',$total_acd / 60) . ":" .  sprintf('%02d',($total_acd % 60)) : "00:00";
245
-            $total_info['mcd'] = $total_info['mcd'] > 0 ? sprintf('%02d',$total_info['mcd'] / 60) . ":" .  sprintf('%02d',($total_info['mcd'] % 60)) : "00:00";
242
+            $total_info['duration'] = $total_info['duration'] > 0 ? sprintf('%02d', $total_info['duration'] / 60).":".sprintf('%02d', ($total_info['duration'] % 60)) : "00:00";
243
+            $total_info['billable'] = $total_info['billable'] > 0 ? sprintf('%02d', $total_info['billable'] / 60).":".sprintf('%02d', ($total_info['billable'] % 60)) : "00:00";
244
+            $total_acd = $total_acd > 0 ? sprintf('%02d', $total_acd / 60).":".sprintf('%02d', ($total_acd % 60)) : "00:00";
245
+            $total_info['mcd'] = $total_info['mcd'] > 0 ? sprintf('%02d', $total_info['mcd'] / 60).":".sprintf('%02d', ($total_info['mcd'] % 60)) : "00:00";
246 246
         }
247 247
         if ($entity != 'provider') {
248
-            $total_profit =   $this->common->calculate_currency_manually($currency_info,$total_info['debit'] - $total_info['cost'],false);
249
-            $total_debit =   $this->common->calculate_currency_manually($currency_info,$total_info['debit'],false);
248
+            $total_profit = $this->common->calculate_currency_manually($currency_info, $total_info['debit'] - $total_info['cost'], false);
249
+            $total_debit = $this->common->calculate_currency_manually($currency_info, $total_info['debit'], false);
250 250
         }
251
-        $total_cost =   $this->common->calculate_currency_manually($currency_info,$total_info['cost'],false);
251
+        $total_cost = $this->common->calculate_currency_manually($currency_info, $total_info['cost'], false);
252 252
         if ($entity != 'provider') {
253 253
             $last_array = array(
254 254
                 "<b>".$total_info['attempts']."</b>",
@@ -277,17 +277,17 @@  discard block
 block discarded – undo
277 277
         if ($purpose == 'export') {
278 278
             $search_arr['custom_total_array'][0] = "Grand Total";
279 279
         }
280
-        $new_export_array=array();
281
-        foreach($last_array as $key=>$value){
282
-	  $value=str_replace("<b>","",$value);
283
-	  $value=str_replace("</b>",'',$value);
284
-	  if($key == 7 || $key ==8 || $key ==9){
285
-	      $value = sprintf("%.".$currency_info['decimalpoints']."f",floatval(preg_replace('/[^\d.]/', '', $value)));
280
+        $new_export_array = array();
281
+        foreach ($last_array as $key=>$value) {
282
+	  $value = str_replace("<b>", "", $value);
283
+	  $value = str_replace("</b>", '', $value);
284
+	  if ($key == 7 || $key == 8 || $key == 9) {
285
+	      $value = sprintf("%.".$currency_info['decimalpoints']."f", floatval(preg_replace('/[^\d.]/', '', $value)));
286 286
 	  }
287
-	  $new_export_array[$key]=$value;
287
+	  $new_export_array[$key] = $value;
288 288
         }
289 289
         $total_array = array_merge($search_arr['custom_total_array'], $last_array);
290
-        $custom_export_arr =array_merge($search_arr['custom_total_array'],$new_export_array);
290
+        $custom_export_arr = array_merge($search_arr['custom_total_array'], $new_export_array);
291 291
         $export_arr[] = $custom_export_arr;
292 292
         $json_data[] = array('cell' => $total_array);
293 293
         return $purpose == 'grid' ? $json_data : $export_arr;
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
 
296 296
     function customer_export_csv() {
297 297
 		$account_info = $accountinfo = $this->session->userdata('accountinfo');
298
-		$currency_id=$account_info['currency_id'];
299
-		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
298
+		$currency_id = $account_info['currency_id'];
299
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
300 300
         $search_arr = $this->session->userdata('customersummary_reports_export');
301 301
         $data_arr = array();
302
-        $query = $this->summary_model->get_customersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], true);
302
+        $query = $this->summary_model->get_customersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], true);
303 303
         $search_header = explode(",", $search_arr['export_str']);
304 304
         ob_clean();
305
-        $fixed_header = array('Attempted Calls','Completed Calls','Duration', 'ASR', 'ACD','MCD','Billable', 'Debit('.$currency.')','Cost('.$currency.')','Profit');
305
+        $fixed_header = array('Attempted Calls', 'Completed Calls', 'Duration', 'ASR', 'ACD', 'MCD', 'Billable', 'Debit('.$currency.')', 'Cost('.$currency.')', 'Profit');
306 306
         $header_arr[] = array_merge($search_header, $fixed_header);
307 307
         if ($query->num_rows() > 0) {
308 308
             $data_arr = $this->summary_report_grid($search_arr, $query, 'customer', 'export');
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
         $customer_array = array_merge($header_arr, $data_arr);
311 311
 
312 312
         $this->load->helper('csv');
313
-        array_to_csv($customer_array, 'Customer_Summary_Report_' . date("Y-m-d") . '.csv');
313
+        array_to_csv($customer_array, 'Customer_Summary_Report_'.date("Y-m-d").'.csv');
314 314
     }
315 315
 
316 316
     function customer_search() {
@@ -320,24 +320,24 @@  discard block
 block discarded – undo
320 320
             unset($_POST['advance_search']);
321 321
             $this->session->set_userdata('customersummary_reports_search', $this->input->post());
322 322
         }
323
-        redirect(base_url() . 'summary/customer/');
323
+        redirect(base_url().'summary/customer/');
324 324
     }
325 325
 
326 326
     function customer_clearsearchfilter() {
327 327
         $this->session->set_userdata('advance_search', 0);
328 328
         $this->session->set_userdata('customersummary_reports_search', "");
329 329
         $this->session->set_userdata('customersummary_reports_export', "");
330
-        redirect(base_url() . 'summary/customer/');
330
+        redirect(base_url().'summary/customer/');
331 331
     }
332 332
 
333 333
     function summary_search_info($entity) {
334 334
         $group_by_str = null;
335 335
         $select_str = null;
336
-        $group_by_time=null;
336
+        $group_by_time = null;
337 337
         $group_by_1 = null;
338 338
         $group_by_2 = null;
339 339
         $group_by_3 = null;
340
-        $order_str=null;
340
+        $order_str = null;
341 341
         $custom_total_array = array();
342 342
         $custom_search = array();
343 343
         $export_select_str = null;
@@ -345,86 +345,86 @@  discard block
 block discarded – undo
345 345
         $i = 0;
346 346
         $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid';
347 347
         if ($this->session->userdata('advance_search') == 1) {
348
-            $custom_search = $this->session->userdata($entity . 'summary_reports_search');
349
-            if (isset($custom_search['time']) && !empty($custom_search['time'])) {
350
-                $group_by_str.=$custom_search['time'] . "(callstart),";
351
-                $select_str.=$custom_search['time'] . "(callstart) as ".$custom_search['time'].",";
352
-                $order_str.=$custom_search['time'].",";
348
+            $custom_search = $this->session->userdata($entity.'summary_reports_search');
349
+            if (isset($custom_search['time']) && ! empty($custom_search['time'])) {
350
+                $group_by_str .= $custom_search['time']."(callstart),";
351
+                $select_str .= $custom_search['time']."(callstart) as ".$custom_search['time'].",";
352
+                $order_str .= $custom_search['time'].",";
353 353
                 $group_by_time = $custom_search['time'];
354
-                $export_select_str.=$custom_search['time'].",";
354
+                $export_select_str .= $custom_search['time'].",";
355 355
                 $custom_total_array[$i] = null;
356 356
                 $i++;
357 357
             }
358
-            if (isset($custom_search['groupby_1']) && !empty($custom_search['groupby_1'])) {
359
-                $group_by_str.=$custom_search['groupby_1'] . ",";
360
-                $select_str.=$custom_search['groupby_1'] . ",";
361
-                $order_str.=$custom_search['groupby_1'] . ",";
358
+            if (isset($custom_search['groupby_1']) && ! empty($custom_search['groupby_1'])) {
359
+                $group_by_str .= $custom_search['groupby_1'].",";
360
+                $select_str .= $custom_search['groupby_1'].",";
361
+                $order_str .= $custom_search['groupby_1'].",";
362 362
                 $group_by_1 = $custom_search['groupby_1'];
363 363
                 if ($custom_search['groupby_1'] == $db_field_name) {
364
-                    $export_select_str.='Account,';
364
+                    $export_select_str .= 'Account,';
365 365
                 } elseif ($custom_search['groupby_1'] == 'trunk_id') {
366
-                    $export_select_str.='Trunk,';
366
+                    $export_select_str .= 'Trunk,';
367 367
                 } elseif ($custom_search['groupby_1'] == 'pattern') {
368
-                    $select_str.='notes,';
369
-                    $order_str.='notes,';
370
-                    $export_select_str.="Code,Destination,";
368
+                    $select_str .= 'notes,';
369
+                    $order_str .= 'notes,';
370
+                    $export_select_str .= "Code,Destination,";
371 371
                     $custom_total_array[$i] = null;
372 372
                     $i++;
373
-                } elseif($custom_search['groupby_1'] =='package_id'){
374
-		    $export_select_str.='Package,';
373
+                } elseif ($custom_search['groupby_1'] == 'package_id') {
374
+		    $export_select_str .= 'Package,';
375 375
                 }
376 376
                 $custom_total_array[$i] = null;
377 377
                 $i++;
378 378
             }
379 379
             
380
-            if (isset($custom_search['groupby_2']) && !empty($custom_search['groupby_2'])) {
381
-                $group_by_str.=$custom_search['groupby_2'] . ",";
382
-                $select_str.=$custom_search['groupby_2'] . ",";
383
-                $order_str.=$custom_search['groupby_2'] . ",";
380
+            if (isset($custom_search['groupby_2']) && ! empty($custom_search['groupby_2'])) {
381
+                $group_by_str .= $custom_search['groupby_2'].",";
382
+                $select_str .= $custom_search['groupby_2'].",";
383
+                $order_str .= $custom_search['groupby_2'].",";
384 384
                 $group_by_2 = $custom_search['groupby_2'];
385 385
                 if ($custom_search['groupby_2'] == $db_field_name) {
386
-                    $export_select_str.='Account,';
386
+                    $export_select_str .= 'Account,';
387 387
                 } elseif ($custom_search['groupby_2'] == 'trunk_id') {
388
-                    $export_select_str.='Trunk,';
388
+                    $export_select_str .= 'Trunk,';
389 389
                 } elseif ($custom_search['groupby_2'] == 'pattern') {
390
-                    $select_str.='notes,';
391
-                    $order_str.='notes,';
392
-                    $export_select_str.="Code,Destination,";
390
+                    $select_str .= 'notes,';
391
+                    $order_str .= 'notes,';
392
+                    $export_select_str .= "Code,Destination,";
393 393
                     $custom_total_array[$i] = null;
394 394
                     $i++;
395
-                } elseif($custom_search['groupby_2'] =='package_id'){
396
-		    $export_select_str.='Package,';
395
+                } elseif ($custom_search['groupby_2'] == 'package_id') {
396
+		    $export_select_str .= 'Package,';
397 397
                 }
398 398
                 $custom_total_array[$i] = null;
399 399
                 $i++;
400 400
             }
401 401
 
402
-            if (isset($custom_search['groupby_3']) && !empty($custom_search['groupby_3'])) {
403
-                $group_by_str.=$custom_search['groupby_3'] . ",";
404
-                $select_str.=$custom_search['groupby_3'] . ",";
405
-                $order_str.=$custom_search['groupby_3'] . ",";
402
+            if (isset($custom_search['groupby_3']) && ! empty($custom_search['groupby_3'])) {
403
+                $group_by_str .= $custom_search['groupby_3'].",";
404
+                $select_str .= $custom_search['groupby_3'].",";
405
+                $order_str .= $custom_search['groupby_3'].",";
406 406
                 $group_by_3 = $custom_search['groupby_3'];
407 407
                 if ($custom_search['groupby_3'] == 'accountid' || $custom_search['groupby_3'] == 'provider_id') {
408
-                    $export_select_str.='Account,';
408
+                    $export_select_str .= 'Account,';
409 409
                 } elseif ($custom_search['groupby_3'] == 'trunk_id') {
410
-                    $export_select_str.='Trunk,';
410
+                    $export_select_str .= 'Trunk,';
411 411
                 } elseif ($custom_search['groupby_3'] == 'pattern') {
412
-                    $select_str.='notes,';
413
-                    $order_str.='notes,';
414
-                    $export_select_str.="Code,Destination,";
412
+                    $select_str .= 'notes,';
413
+                    $order_str .= 'notes,';
414
+                    $export_select_str .= "Code,Destination,";
415 415
                     $custom_total_array[$i] = null;
416 416
                     $i++;
417
-                } elseif($custom_search['groupby_3'] =='package_id'){
418
-		    $export_select_str.='Package,';
417
+                } elseif ($custom_search['groupby_3'] == 'package_id') {
418
+		    $export_select_str .= 'Package,';
419 419
                 }
420 420
                 $custom_total_array[$i] = null;
421 421
                 $i++;
422 422
             }
423
-            $new_arr['search_in'] = (isset($custom_search['search_in']) && !empty($custom_search['search_in'])) ? $custom_search['search_in'] : 'minutes';
423
+            $new_arr['search_in'] = (isset($custom_search['search_in']) && ! empty($custom_search['search_in'])) ? $custom_search['search_in'] : 'minutes';
424 424
             unset($custom_search['groupby_1'], $custom_search['groupby_2'], $custom_search['groupby_3'], $custom_search['search_in']);
425
-            $this->session->set_userdata('summary_' . $entity . '_search', $custom_search);
425
+            $this->session->set_userdata('summary_'.$entity.'_search', $custom_search);
426 426
         }
427
-        if (!empty($group_by_str)) {
427
+        if ( ! empty($group_by_str)) {
428 428
             $group_by_str = rtrim($group_by_str, ",");
429 429
             $select_str = rtrim($select_str, ",");
430 430
             $order_str = rtrim($order_str, ",");
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         $new_arr['groupby_1'] = $group_by_1;
446 446
         $new_arr['groupby_2'] = $group_by_2;
447 447
         $new_arr['groupby_3'] = $group_by_3;
448
-        $new_arr['groupby_time']=$group_by_time;
448
+        $new_arr['groupby_time'] = $group_by_time;
449 449
         $new_arr['custom_total_array'] = $custom_total_array;
450 450
         return $new_arr;
451 451
     }
@@ -471,10 +471,10 @@  discard block
 block discarded – undo
471 471
 
472 472
     function provider_json() {
473 473
         $search_arr = $this->summary_search_info('provider');
474
-        $count_all = $this->summary_model->get_providersummary_report_list(false,'','', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'],false);
474
+        $count_all = $this->summary_model->get_providersummary_report_list(false, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false);
475 475
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
476 476
         $json_data = $paging_data["json_paging"];
477
-        $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);
477
+        $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);
478 478
         if ($query->num_rows() > 0) {
479 479
             $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'provider', 'grid');
480 480
         }
@@ -484,11 +484,11 @@  discard block
 block discarded – undo
484 484
 
485 485
     function provider_export_csv() {
486 486
 		$account_info = $accountinfo = $this->session->userdata('accountinfo');
487
-		$currency_id=$account_info['currency_id'];
488
-		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
487
+		$currency_id = $account_info['currency_id'];
488
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
489 489
         $search_arr = $this->session->userdata('providersummary_reports_export');
490 490
         $data_arr = array();
491
-        $query = $this->summary_model->get_providersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], true);
491
+        $query = $this->summary_model->get_providersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], true);
492 492
         $search_header = explode(",", $search_arr['export_str']);
493 493
         ob_clean();
494 494
         $fixed_header = array("Attempted Calls", "Completed Calls", "Duration", "ASR", "ACD", "MCD", "Billable", "Cost($currency)");
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         $provider_array = array_merge($header_arr, $data_arr);
500 500
 
501 501
         $this->load->helper('csv');
502
-        array_to_csv($provider_array, 'Provider_Summary_Report_' . date("Y-m-d") . '.csv');
502
+        array_to_csv($provider_array, 'Provider_Summary_Report_'.date("Y-m-d").'.csv');
503 503
     }
504 504
 
505 505
     function provider_search() {
@@ -508,14 +508,14 @@  discard block
 block discarded – undo
508 508
             unset($_POST['action'], $_POST['advance_search']);
509 509
             $this->session->set_userdata('providersummary_reports_search', $this->input->post());
510 510
         }
511
-        redirect(base_url() . 'summary/provider/');
511
+        redirect(base_url().'summary/provider/');
512 512
     }
513 513
 
514 514
     function provider_clearsearchfilter() {
515 515
         $this->session->set_userdata('advance_search', 0);
516 516
         $this->session->set_userdata('providersummary_reports_search', "");
517 517
         $this->session->set_userdata('providersummary_reports_export', "");
518
-        redirect(base_url() . "summary/provider/");
518
+        redirect(base_url()."summary/provider/");
519 519
     }
520 520
 
521 521
     function reseller() {
@@ -541,10 +541,10 @@  discard block
 block discarded – undo
541 541
 
542 542
     function reseller_json() {
543 543
         $search_arr = $this->summary_search_info('reseller');
544
-        $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);
544
+        $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);
545 545
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
546 546
         $json_data = $paging_data["json_paging"];
547
-        $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);
547
+        $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);
548 548
         if ($query->num_rows() > 0) {
549 549
             $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'reseller', 'grid');
550 550
         }
@@ -558,24 +558,24 @@  discard block
 block discarded – undo
558 558
             unset($_POST['action'], $_POST['advance_search']);
559 559
             $this->session->set_userdata('resellersummary_reports_search', $this->input->post());
560 560
         }
561
-        redirect(base_url() . "summary/reseller/");
561
+        redirect(base_url()."summary/reseller/");
562 562
     }
563 563
 
564 564
     function reseller_clearsearchfilter() {
565 565
         $this->session->set_userdata('advance_search', 0);
566 566
         $this->session->set_userdata('resellersummary_reports_search', "");
567 567
         $this->session->set_userdata('resellersummary_reports_export', "");
568
-        redirect(base_url() . "summary/reseller/");
568
+        redirect(base_url()."summary/reseller/");
569 569
     }
570 570
 
571 571
     function reseller_export_csv() {
572 572
 		 $account_info = $accountinfo = $this->session->userdata('accountinfo');
573
-		$currency_id=$account_info['currency_id'];
574
-		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
573
+		$currency_id = $account_info['currency_id'];
574
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
575 575
 		
576 576
         $search_arr = $this->session->userdata('resellersummary_reports_export');
577 577
         $data_arr = array();
578
-        $query = $this->summary_model->get_resellersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'],true);
578
+        $query = $this->summary_model->get_resellersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], true);
579 579
         $search_header = explode(",", $search_arr['export_str']);
580 580
         ob_clean();
581 581
         $fixed_header = array("Attempted Calls", "Completed Calls", "Duration", "ASR", "ACD", "MCD", "Billable", "Debit($currency)", "Cost($currency)", "Profit");
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
         }
586 586
         $reseller_array = array_merge($header_arr, $data_arr);
587 587
         $this->load->helper('csv');
588
-        array_to_csv($reseller_array, 'Reseller_Summary_Report_' . date("Y-m-d") . '.csv');
588
+        array_to_csv($reseller_array, 'Reseller_Summary_Report_'.date("Y-m-d").'.csv');
589 589
     }
590 590
 
591 591
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/summary/libraries/summary_form.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 # along with this program.  If not, see <http://www.gnu.org/licenses/>
21 21
 ############################################################################
22 22
 
23
-if (!defined('BASEPATH'))
23
+if ( ! defined('BASEPATH'))
24 24
     exit('No direct script access allowed');
25 25
 
26 26
 class Summary_form {
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
         $form['Search'] = array(
34 34
 	array('From Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'),
35 35
             array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
36
-			array('Account', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"3")),
36
+			array('Account', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"3")),
37 37
 			array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`status`=2, concat(name,"","^"),name) as name', 'trunks', 'build_dropdown_deleted', '', array("status" => "1")),
38
-			array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
38
+			array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
39 39
 			array(' Code Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-string]', '', '', '', 'search_string_type', ''), 
40 40
 		    array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
41 41
             array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
@@ -44,124 +44,124 @@  discard block
 block discarded – undo
44 44
 
45 45
         return $form;
46 46
     }
47
-    function build_providersummary(){
47
+    function build_providersummary() {
48 48
 		
49 49
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
50
-$currency_id=$account_info['currency_id'];
51
-$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);	
50
+$currency_id = $account_info['currency_id'];
51
+$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);	
52 52
 		
53
-        $new_arr=array();
54
-	if($this->CI->session->userdata('advance_search')=='1'){
55
-		$search_array=$this->CI->session->userdata('providersummary_reports_search');
56
-                if(isset($search_array['time']) && !empty($search_array['time'])){
57
-                   $new_arr[]=array($search_array['time'], "151", $search_array['time']."(callstart)", "", "", "");
53
+        $new_arr = array();
54
+	if ($this->CI->session->userdata('advance_search') == '1') {
55
+		$search_array = $this->CI->session->userdata('providersummary_reports_search');
56
+                if (isset($search_array['time']) && ! empty($search_array['time'])) {
57
+                   $new_arr[] = array($search_array['time'], "151", $search_array['time']."(callstart)", "", "", "");
58 58
                 }
59
-		if(isset($search_array['groupby_1']) && !empty($search_array['groupby_1'])){
60
-                    $first_column_groupby=$search_array['groupby_1'];
61
-                    if($first_column_groupby == 'provider_id'){
62
-                        $new_arr[]=array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");    
63
-                    } elseif ($first_column_groupby =='pattern'){
64
-                        $new_arr[]=array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val");
65
-                        $new_arr[]=array("Destination", "85", "notes", "", "", "");    
66
-                    } elseif($first_column_groupby =='trunk_id'){
67
-                        $new_arr[]=array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name");
68
-                    } elseif($first_column_groupby == 'package_id'){
69
-                        $new_arr[]=array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string");    
59
+		if (isset($search_array['groupby_1']) && ! empty($search_array['groupby_1'])) {
60
+                    $first_column_groupby = $search_array['groupby_1'];
61
+                    if ($first_column_groupby == 'provider_id') {
62
+                        $new_arr[] = array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");    
63
+                    } elseif ($first_column_groupby == 'pattern') {
64
+                        $new_arr[] = array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val");
65
+                        $new_arr[] = array("Destination", "85", "notes", "", "", "");    
66
+                    } elseif ($first_column_groupby == 'trunk_id') {
67
+                        $new_arr[] = array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name");
68
+                    } elseif ($first_column_groupby == 'package_id') {
69
+                        $new_arr[] = array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string");    
70 70
                     }
71 71
                 }
72
-                if(isset($search_array['groupby_2']) && !empty($search_array['groupby_2'])){
73
-                    $third_column_groupby=$search_array['groupby_2'];
74
-                    if($third_column_groupby == 'provider_id'){
75
-                        $new_arr[]=array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");    
76
-                    } elseif ($third_column_groupby =='pattern'){
77
-                        $new_arr[]=array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val");
78
-                        $new_arr[]=array("Destination", "85", "notes", "", "", "");    
79
-                    } elseif($third_column_groupby=='trunk_id'){
80
-                        $new_arr[]=array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name");
81
-                    } elseif($third_column_groupby == 'package_id'){
82
-                        $new_arr[]=array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string");    
72
+                if (isset($search_array['groupby_2']) && ! empty($search_array['groupby_2'])) {
73
+                    $third_column_groupby = $search_array['groupby_2'];
74
+                    if ($third_column_groupby == 'provider_id') {
75
+                        $new_arr[] = array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");    
76
+                    } elseif ($third_column_groupby == 'pattern') {
77
+                        $new_arr[] = array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val");
78
+                        $new_arr[] = array("Destination", "85", "notes", "", "", "");    
79
+                    } elseif ($third_column_groupby == 'trunk_id') {
80
+                        $new_arr[] = array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name");
81
+                    } elseif ($third_column_groupby == 'package_id') {
82
+                        $new_arr[] = array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string");    
83 83
                     }
84 84
                 }
85
-                if(isset($search_array['groupby_3']) && !empty($search_array['groupby_3'])){
86
-                    $fifth_column_groupby=$search_array['groupby_3'];
87
-                    if($fifth_column_groupby == 'provider_id'){
88
-                        $new_arr[]=array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");    
89
-                    } elseif ($fifth_column_groupby =='pattern'){
90
-                        $new_arr[]=array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val");
91
-                        $new_arr[]=array("Destination", "85", "notes", "", "", "");    
92
-                    } elseif($fifth_column_groupby == 'trunk_id'){
93
-                        $new_arr[]=array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name");
94
-                    } elseif($fifth_column_groupby == 'package_id'){
95
-                        $new_arr[]=array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string");    
85
+                if (isset($search_array['groupby_3']) && ! empty($search_array['groupby_3'])) {
86
+                    $fifth_column_groupby = $search_array['groupby_3'];
87
+                    if ($fifth_column_groupby == 'provider_id') {
88
+                        $new_arr[] = array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");    
89
+                    } elseif ($fifth_column_groupby == 'pattern') {
90
+                        $new_arr[] = array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val");
91
+                        $new_arr[] = array("Destination", "85", "notes", "", "", "");    
92
+                    } elseif ($fifth_column_groupby == 'trunk_id') {
93
+                        $new_arr[] = array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name");
94
+                    } elseif ($fifth_column_groupby == 'package_id') {
95
+                        $new_arr[] = array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string");    
96 96
                     }
97 97
                 }
98 98
 	}
99
-        if(empty($new_arr))
100
-            $new_arr[]=array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");
99
+        if (empty($new_arr))
100
+            $new_arr[] = array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");
101 101
         $fixed_arr = array(
102 102
             array("Attempted Calls", "130", "attempted_calls", "", "", ""),
103 103
             array("Completed Calls", "130", "description", "", "", ""),
104
-            array("Duration","85","billable",'','',''),
105
-            array("ASR","83","asr",'','',''),
106
-            array("ACD","83","acd  ",'','',''),
107
-            array("MCD","83","mcd",'','',''),
108
-            array("Billable","102","billable",'','',''),
109
-            array("Cost($currency)","117","cost",'','',''),
104
+            array("Duration", "85", "billable", '', '', ''),
105
+            array("ASR", "83", "asr", '', '', ''),
106
+            array("ACD", "83", "acd  ", '', '', ''),
107
+            array("MCD", "83", "mcd", '', '', ''),
108
+            array("Billable", "102", "billable", '', '', ''),
109
+            array("Cost($currency)", "117", "cost", '', '', ''),
110 110
             );
111
-        $grid_field_arr = json_encode(array_merge($new_arr,$fixed_arr));
111
+        $grid_field_arr = json_encode(array_merge($new_arr, $fixed_arr));
112 112
         return $grid_field_arr;
113 113
     }
114 114
     function build_grid_buttons_providersummary() {
115
-       $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/summary/provider_export_csv/", 'single')));
115
+       $buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/summary/provider_export_csv/", 'single')));
116 116
        return $buttons_json;
117 117
     }
118 118
     function get_resellersummary_search_form() {
119
-        $form['forms'] = array("",array('id' => "resellersummary_search"));
119
+        $form['forms'] = array("", array('id' => "resellersummary_search"));
120 120
         $form['Search'] = array(
121 121
             array('From Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'),
122 122
             array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
123
-			array('Account', 'reseller_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"1")),
123
+			array('Account', 'reseller_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"1")),
124 124
 			array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
125 125
             array('Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-string]', '', '', '', 'search_string_type', ''), 
126
-			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
126
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
127 127
         $form['button_search'] = array('name' => 'action', 'id' => "resellersummary_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
128 128
         $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
129 129
 
130 130
         return $form;
131 131
     }
132
-    function build_resellersummary($new_column_arr){
132
+    function build_resellersummary($new_column_arr) {
133 133
 		
134 134
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
135
-$currency_id=$account_info['currency_id'];
136
-$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);		
135
+$currency_id = $account_info['currency_id'];
136
+$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);		
137 137
 		
138
-$column_arr=array(
139
-            array("Attempted Calls", "120", "attempted_calls", "", "", "","","true","center"),
140
-            array("Completed Calls", "120", "description", "", "", "","","true","center"),
141
-            array("Duration","91","billable",'','','',"","true","center"),
142
-            array("ASR","78","asr",'','','',"","true","center"),
143
-            array("ACD","78","acd  ",'','','',"","true","center"),
144
-            array("MCD","78","mcd",'','','',"","true","center"),
145
-            array("Billable","80","billable",'','','',"","true","center"),
146
-            array("Debit($currency)","100","cost",'','','',"","true","right"),
147
-            array("Cost($currency)","100","price",'','','',"","true","right"),            
148
-            array("Profit($currency)", "100", "profit", "", "", "","","true","right"),
138
+$column_arr = array(
139
+            array("Attempted Calls", "120", "attempted_calls", "", "", "", "", "true", "center"),
140
+            array("Completed Calls", "120", "description", "", "", "", "", "true", "center"),
141
+            array("Duration", "91", "billable", '', '', '', "", "true", "center"),
142
+            array("ASR", "78", "asr", '', '', '', "", "true", "center"),
143
+            array("ACD", "78", "acd  ", '', '', '', "", "true", "center"),
144
+            array("MCD", "78", "mcd", '', '', '', "", "true", "center"),
145
+            array("Billable", "80", "billable", '', '', '', "", "true", "center"),
146
+            array("Debit($currency)", "100", "cost", '', '', '', "", "true", "right"),
147
+            array("Cost($currency)", "100", "price", '', '', '', "", "true", "right"),            
148
+            array("Profit($currency)", "100", "profit", "", "", "", "", "true", "right"),
149 149
             );
150
-        $grid_field_arr = json_encode(array_merge($new_column_arr,$column_arr));
150
+        $grid_field_arr = json_encode(array_merge($new_column_arr, $column_arr));
151 151
         return $grid_field_arr;
152 152
     }
153 153
     function build_grid_buttons_resellersummary() {
154
-         $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/summary/reseller_export_csv/", 'single')));
154
+         $buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/summary/reseller_export_csv/", 'single')));
155 155
         return $buttons_json;
156 156
     }
157 157
     function get_customersummary_search_form() {
158 158
         
159
-        $form['forms'] = array(base_url() . 'summary/customer_search',array('id' => "customersummary_search","name"=>"customersummary_search"));
159
+        $form['forms'] = array(base_url().'summary/customer_search', array('id' => "customersummary_search", "name"=>"customersummary_search"));
160 160
         $form['Search'] = array(
161 161
             array('From Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'),
162 162
             array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
163
-	    array('Accounts', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"GLOBAL")),
164
-            array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
163
+	    array('Accounts', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"GLOBAL")),
164
+            array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
165 165
             array('Code Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-string]', '', '', '', 'search_string_type', ''),
166 166
             array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
167 167
             array('', 'HIDDEN', 'advance_search', '1', '', '', '')
@@ -176,29 +176,29 @@  discard block
 block discarded – undo
176 176
 
177 177
         return $form;
178 178
     }
179
-    function build_customersummary($new_column_arr){
179
+    function build_customersummary($new_column_arr) {
180 180
 		
181 181
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
182
-$currency_id=$account_info['currency_id'];
183
-$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);		
182
+$currency_id = $account_info['currency_id'];
183
+$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);		
184 184
 		
185
-        $column_arr=array(
186
-            array("Attempted Calls", "120", "attempted_calls", "", "", "","","true","center"),
187
-            array("Completed Calls", "120", "description", "", "", "","","true","center"),
188
-            array("Duration","95","billable",'','','',"","true","center"),
189
-            array("ASR","85","asr",'','','',"","true","center"),
190
-            array("ACD","85","acd  ",'','','',"","true","center"),
191
-            array("MCD","85","mcd",'','','',"","true","center"),
192
-            array("Billable","90","billable",'','','',"","true","right"),
193
-            array("Debit($currency)","87","cost",'','','',"","true","right"),
194
-            array("Cost($currency)","85","price",'','','',"","true","right"),            
195
-            array("Profit($currency)", "93", "profit", "", "", "","","true","right"),
185
+        $column_arr = array(
186
+            array("Attempted Calls", "120", "attempted_calls", "", "", "", "", "true", "center"),
187
+            array("Completed Calls", "120", "description", "", "", "", "", "true", "center"),
188
+            array("Duration", "95", "billable", '', '', '', "", "true", "center"),
189
+            array("ASR", "85", "asr", '', '', '', "", "true", "center"),
190
+            array("ACD", "85", "acd  ", '', '', '', "", "true", "center"),
191
+            array("MCD", "85", "mcd", '', '', '', "", "true", "center"),
192
+            array("Billable", "90", "billable", '', '', '', "", "true", "right"),
193
+            array("Debit($currency)", "87", "cost", '', '', '', "", "true", "right"),
194
+            array("Cost($currency)", "85", "price", '', '', '', "", "true", "right"),            
195
+            array("Profit($currency)", "93", "profit", "", "", "", "", "true", "right"),
196 196
             );
197
-        $grid_field_arr = json_encode(array_merge($new_column_arr,$column_arr));
197
+        $grid_field_arr = json_encode(array_merge($new_column_arr, $column_arr));
198 198
         return $grid_field_arr;
199 199
     }
200 200
     function build_grid_buttons_customersummary() {
201
-        $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/summary/customer_export_csv/", 'single')));
201
+        $buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/summary/customer_export_csv/", 'single')));
202 202
         return $buttons_json;
203 203
     }
204 204
 
Please login to merge, or discard this patch.
astpp/application/modules/summary/views/view_providersummary_report.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
                                 <legend><b>Search</b></legend>
39 39
                                 <div class="col-md-4 no-padding">
40 40
                                     <label class="search_label col-md-12 no-padding">From Date</label>
41
-                                    <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][0]) ? $session_info['callstart'][0] : date("Y-m-d") . " 00:00:00"; ?>" id="provider_from_date" size="20" class="col-md-5 form-control text field "  />
41
+                                    <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][0]) ? $session_info['callstart'][0] : date("Y-m-d")." 00:00:00"; ?>" id="provider_from_date" size="20" class="col-md-5 form-control text field "  />
42 42
                                 </div>
43 43
                                 <div class="col-md-4 no-padding">
44 44
                                     <label class="search_label col-md-12 no-padding">To Date</label>
45
-                                    <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][1]) ? $session_info['callstart'][1] : date("Y-m-d") . " 23:59:59"; ?>" id="provider_to_date" size="20" class="col-md-5 form-control text field "  />
45
+                                    <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][1]) ? $session_info['callstart'][1] : date("Y-m-d")." 23:59:59"; ?>" id="provider_to_date" size="20" class="col-md-5 form-control text field "  />
46 46
                                 </div>
47 47
                                 <div class="col-md-4 no-padding">
48 48
                                     <label class="search_label col-md-12 no-padding">Account</label>
49 49
 
50 50
                                     <select name="provider_id" class='col-md-5 form-control selectpicker' data-live-search='true'>
51 51
                                         <option value=''>--Select--</option>
52
-                                        <?php if (!empty($accountlist)) {
52
+                                        <?php if ( ! empty($accountlist)) {
53 53
                                             foreach ($accountlist as $key => $value) {
54 54
                                                 ?>
55 55
                                                 <optgroup label="<?php echo $key ?>">
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                                     <select name="trunk_id" class='col-md-5 form-control selectpicker' data-live-search='true'>
75 75
                                         <option value=''>--Select--</option>
76 76
                                         <?php
77
-                                        if (!empty($trunklist)) {
77
+                                        if ( ! empty($trunklist)) {
78 78
                                             foreach ($trunklist as $key => $value) {
79 79
                                                 $selected = null;
80 80
                                                 if (isset($session_info['trunk_id']) && $session_info['trunk_id'] > 0 && $key == $session_info['trunk_id']) {
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
                                 </div>
89 89
                                 <div class="col-md-4 no-padding">
90 90
                                     <label class="search_label col-md-12 no-padding">Code </label>
91
-                                    <input type="text" name="pattern[pattern]" value="<?php echo (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern'])) ? $session_info['pattern']['pattern'] : ''; ?>" size="20" maxlength="15" class="col-md-5 form-control text field "/>
91
+                                    <input type="text" name="pattern[pattern]" value="<?php echo (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && ! empty($session_info['pattern']['pattern'])) ? $session_info['pattern']['pattern'] : ''; ?>" size="20" maxlength="15" class="col-md-5 form-control text field "/>
92 92
                                     <select name="pattern[pattern-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
93 93
                                         <?php
94
-                                        if (!empty($search_string_type)) {
94
+                                        if ( ! empty($search_string_type)) {
95 95
                                             foreach ($search_string_type as $key => $value) {
96 96
                                                 $selected = null;
97
-                                                if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) {
97
+                                                if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && ! empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) {
98 98
                                                     $selected = "selected";
99 99
                                                 }
100 100
                                                 ?>
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
                                 </div>
107 107
                                 <div class="col-md-4 no-padding">
108 108
                                     <label class="search_label col-md-12 no-padding">Destination </label>
109
-                                    <input type="text" name="notes[notes]" value="<?php echo (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes'])) ? $session_info['notes']['notes'] : ''; ?>" size="20" class="col-md-5 form-control text field "  />
109
+                                    <input type="text" name="notes[notes]" value="<?php echo (isset($session_info['notes']) && isset($session_info['notes']['notes']) && ! empty($session_info['notes']['notes'])) ? $session_info['notes']['notes'] : ''; ?>" size="20" class="col-md-5 form-control text field "  />
110 110
                                     <select name="notes[notes-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
111 111
                                     <?php
112
-                                       if (!empty($search_string_type)) {
112
+                                       if ( ! empty($search_string_type)) {
113 113
                                         foreach ($search_string_type as $key => $value) {
114 114
                                             $selected = null;
115
-                                            if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) {
115
+                                            if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && ! empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) {
116 116
                                                 $selected = "selected";
117 117
                                             }
118 118
                                     ?>
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
                                     <label class="search_label col-md-12 no-padding">Group By #time</label>
138 138
                                     <select name="time" class='col-md-5 form-control selectpicker' style='margin-left:5px;'data-live-search='true'>
139 139
                                         <?php
140
-                                        if (!empty($groupby_time)) {
140
+                                        if ( ! empty($groupby_time)) {
141 141
                                             foreach ($groupby_time as $key => $value) {
142 142
                                                 $selected = null;
143
-                                                if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) {
143
+                                                if (isset($session_info['time']) && ! empty($session_info['time']) && $session_info['time'] == $key) {
144 144
                                                     $selected = "selected";
145 145
                                                 }
146 146
                                                 ?>
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
                                     <label class="search_label col-md-12 no-padding">Group By #1</label>
155 155
                                     <select name="groupby_1" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
156 156
                                         <?php
157
-                                        if (!empty($groupby_field)) {
157
+                                        if ( ! empty($groupby_field)) {
158 158
                                             foreach ($groupby_field as $key => $value) {
159 159
                                                 $selected = null;
160
-                                                if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) {
160
+                                                if (isset($session_info['groupby_1']) && ! empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) {
161 161
                                                     $selected = "selected";
162 162
                                                 }
163 163
                                                 ?>
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
                                     <label class="search_label col-md-12 no-padding">Group By #2</label>
172 172
                                     <select name="groupby_2" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
173 173
                                         <?php
174
-                                        if (!empty($groupby_field)) {
174
+                                        if ( ! empty($groupby_field)) {
175 175
                                             foreach ($groupby_field as $key => $value) {
176 176
                                                 $selected = null;
177
-                                                if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) {
177
+                                                if (isset($session_info['groupby_2']) && ! empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) {
178 178
                                                     $selected = "selected";
179 179
                                                 }
180 180
                                                 ?>
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
                                     <label class="search_label col-md-12 no-padding">Group By #3</label>
189 189
                                     <select name="groupby_3" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
190 190
                                         <?php
191
-                                        if (!empty($groupby_field)) {
191
+                                        if ( ! empty($groupby_field)) {
192 192
                                             foreach ($groupby_field as $key => $value) {
193 193
                                                 $selected = null;
194
-                                                if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) {
194
+                                                if (isset($session_info['groupby_3']) && ! empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) {
195 195
                                                     $selected = "selected";
196 196
                                                 }
197 197
                                                 ?>
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
                                     <label class="search_label col-md-6" style="font-size:17px;text-align:right;">Display records in </label>
211 211
                                     <select name="search_in" class='col-md-5 form-control selectpicker' style='background: #ddd; width: 23% !important;' data-live-search='true'>
212 212
 <?php
213
-if (!empty($search_report)) {
213
+if ( ! empty($search_report)) {
214 214
     foreach ($search_report as $key => $value) {
215 215
         $selected = null;
216
-        if (isset($session_info['search_in']) && isset($session_info['search_in']) && !empty($session_info['search_in']) && $session_info['search_in'] == $key) {
216
+        if (isset($session_info['search_in']) && isset($session_info['search_in']) && ! empty($session_info['search_in']) && $session_info['search_in'] == $key) {
217 217
             //echo $key;exit;
218 218
             $selected = "selected";
219 219
         }
Please login to merge, or discard this patch.