Completed
Pull Request — v3.0 (#136)
by
unknown
25:07
created
web_interface/astpp/application/modules/opensips/controllers/opensips.php 3 patches
Indentation   +313 added lines, -313 removed lines patch added patch discarded remove patch
@@ -22,361 +22,361 @@
 block discarded – undo
22 22
 ###############################################################################
23 23
 class Opensips extends MX_Controller {
24 24
 
25
-    function Opensips() {
26
-        parent::__construct();
25
+	function Opensips() {
26
+		parent::__construct();
27 27
 
28
-        $this->load->helper('template_inheritance');
29
-        $this->load->library('session');
30
-        $this->load->library("opensips_form");
31
-        $this->load->library('astpp/form');
32
-        $this->load->model('opensips_model');
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=";
35
-        $this->opensips_db = $this->load->database($opensipdsn, true);
36
-        if ($this->session->userdata('user_login') == FALSE)
37
-            redirect(base_url() . '/astpp/login');
38
-    }
28
+		$this->load->helper('template_inheritance');
29
+		$this->load->library('session');
30
+		$this->load->library("opensips_form");
31
+		$this->load->library('astpp/form');
32
+		$this->load->model('opensips_model');
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=";
35
+		$this->opensips_db = $this->load->database($opensipdsn, true);
36
+		if ($this->session->userdata('user_login') == FALSE)
37
+			redirect(base_url() . '/astpp/login');
38
+	}
39 39
 
40
-    function opensips_add() {
40
+	function opensips_add() {
41 41
   //echo 'dd';
42
-        $data['username'] = $this->session->userdata('user_name');
43
-        $data['flag'] = 'create';
44
-        $data['page_title'] = 'Add  Opensips';
45
-        $data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields(), '');
42
+		$data['username'] = $this->session->userdata('user_name');
43
+		$data['flag'] = 'create';
44
+		$data['page_title'] = 'Add  Opensips';
45
+		$data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields(), '');
46 46
 	$this->load->view('view_opensips_add_edit', $data);
47
-    }
47
+	}
48 48
      
49
-    function opensips_edit($edit_id = '') {
50
-        $data['page_title'] = 'Edit Opensips ';
51
-        $this->opensips_db->where('id', $edit_id);
52
-        $account = $this->opensips_db->get("subscriber");
53
-        foreach ($account->result_array() as $key => $value) {
54
-            $edit_data = $value;
55
-        }
49
+	function opensips_edit($edit_id = '') {
50
+		$data['page_title'] = 'Edit Opensips ';
51
+		$this->opensips_db->where('id', $edit_id);
52
+		$account = $this->opensips_db->get("subscriber");
53
+		foreach ($account->result_array() as $key => $value) {
54
+			$edit_data = $value;
55
+		}
56 56
 
57
-        $data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields($edit_id), $edit_data);
58
-        $this->load->view('view_opensips_add_edit', $data);
59
-    }
57
+		$data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields($edit_id), $edit_data);
58
+		$this->load->view('view_opensips_add_edit', $data);
59
+	}
60 60
 
61
-    function customer_opensips_edit($accountid, $edit_id) {
62
-        $data['page_title'] = 'Edit Opensips';
63
-        $where = array('id' => $edit_id);
64
-        $this->opensips_db->where($where);
65
-        $account = $this->opensips_db->get("subscriber");
66
-        foreach ($account->result_array() as $key => $value) {
67
-            $edit_data = $value;
68
-        }
69
-        $data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($accountid), $edit_data);
70
-        $this->load->view('view_opensips_add_edit', $data);
71
-    }
72
-     function customer_opensips_add($accountid='') {
73
-        $data['username'] = $this->session->userdata('user_name');
74
-        $data['flag'] = 'create';
75
-        $data['page_title'] = 'Create Opensips';
76
-        $data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($accountid), '');
61
+	function customer_opensips_edit($accountid, $edit_id) {
62
+		$data['page_title'] = 'Edit Opensips';
63
+		$where = array('id' => $edit_id);
64
+		$this->opensips_db->where($where);
65
+		$account = $this->opensips_db->get("subscriber");
66
+		foreach ($account->result_array() as $key => $value) {
67
+			$edit_data = $value;
68
+		}
69
+		$data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($accountid), $edit_data);
70
+		$this->load->view('view_opensips_add_edit', $data);
71
+	}
72
+	 function customer_opensips_add($accountid='') {
73
+		$data['username'] = $this->session->userdata('user_name');
74
+		$data['flag'] = 'create';
75
+		$data['page_title'] = 'Create Opensips';
76
+		$data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($accountid), '');
77 77
 
78
-        $this->load->view('view_opensips_add_edit', $data);
79
-    }
80
-    function opensips_save() {
81
-        $add_array = $this->input->post();
82
-        $data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields($add_array['id']), $add_array);
83
-        if ($add_array['id'] != '') {
84
-            $data['page_title'] = 'Edit Opensips';
85
-            if ($this->form_validation->run() == FALSE) {
86
-                $data['validation_errors'] = validation_errors();
87
-                echo $data['validation_errors'];
88
-                exit;
89
-            } else {
90
-                $auth_flag = $this->validate_device_data($add_array);
91
-                if($auth_flag == "TRUE"){
92
-                        $this->opensips_model->edit_opensipsdevices($add_array, $add_array['id']);
93
-                        echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!"));
94
-                        exit;
95
-                }else{
96
-                       echo json_encode($auth_flag);
97
-                       exit;
98
-                }
99
-            }
100
-        } else {
101
-            $data['page_title'] = 'Add Opensips';
102
-            if ($this->form_validation->run() == FALSE) {
103
-                $data['validation_errors'] = validation_errors();
104
-                echo $data['validation_errors'];
105
-                exit;
106
-            } else {
107
-                $auth_flag = $this->validate_device_data($add_array);
108
-                if($auth_flag == "TRUE"){
109
-                        $this->opensips_model->add_opensipsdevices($add_array);
110
-                        echo json_encode(array("SUCCESS"=> "OpenSips added successfully!"));
111
-                        exit;
112
-                }else{
113
-                       echo json_encode($auth_flag);
114
-                        exit;
115
-                }
116
-            }
117
-        }
118
-    }
119
-    function validate_device_data($data){
78
+		$this->load->view('view_opensips_add_edit', $data);
79
+	}
80
+	function opensips_save() {
81
+		$add_array = $this->input->post();
82
+		$data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields($add_array['id']), $add_array);
83
+		if ($add_array['id'] != '') {
84
+			$data['page_title'] = 'Edit Opensips';
85
+			if ($this->form_validation->run() == FALSE) {
86
+				$data['validation_errors'] = validation_errors();
87
+				echo $data['validation_errors'];
88
+				exit;
89
+			} else {
90
+				$auth_flag = $this->validate_device_data($add_array);
91
+				if($auth_flag == "TRUE"){
92
+						$this->opensips_model->edit_opensipsdevices($add_array, $add_array['id']);
93
+						echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!"));
94
+						exit;
95
+				}else{
96
+					   echo json_encode($auth_flag);
97
+					   exit;
98
+				}
99
+			}
100
+		} else {
101
+			$data['page_title'] = 'Add Opensips';
102
+			if ($this->form_validation->run() == FALSE) {
103
+				$data['validation_errors'] = validation_errors();
104
+				echo $data['validation_errors'];
105
+				exit;
106
+			} else {
107
+				$auth_flag = $this->validate_device_data($add_array);
108
+				if($auth_flag == "TRUE"){
109
+						$this->opensips_model->add_opensipsdevices($add_array);
110
+						echo json_encode(array("SUCCESS"=> "OpenSips added successfully!"));
111
+						exit;
112
+				}else{
113
+					   echo json_encode($auth_flag);
114
+						exit;
115
+				}
116
+			}
117
+		}
118
+	}
119
+	function validate_device_data($data){
120 120
 
121
-        if(isset($data["username"]) && $data["username"] != ""){
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=";
124
-                $this->opensips_db = $this->load->database($opensipdsn, true);
125
-                $where = array("username"=>$data["username"]);
126
-                if($data['id'] != ""){
127
-                    $this->opensips_db->where("id <>",$data['id']);
128
-                }
129
-                $this->opensips_db->where($where);
130
-                $auth_flag = $this->opensips_db->get("subscriber");
131
-                $auth_flag = $auth_flag->num_rows();
132
-                if($auth_flag == 0){
133
-                    return "TRUE";
134
-                }else{
135
-                    return array("username_error"=>"Duplicate Email Address Found Email Must Be Unique.");
136
-                }
137
-        }else{
138
-          return array("username_error"=>"User name is required field.");
139
-        }
140
-        return "0";
141
-    }
121
+		if(isset($data["username"]) && $data["username"] != ""){
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=";
124
+				$this->opensips_db = $this->load->database($opensipdsn, true);
125
+				$where = array("username"=>$data["username"]);
126
+				if($data['id'] != ""){
127
+					$this->opensips_db->where("id <>",$data['id']);
128
+				}
129
+				$this->opensips_db->where($where);
130
+				$auth_flag = $this->opensips_db->get("subscriber");
131
+				$auth_flag = $auth_flag->num_rows();
132
+				if($auth_flag == 0){
133
+					return "TRUE";
134
+				}else{
135
+					return array("username_error"=>"Duplicate Email Address Found Email Must Be Unique.");
136
+				}
137
+		}else{
138
+		  return array("username_error"=>"User name is required field.");
139
+		}
140
+		return "0";
141
+	}
142 142
 
143 143
 function user_opensips_save($user_flg = false) {
144
-        $array_add = $this->input->post();
144
+		$array_add = $this->input->post();
145 145
 //        
146
-        $data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($array_add["accountcode"]), $array_add);
147
-        if ($array_add['id'] != '') {
148
-            $data['page_title'] = 'Edit Opensips';
149
-            if ($this->form_validation->run() == FALSE) {
150
-                $data['validation_errors'] = validation_errors();
151
-                echo $data['validation_errors'];
152
-                exit;
153
-            } else {
154
-                $this->opensips_model->edit_opensipsdevices($array_add, $array_add['id']);
155
-                echo json_encode(array("SUCCESS"=> "Opensips Updated Successfully!"));
156
-                exit;
157
-            }
158
-        }else{
159
-	      $data['page_title'] = 'Add Opensips';
160
-	      if ($this->form_validation->run() == FALSE) {
161
-                $data['validation_errors'] = validation_errors();
162
-                echo $data['validation_errors'];
163
-                exit;
164
-            }else{
146
+		$data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($array_add["accountcode"]), $array_add);
147
+		if ($array_add['id'] != '') {
148
+			$data['page_title'] = 'Edit Opensips';
149
+			if ($this->form_validation->run() == FALSE) {
150
+				$data['validation_errors'] = validation_errors();
151
+				echo $data['validation_errors'];
152
+				exit;
153
+			} else {
154
+				$this->opensips_model->edit_opensipsdevices($array_add, $array_add['id']);
155
+				echo json_encode(array("SUCCESS"=> "Opensips Updated Successfully!"));
156
+				exit;
157
+			}
158
+		}else{
159
+		  $data['page_title'] = 'Add Opensips';
160
+		  if ($this->form_validation->run() == FALSE) {
161
+				$data['validation_errors'] = validation_errors();
162
+				echo $data['validation_errors'];
163
+				exit;
164
+			}else{
165 165
 		$this->opensips_model->add_opensipsdevices($array_add);
166
-                echo json_encode(array("SUCCESS"=> "Opensips Added Successfully!"));
167
-                exit;
168
-	    }
169
-        }
170
-    }
166
+				echo json_encode(array("SUCCESS"=> "Opensips Added Successfully!"));
167
+				exit;
168
+		}
169
+		}
170
+	}
171 171
 
172
-    function customer_opensips_save($user_flg = false) {
173
-        $add_array = $this->input->post();
172
+	function customer_opensips_save($user_flg = false) {
173
+		$add_array = $this->input->post();
174 174
 //         print_r($array_add);exit;
175
-        $data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($add_array["accountcode"]), $add_array);
176
-        if ($add_array['id'] != '') {
177
-            $data['page_title'] = 'Edit Opensips';
178
-            if ($this->form_validation->run() == FALSE) {
179
-                $data['validation_errors'] = validation_errors();
180
-                echo $data['validation_errors'];
181
-                exit;
182
-            } else {
183
-                $this->opensips_model->edit_opensipsdevices($add_array, $add_array['id']);
184
-                echo json_encode(array("SUCCESS"=> "OpenSips Updated Successfully!"));
185
-                exit;
186
-            }
187
-        }else{
188
-              $data['page_title'] = 'Add Opensips';
189
-	      if ($this->form_validation->run() == FALSE) {
190
-                $data['validation_errors'] = validation_errors();
191
-                echo $data['validation_errors'];
192
-                exit;
193
-             }else{
175
+		$data['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($add_array["accountcode"]), $add_array);
176
+		if ($add_array['id'] != '') {
177
+			$data['page_title'] = 'Edit Opensips';
178
+			if ($this->form_validation->run() == FALSE) {
179
+				$data['validation_errors'] = validation_errors();
180
+				echo $data['validation_errors'];
181
+				exit;
182
+			} else {
183
+				$this->opensips_model->edit_opensipsdevices($add_array, $add_array['id']);
184
+				echo json_encode(array("SUCCESS"=> "OpenSips Updated Successfully!"));
185
+				exit;
186
+			}
187
+		}else{
188
+			  $data['page_title'] = 'Add Opensips';
189
+		  if ($this->form_validation->run() == FALSE) {
190
+				$data['validation_errors'] = validation_errors();
191
+				echo $data['validation_errors'];
192
+				exit;
193
+			 }else{
194 194
 		$this->opensips_model->add_opensipsdevices($add_array);
195
-                echo json_encode(array("SUCCESS"=> "OpenSips Added Successfully!"));
196
-                exit;
197
-	    }
198
-        }
199
-    }
195
+				echo json_encode(array("SUCCESS"=> "OpenSips Added Successfully!"));
196
+				exit;
197
+		}
198
+		}
199
+	}
200 200
 
201
-    function customer_opensips_json($accountid,$accounttype) {
201
+	function customer_opensips_json($accountid,$accounttype) {
202 202
 	
203
-        $json_data = array();
204
-        $count_all = $this->opensips_model->getopensipsdevice_customer_list(false, $accountid,$accounttype);
205
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
206
-        $json_data = $paging_data["json_paging"];
203
+		$json_data = array();
204
+		$count_all = $this->opensips_model->getopensipsdevice_customer_list(false, $accountid,$accounttype);
205
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
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"]);
209
-        $grid_fields = json_decode($this->opensips_form->opensips_customer_build_opensips_list($accountid));
210
-        $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
208
+		$query = $this->opensips_model->getopensipsdevice_customer_list(true, $accountid,$accounttype, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
209
+		$grid_fields = json_decode($this->opensips_form->opensips_customer_build_opensips_list($accountid));
210
+		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
211 211
 
212
-        echo json_encode($json_data);
213
-    }
212
+		echo json_encode($json_data);
213
+	}
214 214
 
215 215
 
216
-    function opensips_add_customer($add_data) {
217
-        $this->opensips_model->add_opensipsdevices($add_array);
218
-    }
216
+	function opensips_add_customer($add_data) {
217
+		$this->opensips_model->add_opensipsdevices($add_array);
218
+	}
219 219
 
220
-    function opensips_remove($id) {
221
-        $this->opensips_model->remove_opensips($id);
222
-        $this->session->set_flashdata('astpp_notification', 'OpenSips Removed Successfully!');
223
-        redirect(base_url() . 'opensips/opensips_list/');
224
-    }
220
+	function opensips_remove($id) {
221
+		$this->opensips_model->remove_opensips($id);
222
+		$this->session->set_flashdata('astpp_notification', 'OpenSips Removed Successfully!');
223
+		redirect(base_url() . 'opensips/opensips_list/');
224
+	}
225 225
 
226
-    function opensips_list() {
226
+	function opensips_list() {
227 227
 
228
-        $data['username'] = $this->session->userdata('user_name');
229
-        $data['page_title'] = 'Opensips Devices List';
228
+		$data['username'] = $this->session->userdata('user_name');
229
+		$data['page_title'] = 'Opensips Devices List';
230 230
 	$data['search_flag'] = true;
231
-        $this->session->set_userdata('advance_search', 0);
232
-        $data['grid_fields'] = $this->opensips_form->build_opensips_list();
233
-        $data["grid_buttons"] = $this->opensips_form->build_grid_buttons();
234
-        $data['form_search'] = $this->form->build_serach_form($this->opensips_form->get_search_opensips_form());
235
-        $this->load->view('view_opensips_list', $data);
236
-    }
231
+		$this->session->set_userdata('advance_search', 0);
232
+		$data['grid_fields'] = $this->opensips_form->build_opensips_list();
233
+		$data["grid_buttons"] = $this->opensips_form->build_grid_buttons();
234
+		$data['form_search'] = $this->form->build_serach_form($this->opensips_form->get_search_opensips_form());
235
+		$this->load->view('view_opensips_list', $data);
236
+	}
237 237
 
238
-    /**
239
-     * -------Here we write code for controller accounts functions account_list------
240
-     * Listing of Accounts table data through php function json_encode
241
-     */
242
-    function opensips_list_json() {
243
-        $json_data = array();
244
-        $count_all = $this->opensips_model->getopensipsdevice_list(false);
245
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
246
-        $json_data = $paging_data["json_paging"];
247
-        $query = $this->opensips_model->getopensipsdevice_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
248
-        $grid_fields = json_decode($this->opensips_form->build_opensips_list());
249
-        $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
250
-        $result = $this->opensips_db->get("subscriber");
251
-        if($result->num_rows() <= 0){
252
-            $json_data['page'] = 0;
253
-            $json_data['total'] = 0;
254
-        }
255
-        echo json_encode($json_data);
256
-    }
238
+	/**
239
+	 * -------Here we write code for controller accounts functions account_list------
240
+	 * Listing of Accounts table data through php function json_encode
241
+	 */
242
+	function opensips_list_json() {
243
+		$json_data = array();
244
+		$count_all = $this->opensips_model->getopensipsdevice_list(false);
245
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
246
+		$json_data = $paging_data["json_paging"];
247
+		$query = $this->opensips_model->getopensipsdevice_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
248
+		$grid_fields = json_decode($this->opensips_form->build_opensips_list());
249
+		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
250
+		$result = $this->opensips_db->get("subscriber");
251
+		if($result->num_rows() <= 0){
252
+			$json_data['page'] = 0;
253
+			$json_data['total'] = 0;
254
+		}
255
+		echo json_encode($json_data);
256
+	}
257 257
 
258
-     function opensips_list_search() {
258
+	 function opensips_list_search() {
259 259
 //alert('hgjgh');
260
-        $ajax_search = $this->input->post('ajax_search', 0);
260
+		$ajax_search = $this->input->post('ajax_search', 0);
261 261
 //alert();
262
-        if ($this->input->post('advance_search', TRUE) == 1) {
263
-            $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
264
-            $action = $this->input->post();
265
-            unset($action['action']);
266
-            unset($action['advance_search']);
267
-            $this->session->set_userdata('opensipsdevice_list_search', $action);
268
-        }
269
-        if (@$ajax_search != 1) {
270
-            redirect(base_url() . 'opensips/opensips_list/');
271
-        }
272
-    }
273
-    function opensips_list_clearsearchfilter() {
274
-            $this->session->set_userdata('advance_search','');
275
-            $this->session->set_userdata('opensipsdevice_list_search','');
276
-    }
262
+		if ($this->input->post('advance_search', TRUE) == 1) {
263
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
264
+			$action = $this->input->post();
265
+			unset($action['action']);
266
+			unset($action['advance_search']);
267
+			$this->session->set_userdata('opensipsdevice_list_search', $action);
268
+		}
269
+		if (@$ajax_search != 1) {
270
+			redirect(base_url() . 'opensips/opensips_list/');
271
+		}
272
+	}
273
+	function opensips_list_clearsearchfilter() {
274
+			$this->session->set_userdata('advance_search','');
275
+			$this->session->set_userdata('opensipsdevice_list_search','');
276
+	}
277 277
 
278 278
 //    dispather List add edit delete
279
-    function dispatcher_add() {
280
-        $data['username'] = $this->session->userdata('user_name');
281
-        $data['flag'] = 'create';
282
-        $data['page_title'] = 'Dispatcher';
283
-        $data['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), '');
279
+	function dispatcher_add() {
280
+		$data['username'] = $this->session->userdata('user_name');
281
+		$data['flag'] = 'create';
282
+		$data['page_title'] = 'Dispatcher';
283
+		$data['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), '');
284 284
 
285
-        $this->load->view('view_dispatcher_add_edit', $data);
286
-    }
285
+		$this->load->view('view_dispatcher_add_edit', $data);
286
+	}
287 287
 
288
-    function dispatcher_edit($edit_id = '') {
289
-        $data['page_title'] = 'Dispatcher ';
290
-        $this->opensips_db->where('id', $edit_id);
291
-        $account = $this->opensips_db->get("dispatcher");
292
-        foreach ($account->result_array() as $key => $value) {
293
-            $edit_data = $value;
294
-        }
288
+	function dispatcher_edit($edit_id = '') {
289
+		$data['page_title'] = 'Dispatcher ';
290
+		$this->opensips_db->where('id', $edit_id);
291
+		$account = $this->opensips_db->get("dispatcher");
292
+		foreach ($account->result_array() as $key => $value) {
293
+			$edit_data = $value;
294
+		}
295 295
 
296
-        $data['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), $edit_data);
297
-        $this->load->view('view_dispatcher_add_edit', $data);
298
-    }
299
-    function dispatcher_save() {
300
-        $add_array = $this->input->post();
301
-        $data['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), $add_array);
302
-        if ($add_array['id'] != '') {
303
-            $data['page_title'] = 'Edit Dispatcher';
304
-            if ($this->form_validation->run() == FALSE) {
305
-                $data['validation_errors'] = validation_errors();
306
-                echo $data['validation_errors'];exit;
307
-            } else {
308
-                $this->opensips_model->edit_opensipsdispatcher($add_array, $add_array['id']);
309
-                echo json_encode(array("SUCCESS"=> "Dispatcher Updated Successfully!"));
310
-                exit;
311
-            }
312
-        } else {
313
-            $data['page_title'] = 'Add Dispatcher';
314
-            if ($this->form_validation->run() == FALSE) {
315
-                $data['validation_errors'] = validation_errors();
316
-                 echo $data['validation_errors'];exit;
317
-            } else {
318
-                $this->opensips_model->add_opensipsdispatcher($add_array);
319
-                echo json_encode(array("SUCCESS"=> "Dispatcher Added Successfully!"));
320
-                exit;
321
-            }
322
-        } 
323
-    }
296
+		$data['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), $edit_data);
297
+		$this->load->view('view_dispatcher_add_edit', $data);
298
+	}
299
+	function dispatcher_save() {
300
+		$add_array = $this->input->post();
301
+		$data['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), $add_array);
302
+		if ($add_array['id'] != '') {
303
+			$data['page_title'] = 'Edit Dispatcher';
304
+			if ($this->form_validation->run() == FALSE) {
305
+				$data['validation_errors'] = validation_errors();
306
+				echo $data['validation_errors'];exit;
307
+			} else {
308
+				$this->opensips_model->edit_opensipsdispatcher($add_array, $add_array['id']);
309
+				echo json_encode(array("SUCCESS"=> "Dispatcher Updated Successfully!"));
310
+				exit;
311
+			}
312
+		} else {
313
+			$data['page_title'] = 'Add Dispatcher';
314
+			if ($this->form_validation->run() == FALSE) {
315
+				$data['validation_errors'] = validation_errors();
316
+				 echo $data['validation_errors'];exit;
317
+			} else {
318
+				$this->opensips_model->add_opensipsdispatcher($add_array);
319
+				echo json_encode(array("SUCCESS"=> "Dispatcher Added Successfully!"));
320
+				exit;
321
+			}
322
+		} 
323
+	}
324 324
 
325
-    function dispatcher_remove($id) {
326
-        $this->opensips_model->remove_dispatcher($id);
327
-        $this->session->set_flashdata('astpp_notification', 'Dispatcher Removed Successfully!');
328
-        redirect(base_url() . 'opensips/dispatcher_list/');
329
-    }
325
+	function dispatcher_remove($id) {
326
+		$this->opensips_model->remove_dispatcher($id);
327
+		$this->session->set_flashdata('astpp_notification', 'Dispatcher Removed Successfully!');
328
+		redirect(base_url() . 'opensips/dispatcher_list/');
329
+	}
330 330
 
331
-    function dispatcher_list() {
332
-        $data['username'] = $this->session->userdata('user_name');
333
-        $data['page_title'] = 'Opensips Dispatcher List';
331
+	function dispatcher_list() {
332
+		$data['username'] = $this->session->userdata('user_name');
333
+		$data['page_title'] = 'Opensips Dispatcher List';
334 334
 	$data['search_flag'] = true;
335
-        $this->session->set_userdata('advance_search', 0);
336
-        $data['grid_fields'] = $this->opensips_form->build_opensipsdispatcher_list();
337
-        $data["grid_buttons"] = $this->opensips_form->build_grid_dispatcherbuttons();
338
-        $data['form_search'] = $this->form->build_serach_form($this->opensips_form->get_search_dispatcher_form());
339
-        $this->load->view('view_dispatcher_list', $data);
340
-    }
335
+		$this->session->set_userdata('advance_search', 0);
336
+		$data['grid_fields'] = $this->opensips_form->build_opensipsdispatcher_list();
337
+		$data["grid_buttons"] = $this->opensips_form->build_grid_dispatcherbuttons();
338
+		$data['form_search'] = $this->form->build_serach_form($this->opensips_form->get_search_dispatcher_form());
339
+		$this->load->view('view_dispatcher_list', $data);
340
+	}
341 341
 
342
-    /**
343
-     * -------Here we write code for controller accounts functions account_list------
344
-     * Listing of Accounts table data through php function json_encode
345
-     */
346
-    function dispatcher_list_json() {
347
-        $json_data = array();
348
-        $count_all = $this->opensips_model->getopensipsdispatcher_list(false);
349
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
350
-        $json_data = $paging_data["json_paging"];
342
+	/**
343
+	 * -------Here we write code for controller accounts functions account_list------
344
+	 * Listing of Accounts table data through php function json_encode
345
+	 */
346
+	function dispatcher_list_json() {
347
+		$json_data = array();
348
+		$count_all = $this->opensips_model->getopensipsdispatcher_list(false);
349
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
350
+		$json_data = $paging_data["json_paging"];
351 351
 
352
-        $query = $this->opensips_model->getopensipsdispatcher_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
353
-        $grid_fields = json_decode($this->opensips_form->build_opensipsdispatcher_list());
354
-        $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
355
-        $result = $this->opensips_db->get("subscriber");
356
-        if($result->num_rows() <= 0){
357
-            $json_data['page'] = 0;
358
-            $json_data['total'] = 0;
359
-        }
360
-        echo json_encode($json_data);
361
-    }
352
+		$query = $this->opensips_model->getopensipsdispatcher_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
353
+		$grid_fields = json_decode($this->opensips_form->build_opensipsdispatcher_list());
354
+		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
355
+		$result = $this->opensips_db->get("subscriber");
356
+		if($result->num_rows() <= 0){
357
+			$json_data['page'] = 0;
358
+			$json_data['total'] = 0;
359
+		}
360
+		echo json_encode($json_data);
361
+	}
362 362
 
363
-    function dispatcher_list_search() {
364
-        $ajax_search = $this->input->post('ajax_search', 0);
365
-        if ($this->input->post('advance_search', TRUE) == 1) {
366
-            $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
367
-            unset($_POST['action']);
368
-            unset($_POST['advance_search']);
369
-            $this->session->set_userdata('opensipsdispatcher_list_search', $this->input->post());
370
-        }
371
-        if (@$ajax_search != 1) {
372
-            redirect(base_url() . 'opensips/dispatcher_list/');
373
-        }
374
-    }
363
+	function dispatcher_list_search() {
364
+		$ajax_search = $this->input->post('ajax_search', 0);
365
+		if ($this->input->post('advance_search', TRUE) == 1) {
366
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
367
+			unset($_POST['action']);
368
+			unset($_POST['advance_search']);
369
+			$this->session->set_userdata('opensipsdispatcher_list_search', $this->input->post());
370
+		}
371
+		if (@$ajax_search != 1) {
372
+			redirect(base_url() . 'opensips/dispatcher_list/');
373
+		}
374
+	}
375 375
 
376
-    function dispatcher_list_clearsearchfilter() {
377
-        $this->session->set_userdata('advance_search', 0);
378
-        $this->session->set_userdata('opensipsdispatcher_list_search', "");
379
-    }
376
+	function dispatcher_list_clearsearchfilter() {
377
+		$this->session->set_userdata('advance_search', 0);
378
+		$this->session->set_userdata('opensipsdispatcher_list_search', "");
379
+	}
380 380
 
381 381
 }
382 382
 
Please login to merge, or discard this 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.
Braces   +11 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@  discard block
 block discarded – undo
33 33
         $db_config = Common_model::$global_config['system_config'];
34 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
-        if ($this->session->userdata('user_login') == FALSE)
37
-            redirect(base_url() . '/astpp/login');
36
+        if ($this->session->userdata('user_login') == FALSE) {
37
+                    redirect(base_url() . '/astpp/login');
38
+        }
38 39
     }
39 40
 
40 41
     function opensips_add() {
@@ -92,7 +93,7 @@  discard block
 block discarded – undo
92 93
                         $this->opensips_model->edit_opensipsdevices($add_array, $add_array['id']);
93 94
                         echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!"));
94 95
                         exit;
95
-                }else{
96
+                } else{
96 97
                        echo json_encode($auth_flag);
97 98
                        exit;
98 99
                 }
@@ -109,7 +110,7 @@  discard block
 block discarded – undo
109 110
                         $this->opensips_model->add_opensipsdevices($add_array);
110 111
                         echo json_encode(array("SUCCESS"=> "OpenSips added successfully!"));
111 112
                         exit;
112
-                }else{
113
+                } else{
113 114
                        echo json_encode($auth_flag);
114 115
                         exit;
115 116
                 }
@@ -131,10 +132,10 @@  discard block
 block discarded – undo
131 132
                 $auth_flag = $auth_flag->num_rows();
132 133
                 if($auth_flag == 0){
133 134
                     return "TRUE";
134
-                }else{
135
+                } else{
135 136
                     return array("username_error"=>"Duplicate Email Address Found Email Must Be Unique.");
136 137
                 }
137
-        }else{
138
+        } else{
138 139
           return array("username_error"=>"User name is required field.");
139 140
         }
140 141
         return "0";
@@ -155,13 +156,13 @@  discard block
 block discarded – undo
155 156
                 echo json_encode(array("SUCCESS"=> "Opensips Updated Successfully!"));
156 157
                 exit;
157 158
             }
158
-        }else{
159
+        } else{
159 160
 	      $data['page_title'] = 'Add Opensips';
160 161
 	      if ($this->form_validation->run() == FALSE) {
161 162
                 $data['validation_errors'] = validation_errors();
162 163
                 echo $data['validation_errors'];
163 164
                 exit;
164
-            }else{
165
+            } else{
165 166
 		$this->opensips_model->add_opensipsdevices($array_add);
166 167
                 echo json_encode(array("SUCCESS"=> "Opensips Added Successfully!"));
167 168
                 exit;
@@ -184,13 +185,13 @@  discard block
 block discarded – undo
184 185
                 echo json_encode(array("SUCCESS"=> "OpenSips Updated Successfully!"));
185 186
                 exit;
186 187
             }
187
-        }else{
188
+        } else{
188 189
               $data['page_title'] = 'Add Opensips';
189 190
 	      if ($this->form_validation->run() == FALSE) {
190 191
                 $data['validation_errors'] = validation_errors();
191 192
                 echo $data['validation_errors'];
192 193
                 exit;
193
-             }else{
194
+             } else{
194 195
 		$this->opensips_model->add_opensipsdevices($add_array);
195 196
                 echo json_encode(array("SUCCESS"=> "OpenSips Added Successfully!"));
196 197
                 exit;
Please login to merge, or discard this patch.
astpp/application/modules/opensips/libraries/opensips_form.php 3 patches
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -22,184 +22,184 @@
 block discarded – undo
22 22
 ###############################################################################
23 23
 
24 24
 if (!defined('BASEPATH'))
25
-    exit('No direct script access allowed');
25
+	exit('No direct script access allowed');
26 26
 
27 27
 class Opensips_form {
28 28
 
29
-    function __construct() {
30
-        $this->CI = & get_instance();
31
-    }
32
-
33
-    function get_opensips_form_fields($id = false) {
34
-        $accountinfo = $this->CI->session->userdata("accountinfo");
35
-
36
-        $uname_user = $this->CI->common->find_uniq_rendno('10', '', '');
37
-        $password = $this->CI->common->generate_password();
38
-        $val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username';
39
-
40
-        // echo '<pre>'; print_r($val); exit;
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"));
43
-        $form['Opensips Device'] = array(
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>'),
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
-            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'),
50
-            array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
51
-            array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
52
-        );
53
-        $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'button', 'id' => 'submit', 'class' => 'btn btn-line-parrot');
54
-        $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
55
-        //  echo '<pre>'; print_r($form); exit;
56
-        return $form;
57
-    }
58
-
59
-    function get_dispatcher_form_fields() {
60
-
61
-        $form['forms'] = array(base_url() . 'opensips/dispatcher_save/', array("id" => "opensips_dispatcher_form", "name" => "opensips_dispatcher_form"));
62
-        $form['Dispatcher Information'] = array(
63
-            array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
64
-            array('Setid', 'INPUT', array('name' => 'setid', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
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', ''),
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', ''),
69
-        );
70
-        $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'button', 'id' => 'submit', 'class' => 'btn btn-line-parrot');
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/\')');
72
-        return $form;
73
-    }
74
-
75
-    function get_search_dispatcher_form() {
76
-        $form['forms'] = array("", array('id' => "dispatcher_search"));
77
-        $form['Search'] = array(
78
-            array('Description', 'INPUT', array('name' => 'description[description]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''),
79
-            array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
80
-            array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
81
-        );
82
-
83
-        $form['button_search'] = array('name' => 'action', 'id' => "opensipsdispatcher_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
84
-        $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');
85
-
86
-        return $form;
87
-    }
88
-
89
-    function get_search_opensips_form() {
90
-        $form['forms'] = array("", array('id' => "opensips_list_search"));
91
-        $form['Search'] = array(
92
-            array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''),
93
-            array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
94
-            array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
95
-        );
96
-
97
-        $form['button_search'] = array('name' => 'action', 'id' => "opensipsdevice_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
98
-        $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');
99
-
100
-        return $form;
101
-    }
102
-
103
-    function build_opensips_list() {
104
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
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"),
112
-            array("Action", "100", "", "", "", array("EDIT" => array("url" => "/opensips/opensips_edit/", "mode" => "popup"),
113
-                    "DELETE" => array("url" => "/opensips/opensips_remove/", "mode" => "single")))
114
-                ));
115
-        return $grid_field_arr;
116
-    }
117
-
118
-    function build_opensipsdispatcher_list() {
119
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
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"),
126
-            array("Action", "170", "", "", "", array("EDIT" => array("url" => "/opensips/dispatcher_edit/", "mode" => "popup"),
127
-                    "DELETE" => array("url" => "/opensips/dispatcher_remove/", "mode" => "single")))
128
-                ));
129
-        return $grid_field_arr;
130
-    }
131
-
132
-    function build_grid_buttons() {
133
-        $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/opensips/opensips_add/", 'popup'),
29
+	function __construct() {
30
+		$this->CI = & get_instance();
31
+	}
32
+
33
+	function get_opensips_form_fields($id = false) {
34
+		$accountinfo = $this->CI->session->userdata("accountinfo");
35
+
36
+		$uname_user = $this->CI->common->find_uniq_rendno('10', '', '');
37
+		$password = $this->CI->common->generate_password();
38
+		$val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username';
39
+
40
+		// echo '<pre>'; print_r($val); exit;
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"));
43
+		$form['Opensips Device'] = array(
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>'),
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
+			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'),
50
+			array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
51
+			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
52
+		);
53
+		$form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'button', 'id' => 'submit', 'class' => 'btn btn-line-parrot');
54
+		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
55
+		//  echo '<pre>'; print_r($form); exit;
56
+		return $form;
57
+	}
58
+
59
+	function get_dispatcher_form_fields() {
60
+
61
+		$form['forms'] = array(base_url() . 'opensips/dispatcher_save/', array("id" => "opensips_dispatcher_form", "name" => "opensips_dispatcher_form"));
62
+		$form['Dispatcher Information'] = array(
63
+			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
64
+			array('Setid', 'INPUT', array('name' => 'setid', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
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', ''),
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', ''),
69
+		);
70
+		$form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'button', 'id' => 'submit', 'class' => 'btn btn-line-parrot');
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/\')');
72
+		return $form;
73
+	}
74
+
75
+	function get_search_dispatcher_form() {
76
+		$form['forms'] = array("", array('id' => "dispatcher_search"));
77
+		$form['Search'] = array(
78
+			array('Description', 'INPUT', array('name' => 'description[description]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''),
79
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
80
+			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
81
+		);
82
+
83
+		$form['button_search'] = array('name' => 'action', 'id' => "opensipsdispatcher_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
84
+		$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');
85
+
86
+		return $form;
87
+	}
88
+
89
+	function get_search_opensips_form() {
90
+		$form['forms'] = array("", array('id' => "opensips_list_search"));
91
+		$form['Search'] = array(
92
+			array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''),
93
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
94
+			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
95
+		);
96
+
97
+		$form['button_search'] = array('name' => 'action', 'id' => "opensipsdevice_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
98
+		$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');
99
+
100
+		return $form;
101
+	}
102
+
103
+	function build_opensips_list() {
104
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
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"),
112
+			array("Action", "100", "", "", "", array("EDIT" => array("url" => "/opensips/opensips_edit/", "mode" => "popup"),
113
+					"DELETE" => array("url" => "/opensips/opensips_remove/", "mode" => "single")))
114
+				));
115
+		return $grid_field_arr;
116
+	}
117
+
118
+	function build_opensipsdispatcher_list() {
119
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
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"),
126
+			array("Action", "170", "", "", "", array("EDIT" => array("url" => "/opensips/dispatcher_edit/", "mode" => "popup"),
127
+					"DELETE" => array("url" => "/opensips/dispatcher_remove/", "mode" => "single")))
128
+				));
129
+		return $grid_field_arr;
130
+	}
131
+
132
+	function build_grid_buttons() {
133
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/opensips/opensips_add/", 'popup'),
134 134
 //				    array("Refresh","reload","/accounts/clearsearchfilter/")
135
-                ));
136
-        return $buttons_json;
137
-    }
138
-
139
-    function build_grid_dispatcherbuttons() {
140
-        $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/opensips/dispatcher_add/", "popup"),
141
-                //  array("Refresh","reload","/accounts/clearsearchfilter/")
142
-                ));
143
-        return $buttons_json;
144
-    }
145
-
146
-    function get_opensips_form_fields_for_customer($accountid, $id = false) {
147
-        $val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username';
148
-        $uname_user = $this->CI->common->find_uniq_rendno('10', '', '');
149
-        $password = $this->CI->common->generate_password();
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/';    
152
-            $form['forms'] = array($link, array("id" => "opensips_form", "name" => "opensips_form"));
153
-            $form['Opensips Device'] = array(
154
-                array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
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>'),
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'),
160
-                array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
161
-                array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),                
162
-            );
163
-        $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'button', 'id' => 'submit', 'class' => 'btn btn-line-parrot');
164
-        $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
165
-        return $form;
166
-    }
167
-
168
-    function user_opensips() {
169
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
170
-        $grid_field_arr = json_encode(array(
171
-            array("Username", "130", "username", "", "", ""),
172
-            array("Password", "130", "password", "", "", ""),
173
-            array("Domain", "130", "domain", "", "", ""),
174
-            array("Action", "120", "", "", "",
175
-                array("EDIT" => array("url" => 'user/user_opensips_action/edit/', "mode" => "popup"),
176
-                    "DELETE" => array("url" => 'user/user_opensips_action/delete/', "mode" => "popup")
177
-            ))));
178
-        return $grid_field_arr;
179
-    }
180
-
181
-    function opensips_customer_build_grid_buttons($accountid) {
182
-        $buttons_json = json_encode(array(array("Add Devices", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/opensips/customer_opensips_add/$accountid/", "popup"),
183
-                //array("Refresh", "reload", "/accounts/clearsearchfilter/")
184
-                ));
185
-        return $buttons_json;
186
-    }
187
-
188
-    function opensips_customer_build_opensips_list($accountid) {
135
+				));
136
+		return $buttons_json;
137
+	}
138
+
139
+	function build_grid_dispatcherbuttons() {
140
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/opensips/dispatcher_add/", "popup"),
141
+				//  array("Refresh","reload","/accounts/clearsearchfilter/")
142
+				));
143
+		return $buttons_json;
144
+	}
145
+
146
+	function get_opensips_form_fields_for_customer($accountid, $id = false) {
147
+		$val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username';
148
+		$uname_user = $this->CI->common->find_uniq_rendno('10', '', '');
149
+		$password = $this->CI->common->generate_password();
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/';    
152
+			$form['forms'] = array($link, array("id" => "opensips_form", "name" => "opensips_form"));
153
+			$form['Opensips Device'] = array(
154
+				array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
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>'),
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'),
160
+				array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
161
+				array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),                
162
+			);
163
+		$form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'button', 'id' => 'submit', 'class' => 'btn btn-line-parrot');
164
+		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
165
+		return $form;
166
+	}
167
+
168
+	function user_opensips() {
169
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
170
+		$grid_field_arr = json_encode(array(
171
+			array("Username", "130", "username", "", "", ""),
172
+			array("Password", "130", "password", "", "", ""),
173
+			array("Domain", "130", "domain", "", "", ""),
174
+			array("Action", "120", "", "", "",
175
+				array("EDIT" => array("url" => 'user/user_opensips_action/edit/', "mode" => "popup"),
176
+					"DELETE" => array("url" => 'user/user_opensips_action/delete/', "mode" => "popup")
177
+			))));
178
+		return $grid_field_arr;
179
+	}
180
+
181
+	function opensips_customer_build_grid_buttons($accountid) {
182
+		$buttons_json = json_encode(array(array("Add Devices", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/opensips/customer_opensips_add/$accountid/", "popup"),
183
+				//array("Refresh", "reload", "/accounts/clearsearchfilter/")
184
+				));
185
+		return $buttons_json;
186
+	}
187
+
188
+	function opensips_customer_build_opensips_list($accountid) {
189 189
 //echo $accountid;
190
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
191
-        $grid_field_arr = json_encode(array(
192
-            array("Username", "200", "username", "", "", ""),
193
-            array("Password", "200", "password", "", "", ""),
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")))
199
-                ));
200
-
201
-        return $grid_field_arr;
202
-    }
190
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
191
+		$grid_field_arr = json_encode(array(
192
+			array("Username", "200", "username", "", "", ""),
193
+			array("Password", "200", "password", "", "", ""),
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")))
199
+				));
200
+
201
+		return $grid_field_arr;
202
+	}
203 203
 
204 204
 }
205 205
 
Please login to merge, or discard this 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.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@
 block discarded – undo
22 22
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 23
 ###############################################################################
24 24
 
25
-if (!defined('BASEPATH'))
26
-    exit('No direct script access allowed');
25
+if (!defined('BASEPATH')) {
26
+    exit('No direct script access allowed');
27
+}
27 28
 
28 29
 class Package_form {
29 30
 
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/opensips/models/opensips_model.php 3 patches
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -22,200 +22,200 @@
 block discarded – undo
22 22
 ###############################################################################
23 23
 class Opensips_model extends CI_Model {
24 24
 
25
-    function Opensips_model() {
26
-        parent::__construct();
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=";
29
-        $this->opensips_db = $this->load->database($opensipdsn, true);
30
-    }
25
+	function Opensips_model() {
26
+		parent::__construct();
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=";
29
+		$this->opensips_db = $this->load->database($opensipdsn, true);
30
+	}
31 31
     
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');
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 35
 	$reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0;
36
-        $this->opensips_db->where('reseller_id',$reseller_id);
37
-        if ($flag) {
38
-            $this->opensips_db->limit($limit,$start);
39
-            if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
36
+		$this->opensips_db->where('reseller_id',$reseller_id);
37
+		if ($flag) {
38
+			$this->opensips_db->limit($limit,$start);
39
+			if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
40 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
-	    }
44
-            $query = $this->opensips_db->get("subscriber");
45
-        } else {
46
-            $query = $this->opensips_db->get("subscriber");
47
-            $query = $query->num_rows();
48
-        }
49
-        return $query;
50
-    }
41
+		}else{
42
+			$this->opensips_db->order_by('username','asc');
43
+		}
44
+			$query = $this->opensips_db->get("subscriber");
45
+		} else {
46
+			$query = $this->opensips_db->get("subscriber");
47
+			$query = $query->num_rows();
48
+		}
49
+		return $query;
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
-        if ($accountid != "") {
55
-            $where = array("accountcode" => $this->common->get_field_name('number', 'accounts', array('id' => $accountid)));
56
-        }
57
-        $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_opensips');
58
-        $like_str=!empty($instant_search) ? "(username like '%$instant_search%'
54
+		if ($accountid != "") {
55
+			$where = array("accountcode" => $this->common->get_field_name('number', 'accounts', array('id' => $accountid)));
56
+		}
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
-                                           :null;
65
-        if(!empty($like_str))
66
-        $this->opensips_db->where($like_str);
67
-        $this->opensips_db->where($where);
68
-        if ($flag) {
69
-	      $this->opensips_db->limit($limit,$start);            
70
-        }
71
-        $result = $this->opensips_db->get("subscriber");
72
-        if($result->num_rows() > 0){
64
+										   :null;
65
+		if(!empty($like_str))
66
+		$this->opensips_db->where($like_str);
67
+		$this->opensips_db->where($where);
68
+		if ($flag) {
69
+		  $this->opensips_db->limit($limit,$start);            
70
+		}
71
+		$result = $this->opensips_db->get("subscriber");
72
+		if($result->num_rows() > 0){
73 73
 	  if($flag){
74
-	    return $result;
74
+		return $result;
75 75
 	  }
76 76
 	  else{
77
-	    return $result->num_rows();
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 83
 	  else{
84
-	      $result=0;
84
+		  $result=0;
85 85
 	  }
86 86
 	  return $result;
87
-        }
88
-    }
87
+		}
88
+	}
89 89
 
90
-    function getopensipsdispatcher_list($flag, $start = '', $limit = '') {
91
-       $this->db_model->build_search_opensips($this->opensips_db,'opensipsdispatcher_list_search');
90
+	function getopensipsdispatcher_list($flag, $start = '', $limit = '') {
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'){
93
+			$this->opensips_db->limit( $limit,$start);
94
+			if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
95 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
-	    }
99
-            $query = $this->opensips_db->get("dispatcher");
100
-        } else {
101
-            $query = $this->opensips_db->get("dispatcher");
102
-            $query = $query->num_rows();
96
+		}else{
97
+			$this->opensips_db->order_by('setid','asc');
98
+		}
99
+			$query = $this->opensips_db->get("dispatcher");
100
+		} else {
101
+			$query = $this->opensips_db->get("dispatcher");
102
+			$query = $query->num_rows();
103 103
 
104
-        }
105
-        return $query;
106
-    }
104
+		}
105
+		return $query;
106
+	}
107 107
 
108 108
 
109 109
 
110 110
  function add_opensipsdevices($data) {
111
-        unset($data["action"]);
112
-        $data['creation_date']=gmdate("Y-m-d H:i:s");
113
-        $accountinfo=$this->session->userdata('accountinfo');
111
+		unset($data["action"]);
112
+		$data['creation_date']=gmdate("Y-m-d H:i:s");
113
+		$accountinfo=$this->session->userdata('accountinfo');
114 114
 		$data['reseller_id']=$accountinfo['type']==1 ? $accountinfo['id'] : 0;
115
-        unset($data["id"]);	
116
-        $this->opensips_db->insert("subscriber", $data);
117
-    }
118
-
119
-    function edit_opensipsdevices($data, $id) {
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']);
122
-      $this->opensips_db->where("id", $id);
123
-      $data['last_modified_date']=gmdate("Y-m-d H:i:s");
124
-      $this->opensips_db->update("subscriber", $data);
125
-    }
126
-    function delete_opensips_devices($id) {
127
-        $this->opensips_db->where("id", $id);
128
-        $this->opensips_db->delete("subscriber");
129
-        return true;
130
-    }
131
-
132
-    function remove_opensips($id) {
133
-        $this->opensips_db->where("id", $id);
134
-        $this->opensips_db->delete("subscriber");
135
-        return true;
136
-    }
137
-
138
-    function add_opensipsdispatcher($data) {
139
-        unset($data["action"]);
140
-        $this->opensips_db->insert("dispatcher", $data);
141
-    }
142
-
143
-    function edit_opensipsdispatcher($data, $id) {
144
-        unset($data["action"]);
145
-        $this->opensips_db->where("id", $id);
146
-        $this->opensips_db->update("dispatcher", $data);
147
-    }
148
-
149
-    function remove_dispatcher($id) {
150
-        $this->opensips_db->where("id", $id);
151
-        $this->opensips_db->delete("dispatcher");
152
-        return true;
153
-    }
115
+		unset($data["id"]);	
116
+		$this->opensips_db->insert("subscriber", $data);
117
+	}
118
+
119
+	function edit_opensipsdevices($data, $id) {
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']);
122
+	  $this->opensips_db->where("id", $id);
123
+	  $data['last_modified_date']=gmdate("Y-m-d H:i:s");
124
+	  $this->opensips_db->update("subscriber", $data);
125
+	}
126
+	function delete_opensips_devices($id) {
127
+		$this->opensips_db->where("id", $id);
128
+		$this->opensips_db->delete("subscriber");
129
+		return true;
130
+	}
131
+
132
+	function remove_opensips($id) {
133
+		$this->opensips_db->where("id", $id);
134
+		$this->opensips_db->delete("subscriber");
135
+		return true;
136
+	}
137
+
138
+	function add_opensipsdispatcher($data) {
139
+		unset($data["action"]);
140
+		$this->opensips_db->insert("dispatcher", $data);
141
+	}
142
+
143
+	function edit_opensipsdispatcher($data, $id) {
144
+		unset($data["action"]);
145
+		$this->opensips_db->where("id", $id);
146
+		$this->opensips_db->update("dispatcher", $data);
147
+	}
148
+
149
+	function remove_dispatcher($id) {
150
+		$this->opensips_db->where("id", $id);
151
+		$this->opensips_db->delete("dispatcher");
152
+		return true;
153
+	}
154 154
 
155 155
  function build_search_opensips($accounts_list_search) {
156
-        if ($this->session->userdata('advance_search') == 1) {
157
-            $account_search = $this->session->userdata($accounts_list_search);
158
-            unset($account_search["ajax_search"]);
159
-            unset($account_search["advance_search"]);
160
-            foreach ($account_search as $key => $value) {
161
-                if ($value != "") {
162
-                    if (is_array($value)) {
163
-                        if (array_key_exists($key . "-integer", $value)) {
164
-                            $this->get_interger_array($key, $value[$key . "-integer"], $value[$key]);
165
-                        }
166
-                        if (array_key_exists($key . "-string", $value)) {
167
-                            $this->get_string_array($key, $value[$key . "-string"], $value[$key]);
168
-                        }
169
-                    } else {
170
-                        $this->opensips_db->where($key, $value);
171
-                    }
172
-                }
173
-            }
174
-        }
175
-    }
176
-
177
-    function get_interger_array($field, $value, $search_array) {
178
-        if ($search_array != '') {
179
-            switch ($value) {
180
-                case "1":
181
-                    $this->opensips_db->where($field, $search_array);
182
-                    break;
183
-                case "2":
184
-                    $this->opensips_db->where($field . ' <>', $search_array);
185
-                    break;
186
-                case "3":
187
-                    $this->opensips_db->where($field . ' > ', $search_array);
188
-                    break;
189
-                case "4":
190
-                    $this->opensips_db->where($field . ' < ', $search_array);
191
-                    break;
192
-                case "5":
193
-                    $this->opensips_db->where($field . ' >= ', $search_array);
194
-                    break;
195
-                case "6":
196
-                    $this->opensips_db->where($field . ' <= ', $search_array);
197
-                    break;
198
-            }
199
-        }
200
-    }
201
-
202
-    function get_string_array($field, $value, $search_array) {
203
-        if ($search_array != '') {
204
-            switch ($value) {
205
-                case "1":
206
-                    $this->opensips_db->like($field, $search_array);
207
-                    break;
208
-                case "2":
209
-                    $this->opensips_db->not_like($field, $search_array);
210
-                    break;
211
-                case "3":
212
-                    $this->opensips_db->where($field, $search_array);
213
-                    break;
214
-                case "4":
215
-                    $this->opensips_db->where($field . ' <>', $search_array);
216
-                    break;
217
-            }
218
-        }
219
-    }
156
+		if ($this->session->userdata('advance_search') == 1) {
157
+			$account_search = $this->session->userdata($accounts_list_search);
158
+			unset($account_search["ajax_search"]);
159
+			unset($account_search["advance_search"]);
160
+			foreach ($account_search as $key => $value) {
161
+				if ($value != "") {
162
+					if (is_array($value)) {
163
+						if (array_key_exists($key . "-integer", $value)) {
164
+							$this->get_interger_array($key, $value[$key . "-integer"], $value[$key]);
165
+						}
166
+						if (array_key_exists($key . "-string", $value)) {
167
+							$this->get_string_array($key, $value[$key . "-string"], $value[$key]);
168
+						}
169
+					} else {
170
+						$this->opensips_db->where($key, $value);
171
+					}
172
+				}
173
+			}
174
+		}
175
+	}
176
+
177
+	function get_interger_array($field, $value, $search_array) {
178
+		if ($search_array != '') {
179
+			switch ($value) {
180
+				case "1":
181
+					$this->opensips_db->where($field, $search_array);
182
+					break;
183
+				case "2":
184
+					$this->opensips_db->where($field . ' <>', $search_array);
185
+					break;
186
+				case "3":
187
+					$this->opensips_db->where($field . ' > ', $search_array);
188
+					break;
189
+				case "4":
190
+					$this->opensips_db->where($field . ' < ', $search_array);
191
+					break;
192
+				case "5":
193
+					$this->opensips_db->where($field . ' >= ', $search_array);
194
+					break;
195
+				case "6":
196
+					$this->opensips_db->where($field . ' <= ', $search_array);
197
+					break;
198
+			}
199
+		}
200
+	}
201
+
202
+	function get_string_array($field, $value, $search_array) {
203
+		if ($search_array != '') {
204
+			switch ($value) {
205
+				case "1":
206
+					$this->opensips_db->like($field, $search_array);
207
+					break;
208
+				case "2":
209
+					$this->opensips_db->not_like($field, $search_array);
210
+					break;
211
+				case "3":
212
+					$this->opensips_db->where($field, $search_array);
213
+					break;
214
+				case "4":
215
+					$this->opensips_db->where($field . ' <>', $search_array);
216
+					break;
217
+			}
218
+		}
219
+	}
220 220
 
221 221
 }
Please login to merge, or discard this 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.
Braces   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             $this->opensips_db->limit($limit,$start);
39 39
             if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
40 40
 		$this->opensips_db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
41
-	    }else{
41
+	    } else{
42 42
             $this->opensips_db->order_by('username','asc');
43 43
 	    }
44 44
             $query = $this->opensips_db->get("subscriber");
@@ -62,8 +62,9 @@  discard block
 block discarded – undo
62 62
                                             OR  effective_caller_id_number like '%$instant_search%'
63 63
                                                 )"
64 64
                                            :null;
65
-        if(!empty($like_str))
66
-        $this->opensips_db->where($like_str);
65
+        if(!empty($like_str)) {
66
+                $this->opensips_db->where($like_str);
67
+        }
67 68
         $this->opensips_db->where($where);
68 69
         if ($flag) {
69 70
 	      $this->opensips_db->limit($limit,$start);            
@@ -72,15 +73,13 @@  discard block
 block discarded – undo
72 73
         if($result->num_rows() > 0){
73 74
 	  if($flag){
74 75
 	    return $result;
75
-	  }
76
-	  else{
76
+	  } else{
77 77
 	    return $result->num_rows();
78 78
 	  }
79
-        }else{
79
+        } else{
80 80
          if($flag){
81 81
 	      $result=(object)array('num_rows'=>0);
82
-	  }
83
-	  else{
82
+	  } else{
84 83
 	      $result=0;
85 84
 	  }
86 85
 	  return $result;
@@ -93,7 +92,7 @@  discard block
 block discarded – undo
93 92
             $this->opensips_db->limit( $limit,$start);
94 93
             if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
95 94
 		$this->opensips_db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
96
-	    }else{
95
+	    } else{
97 96
             $this->opensips_db->order_by('setid','asc');
98 97
 	    }
99 98
             $query = $this->opensips_db->get("dispatcher");
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/controllers/ipmap.php 3 patches
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -24,200 +24,200 @@
 block discarded – undo
24 24
 
25 25
 class IPMAP extends MX_Controller {
26 26
 
27
-    function IPMAP() {
28
-        parent::__construct();
29
-        $this->load->helper('template_inheritance');
30
-        $this->load->library('session');
31
-        $this->load->library("ipmap_form");
32
-        $this->load->library('astpp/form');
33
-        $this->load->model('ipmap_model');
34
-        if ($this->session->userdata('user_login') == FALSE)
35
-            redirect(base_url() . '/astpp/login');
36
-         }
37
-    function ipmap_add() {
38
-        $data['username'] = $this->session->userdata('user_name');
39
-        $data['flag'] = 'create';
40
-        $data['page_title'] = 'Add IP Map';
41
-        $data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), '');
42
-        $this->load->view('ipmap_add_edit', $data);
43
-      }
27
+	function IPMAP() {
28
+		parent::__construct();
29
+		$this->load->helper('template_inheritance');
30
+		$this->load->library('session');
31
+		$this->load->library("ipmap_form");
32
+		$this->load->library('astpp/form');
33
+		$this->load->model('ipmap_model');
34
+		if ($this->session->userdata('user_login') == FALSE)
35
+			redirect(base_url() . '/astpp/login');
36
+		 }
37
+	function ipmap_add() {
38
+		$data['username'] = $this->session->userdata('user_name');
39
+		$data['flag'] = 'create';
40
+		$data['page_title'] = 'Add IP Map';
41
+		$data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), '');
42
+		$this->load->view('ipmap_add_edit', $data);
43
+	  }
44 44
 
45
-    function ipmap_edit($edit_id = '') {
46
-        $data['page_title'] = 'Edit IP Map ';
47
-        $where = array('id' => $edit_id);
48
-        $account = $this->db_model->getSelect("*", "ip_map", $where);
49
-        //echo $this->db->last_query(); exit;
50
-        foreach ($account->result_array() as $key => $value) {
51
-        /*********************
45
+	function ipmap_edit($edit_id = '') {
46
+		$data['page_title'] = 'Edit IP Map ';
47
+		$where = array('id' => $edit_id);
48
+		$account = $this->db_model->getSelect("*", "ip_map", $where);
49
+		//echo $this->db->last_query(); exit;
50
+		foreach ($account->result_array() as $key => $value) {
51
+		/*********************
52 52
      	ASTPP  3.0 
53 53
    	in customer login show ipmap (ACL) module
54 54
    	*****************************************/
55
-         $ip=explode("/",$value['ip']);
56
-         $edit_data = $value;
57
-         $edit_data['ip']=$ip[0];
58
-        }
59
-        /*************************************************************************************************/
60
-        $data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $edit_data);
61
-        $this->load->view('ipmap_add_edit', $data);
62
-    }
55
+		 $ip=explode("/",$value['ip']);
56
+		 $edit_data = $value;
57
+		 $edit_data['ip']=$ip[0];
58
+		}
59
+		/*************************************************************************************************/
60
+		$data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $edit_data);
61
+		$this->load->view('ipmap_add_edit', $data);
62
+	}
63 63
 
64
-    function ipmap_save() {
65
-        $add_array = $this->input->post();
66
-        $ip = $add_array['ip'];
67
-        if (strpos($ip,'/') !== false) {
68
-           $add_array['ip']=$add_array['ip'];
69
-        }
70
-        else{
71
-           $add_array['ip']=$add_array['ip'].'/32';
72
-        }
73
-        $data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $add_array);
74
-        if ($add_array['id'] != '') {
75
-            $data['page_title'] = 'Add IP Map';
76
-            if ($this->form_validation->run() == FALSE) {
77
-                $data['validation_errors'] = validation_errors();
78
-                echo $data['validation_errors'];
79
-                exit;
80
-            } else {
81
-                 $ip_free= $this->ipmap_model->edit_ipmap($add_array, $add_array['id']);
82
-                 if ($ip_free) {
83
-                    $this->load->library('freeswitch_lib');
84
-                    $this->load->module('freeswitch/freeswitch');
85
-                    $command = "api reloadacl";
86
-                    $response = $this->freeswitch_model->reload_freeswitch($command);
87
-                    $this->session->set_userdata('astpp_notification',$response);
88
-                }
89
-                echo json_encode(array("SUCCESS"=> " IP Map updated successfully!"));
90
-                exit;
91
-            }
92
-        } else {
64
+	function ipmap_save() {
65
+		$add_array = $this->input->post();
66
+		$ip = $add_array['ip'];
67
+		if (strpos($ip,'/') !== false) {
68
+		   $add_array['ip']=$add_array['ip'];
69
+		}
70
+		else{
71
+		   $add_array['ip']=$add_array['ip'].'/32';
72
+		}
73
+		$data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $add_array);
74
+		if ($add_array['id'] != '') {
75
+			$data['page_title'] = 'Add IP Map';
76
+			if ($this->form_validation->run() == FALSE) {
77
+				$data['validation_errors'] = validation_errors();
78
+				echo $data['validation_errors'];
79
+				exit;
80
+			} else {
81
+				 $ip_free= $this->ipmap_model->edit_ipmap($add_array, $add_array['id']);
82
+				 if ($ip_free) {
83
+					$this->load->library('freeswitch_lib');
84
+					$this->load->module('freeswitch/freeswitch');
85
+					$command = "api reloadacl";
86
+					$response = $this->freeswitch_model->reload_freeswitch($command);
87
+					$this->session->set_userdata('astpp_notification',$response);
88
+				}
89
+				echo json_encode(array("SUCCESS"=> " IP Map updated successfully!"));
90
+				exit;
91
+			}
92
+		} else {
93 93
         
94
-            if ($this->form_validation->run() == FALSE) {
95
-                $data['validation_errors'] = validation_errors();
96
-                echo $data['validation_errors'];
97
-                exit;
98
-            } else {
99
-                 $ip_free = $this->ipmap_model->add_ipmap($add_array);
100
-                 if ($ip_free) {
101
-                    $this->load->library('freeswitch_lib');
102
-                    $this->load->module('freeswitch/freeswitch');
103
-                    $command = "api reloadacl";
104
-                    $response = $this->freeswitch_model->reload_freeswitch($command);
105
-                    $this->session->set_userdata('astpp_notification',$response);
106
-                }               
107
-                echo json_encode(array("SUCCESS"=> " IP Map added successfully!"));
108
-                exit;
109
-            }
110
-        }
111
-    }
112
-      function ipmap_delete($id) {
113
-        $ip_free=$this->ipmap_model-> remove_ipmap($id);
114
-         if ($ip_free) {
115
-                    $this->load->library('freeswitch_lib');
116
-                    $this->load->module('freeswitch/freeswitch');
117
-                    $command = "api reloadacl";
118
-                    $response = $this->freeswitch_model->reload_freeswitch($command);
119
-                    $this->session->set_userdata('astpp_notification',$response);
120
-                }
121
-        $this->session->set_flashdata('astpp_notification', 'IP Map removed successfully!');
122
-        /*********************
94
+			if ($this->form_validation->run() == FALSE) {
95
+				$data['validation_errors'] = validation_errors();
96
+				echo $data['validation_errors'];
97
+				exit;
98
+			} else {
99
+				 $ip_free = $this->ipmap_model->add_ipmap($add_array);
100
+				 if ($ip_free) {
101
+					$this->load->library('freeswitch_lib');
102
+					$this->load->module('freeswitch/freeswitch');
103
+					$command = "api reloadacl";
104
+					$response = $this->freeswitch_model->reload_freeswitch($command);
105
+					$this->session->set_userdata('astpp_notification',$response);
106
+				}               
107
+				echo json_encode(array("SUCCESS"=> " IP Map added successfully!"));
108
+				exit;
109
+			}
110
+		}
111
+	}
112
+	  function ipmap_delete($id) {
113
+		$ip_free=$this->ipmap_model-> remove_ipmap($id);
114
+		 if ($ip_free) {
115
+					$this->load->library('freeswitch_lib');
116
+					$this->load->module('freeswitch/freeswitch');
117
+					$command = "api reloadacl";
118
+					$response = $this->freeswitch_model->reload_freeswitch($command);
119
+					$this->session->set_userdata('astpp_notification',$response);
120
+				}
121
+		$this->session->set_flashdata('astpp_notification', 'IP Map removed successfully!');
122
+		/*********************
123 123
      	ASTPP  3.0 
124 124
    	in customer login show ipmap (ACL) module
125 125
    	*****************************************/
126 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
-        }
132
-        /*********************************************************************/
133
-    }
127
+		if($accountdata['type'] == '0'){
128
+		redirect(base_url() . 'user/user_ipmap_detail/');
129
+		}else{
130
+		redirect(base_url() . 'ipmap/ipmap_detail/');
131
+		}
132
+		/*********************************************************************/
133
+	}
134 134
 
135
-    function ipmap_detail_search() {
136
-        $ajax_search = $this->input->post('ajax_search', 0);
137
-        if ($this->input->post('advance_search', TRUE) == 1) {
138
-            $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
139
-            $action = $this->input->post();
140
-            unset($action['action']);
141
-            unset($action['advance_search']);
142
-            $this->session->set_userdata('ipmap_list_search', $action);
143
-        }
144
-        if (@$ajax_search != 1) {
145
-            redirect(base_url() . 'ipmap/ipmap_list/');
146
-        }
147
-    }
135
+	function ipmap_detail_search() {
136
+		$ajax_search = $this->input->post('ajax_search', 0);
137
+		if ($this->input->post('advance_search', TRUE) == 1) {
138
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
139
+			$action = $this->input->post();
140
+			unset($action['action']);
141
+			unset($action['advance_search']);
142
+			$this->session->set_userdata('ipmap_list_search', $action);
143
+		}
144
+		if (@$ajax_search != 1) {
145
+			redirect(base_url() . 'ipmap/ipmap_list/');
146
+		}
147
+	}
148 148
 
149
-    function ipmap_detail_clearsearchfilter() {
150
-        $this->session->set_userdata('advance_search', 0);
151
-        $this->session->set_userdata('ipmap_list_search', "");
152
-    }
149
+	function ipmap_detail_clearsearchfilter() {
150
+		$this->session->set_userdata('advance_search', 0);
151
+		$this->session->set_userdata('ipmap_list_search', "");
152
+	}
153 153
   
154 154
    function ipmap_detail() {
155
-        $data['username'] = $this->session->userdata('user_name');
156
-        $data['page_title'] = 'IP Map(ACL)';
157
-        $data['search_flag'] = true;
158
-        $this->session->set_userdata('advance_search', 0);
159
-        $data['grid_fields'] = $this->ipmap_form->build_ipmap_list_for_admin();
160
-        $data["grid_buttons"] = $this->ipmap_form->build_grid_buttons();
161
-        $data['form_search'] = $this->form->build_serach_form($this->ipmap_form->get_ipmap_search_form());
162
-        $this->load->view('ipmap_view', $data);
163
-    }
155
+		$data['username'] = $this->session->userdata('user_name');
156
+		$data['page_title'] = 'IP Map(ACL)';
157
+		$data['search_flag'] = true;
158
+		$this->session->set_userdata('advance_search', 0);
159
+		$data['grid_fields'] = $this->ipmap_form->build_ipmap_list_for_admin();
160
+		$data["grid_buttons"] = $this->ipmap_form->build_grid_buttons();
161
+		$data['form_search'] = $this->form->build_serach_form($this->ipmap_form->get_ipmap_search_form());
162
+		$this->load->view('ipmap_view', $data);
163
+	}
164 164
 
165
-    /*********************
165
+	/*********************
166 166
      ASTPP  3.0 
167 167
      in customer login show ipmap (ACL) module
168 168
      *****************************************/
169
-    function ipmap_detail_json() {
170
-        $json_data = array();
171
-        $account_data = $this->session->userdata("accountinfo");
172
-        $count_all = $this->ipmap_model->ipmap_list(false);
173
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
174
-        $json_data = $paging_data["json_paging"];
175
-        $query = $this->ipmap_model->ipmap_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
176
-        $query =$query->result_array();
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='';
182
-         $json_data['rows'][] = array('cell' => array(
183
-         $ipmap_checkbox,
184
-         $value['name'],
185
-         $value['ip'],
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']),
190
-         $ret_url,
169
+	function ipmap_detail_json() {
170
+		$json_data = array();
171
+		$account_data = $this->session->userdata("accountinfo");
172
+		$count_all = $this->ipmap_model->ipmap_list(false);
173
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
174
+		$json_data = $paging_data["json_paging"];
175
+		$query = $this->ipmap_model->ipmap_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
176
+		$query =$query->result_array();
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='';
182
+		 $json_data['rows'][] = array('cell' => array(
183
+		 $ipmap_checkbox,
184
+		 $value['name'],
185
+		 $value['ip'],
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']),
190
+		 $ret_url,
191 191
          
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']);
196
-         $json_data['rows'][] = array('cell' => array(
197
-         $ipmap_checkbox,
198
-         $account_name,
199
-         $value['name'],
200
-         $value['ip'],
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']),
205
-         $ret_url,
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']);
196
+		 $json_data['rows'][] = array('cell' => array(
197
+		 $ipmap_checkbox,
198
+		 $account_name,
199
+		 $value['name'],
200
+		 $value['ip'],
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']),
205
+		 $ret_url,
206 206
          
207
-          ));
208
-         }
209
-         }
207
+		  ));
208
+		 }
209
+		 }
210 210
         
211
-        echo json_encode($json_data);
212
-    }
213
-    /*************************************************************/
211
+		echo json_encode($json_data);
212
+	}
213
+	/*************************************************************/
214 214
 
215
-    function ipmap_delete_multiple() {
216
-        $ids = $this->input->post("selected_ids", true);
217
-        $where = "id IN ($ids)";
218
-        $this->db->where($where);
219
-        echo $this->db->delete("ip_map");
220
-    }
215
+	function ipmap_delete_multiple() {
216
+		$ids = $this->input->post("selected_ids", true);
217
+		$where = "id IN ($ids)";
218
+		$this->db->where($where);
219
+		echo $this->db->delete("ip_map");
220
+	}
221 221
   }
222 222
 
223 223
 
Please login to merge, or discard this 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.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@  discard block
 block discarded – undo
31 31
         $this->load->library("ipmap_form");
32 32
         $this->load->library('astpp/form');
33 33
         $this->load->model('ipmap_model');
34
-        if ($this->session->userdata('user_login') == FALSE)
35
-            redirect(base_url() . '/astpp/login');
34
+        if ($this->session->userdata('user_login') == FALSE) {
35
+                    redirect(base_url() . '/astpp/login');
36
+        }
36 37
          }
37 38
     function ipmap_add() {
38 39
         $data['username'] = $this->session->userdata('user_name');
@@ -66,8 +67,7 @@  discard block
 block discarded – undo
66 67
         $ip = $add_array['ip'];
67 68
         if (strpos($ip,'/') !== false) {
68 69
            $add_array['ip']=$add_array['ip'];
69
-        }
70
-        else{
70
+        } else{
71 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);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
    	$accountdata=$this->session->userdata['accountinfo'];
127 127
         if($accountdata['type'] == '0'){
128 128
         redirect(base_url() . 'user/user_ipmap_detail/');
129
-        }else{
129
+        } else{
130 130
         redirect(base_url() . 'ipmap/ipmap_detail/');
131 131
         }
132 132
         /*********************************************************************/
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
          $ret_url,
191 191
          
192 192
           ));
193
-         }else{
193
+         } else{
194 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 195
          $account_name =$this->common->build_concat_string("first_name,last_name,number", "accounts",$value['accountid']);
196 196
          $json_data['rows'][] = array('cell' => array(
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/libraries/ipmap_form.php 3 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -21,152 +21,152 @@
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 if (!defined('BASEPATH'))
24
-    exit('No direct script access allowed');
24
+	exit('No direct script access allowed');
25 25
 
26 26
 class Ipmap_form {
27
-      	function __construct($library_name = '') {
28
-        $this->CI = & get_instance();
29
-    }
27
+	  	function __construct($library_name = '') {
28
+		$this->CI = & get_instance();
29
+	}
30 30
    
31 31
    /*********************
32 32
      ASTPP  3.0 
33 33
      in customer login show ipmap (ACL) module put $account_type in function params
34 34
      *****************************************/
35
-    function get_ipmap_form_fields($account_type = '') {
36
-    /***************************************************/
37
-     /*********************
35
+	function get_ipmap_form_fields($account_type = '') {
36
+	/***************************************************/
37
+	 /*********************
38 38
      ASTPP  3.0 
39 39
      in customer login show ipmap (ACL) module
40 40
      *****************************************/
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'));
48
-       }
49
-       /***********************************************************************************************/
50
-        $form['IP map'] = array(
51
-            array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
52
-             /*********************
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'));
48
+	   }
49
+	   /***********************************************************************************************/
50
+		$form['IP map'] = array(
51
+			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
52
+			 /*********************
53 53
      	    ASTPP  3.0 
54 54
    	    in customer login show ipmap (ACL) module
55 55
    	    *****************************************/
56
-            $account,
57
-            /**********************************************************************************************/
58
-            array('Name', 'INPUT', array('name' => 'name', 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
59
-           /*ASTPP  3.0 
56
+			$account,
57
+			/**********************************************************************************************/
58
+			array('Name', 'INPUT', array('name' => 'name', 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
59
+		   /*ASTPP  3.0 
60 60
    	    in customer login show ipmap (ACL) module
61 61
    	    *****************************************/
62
-            array('IP', 'INPUT', array('name' => 'ip', 'size' => '20', 'class' => "text field medium"), 'trim|required|valid_ip', 'tOOL TIP', 'Please Enter proper ip'),
63
-            /****************************************************************************************************/
64
-            array('Prefix', 'INPUT', array('name' => 'prefix', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', 'Please Enter prefix number'),
65
-            array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
62
+			array('IP', 'INPUT', array('name' => 'ip', 'size' => '20', 'class' => "text field medium"), 'trim|required|valid_ip', 'tOOL TIP', 'Please Enter proper ip'),
63
+			/****************************************************************************************************/
64
+			array('Prefix', 'INPUT', array('name' => 'prefix', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', 'Please Enter prefix number'),
65
+			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
66 66
             
67
-        );
68
-        $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
69
-        $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
70
-        return $form;
71
-    }
67
+		);
68
+		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
69
+		$form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
70
+		return $form;
71
+	}
72 72
 
73
-    function get_ipmap_search_form($account_data = '') {
74
-        $accountinfo=$this->CI->session->userdata('accountinfo');
75
-        $reseller_id=$accountinfo['type']==1 ? $accountinfo['id']:0;
76
-    /*********************
73
+	function get_ipmap_search_form($account_data = '') {
74
+		$accountinfo=$this->CI->session->userdata('accountinfo');
75
+		$reseller_id=$accountinfo['type']==1 ? $accountinfo['id']:0;
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"));
84
-        }
85
-        /***************************************************************************************/
86
-        $form['forms'] = array("", array('id' => "ipmap_search"));
87
-        $form['Search'] = array(      
88
-             $account,
89
-             array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''),
90
-             array('IP', 'INPUT', array('name' => 'ip[ip]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'ip[ip-string]', '', '', '', 'search_string_type', ''),    
91
-             array('Prefix', 'INPUT', array('name' => 'prefix[prefix]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'prefix[prefix-string]', '', '', '', 'search_string_type', ''),
92
-             /*********************
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
+		}
85
+		/***************************************************************************************/
86
+		$form['forms'] = array("", array('id' => "ipmap_search"));
87
+		$form['Search'] = array(      
88
+			 $account,
89
+			 array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''),
90
+			 array('IP', 'INPUT', array('name' => 'ip[ip]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'ip[ip-string]', '', '', '', 'search_string_type', ''),    
91
+			 array('Prefix', 'INPUT', array('name' => 'prefix[prefix]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'prefix[prefix-string]', '', '', '', 'search_string_type', ''),
92
+			 /*********************
93 93
      	    ASTPP  3.0 
94 94
    	    in customer login show ipmap (ACL) module
95 95
    	    *****************************************/
96 96
             
97
-              array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'),
98
-               /***************************************************************************************/
99
-	     array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
100
-             array('', 'HIDDEN', 'advance_search', '1', '', '', '')
101
-        );
102
-        $form['button_search'] = array('name' => 'action', 'id' => "ipmap_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
103
-       $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");
97
+			  array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'),
98
+			   /***************************************************************************************/
99
+		 array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
100
+			 array('', 'HIDDEN', 'advance_search', '1', '', '', '')
101
+		);
102
+		$form['button_search'] = array('name' => 'action', 'id' => "ipmap_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
103
+	   $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");
104 104
 
105
-        return $form;
106
-    }
105
+		return $form;
106
+	}
107 107
 
108
-    /*******
108
+	/*******
109 109
     ASTPP  3.0 
110 110
     in customer Add/Edit show Ipmap (ACL) module.
111 111
     *******/
112
-    function build_ipmap_list_for_admin($account_data = '') {
113
-            if($account_data == '0'){
114
-            $grid_field_arr = json_encode(array(
115
-            array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
112
+	function build_ipmap_list_for_admin($account_data = '') {
113
+			if($account_data == '0'){
114
+			$grid_field_arr = json_encode(array(
115
+			array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
116 116
 			array("Name", "100", "name", "", "", ""),
117
-            array("IP", "240", "ip", "", "", ""),
118
-            array("Prefix", "240", "prefix", "", "", ""),
119
-             /*
117
+			array("IP", "240", "ip", "", "", ""),
118
+			array("Prefix", "240", "prefix", "", "", ""),
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"),
123
-            array("Created Date", "150", "creation_date", "creation_date", "creation_date", "convert_GMT_to"),
124
-            array("Modified Date Date", "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to"),
122
+			array("Status", "180", "status", "status", "ip_map", "get_status","","true","center"),
123
+			array("Created Date", "150", "creation_date", "creation_date", "creation_date", "convert_GMT_to"),
124
+			array("Modified Date Date", "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to"),
125 125
             
126
-            /********************************************************************/
127
-            array("Action", "205", "", "", "", array("EDIT" => array("url" => "ipmap/ipmap_edit/", "mode" => "popup", 'popup'),
128
-                    "DELETE" => array("url" => "ipmap/ipmap_delete/", "mode" => "single")))
129
-                ));
130
-            }else{
131
-           $grid_field_arr = json_encode(array(
132
-           array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "","","","false","center"),
126
+			/********************************************************************/
127
+			array("Action", "205", "", "", "", array("EDIT" => array("url" => "ipmap/ipmap_edit/", "mode" => "popup", 'popup'),
128
+					"DELETE" => array("url" => "ipmap/ipmap_delete/", "mode" => "single")))
129
+				));
130
+			}else{
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 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
-            /*
134
+		   array("Name", "190", "name", "", "", "","","true","center"),
135
+		   array("IP", "170", "ip", "", "", "","","true","center"),
136
+		   array("Prefix", "100", "prefix", "", "", "","","true","center"),
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"),
143
-            /********************************************************************/
144
-           array("Action", "100", "", "", "", array("EDIT" => array("url" => "ipmap/ipmap_edit/", "mode" => "popup", 'popup'),
145
-                    "DELETE" => array("url" => "ipmap/ipmap_delete/", "mode" => "single")))
146
-                ));
147
-            }    
148
-        return $grid_field_arr;
149
-    }
150
-    /**********************************************************************************************************/
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
+			/********************************************************************/
144
+		   array("Action", "100", "", "", "", array("EDIT" => array("url" => "ipmap/ipmap_edit/", "mode" => "popup", 'popup'),
145
+					"DELETE" => array("url" => "ipmap/ipmap_delete/", "mode" => "single")))
146
+				));
147
+			}    
148
+		return $grid_field_arr;
149
+	}
150
+	/**********************************************************************************************************/
151 151
 
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/")
155
-            ));
156
-        return $buttons_json;
157
-    }
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/")
155
+			));
156
+		return $buttons_json;
157
+	}
158 158
     
159
-    /*******
159
+	/*******
160 160
     ASTPP  3.0 
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/")
167
-            ));
168
-        return $buttons_json;
169
-    }
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
+			));
168
+		return $buttons_json;
169
+	}
170 170
    
171 171
   /**************************************************************************************************************************/ 
172 172
    
Please login to merge, or discard this 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.
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  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'))
24
-    exit('No direct script access allowed');
23
+if (!defined('BASEPATH')) {
24
+    exit('No direct script access allowed');
25
+}
25 26
 
26 27
 class Ipmap_form {
27 28
       	function __construct($library_name = '') {
@@ -42,7 +43,7 @@  discard block
 block discarded – undo
42 43
        if($account_type == '0' || $logintype == '0'){
43 44
         $account=null;
44 45
         $form['forms'] = array(base_url() . 'user/user_ipmap_save/', array('id' => 'ipmap_form', 'method' => 'POST', 'name' => 'ipmap_form'));
45
-       }else{
46
+       } else{
46 47
        $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 48
         $form['forms'] = array(base_url() . 'ipmap/ipmap_save/', array('id' => 'ipmap_form', 'method' => 'POST', 'name' => 'ipmap_form'));
48 49
        }
@@ -79,7 +80,7 @@  discard block
 block discarded – undo
79 80
    	    *****************************************/
80 81
      if($account_data =='0'){
81 82
            $account=null;
82
-        }else{
83
+        } else{
83 84
          $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 85
         }
85 86
         /***************************************************************************************/
@@ -127,7 +128,7 @@  discard block
 block discarded – undo
127 128
             array("Action", "205", "", "", "", array("EDIT" => array("url" => "ipmap/ipmap_edit/", "mode" => "popup", 'popup'),
128 129
                     "DELETE" => array("url" => "ipmap/ipmap_delete/", "mode" => "single")))
129 130
                 ));
130
-            }else{
131
+            } else{
131 132
            $grid_field_arr = json_encode(array(
132 133
            array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "","","","false","center"),
133 134
 		   array("Account", "200", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"),
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/models/ipmap_model.php 3 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -24,17 +24,17 @@  discard block
 block discarded – undo
24 24
 
25 25
 class IPMAP_model extends CI_Model {
26 26
 
27
-    function IPMAP_model() {
28
-        parent::__construct();
29
-    }
27
+	function IPMAP_model() {
28
+		parent::__construct();
29
+	}
30 30
 
31
-    function ipmap_list($flag, $start = 0, $limit = 0) {
32
-        $accountinfo = $this->session->userdata('accountinfo');
33
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
34
-            $qry = $this->db_model->getselect('id', 'accounts', array('reseller_id' => $accountinfo['id']));
35
-            $result = $qry->result_array();
36
-         	foreach ($result as $value1) {
37
-                $value[] = $value1['id'];
31
+	function ipmap_list($flag, $start = 0, $limit = 0) {
32
+		$accountinfo = $this->session->userdata('accountinfo');
33
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
34
+			$qry = $this->db_model->getselect('id', 'accounts', array('reseller_id' => $accountinfo['id']));
35
+			$result = $qry->result_array();
36
+		 	foreach ($result as $value1) {
37
+				$value[] = $value1['id'];
38 38
 		 	}
39 39
 		 	if(!empty($value)){
40 40
 		 		$this->db->where_in('accountid', $value);	
@@ -42,85 +42,85 @@  discard block
 block discarded – undo
42 42
 		 		$this->db->where_in('accountid', '0');
43 43
 		 	}
44 44
             
45
-        } else {
45
+		} else {
46 46
 
47
-            $qry = $this->db_model->getselect('id', 'accounts', array('reseller_id' => 0));
48
-            $result = $qry->result_array();
47
+			$qry = $this->db_model->getselect('id', 'accounts', array('reseller_id' => 0));
48
+			$result = $qry->result_array();
49 49
 
50
-            foreach ($result as $value1) {
51
-                $value[] = $value1['id'];
52
-            }
53
-            //$this->db->where_in('accountid', $value);
50
+			foreach ($result as $value1) {
51
+				$value[] = $value1['id'];
52
+			}
53
+			//$this->db->where_in('accountid', $value);
54 54
 			if(!empty($value)){
55 55
 		 		$this->db->where_in('accountid', $value);	
56 56
 		 	}else{
57 57
 		 		$this->db->where_in('accountid', '0');
58 58
 		 	}            
59
-        }
60
-         $this->db_model->build_search('ipmap_list_search');
61
-        /*******
59
+		}
60
+		 $this->db_model->build_search('ipmap_list_search');
61
+		/*******
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='';
69
-        }
70
-        /**************************************************************************************************************/
71
-        if ($flag) {
72
-           /*******
65
+		if( $accountinfo['type'] == '0'){
66
+		$where=array('accountid'=>$accountinfo['id']);
67
+		}else{
68
+		$where='';
69
+		}
70
+		/**************************************************************************************************************/
71
+		if ($flag) {
72
+		   /*******
73 73
            ASTPP  3.0 
74 74
 	   in customer login show ipmap (ACL) module
75 75
  	   *******/
76
-         $query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $limit, $start);
77
-        /*******************************************************************************************/
78
-           } else {
79
-           /*******
76
+		 $query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $limit, $start);
77
+		/*******************************************************************************************/
78
+		   } else {
79
+		   /*******
80 80
          ASTPP  3.0 
81 81
 	 in customer login show ipmap (ACL) module
82 82
  	 *******/
83
-        $query = $this->db_model->countQuery("*", "ip_map", $where);
84
-        /*************************************************************************************************************/
85
-        }
86
-          return $query;
87
-    }
83
+		$query = $this->db_model->countQuery("*", "ip_map", $where);
84
+		/*************************************************************************************************************/
85
+		}
86
+		  return $query;
87
+	}
88 88
 
89
-    function add_ipmap($add_array) {
89
+	function add_ipmap($add_array) {
90 90
 		
91
-    /*******
91
+	/*******
92 92
     ASTPP  3.0 
93 93
     in customer login show ipmap (ACL) module
94 94
     *******/
95
-    $account_data = $this->session->userdata("accountinfo");
96
-    if($account_data['type'] == '0'){
97
-    $add_array['accountid'] = $account_data['id'];
98
-     }
99
-     /*******************************************************************/
95
+	$account_data = $this->session->userdata("accountinfo");
96
+	if($account_data['type'] == '0'){
97
+	$add_array['accountid'] = $account_data['id'];
98
+	 }
99
+	 /*******************************************************************/
100 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
-    $this->db->insert("ip_map", $data);
102
-    return $this->db->insert_id();
103
-    }
101
+	$this->db->insert("ip_map", $data);
102
+	return $this->db->insert_id();
103
+	}
104 104
 
105
-    function edit_ipmap($add_array, $id) {
106
-      /*******
105
+	function edit_ipmap($add_array, $id) {
106
+	  /*******
107 107
     ASTPP  3.0 
108 108
     in customer login show ipmap (ACL) module
109 109
     *******/
110
-     $account_data = $this->session->userdata("accountinfo");
111
-       if($account_data['type'] == '0'){
112
-       $add_array['accountid'] = $account_data['id'];
113
-       }
114
-       /************************************************************************************************/
110
+	 $account_data = $this->session->userdata("accountinfo");
111
+	   if($account_data['type'] == '0'){
112
+	   $add_array['accountid'] = $account_data['id'];
113
+	   }
114
+	   /************************************************************************************************/
115 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
-        $this->db->where("id", $id);
117
-        return $this->db->update("ip_map", $data);
116
+		$this->db->where("id", $id);
117
+		return $this->db->update("ip_map", $data);
118 118
        
119
-    }
119
+	}
120 120
 
121
-    function remove_ipmap($id) {
122
-        $this->db->where("id", $id);
123
-        $this->db->delete("ip_map");
124
-       return true;
125
-    }
126
-    }
121
+	function remove_ipmap($id) {
122
+		$this->db->where("id", $id);
123
+		$this->db->delete("ip_map");
124
+	   return true;
125
+	}
126
+	}
Please login to merge, or discard this 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.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		 	}
39 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
             
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             //$this->db->where_in('accountid', $value);
54 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
         }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
  	 *******/
65 65
         if( $accountinfo['type'] == '0'){
66 66
         $where=array('accountid'=>$accountinfo['id']);
67
-        }else{
67
+        } else{
68 68
         $where='';
69 69
         }
70 70
         /**************************************************************************************************************/
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/summary/libraries/summary_form.php 3 patches
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -21,186 +21,186 @@
 block discarded – undo
21 21
 ############################################################################
22 22
 
23 23
 if (!defined('BASEPATH'))
24
-    exit('No direct script access allowed');
24
+	exit('No direct script access allowed');
25 25
 
26 26
 class Summary_form {
27
-    function __construct() {
28
-        $this->CI = & get_instance();
29
-    }
27
+	function __construct() {
28
+		$this->CI = & get_instance();
29
+	}
30 30
     
31
-    function get_providersummary_search_form() {
32
-        $form['forms'] = array('', array('id' => "providersummary_search"));
33
-        $form['Search'] = array(
31
+	function get_providersummary_search_form() {
32
+		$form['forms'] = array('', array('id' => "providersummary_search"));
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
-            array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
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 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 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
-		    array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
41
-            array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
42
-        $form['button_search'] = array('name' => 'action', 'id' => "providersummary_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
43
-        $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');
40
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
41
+			array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
42
+		$form['button_search'] = array('name' => 'action', 'id' => "providersummary_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
43
+		$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');
44 44
 
45
-        return $form;
46
-    }
47
-    function build_providersummary(){
45
+		return $form;
46
+	}
47
+	function build_providersummary(){
48 48
 		
49 49
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
50 50
 $currency_id=$account_info['currency_id'];
51 51
 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);	
52 52
 		
53
-        $new_arr=array();
53
+		$new_arr=array();
54 54
 	if($this->CI->session->userdata('advance_search')=='1'){
55 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
-                }
56
+				if(isset($search_array['time']) && !empty($search_array['time'])){
57
+				   $new_arr[]=array($search_array['time'], "151", $search_array['time']."(callstart)", "", "", "");
58
+				}
59 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
-                    }
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");    
83
-                    }
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");    
96
-                    }
97
-                }
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
+					}
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");    
83
+					}
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");    
96
+					}
97
+				}
98
+	}
99
+		if(empty($new_arr))
100
+			$new_arr[]=array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");
101
+		$fixed_arr = array(
102
+			array("Attempted Calls", "130", "attempted_calls", "", "", ""),
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",'','',''),
110
+			);
111
+		$grid_field_arr = json_encode(array_merge($new_arr,$fixed_arr));
112
+		return $grid_field_arr;
98 113
 	}
99
-        if(empty($new_arr))
100
-            $new_arr[]=array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");
101
-        $fixed_arr = array(
102
-            array("Attempted Calls", "130", "attempted_calls", "", "", ""),
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",'','',''),
110
-            );
111
-        $grid_field_arr = json_encode(array_merge($new_arr,$fixed_arr));
112
-        return $grid_field_arr;
113
-    }
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')));
116
-       return $buttons_json;
117
-    }
118
-    function get_resellersummary_search_form() {
119
-        $form['forms'] = array("",array('id' => "resellersummary_search"));
120
-        $form['Search'] = array(
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
-            array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
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')));
116
+	   return $buttons_json;
117
+	}
118
+	function get_resellersummary_search_form() {
119
+		$form['forms'] = array("",array('id' => "resellersummary_search"));
120
+		$form['Search'] = array(
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
+			array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
123 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
-            array('Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-string]', '', '', '', 'search_string_type', ''), 
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 126
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
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
-        $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');
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
+		$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
-        return $form;
131
-    }
132
-    function build_resellersummary($new_column_arr){
130
+		return $form;
131
+	}
132
+	function build_resellersummary($new_column_arr){
133 133
 		
134 134
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
135 135
 $currency_id=$account_info['currency_id'];
136 136
 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);		
137 137
 		
138 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
-            );
150
-        $grid_field_arr = json_encode(array_merge($new_column_arr,$column_arr));
151
-        return $grid_field_arr;
152
-    }
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')));
155
-        return $buttons_json;
156
-    }
157
-    function get_customersummary_search_form() {
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
+			);
150
+		$grid_field_arr = json_encode(array_merge($new_column_arr,$column_arr));
151
+		return $grid_field_arr;
152
+	}
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')));
155
+		return $buttons_json;
156
+	}
157
+	function get_customersummary_search_form() {
158 158
         
159
-        $form['forms'] = array(base_url() . 'summary/customer_search',array('id' => "customersummary_search","name"=>"customersummary_search"));
160
-        $form['Search'] = array(
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
-            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', ''),
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
-            array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
167
-            array('', 'HIDDEN', 'advance_search', '1', '', '', '')
168
-        );
169
-        $form['Group'] = array(          
170
-            array('Group By #1', 'groupby_1', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_summarycustomer_groupby'),
171
-            array('Group By #2', 'groupby_2', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_summarycustomer_groupby'),
172
-            array('Group By #3', 'groupby_3', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_summarycustomer_groupby'),
173
-        );
174
-        $form['button_search'] = array('name' => 'action', 'id' => "customersummary_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
175
-        $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');
159
+		$form['forms'] = array(base_url() . 'summary/customer_search',array('id' => "customersummary_search","name"=>"customersummary_search"));
160
+		$form['Search'] = array(
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
+			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', ''),
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
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
167
+			array('', 'HIDDEN', 'advance_search', '1', '', '', '')
168
+		);
169
+		$form['Group'] = array(          
170
+			array('Group By #1', 'groupby_1', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_summarycustomer_groupby'),
171
+			array('Group By #2', 'groupby_2', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_summarycustomer_groupby'),
172
+			array('Group By #3', 'groupby_3', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_summarycustomer_groupby'),
173
+		);
174
+		$form['button_search'] = array('name' => 'action', 'id' => "customersummary_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
175
+		$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');
176 176
 
177
-        return $form;
178
-    }
179
-    function build_customersummary($new_column_arr){
177
+		return $form;
178
+	}
179
+	function build_customersummary($new_column_arr){
180 180
 		
181 181
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
182 182
 $currency_id=$account_info['currency_id'];
183 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"),
196
-            );
197
-        $grid_field_arr = json_encode(array_merge($new_column_arr,$column_arr));
198
-        return $grid_field_arr;
199
-    }
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')));
202
-        return $buttons_json;
203
-    }
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
+			);
197
+		$grid_field_arr = json_encode(array_merge($new_column_arr,$column_arr));
198
+		return $grid_field_arr;
199
+	}
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')));
202
+		return $buttons_json;
203
+	}
204 204
 
205 205
 }
206 206
 
Please login to merge, or discard this 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.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  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'))
24
-    exit('No direct script access allowed');
23
+if (!defined('BASEPATH')) {
24
+    exit('No direct script access allowed');
25
+}
25 26
 
26 27
 class Summary_form {
27 28
     function __construct() {
@@ -96,8 +97,9 @@  discard block
 block discarded – undo
96 97
                     }
97 98
                 }
98 99
 	}
99
-        if(empty($new_arr))
100
-            $new_arr[]=array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");
100
+        if(empty($new_arr)) {
101
+                    $new_arr[]=array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string");
102
+        }
101 103
         $fixed_arr = array(
102 104
             array("Attempted Calls", "130", "attempted_calls", "", "", ""),
103 105
             array("Completed Calls", "130", "description", "", "", ""),
Please login to merge, or discard this patch.
astpp/application/modules/summary/views/view_providersummary_report.php 2 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -50,19 +50,19 @@  discard block
 block discarded – undo
50 50
                                     <select name="provider_id" class='col-md-5 form-control selectpicker' data-live-search='true'>
51 51
                                         <option value=''>--Select--</option>
52 52
                                         <?php if (!empty($accountlist)) {
53
-                                            foreach ($accountlist as $key => $value) {
54
-                                                ?>
53
+											foreach ($accountlist as $key => $value) {
54
+												?>
55 55
                                                 <optgroup label="<?php echo $key ?>">
56 56
                                                     <?php
57
-                                                    foreach ($value as $sub_key => $sub_value) {
58
-                                                        $selected = null;
59
-                                                        if (isset($session_info['provider_id']) && $session_info['provider_id'] > 0 && $sub_key == $session_info['provider_id']) {
60
-                                                            $selected = "selected";
61
-                                                        }
62
-                                                        ?>
57
+													foreach ($value as $sub_key => $sub_value) {
58
+														$selected = null;
59
+														if (isset($session_info['provider_id']) && $session_info['provider_id'] > 0 && $sub_key == $session_info['provider_id']) {
60
+															$selected = "selected";
61
+														}
62
+														?>
63 63
                                                         <option value='<?php echo $sub_key; ?>'<?php echo $selected; ?>><?php echo $sub_value ?></option>
64 64
                                                 <? }
65
-                                                ?>
65
+												?>
66 66
                                                 </optgroup>
67 67
     <? }
68 68
 }
@@ -74,16 +74,16 @@  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)) {
78
-                                            foreach ($trunklist as $key => $value) {
79
-                                                $selected = null;
80
-                                                if (isset($session_info['trunk_id']) && $session_info['trunk_id'] > 0 && $key == $session_info['trunk_id']) {
81
-                                                    $selected = "selected";
82
-                                                }
83
-                                                ?>
77
+										if (!empty($trunklist)) {
78
+											foreach ($trunklist as $key => $value) {
79
+												$selected = null;
80
+												if (isset($session_info['trunk_id']) && $session_info['trunk_id'] > 0 && $key == $session_info['trunk_id']) {
81
+													$selected = "selected";
82
+												}
83
+												?>
84 84
                                                 <option value='<?php echo $key; ?>'<?php echo $selected; ?>><?php echo $value ?></option>
85 85
                                             <? }
86
-                                        } ?>
86
+										} ?>
87 87
                                     </select>
88 88
                                 </div>
89 89
                                 <div class="col-md-4 no-padding">
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 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)) {
95
-                                            foreach ($search_string_type as $key => $value) {
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) {
98
-                                                    $selected = "selected";
99
-                                                }
100
-                                                ?>
94
+										if (!empty($search_string_type)) {
95
+											foreach ($search_string_type as $key => $value) {
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) {
98
+													$selected = "selected";
99
+												}
100
+												?>
101 101
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
102 102
                                             <?php }
103
-                                        }
104
-                                        ?>       
103
+										}
104
+										?>       
105 105
                                     </select>
106 106
                                 </div>
107 107
                                 <div class="col-md-4 no-padding">
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 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)) {
113
-                                        foreach ($search_string_type as $key => $value) {
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) {
116
-                                                $selected = "selected";
117
-                                            }
118
-                                    ?>
112
+									   if (!empty($search_string_type)) {
113
+										foreach ($search_string_type as $key => $value) {
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) {
116
+												$selected = "selected";
117
+											}
118
+									?>
119 119
                                             <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
120 120
                                     <?php }
121
-                                    }
122
-                                    ?>       
121
+									}
122
+									?>       
123 123
                                     </select>
124 124
                                 </div>
125 125
                                 <div class="col-md-4 no-padding">
@@ -137,47 +137,47 @@  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)) {
141
-                                            foreach ($groupby_time as $key => $value) {
142
-                                                $selected = null;
143
-                                                if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) {
144
-                                                    $selected = "selected";
145
-                                                }
146
-                                                ?>
140
+										if (!empty($groupby_time)) {
141
+											foreach ($groupby_time as $key => $value) {
142
+												$selected = null;
143
+												if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) {
144
+													$selected = "selected";
145
+												}
146
+												?>
147 147
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
148 148
                                             <?php }
149
-                                        }
150
-                                        ?>  
149
+										}
150
+										?>  
151 151
                                     </select>
152 152
                                  </div>
153 153
                                 <div class="col-md-3 no-padding">
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)) {
158
-                                            foreach ($groupby_field as $key => $value) {
159
-                                                $selected = null;
160
-                                                if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) {
161
-                                                    $selected = "selected";
162
-                                                }
163
-                                                ?>
157
+										if (!empty($groupby_field)) {
158
+											foreach ($groupby_field as $key => $value) {
159
+												$selected = null;
160
+												if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) {
161
+													$selected = "selected";
162
+												}
163
+												?>
164 164
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
165 165
                                             <?php }
166
-                                        }
167
-                                        ?>        
166
+										}
167
+										?>        
168 168
                                     </select>
169 169
                                 </div>
170 170
                                 <div class="col-md-3 no-padding">
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)) {
175
-                                            foreach ($groupby_field as $key => $value) {
176
-                                                $selected = null;
177
-                                                if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) {
178
-                                                    $selected = "selected";
179
-                                                }
180
-                                                ?>
174
+										if (!empty($groupby_field)) {
175
+											foreach ($groupby_field as $key => $value) {
176
+												$selected = null;
177
+												if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) {
178
+													$selected = "selected";
179
+												}
180
+												?>
181 181
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
182 182
     <?php }
183 183
 }
@@ -188,17 +188,17 @@  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)) {
192
-                                            foreach ($groupby_field as $key => $value) {
193
-                                                $selected = null;
194
-                                                if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) {
195
-                                                    $selected = "selected";
196
-                                                }
197
-                                                ?>
191
+										if (!empty($groupby_field)) {
192
+											foreach ($groupby_field as $key => $value) {
193
+												$selected = null;
194
+												if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) {
195
+													$selected = "selected";
196
+												}
197
+												?>
198 198
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
199 199
                                             <?php }
200
-                                        }
201
-                                        ?>
200
+										}
201
+										?>
202 202
                                     </select>
203 203
                                 </div>
204 204
                             </fieldset>
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
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 213
 if (!empty($search_report)) {
214
-    foreach ($search_report as $key => $value) {
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) {
217
-            //echo $key;exit;
218
-            $selected = "selected";
219
-        }
220
-        ?>
214
+	foreach ($search_report as $key => $value) {
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) {
217
+			//echo $key;exit;
218
+			$selected = "selected";
219
+		}
220
+		?>
221 221
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
222 222
     <?php }
223 223
 }
Please login to merge, or discard this 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.
astpp/application/modules/summary/views/view_customersummary_report.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -50,19 +50,19 @@  discard block
 block discarded – undo
50 50
                                     <select name="accountid" class='col-md-5 form-control selectpicker' data-live-search='true'>
51 51
                                         <option value=''>--Select--</option>
52 52
                                         <?php if (!empty($accountlist)) {
53
-                                            foreach ($accountlist as $key => $value) {
54
-                                                ?>
53
+											foreach ($accountlist as $key => $value) {
54
+												?>
55 55
                                                 <optgroup label="<?php echo $key ?>">
56 56
                                                     <?php
57
-                                                    foreach ($value as $sub_key => $sub_value) {
58
-                                                        $selected = null;
59
-                                                        if (isset($session_info['accountid']) && $session_info['accountid'] > 0 && $sub_key == $session_info['accountid']) {
60
-                                                            $selected = "selected";
61
-                                                        }
62
-                                                        ?>
57
+													foreach ($value as $sub_key => $sub_value) {
58
+														$selected = null;
59
+														if (isset($session_info['accountid']) && $session_info['accountid'] > 0 && $sub_key == $session_info['accountid']) {
60
+															$selected = "selected";
61
+														}
62
+														?>
63 63
                                                         <option value='<?php echo $sub_key; ?>'<?php echo $selected; ?>><?php echo $sub_value ?></option>
64 64
                                                 <? }
65
-                                                ?>
65
+												?>
66 66
                                                 </optgroup>
67 67
     <? }
68 68
 }
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
                                     <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 "/>
75 75
                                     <select name="pattern[pattern-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
76 76
                                         <?php
77
-                                        if (!empty($search_string_type)) {
78
-                                            foreach ($search_string_type as $key => $value) {
79
-                                                $selected = null;
80
-                                                if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) {
81
-                                                    $selected = "selected";
82
-                                                }
83
-                                                ?>
77
+										if (!empty($search_string_type)) {
78
+											foreach ($search_string_type as $key => $value) {
79
+												$selected = null;
80
+												if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) {
81
+													$selected = "selected";
82
+												}
83
+												?>
84 84
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
85 85
     <?php }
86 86
 }
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
                                     <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 "  />
93 93
                                     <select name="notes[notes-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
94 94
                                         <?php
95
-                                        if (!empty($search_string_type)) {
96
-                                            foreach ($search_string_type as $key => $value) {
97
-                                                $selected = null;
98
-                                                if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) {
99
-                                                    $selected = "selected";
100
-                                                }
101
-                                                ?>
95
+										if (!empty($search_string_type)) {
96
+											foreach ($search_string_type as $key => $value) {
97
+												$selected = null;
98
+												if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) {
99
+													$selected = "selected";
100
+												}
101
+												?>
102 102
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
103 103
     <?php }
104 104
 }
@@ -120,68 +120,68 @@  discard block
 block discarded – undo
120 120
                                     <label class="search_label col-md-12 no-padding">Group By #Time</label>
121 121
                                     <select name="time" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
122 122
                                         <?php
123
-                                        if (!empty($groupby_time)) {
124
-                                            foreach ($groupby_time as $key => $value) {
125
-                                                $selected = null;
126
-                                                if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) {
127
-                                                    $selected = "selected";
128
-                                                }
129
-                                                ?>
123
+										if (!empty($groupby_time)) {
124
+											foreach ($groupby_time as $key => $value) {
125
+												$selected = null;
126
+												if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) {
127
+													$selected = "selected";
128
+												}
129
+												?>
130 130
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
131 131
                                             <?php }
132
-                                        }
133
-                                        ?>  
132
+										}
133
+										?>  
134 134
                                     </select>
135 135
                                  </div>
136 136
                                 <div class="col-md-3 no-padding">
137 137
                                     <label class="search_label col-md-12 no-padding">Group By #1</label>
138 138
                                     <select name="groupby_1" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
139 139
                                         <?php
140
-                                        if (!empty($groupby_field)) {
141
-                                            foreach ($groupby_field as $key => $value) {
142
-                                                $selected = null;
143
-                                                if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) {
144
-                                                    $selected = "selected";
145
-                                                }
146
-                                                ?>
140
+										if (!empty($groupby_field)) {
141
+											foreach ($groupby_field as $key => $value) {
142
+												$selected = null;
143
+												if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) {
144
+													$selected = "selected";
145
+												}
146
+												?>
147 147
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
148 148
                                             <?php }
149
-                                        }
150
-                                        ?>        
149
+										}
150
+										?>        
151 151
                                     </select>
152 152
                                 </div>
153 153
                                 <div class="col-md-3 no-padding">
154 154
                                     <label class="search_label col-md-12 no-padding">Group By #2</label>
155 155
                                     <select name="groupby_2" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
156 156
                                             <?php
157
-                                            if (!empty($groupby_field)) {
158
-                                                foreach ($groupby_field as $key => $value) {
159
-                                                    $selected = null;
160
-                                                    if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) {
161
-                                                        $selected = "selected";
162
-                                                    }
163
-                                                    ?>
157
+											if (!empty($groupby_field)) {
158
+												foreach ($groupby_field as $key => $value) {
159
+													$selected = null;
160
+													if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) {
161
+														$selected = "selected";
162
+													}
163
+													?>
164 164
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
165 165
                                             <?php }
166
-                                        }
167
-                                        ?>
166
+										}
167
+										?>
168 168
                                     </select>
169 169
                                 </div>
170 170
                                  <div class="col-md-3 no-padding">
171 171
                                     <label class="search_label col-md-12 no-padding">Group By #3</label>
172 172
                                     <select name="groupby_3" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
173 173
                                             <?php
174
-                                            if (!empty($groupby_field)) {
175
-                                                foreach ($groupby_field as $key => $value) {
176
-                                                    $selected = null;
177
-                                                    if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) {
178
-                                                        $selected = "selected";
179
-                                                    }
180
-                                                    ?>
174
+											if (!empty($groupby_field)) {
175
+												foreach ($groupby_field as $key => $value) {
176
+													$selected = null;
177
+													if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) {
178
+														$selected = "selected";
179
+													}
180
+													?>
181 181
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
182 182
                                             <?php }
183
-                                        }
184
-                                        ?>
183
+										}
184
+										?>
185 185
                                     </select>
186 186
                                 </div>
187 187
                             </fieldset>
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
                                     <select name="search_in" class='col-md-5 form-control selectpicker' style='background: #ddd; width: 23% !important;' data-live-search='true'>
195 195
 <?php
196 196
 if (!empty($search_report)) {
197
-    foreach ($search_report as $key => $value) {
198
-        $selected = null;
199
-        if (isset($session_info['search_in']) && isset($session_info['search_in']) && !empty($session_info['search_in']) && $session_info['search_in'] == $key) {
200
-            //echo $key;exit;
201
-            $selected = "selected";
202
-        }
203
-        ?>
197
+	foreach ($search_report as $key => $value) {
198
+		$selected = null;
199
+		if (isset($session_info['search_in']) && isset($session_info['search_in']) && !empty($session_info['search_in']) && $session_info['search_in'] == $key) {
200
+			//echo $key;exit;
201
+			$selected = "selected";
202
+		}
203
+		?>
204 204
                                                 <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option>
205 205
     <?php }
206 206
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 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="customer_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="customer_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="customer_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="customer_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="accountid" 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 ?>">
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
                                 </div>
72 72
                                 <div class="col-md-4 no-padding">
73 73
                                     <label class="search_label col-md-12 no-padding">Code </label>
74
-                                    <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 "/>
74
+                                    <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 "/>
75 75
                                     <select name="pattern[pattern-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
76 76
                                         <?php
77
-                                        if (!empty($search_string_type)) {
77
+                                        if ( ! empty($search_string_type)) {
78 78
                                             foreach ($search_string_type as $key => $value) {
79 79
                                                 $selected = null;
80
-                                                if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) {
80
+                                                if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && ! empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) {
81 81
                                                     $selected = "selected";
82 82
                                                 }
83 83
                                                 ?>
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
                                 </div>
90 90
                                 <div class="col-md-4 no-padding">
91 91
                                     <label class="search_label col-md-12 no-padding">Destination </label>
92
-                                    <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 "  />
92
+                                    <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 "  />
93 93
                                     <select name="notes[notes-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
94 94
                                         <?php
95
-                                        if (!empty($search_string_type)) {
95
+                                        if ( ! empty($search_string_type)) {
96 96
                                             foreach ($search_string_type as $key => $value) {
97 97
                                                 $selected = null;
98
-                                                if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) {
98
+                                                if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && ! empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) {
99 99
                                                     $selected = "selected";
100 100
                                                 }
101 101
                                                 ?>
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
                                     <label class="search_label col-md-12 no-padding">Group By #Time</label>
121 121
                                     <select name="time" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
122 122
                                         <?php
123
-                                        if (!empty($groupby_time)) {
123
+                                        if ( ! empty($groupby_time)) {
124 124
                                             foreach ($groupby_time as $key => $value) {
125 125
                                                 $selected = null;
126
-                                                if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) {
126
+                                                if (isset($session_info['time']) && ! empty($session_info['time']) && $session_info['time'] == $key) {
127 127
                                                     $selected = "selected";
128 128
                                                 }
129 129
                                                 ?>
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
                                     <label class="search_label col-md-12 no-padding">Group By #1</label>
138 138
                                     <select name="groupby_1" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'>
139 139
                                         <?php
140
-                                        if (!empty($groupby_field)) {
140
+                                        if ( ! empty($groupby_field)) {
141 141
                                             foreach ($groupby_field as $key => $value) {
142 142
                                                 $selected = null;
143
-                                                if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) {
143
+                                                if (isset($session_info['groupby_1']) && ! empty($session_info['groupby_1']) && $session_info['groupby_1'] == $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 #2</label>
155 155
                                     <select name="groupby_2" 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_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) {
160
+                                                    if (isset($session_info['groupby_2']) && ! empty($session_info['groupby_2']) && $session_info['groupby_2'] == $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 #3</label>
172 172
                                     <select name="groupby_3" 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_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) {
177
+                                                    if (isset($session_info['groupby_3']) && ! empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) {
178 178
                                                         $selected = "selected";
179 179
                                                     }
180 180
                                                     ?>
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
                                     <label class="search_label col-md-6" style="font-size:17px;text-align:right;">Display records in </label>
194 194
                                     <select name="search_in" class='col-md-5 form-control selectpicker' style='background: #ddd; width: 23% !important;' data-live-search='true'>
195 195
 <?php
196
-if (!empty($search_report)) {
196
+if ( ! empty($search_report)) {
197 197
     foreach ($search_report as $key => $value) {
198 198
         $selected = null;
199
-        if (isset($session_info['search_in']) && isset($session_info['search_in']) && !empty($session_info['search_in']) && $session_info['search_in'] == $key) {
199
+        if (isset($session_info['search_in']) && isset($session_info['search_in']) && ! empty($session_info['search_in']) && $session_info['search_in'] == $key) {
200 200
             //echo $key;exit;
201 201
             $selected = "selected";
202 202
         }
Please login to merge, or discard this patch.