@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | ############################################################################### |
23 | 23 | class Invoices_model extends CI_Model { |
24 | 24 | |
25 | - function Invoices_model() { |
|
26 | - parent::__construct(); |
|
27 | - } |
|
28 | - function get_invoice_list($flag, $start = 100, $limit = 100) { |
|
25 | + function Invoices_model() { |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | + function get_invoice_list($flag, $start = 100, $limit = 100) { |
|
29 | 29 | $where = array(); |
30 | 30 | |
31 | 31 | $accountinfo = $this->session->userdata('accountinfo'); |
@@ -44,96 +44,96 @@ discard block |
||
44 | 44 | if($result->num_rows() >0){ |
45 | 45 | $acc_arr=array(); |
46 | 46 | $result=$result->result_array(); |
47 | - foreach($result as $data){ |
|
48 | - $acc_arr[]=$data['id']; |
|
49 | - } |
|
50 | - $this->db->where_in('accountid',$acc_arr); |
|
51 | - if($flag){ |
|
52 | - $this->db->select('*'); |
|
53 | - } |
|
54 | - else{ |
|
55 | - $this->db->select('count(id) as count'); |
|
56 | - } |
|
57 | - if($flag){ |
|
58 | - $this->db->where('deleted',0); |
|
59 | - $this->db->order_by('invoice_date','desc'); |
|
60 | - $this->db->limit($limit, $start); |
|
61 | - } |
|
62 | - $result=$this->db->get('invoices'); |
|
63 | - //echo $this->db->last_query();exit; |
|
64 | - if($flag){ |
|
65 | - return $result; |
|
66 | - }else{ |
|
67 | - $result=$result->result_array(); |
|
68 | - return $result[0]['count']; |
|
69 | - } |
|
47 | + foreach($result as $data){ |
|
48 | + $acc_arr[]=$data['id']; |
|
49 | + } |
|
50 | + $this->db->where_in('accountid',$acc_arr); |
|
51 | + if($flag){ |
|
52 | + $this->db->select('*'); |
|
53 | + } |
|
54 | + else{ |
|
55 | + $this->db->select('count(id) as count'); |
|
56 | + } |
|
57 | + if($flag){ |
|
58 | + $this->db->where('deleted',0); |
|
59 | + $this->db->order_by('invoice_date','desc'); |
|
60 | + $this->db->limit($limit, $start); |
|
61 | + } |
|
62 | + $result=$this->db->get('invoices'); |
|
63 | + //echo $this->db->last_query();exit; |
|
64 | + if($flag){ |
|
65 | + return $result; |
|
66 | + }else{ |
|
67 | + $result=$result->result_array(); |
|
68 | + return $result[0]['count']; |
|
69 | + } |
|
70 | 70 | }else{ |
71 | - if($flag){ |
|
72 | - $query=(object)array('num_rows'=>0); |
|
71 | + if($flag){ |
|
72 | + $query=(object)array('num_rows'=>0); |
|
73 | 73 | } |
74 | 74 | else{ |
75 | - $query=0; |
|
75 | + $query=0; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | return $query; |
79 | - } |
|
80 | - }else{ |
|
79 | + } |
|
80 | + }else{ |
|
81 | 81 | |
82 | - if($result->num_rows() >0){ |
|
82 | + if($result->num_rows() >0){ |
|
83 | 83 | /**** |
84 | 84 | Invoice manually |
85 | 85 | **/ |
86 | - $acc_arr=array(); |
|
87 | - $result=$result->result_array(); |
|
88 | - foreach($result as $data){ |
|
89 | - $acc_arr[]=$data['id']; |
|
90 | - } |
|
91 | - $this->db->where_in('accountid',$acc_arr); |
|
86 | + $acc_arr=array(); |
|
87 | + $result=$result->result_array(); |
|
88 | + foreach($result as $data){ |
|
89 | + $acc_arr[]=$data['id']; |
|
90 | + } |
|
91 | + $this->db->where_in('accountid',$acc_arr); |
|
92 | 92 | } |
93 | 93 | |
94 | - if($flag){ |
|
94 | + if($flag){ |
|
95 | 95 | $this->db->select('*'); |
96 | - } |
|
97 | - else{ |
|
98 | - $this->db->select('count(id) as count'); |
|
99 | - } |
|
100 | - if($flag){ |
|
96 | + } |
|
97 | + else{ |
|
98 | + $this->db->select('count(id) as count'); |
|
99 | + } |
|
100 | + if($flag){ |
|
101 | 101 | $this->db->order_by('invoice_date','desc'); |
102 | 102 | $this->db->limit($limit, $start); |
103 | - } |
|
104 | - $result=$this->db->get('invoices'); |
|
103 | + } |
|
104 | + $result=$this->db->get('invoices'); |
|
105 | 105 | // echo $this->db->last_query();exit; |
106 | - if($result->num_rows() > 0){ |
|
107 | - if($flag){ |
|
106 | + if($result->num_rows() > 0){ |
|
107 | + if($flag){ |
|
108 | 108 | |
109 | 109 | return $result; |
110 | - }else{ |
|
110 | + }else{ |
|
111 | 111 | $result=$result->result_array(); |
112 | 112 | |
113 | 113 | return $result[0]['count']; |
114 | - } |
|
115 | - }else{ |
|
116 | - if($flag){ |
|
114 | + } |
|
115 | + }else{ |
|
116 | + if($flag){ |
|
117 | 117 | |
118 | 118 | $query=(object)array('num_rows'=>0); |
119 | 119 | // echo '<pre>'; print_r($query); |
120 | - } |
|
121 | - else{ |
|
120 | + } |
|
121 | + else{ |
|
122 | 122 | $query=0; |
123 | - } |
|
123 | + } |
|
124 | 124 | return $query; |
125 | 125 | } |
126 | - } |
|
126 | + } |
|
127 | 127 | } |
128 | 128 | |
129 | - function getCdrs_invoice($invoiceid) |
|
129 | + function getCdrs_invoice($invoiceid) |
|
130 | 130 | { |
131 | 131 | $this->db->where('invoiceid', $invoiceid); |
132 | 132 | $this->db->from('cdrs'); |
133 | 133 | $query = $this->db->get(); |
134 | 134 | return $query; |
135 | - } |
|
136 | - function get_account_including_closed($accountdata) |
|
135 | + } |
|
136 | + function get_account_including_closed($accountdata) |
|
137 | 137 | { |
138 | 138 | $q = "SELECT * FROM accounts WHERE number = '".$this->db->escape_str($accountdata)."'"; |
139 | 139 | $query = $this->db->query($q); |
@@ -151,61 +151,61 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | return NULL; |
154 | - } |
|
155 | - function get_user_invoice_list($flag, $start = 0, $limit = 0){ |
|
154 | + } |
|
155 | + function get_user_invoice_list($flag, $start = 0, $limit = 0){ |
|
156 | 156 | $this->db_model->build_search('invoice_list_search'); |
157 | 157 | $accountinfo=$this->session->userdata('accountinfo'); |
158 | 158 | /**** |
159 | 159 | Invoice manually |
160 | 160 | **/ |
161 | - $where = array("accountid" => $accountinfo['id'],'confirm'=>1); |
|
162 | - if ($flag) { |
|
163 | - $query = $this->db_model->select("*", "invoices", $where, "invoice_date", "desc", $limit, $start); |
|
161 | + $where = array("accountid" => $accountinfo['id'],'confirm'=>1); |
|
162 | + if ($flag) { |
|
163 | + $query = $this->db_model->select("*", "invoices", $where, "invoice_date", "desc", $limit, $start); |
|
164 | 164 | |
165 | - } else { |
|
166 | - $query = $this->db_model->countQuery("*", "invoices", $where); |
|
167 | - } |
|
165 | + } else { |
|
166 | + $query = $this->db_model->countQuery("*", "invoices", $where); |
|
167 | + } |
|
168 | 168 | // echo $this->db->last_query();exit; |
169 | - return $query; |
|
170 | - } |
|
169 | + return $query; |
|
170 | + } |
|
171 | 171 | //22_1 |
172 | 172 | function getinvoiceconf_list($flag, $start = 0, $limit = 0) { |
173 | 173 | $where = array(); |
174 | 174 | $logintype = $this->session->userdata('logintype'); |
175 | 175 | |
176 | - if ($logintype == 1 || $logintype == 5) { |
|
176 | + if ($logintype == 1 || $logintype == 5) { |
|
177 | 177 | |
178 | 178 | $where = array("accountid" => $this->session->userdata["accountinfo"]['id']); |
179 | - } |
|
179 | + } |
|
180 | 180 | |
181 | 181 | |
182 | - if ($flag) { |
|
183 | - $query = $this->db_model->select("*", "invoice_conf", $where, "id", "ASC", $limit, $start); |
|
184 | - } else { |
|
185 | - $query = $this->db_model->countQuery("*", "invoice_conf", $where); |
|
186 | - } |
|
182 | + if ($flag) { |
|
183 | + $query = $this->db_model->select("*", "invoice_conf", $where, "id", "ASC", $limit, $start); |
|
184 | + } else { |
|
185 | + $query = $this->db_model->countQuery("*", "invoice_conf", $where); |
|
186 | + } |
|
187 | 187 | //echo $this->db->last_query(); |
188 | - return $query; |
|
189 | - } |
|
190 | - function get_invoiceconf($accountid) { |
|
191 | - $return_array=array(); |
|
188 | + return $query; |
|
189 | + } |
|
190 | + function get_invoiceconf($accountid) { |
|
191 | + $return_array=array(); |
|
192 | 192 | $logintype = $this->session->userdata('logintype'); |
193 | - if ($logintype == 1 || $logintype == 5) { |
|
193 | + if ($logintype == 1 || $logintype == 5) { |
|
194 | 194 | |
195 | 195 | $where = array("accountid" => $this->session->userdata["accountinfo"]['id']); |
196 | - }else{ |
|
197 | - $where=array('id'=> $accountid); |
|
196 | + }else{ |
|
197 | + $where=array('id'=> $accountid); |
|
198 | 198 | } |
199 | - $query = $this->db_model->getSelect("*","invoice_conf",$where); |
|
200 | - foreach($query->result_array() as $key => $value) |
|
201 | - { |
|
202 | - $return_array=$value; |
|
203 | - } |
|
204 | - return $return_array; |
|
205 | - } |
|
199 | + $query = $this->db_model->getSelect("*","invoice_conf",$where); |
|
200 | + foreach($query->result_array() as $key => $value) |
|
201 | + { |
|
202 | + $return_array=$value; |
|
203 | + } |
|
204 | + return $return_array; |
|
205 | + } |
|
206 | 206 | |
207 | 207 | |
208 | - function save_invoiceconf($post_array){ |
|
208 | + function save_invoiceconf($post_array){ |
|
209 | 209 | $where_arr=array('id'=>$post_array['id']); |
210 | 210 | unset($post_array['action']); |
211 | 211 | if($post_array['id'] != "" ){ |
@@ -22,361 +22,361 @@ |
||
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 |
@@ -22,184 +22,184 @@ |
||
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 |
@@ -22,200 +22,200 @@ |
||
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 | } |
@@ -24,200 +24,200 @@ |
||
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"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="'. base_url() .'user/user_ipmap_delete/' . $value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <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"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="'. base_url() .'user/user_ipmap_delete/' . $value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <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"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="'. base_url() .'ipmap/ipmap_delete/' . $value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <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"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="'. base_url() .'ipmap/ipmap_delete/' . $value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <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 |
@@ -21,152 +21,152 @@ |
||
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 |
@@ -24,17 +24,17 @@ discard block |
||
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 |
||
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 | + } |
@@ -24,569 +24,569 @@ |
||
24 | 24 | |
25 | 25 | class Summary extends MX_Controller { |
26 | 26 | |
27 | - function Summary() { |
|
28 | - parent::__construct(); |
|
27 | + function Summary() { |
|
28 | + parent::__construct(); |
|
29 | 29 | |
30 | - $this->load->helper('template_inheritance'); |
|
30 | + $this->load->helper('template_inheritance'); |
|
31 | 31 | |
32 | - $this->load->library('session'); |
|
33 | - $this->load->library('astpp/form'); |
|
34 | - $this->load->library("summary_form"); |
|
35 | - $this->load->model('summary_model'); |
|
36 | - $this->load->library('fpdf'); |
|
37 | - $this->load->library('pdf'); |
|
38 | - $this->fpdf = new PDF('P', 'pt'); |
|
39 | - $this->fpdf->initialize('P', 'mm', 'A4'); |
|
32 | + $this->load->library('session'); |
|
33 | + $this->load->library('astpp/form'); |
|
34 | + $this->load->library("summary_form"); |
|
35 | + $this->load->model('summary_model'); |
|
36 | + $this->load->library('fpdf'); |
|
37 | + $this->load->library('pdf'); |
|
38 | + $this->fpdf = new PDF('P', 'pt'); |
|
39 | + $this->fpdf->initialize('P', 'mm', 'A4'); |
|
40 | 40 | |
41 | - if ($this->session->userdata('user_login') == FALSE) |
|
42 | - redirect(base_url() . '/astpp/login'); |
|
43 | - } |
|
44 | - function customer() { |
|
45 | - $data['page_title'] = 'Customer Summary Report'; |
|
46 | - $data['search_flag'] = true; |
|
47 | - $session_info = $this->session->userdata('customersummary_reports_search'); |
|
48 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
49 | - $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
50 | - $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array('reseller_id' => $reseller_id, "type" => "GLOBAL")); |
|
51 | - $data['accountlist'] = $accountlist; |
|
52 | - $data['session_info'] = $session_info; |
|
53 | - $data['search_string_type'] = $this->common->search_string_type(); |
|
54 | - $data['search_report'] = $this->common->search_report_in(); |
|
55 | - $new_column_arr = $this->summary_column_arr('customer'); |
|
56 | - $data['grid_fields'] = $this->summary_form->build_customersummary($new_column_arr); |
|
57 | - $data["grid_buttons"] = $this->summary_form->build_grid_buttons_customersummary(); |
|
58 | - $data['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
59 | - $data['groupby_time'] = $this->common->group_by_time(); |
|
60 | - $this->load->view('view_customersummary_report', $data); |
|
61 | - } |
|
41 | + if ($this->session->userdata('user_login') == FALSE) |
|
42 | + redirect(base_url() . '/astpp/login'); |
|
43 | + } |
|
44 | + function customer() { |
|
45 | + $data['page_title'] = 'Customer Summary Report'; |
|
46 | + $data['search_flag'] = true; |
|
47 | + $session_info = $this->session->userdata('customersummary_reports_search'); |
|
48 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
49 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
50 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array('reseller_id' => $reseller_id, "type" => "GLOBAL")); |
|
51 | + $data['accountlist'] = $accountlist; |
|
52 | + $data['session_info'] = $session_info; |
|
53 | + $data['search_string_type'] = $this->common->search_string_type(); |
|
54 | + $data['search_report'] = $this->common->search_report_in(); |
|
55 | + $new_column_arr = $this->summary_column_arr('customer'); |
|
56 | + $data['grid_fields'] = $this->summary_form->build_customersummary($new_column_arr); |
|
57 | + $data["grid_buttons"] = $this->summary_form->build_grid_buttons_customersummary(); |
|
58 | + $data['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
59 | + $data['groupby_time'] = $this->common->group_by_time(); |
|
60 | + $this->load->view('view_customersummary_report', $data); |
|
61 | + } |
|
62 | 62 | |
63 | - function customer_json() { |
|
64 | - $search_arr = $this->summary_search_info('customer'); |
|
65 | - $count_all = $this->summary_model->get_customersummary_report_list(false, 0, 0, $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'],false); |
|
66 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
67 | - $json_data = $paging_data["json_paging"]; |
|
68 | - $query = $this->summary_model->get_customersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], false); |
|
69 | - if ($query->num_rows() > 0) { |
|
70 | - $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'customer', 'grid'); |
|
71 | - } |
|
72 | - $this->session->set_userdata('customersummary_reports_export', $search_arr); |
|
73 | - echo json_encode($json_data); |
|
74 | - } |
|
63 | + function customer_json() { |
|
64 | + $search_arr = $this->summary_search_info('customer'); |
|
65 | + $count_all = $this->summary_model->get_customersummary_report_list(false, 0, 0, $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'],false); |
|
66 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
67 | + $json_data = $paging_data["json_paging"]; |
|
68 | + $query = $this->summary_model->get_customersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], false); |
|
69 | + if ($query->num_rows() > 0) { |
|
70 | + $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'customer', 'grid'); |
|
71 | + } |
|
72 | + $this->session->set_userdata('customersummary_reports_export', $search_arr); |
|
73 | + echo json_encode($json_data); |
|
74 | + } |
|
75 | 75 | |
76 | - function summary_column_arr($entity) { |
|
77 | - $new_column_arr = array(); |
|
78 | - $total_width = '322'; |
|
79 | - $column_name = 'accountid'; |
|
80 | - if ($this->session->userdata('advance_search') == '1') { |
|
81 | - $search_array = $this->session->userdata($entity . 'summary_reports_search'); |
|
82 | - if(isset($search_array['time']) && !empty($search_array['time'])){ |
|
83 | - $new_column_arr[]=array(ucfirst(strtolower($search_array['time'])), "58", $search_array['time']."(callstart)", "", "", ""); |
|
84 | - } |
|
85 | - if (isset($search_array['groupby_1']) && !empty($search_array['groupby_1'])) { |
|
86 | - $first_column_groupby = $search_array['groupby_1']; |
|
76 | + function summary_column_arr($entity) { |
|
77 | + $new_column_arr = array(); |
|
78 | + $total_width = '322'; |
|
79 | + $column_name = 'accountid'; |
|
80 | + if ($this->session->userdata('advance_search') == '1') { |
|
81 | + $search_array = $this->session->userdata($entity . 'summary_reports_search'); |
|
82 | + if(isset($search_array['time']) && !empty($search_array['time'])){ |
|
83 | + $new_column_arr[]=array(ucfirst(strtolower($search_array['time'])), "58", $search_array['time']."(callstart)", "", "", ""); |
|
84 | + } |
|
85 | + if (isset($search_array['groupby_1']) && !empty($search_array['groupby_1'])) { |
|
86 | + $first_column_groupby = $search_array['groupby_1']; |
|
87 | 87 | |
88 | - if ($first_column_groupby == 'accountid') { |
|
89 | - $new_column_arr[] = array("Account", "105",'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
90 | - } elseif ($first_column_groupby == 'pattern') { |
|
91 | - $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
92 | - $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
93 | - } elseif($first_column_groupby =='package_id'){ |
|
94 | - $new_column_arr[] = array("Package", "105",'package_id', "package_name", "packages", "get_field_name"); |
|
95 | - } |
|
96 | - } |
|
97 | - if (isset($search_array['groupby_2']) && !empty($search_array['groupby_2'])) { |
|
98 | - $third_column_groupby = $search_array['groupby_2']; |
|
99 | - if ($third_column_groupby == 'accountid') { |
|
100 | - $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
101 | - } elseif ($third_column_groupby == 'pattern') { |
|
102 | - $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
103 | - $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
104 | - } elseif($third_column_groupby =='package_id'){ |
|
105 | - $new_column_arr[] = array("Package", "105",'package_id', "package_name", "packages", "get_field_name"); |
|
106 | - } |
|
107 | - } |
|
108 | - if (isset($search_array['groupby_3']) && !empty($search_array['groupby_3'])) { |
|
109 | - $fifth_column_groupby = $search_array['groupby_3']; |
|
110 | - if ($fifth_column_groupby == 'accountid') { |
|
111 | - $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
112 | - } elseif ($fifth_column_groupby == 'pattern') { |
|
113 | - $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
114 | - $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
115 | - } elseif($fifth_column_groupby =='package_id'){ |
|
116 | - $new_column_arr[] = array("Package", "105",'package_id', "package_name", "packages", "get_field_name"); |
|
117 | - } |
|
118 | - } |
|
119 | - if (empty($new_column_arr)) { |
|
120 | - $new_column_arr[] = array("Account", '322', 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
121 | - } |
|
122 | - } else { |
|
123 | - $new_column_arr[] = array("Account", '322', 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
124 | - } |
|
88 | + if ($first_column_groupby == 'accountid') { |
|
89 | + $new_column_arr[] = array("Account", "105",'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
90 | + } elseif ($first_column_groupby == 'pattern') { |
|
91 | + $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
92 | + $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
93 | + } elseif($first_column_groupby =='package_id'){ |
|
94 | + $new_column_arr[] = array("Package", "105",'package_id', "package_name", "packages", "get_field_name"); |
|
95 | + } |
|
96 | + } |
|
97 | + if (isset($search_array['groupby_2']) && !empty($search_array['groupby_2'])) { |
|
98 | + $third_column_groupby = $search_array['groupby_2']; |
|
99 | + if ($third_column_groupby == 'accountid') { |
|
100 | + $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
101 | + } elseif ($third_column_groupby == 'pattern') { |
|
102 | + $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
103 | + $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
104 | + } elseif($third_column_groupby =='package_id'){ |
|
105 | + $new_column_arr[] = array("Package", "105",'package_id', "package_name", "packages", "get_field_name"); |
|
106 | + } |
|
107 | + } |
|
108 | + if (isset($search_array['groupby_3']) && !empty($search_array['groupby_3'])) { |
|
109 | + $fifth_column_groupby = $search_array['groupby_3']; |
|
110 | + if ($fifth_column_groupby == 'accountid') { |
|
111 | + $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
112 | + } elseif ($fifth_column_groupby == 'pattern') { |
|
113 | + $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
114 | + $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
115 | + } elseif($fifth_column_groupby =='package_id'){ |
|
116 | + $new_column_arr[] = array("Package", "105",'package_id', "package_name", "packages", "get_field_name"); |
|
117 | + } |
|
118 | + } |
|
119 | + if (empty($new_column_arr)) { |
|
120 | + $new_column_arr[] = array("Account", '322', 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
121 | + } |
|
122 | + } else { |
|
123 | + $new_column_arr[] = array("Account", '322', 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
124 | + } |
|
125 | 125 | |
126 | - return $new_column_arr; |
|
127 | - } |
|
126 | + return $new_column_arr; |
|
127 | + } |
|
128 | 128 | |
129 | - function summary_report_grid($search_arr, $query, $entity, $purpose) { |
|
130 | - $export_arr = array(); |
|
131 | - $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
|
132 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
133 | - $currency_info =$this->common->get_currency_info(); |
|
134 | - foreach ($query->result_array() as $row1) { |
|
135 | - $atmpt = $row1['attempts']; |
|
136 | - $cmplt = ($row1['completed'] != 0) ? $row1['completed'] : 0; |
|
137 | - $acd = ($row1['completed'] > 0 ) ? round($row1['billable'] / $row1['completed']) : 0; |
|
138 | - $mcd = $row1['mcd']; |
|
139 | - if ($show_seconds == 'minutes') { |
|
140 | - $avgsec = $acd > 0 ? sprintf('%02d',$acd / 60) . ":" . sprintf('%02d',($acd % 60)) : "00:00"; |
|
141 | - $maxsec = $mcd > 0 ? sprintf('%02d',$mcd / 60) . ":" . sprintf('%02d',($mcd % 60)) : "00:00"; |
|
142 | - $duration = ($row1['duration'] > 0 ) ? sprintf('%02d',$row1['duration'] / 60) . ":" . sprintf('%02d',($row1['duration'] % 60)) : "00:00"; |
|
143 | - $billsec = ($row1['billable'] > 0 ) ? sprintf('%02d',$row1['billable'] / 60) . ":" . sprintf('%02d',($row1['billable'] % 60)) : "00:00"; |
|
144 | - } else { |
|
145 | - $duration = sprintf('%02d',$row1['duration']); |
|
146 | - $avgsec = $acd; |
|
147 | - $maxsec = $mcd; |
|
148 | - $billsec = sprintf('%02d',$row1['billable']); |
|
149 | - } |
|
150 | - if ($entity != 'provider') { |
|
151 | - $profit = $this->common->calculate_currency_manually($currency_info,$row1['debit'] - $row1['cost'],false); |
|
152 | - $debit = $this->common->calculate_currency_manually($currency_info,$row1['debit'],false); |
|
153 | - } |
|
154 | - $cost = $this->common->calculate_currency_manually($currency_info,$row1['cost'],false); |
|
155 | - $asr = ($atmpt > 0 ) ? (round(($cmplt / $atmpt) * 100,2)) : '0.00' ; |
|
156 | - $new_arr = array(); |
|
157 | - if ($this->session->userdata('advance_search') == 1) { |
|
158 | - if (!empty($search_arr['groupby_time'])) { |
|
159 | - $time =$row1[$search_arr['groupby_time']]; |
|
160 | - if($search_arr['groupby_time']== "HOUR"|| $search_arr['groupby_time']== "DAY"){ |
|
129 | + function summary_report_grid($search_arr, $query, $entity, $purpose) { |
|
130 | + $export_arr = array(); |
|
131 | + $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
|
132 | + $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
133 | + $currency_info =$this->common->get_currency_info(); |
|
134 | + foreach ($query->result_array() as $row1) { |
|
135 | + $atmpt = $row1['attempts']; |
|
136 | + $cmplt = ($row1['completed'] != 0) ? $row1['completed'] : 0; |
|
137 | + $acd = ($row1['completed'] > 0 ) ? round($row1['billable'] / $row1['completed']) : 0; |
|
138 | + $mcd = $row1['mcd']; |
|
139 | + if ($show_seconds == 'minutes') { |
|
140 | + $avgsec = $acd > 0 ? sprintf('%02d',$acd / 60) . ":" . sprintf('%02d',($acd % 60)) : "00:00"; |
|
141 | + $maxsec = $mcd > 0 ? sprintf('%02d',$mcd / 60) . ":" . sprintf('%02d',($mcd % 60)) : "00:00"; |
|
142 | + $duration = ($row1['duration'] > 0 ) ? sprintf('%02d',$row1['duration'] / 60) . ":" . sprintf('%02d',($row1['duration'] % 60)) : "00:00"; |
|
143 | + $billsec = ($row1['billable'] > 0 ) ? sprintf('%02d',$row1['billable'] / 60) . ":" . sprintf('%02d',($row1['billable'] % 60)) : "00:00"; |
|
144 | + } else { |
|
145 | + $duration = sprintf('%02d',$row1['duration']); |
|
146 | + $avgsec = $acd; |
|
147 | + $maxsec = $mcd; |
|
148 | + $billsec = sprintf('%02d',$row1['billable']); |
|
149 | + } |
|
150 | + if ($entity != 'provider') { |
|
151 | + $profit = $this->common->calculate_currency_manually($currency_info,$row1['debit'] - $row1['cost'],false); |
|
152 | + $debit = $this->common->calculate_currency_manually($currency_info,$row1['debit'],false); |
|
153 | + } |
|
154 | + $cost = $this->common->calculate_currency_manually($currency_info,$row1['cost'],false); |
|
155 | + $asr = ($atmpt > 0 ) ? (round(($cmplt / $atmpt) * 100,2)) : '0.00' ; |
|
156 | + $new_arr = array(); |
|
157 | + if ($this->session->userdata('advance_search') == 1) { |
|
158 | + if (!empty($search_arr['groupby_time'])) { |
|
159 | + $time =$row1[$search_arr['groupby_time']]; |
|
160 | + if($search_arr['groupby_time']== "HOUR"|| $search_arr['groupby_time']== "DAY"){ |
|
161 | 161 | $time=sprintf('%02d',$time); |
162 | - } |
|
163 | - if($search_arr['groupby_time']== "MONTH"){ |
|
162 | + } |
|
163 | + if($search_arr['groupby_time']== "MONTH"){ |
|
164 | 164 | $dateObj = DateTime::createFromFormat('!m',$time); |
165 | 165 | $time= $dateObj->format('F'); |
166 | - } |
|
167 | - $new_arr[] = $time; |
|
168 | - } |
|
169 | - if ($search_arr['groupby_1'] == $db_field_name) { |
|
170 | - $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
171 | - } elseif ($search_arr['groupby_1'] == 'pattern') { |
|
172 | - $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
173 | - $new_arr[] = $row1['notes']; |
|
174 | - } elseif ($search_arr['groupby_1'] == 'trunk_id') { |
|
175 | - $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
176 | - } elseif($search_arr['groupby_1'] == 'package_id'){ |
|
177 | - $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
178 | - } |
|
166 | + } |
|
167 | + $new_arr[] = $time; |
|
168 | + } |
|
169 | + if ($search_arr['groupby_1'] == $db_field_name) { |
|
170 | + $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
171 | + } elseif ($search_arr['groupby_1'] == 'pattern') { |
|
172 | + $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
173 | + $new_arr[] = $row1['notes']; |
|
174 | + } elseif ($search_arr['groupby_1'] == 'trunk_id') { |
|
175 | + $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
176 | + } elseif($search_arr['groupby_1'] == 'package_id'){ |
|
177 | + $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
178 | + } |
|
179 | 179 | |
180 | - if ($search_arr['groupby_2'] == $db_field_name) { |
|
181 | - $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
182 | - } elseif ($search_arr['groupby_2'] == 'pattern') { |
|
183 | - $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
184 | - $new_arr[] = $row1['notes']; |
|
185 | - } elseif ($search_arr['groupby_2'] == 'trunk_id') { |
|
186 | - $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
187 | - } elseif($search_arr['groupby_2'] == 'package_id'){ |
|
188 | - $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
189 | - } |
|
180 | + if ($search_arr['groupby_2'] == $db_field_name) { |
|
181 | + $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
182 | + } elseif ($search_arr['groupby_2'] == 'pattern') { |
|
183 | + $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
184 | + $new_arr[] = $row1['notes']; |
|
185 | + } elseif ($search_arr['groupby_2'] == 'trunk_id') { |
|
186 | + $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
187 | + } elseif($search_arr['groupby_2'] == 'package_id'){ |
|
188 | + $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
189 | + } |
|
190 | 190 | |
191 | - if ($search_arr['groupby_3'] == $db_field_name) { |
|
192 | - $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
193 | - } elseif ($search_arr['groupby_3'] == 'pattern') { |
|
194 | - $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
195 | - $new_arr[] = $row1['notes']; |
|
196 | - } elseif ($search_arr['groupby_3'] == 'trunk_id') { |
|
197 | - $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
198 | - } elseif($search_arr['groupby_3'] == 'package_id'){ |
|
199 | - $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
200 | - } |
|
201 | - if (empty($new_arr)) { |
|
202 | - $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
203 | - } |
|
204 | - } else { |
|
205 | - $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
206 | - } |
|
207 | - if ($entity != 'provider') { |
|
208 | - $custom_array = array( |
|
209 | - $atmpt, |
|
210 | - $cmplt, |
|
211 | - $duration, |
|
212 | - round($asr, 2), |
|
213 | - $avgsec, |
|
214 | - $maxsec, |
|
215 | - $billsec, |
|
216 | - $debit, |
|
217 | - $cost, |
|
218 | - $profit); |
|
219 | - } else { |
|
220 | - $custom_array = array( |
|
221 | - $atmpt, |
|
222 | - $cmplt, |
|
223 | - $duration, |
|
224 | - round($asr, 2), |
|
225 | - $avgsec, |
|
226 | - $maxsec, |
|
227 | - $billsec, |
|
228 | - $cost |
|
229 | - ); |
|
230 | - } |
|
231 | - $final_array = array_merge($new_arr, $custom_array); |
|
232 | - $json_data[] = array('cell' => $final_array); |
|
233 | - $export_arr[] = $final_array; |
|
234 | - } |
|
235 | - $function_name = 'get_' . $entity . 'summary_report_list'; |
|
236 | - $total_info = $this->summary_model->$function_name(true, '', '', '', $search_arr['select_str'], $search_arr['order_str'],true); |
|
237 | - $total_info = $total_info->result_array(); |
|
238 | - $total_info = $total_info[0]; |
|
239 | - $total_asr = ($total_info['attempts'] > 0 ) ? round(($total_info['completed'] / $total_info['attempts']) * 100, 2) : 0; |
|
240 | - $total_acd = ($total_info['completed']> 0 ) ?round($total_info['billable'] / $total_info['completed']) : 0 ; |
|
241 | - if ($show_seconds == 'minutes') { |
|
242 | - $total_info['duration'] = $total_info['duration'] > 0 ? sprintf('%02d',$total_info['duration'] / 60) . ":" . sprintf('%02d',($total_info['duration'] % 60)) : "00:00"; |
|
243 | - $total_info['billable'] = $total_info['billable'] > 0 ? sprintf('%02d',$total_info['billable'] / 60) . ":" . sprintf('%02d',($total_info['billable'] % 60)) : "00:00"; |
|
244 | - $total_acd = $total_acd > 0 ? sprintf('%02d',$total_acd / 60) . ":" . sprintf('%02d',($total_acd % 60)) : "00:00"; |
|
245 | - $total_info['mcd'] = $total_info['mcd'] > 0 ? sprintf('%02d',$total_info['mcd'] / 60) . ":" . sprintf('%02d',($total_info['mcd'] % 60)) : "00:00"; |
|
246 | - } |
|
247 | - if ($entity != 'provider') { |
|
248 | - $total_profit = $this->common->calculate_currency_manually($currency_info,$total_info['debit'] - $total_info['cost'],false); |
|
249 | - $total_debit = $this->common->calculate_currency_manually($currency_info,$total_info['debit'],false); |
|
250 | - } |
|
251 | - $total_cost = $this->common->calculate_currency_manually($currency_info,$total_info['cost'],false); |
|
252 | - if ($entity != 'provider') { |
|
253 | - $last_array = array( |
|
254 | - "<b>".$total_info['attempts']."</b>", |
|
255 | - "<b>".$total_info['completed']."</b>", |
|
256 | - "<b>".$total_info['duration']."</b>", |
|
257 | - "<b>".$total_asr."</b>", |
|
191 | + if ($search_arr['groupby_3'] == $db_field_name) { |
|
192 | + $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
193 | + } elseif ($search_arr['groupby_3'] == 'pattern') { |
|
194 | + $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
195 | + $new_arr[] = $row1['notes']; |
|
196 | + } elseif ($search_arr['groupby_3'] == 'trunk_id') { |
|
197 | + $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
198 | + } elseif($search_arr['groupby_3'] == 'package_id'){ |
|
199 | + $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
200 | + } |
|
201 | + if (empty($new_arr)) { |
|
202 | + $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
203 | + } |
|
204 | + } else { |
|
205 | + $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
206 | + } |
|
207 | + if ($entity != 'provider') { |
|
208 | + $custom_array = array( |
|
209 | + $atmpt, |
|
210 | + $cmplt, |
|
211 | + $duration, |
|
212 | + round($asr, 2), |
|
213 | + $avgsec, |
|
214 | + $maxsec, |
|
215 | + $billsec, |
|
216 | + $debit, |
|
217 | + $cost, |
|
218 | + $profit); |
|
219 | + } else { |
|
220 | + $custom_array = array( |
|
221 | + $atmpt, |
|
222 | + $cmplt, |
|
223 | + $duration, |
|
224 | + round($asr, 2), |
|
225 | + $avgsec, |
|
226 | + $maxsec, |
|
227 | + $billsec, |
|
228 | + $cost |
|
229 | + ); |
|
230 | + } |
|
231 | + $final_array = array_merge($new_arr, $custom_array); |
|
232 | + $json_data[] = array('cell' => $final_array); |
|
233 | + $export_arr[] = $final_array; |
|
234 | + } |
|
235 | + $function_name = 'get_' . $entity . 'summary_report_list'; |
|
236 | + $total_info = $this->summary_model->$function_name(true, '', '', '', $search_arr['select_str'], $search_arr['order_str'],true); |
|
237 | + $total_info = $total_info->result_array(); |
|
238 | + $total_info = $total_info[0]; |
|
239 | + $total_asr = ($total_info['attempts'] > 0 ) ? round(($total_info['completed'] / $total_info['attempts']) * 100, 2) : 0; |
|
240 | + $total_acd = ($total_info['completed']> 0 ) ?round($total_info['billable'] / $total_info['completed']) : 0 ; |
|
241 | + if ($show_seconds == 'minutes') { |
|
242 | + $total_info['duration'] = $total_info['duration'] > 0 ? sprintf('%02d',$total_info['duration'] / 60) . ":" . sprintf('%02d',($total_info['duration'] % 60)) : "00:00"; |
|
243 | + $total_info['billable'] = $total_info['billable'] > 0 ? sprintf('%02d',$total_info['billable'] / 60) . ":" . sprintf('%02d',($total_info['billable'] % 60)) : "00:00"; |
|
244 | + $total_acd = $total_acd > 0 ? sprintf('%02d',$total_acd / 60) . ":" . sprintf('%02d',($total_acd % 60)) : "00:00"; |
|
245 | + $total_info['mcd'] = $total_info['mcd'] > 0 ? sprintf('%02d',$total_info['mcd'] / 60) . ":" . sprintf('%02d',($total_info['mcd'] % 60)) : "00:00"; |
|
246 | + } |
|
247 | + if ($entity != 'provider') { |
|
248 | + $total_profit = $this->common->calculate_currency_manually($currency_info,$total_info['debit'] - $total_info['cost'],false); |
|
249 | + $total_debit = $this->common->calculate_currency_manually($currency_info,$total_info['debit'],false); |
|
250 | + } |
|
251 | + $total_cost = $this->common->calculate_currency_manually($currency_info,$total_info['cost'],false); |
|
252 | + if ($entity != 'provider') { |
|
253 | + $last_array = array( |
|
254 | + "<b>".$total_info['attempts']."</b>", |
|
255 | + "<b>".$total_info['completed']."</b>", |
|
256 | + "<b>".$total_info['duration']."</b>", |
|
257 | + "<b>".$total_asr."</b>", |
|
258 | 258 | "<b>".$total_acd."</b>", |
259 | 259 | "<b>".$total_info['mcd']."</b>", |
260 | 260 | "<b>".$total_info['billable']."</b>", |
261 | 261 | "<b>".$total_debit."</b>", |
262 | 262 | "<b>".$total_cost."</b>", |
263 | 263 | "<b>".$total_profit."</b>" |
264 | - ); |
|
265 | - } else { |
|
266 | - $last_array = array( |
|
267 | - "<b>".$total_info['attempts']."</b>", |
|
268 | - "<b>".$total_info['completed']."</b>", |
|
269 | - "<b>".$total_info['duration']."</b>", |
|
270 | - "<b>".$total_asr."</b>", |
|
271 | - "<b>".$total_acd."</b>", |
|
272 | - "<b>".$total_info['mcd']."</b>", |
|
273 | - "<b>".$total_info['billable']."</b>", |
|
274 | - "<b>".$total_cost."</b>", |
|
275 | - ); |
|
276 | - } |
|
277 | - if ($purpose == 'export') { |
|
278 | - $search_arr['custom_total_array'][0] = "Grand Total"; |
|
279 | - } |
|
280 | - $new_export_array=array(); |
|
281 | - foreach($last_array as $key=>$value){ |
|
264 | + ); |
|
265 | + } else { |
|
266 | + $last_array = array( |
|
267 | + "<b>".$total_info['attempts']."</b>", |
|
268 | + "<b>".$total_info['completed']."</b>", |
|
269 | + "<b>".$total_info['duration']."</b>", |
|
270 | + "<b>".$total_asr."</b>", |
|
271 | + "<b>".$total_acd."</b>", |
|
272 | + "<b>".$total_info['mcd']."</b>", |
|
273 | + "<b>".$total_info['billable']."</b>", |
|
274 | + "<b>".$total_cost."</b>", |
|
275 | + ); |
|
276 | + } |
|
277 | + if ($purpose == 'export') { |
|
278 | + $search_arr['custom_total_array'][0] = "Grand Total"; |
|
279 | + } |
|
280 | + $new_export_array=array(); |
|
281 | + foreach($last_array as $key=>$value){ |
|
282 | 282 | $value=str_replace("<b>","",$value); |
283 | 283 | $value=str_replace("</b>",'',$value); |
284 | 284 | if($key == 7 || $key ==8 || $key ==9){ |
285 | - $value = sprintf("%.".$currency_info['decimalpoints']."f",floatval(preg_replace('/[^\d.]/', '', $value))); |
|
285 | + $value = sprintf("%.".$currency_info['decimalpoints']."f",floatval(preg_replace('/[^\d.]/', '', $value))); |
|
286 | 286 | } |
287 | 287 | $new_export_array[$key]=$value; |
288 | - } |
|
289 | - $total_array = array_merge($search_arr['custom_total_array'], $last_array); |
|
290 | - $custom_export_arr =array_merge($search_arr['custom_total_array'],$new_export_array); |
|
291 | - $export_arr[] = $custom_export_arr; |
|
292 | - $json_data[] = array('cell' => $total_array); |
|
293 | - return $purpose == 'grid' ? $json_data : $export_arr; |
|
294 | - } |
|
288 | + } |
|
289 | + $total_array = array_merge($search_arr['custom_total_array'], $last_array); |
|
290 | + $custom_export_arr =array_merge($search_arr['custom_total_array'],$new_export_array); |
|
291 | + $export_arr[] = $custom_export_arr; |
|
292 | + $json_data[] = array('cell' => $total_array); |
|
293 | + return $purpose == 'grid' ? $json_data : $export_arr; |
|
294 | + } |
|
295 | 295 | |
296 | - function customer_export_csv() { |
|
296 | + function customer_export_csv() { |
|
297 | 297 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
298 | 298 | $currency_id=$account_info['currency_id']; |
299 | 299 | $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
300 | - $search_arr = $this->session->userdata('customersummary_reports_export'); |
|
301 | - $data_arr = array(); |
|
302 | - $query = $this->summary_model->get_customersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], true); |
|
303 | - $search_header = explode(",", $search_arr['export_str']); |
|
304 | - ob_clean(); |
|
305 | - $fixed_header = array('Attempted Calls','Completed Calls','Duration', 'ASR', 'ACD','MCD','Billable', 'Debit('.$currency.')','Cost('.$currency.')','Profit'); |
|
306 | - $header_arr[] = array_merge($search_header, $fixed_header); |
|
307 | - if ($query->num_rows() > 0) { |
|
308 | - $data_arr = $this->summary_report_grid($search_arr, $query, 'customer', 'export'); |
|
309 | - } |
|
310 | - $customer_array = array_merge($header_arr, $data_arr); |
|
300 | + $search_arr = $this->session->userdata('customersummary_reports_export'); |
|
301 | + $data_arr = array(); |
|
302 | + $query = $this->summary_model->get_customersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], true); |
|
303 | + $search_header = explode(",", $search_arr['export_str']); |
|
304 | + ob_clean(); |
|
305 | + $fixed_header = array('Attempted Calls','Completed Calls','Duration', 'ASR', 'ACD','MCD','Billable', 'Debit('.$currency.')','Cost('.$currency.')','Profit'); |
|
306 | + $header_arr[] = array_merge($search_header, $fixed_header); |
|
307 | + if ($query->num_rows() > 0) { |
|
308 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'customer', 'export'); |
|
309 | + } |
|
310 | + $customer_array = array_merge($header_arr, $data_arr); |
|
311 | 311 | |
312 | - $this->load->helper('csv'); |
|
313 | - array_to_csv($customer_array, 'Customer_Summary_Report_' . date("Y-m-d") . '.csv'); |
|
314 | - } |
|
312 | + $this->load->helper('csv'); |
|
313 | + array_to_csv($customer_array, 'Customer_Summary_Report_' . date("Y-m-d") . '.csv'); |
|
314 | + } |
|
315 | 315 | |
316 | - function customer_search() { |
|
317 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
318 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
319 | - unset($_POST['action']); |
|
320 | - unset($_POST['advance_search']); |
|
321 | - $this->session->set_userdata('customersummary_reports_search', $this->input->post()); |
|
322 | - } |
|
323 | - redirect(base_url() . 'summary/customer/'); |
|
324 | - } |
|
316 | + function customer_search() { |
|
317 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
318 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
319 | + unset($_POST['action']); |
|
320 | + unset($_POST['advance_search']); |
|
321 | + $this->session->set_userdata('customersummary_reports_search', $this->input->post()); |
|
322 | + } |
|
323 | + redirect(base_url() . 'summary/customer/'); |
|
324 | + } |
|
325 | 325 | |
326 | - function customer_clearsearchfilter() { |
|
327 | - $this->session->set_userdata('advance_search', 0); |
|
328 | - $this->session->set_userdata('customersummary_reports_search', ""); |
|
329 | - $this->session->set_userdata('customersummary_reports_export', ""); |
|
330 | - redirect(base_url() . 'summary/customer/'); |
|
331 | - } |
|
326 | + function customer_clearsearchfilter() { |
|
327 | + $this->session->set_userdata('advance_search', 0); |
|
328 | + $this->session->set_userdata('customersummary_reports_search', ""); |
|
329 | + $this->session->set_userdata('customersummary_reports_export', ""); |
|
330 | + redirect(base_url() . 'summary/customer/'); |
|
331 | + } |
|
332 | 332 | |
333 | - function summary_search_info($entity) { |
|
334 | - $group_by_str = null; |
|
335 | - $select_str = null; |
|
336 | - $group_by_time=null; |
|
337 | - $group_by_1 = null; |
|
338 | - $group_by_2 = null; |
|
339 | - $group_by_3 = null; |
|
340 | - $order_str=null; |
|
341 | - $custom_total_array = array(); |
|
342 | - $custom_search = array(); |
|
343 | - $export_select_str = null; |
|
344 | - $new_arr['search_in'] = 'minutes'; |
|
345 | - $i = 0; |
|
346 | - $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
|
347 | - if ($this->session->userdata('advance_search') == 1) { |
|
348 | - $custom_search = $this->session->userdata($entity . 'summary_reports_search'); |
|
349 | - if (isset($custom_search['time']) && !empty($custom_search['time'])) { |
|
350 | - $group_by_str.=$custom_search['time'] . "(callstart),"; |
|
351 | - $select_str.=$custom_search['time'] . "(callstart) as ".$custom_search['time'].","; |
|
352 | - $order_str.=$custom_search['time'].","; |
|
353 | - $group_by_time = $custom_search['time']; |
|
354 | - $export_select_str.=$custom_search['time'].","; |
|
355 | - $custom_total_array[$i] = null; |
|
356 | - $i++; |
|
357 | - } |
|
358 | - if (isset($custom_search['groupby_1']) && !empty($custom_search['groupby_1'])) { |
|
359 | - $group_by_str.=$custom_search['groupby_1'] . ","; |
|
360 | - $select_str.=$custom_search['groupby_1'] . ","; |
|
361 | - $order_str.=$custom_search['groupby_1'] . ","; |
|
362 | - $group_by_1 = $custom_search['groupby_1']; |
|
363 | - if ($custom_search['groupby_1'] == $db_field_name) { |
|
364 | - $export_select_str.='Account,'; |
|
365 | - } elseif ($custom_search['groupby_1'] == 'trunk_id') { |
|
366 | - $export_select_str.='Trunk,'; |
|
367 | - } elseif ($custom_search['groupby_1'] == 'pattern') { |
|
368 | - $select_str.='notes,'; |
|
369 | - $order_str.='notes,'; |
|
370 | - $export_select_str.="Code,Destination,"; |
|
371 | - $custom_total_array[$i] = null; |
|
372 | - $i++; |
|
373 | - } elseif($custom_search['groupby_1'] =='package_id'){ |
|
374 | - $export_select_str.='Package,'; |
|
375 | - } |
|
376 | - $custom_total_array[$i] = null; |
|
377 | - $i++; |
|
378 | - } |
|
333 | + function summary_search_info($entity) { |
|
334 | + $group_by_str = null; |
|
335 | + $select_str = null; |
|
336 | + $group_by_time=null; |
|
337 | + $group_by_1 = null; |
|
338 | + $group_by_2 = null; |
|
339 | + $group_by_3 = null; |
|
340 | + $order_str=null; |
|
341 | + $custom_total_array = array(); |
|
342 | + $custom_search = array(); |
|
343 | + $export_select_str = null; |
|
344 | + $new_arr['search_in'] = 'minutes'; |
|
345 | + $i = 0; |
|
346 | + $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
|
347 | + if ($this->session->userdata('advance_search') == 1) { |
|
348 | + $custom_search = $this->session->userdata($entity . 'summary_reports_search'); |
|
349 | + if (isset($custom_search['time']) && !empty($custom_search['time'])) { |
|
350 | + $group_by_str.=$custom_search['time'] . "(callstart),"; |
|
351 | + $select_str.=$custom_search['time'] . "(callstart) as ".$custom_search['time'].","; |
|
352 | + $order_str.=$custom_search['time'].","; |
|
353 | + $group_by_time = $custom_search['time']; |
|
354 | + $export_select_str.=$custom_search['time'].","; |
|
355 | + $custom_total_array[$i] = null; |
|
356 | + $i++; |
|
357 | + } |
|
358 | + if (isset($custom_search['groupby_1']) && !empty($custom_search['groupby_1'])) { |
|
359 | + $group_by_str.=$custom_search['groupby_1'] . ","; |
|
360 | + $select_str.=$custom_search['groupby_1'] . ","; |
|
361 | + $order_str.=$custom_search['groupby_1'] . ","; |
|
362 | + $group_by_1 = $custom_search['groupby_1']; |
|
363 | + if ($custom_search['groupby_1'] == $db_field_name) { |
|
364 | + $export_select_str.='Account,'; |
|
365 | + } elseif ($custom_search['groupby_1'] == 'trunk_id') { |
|
366 | + $export_select_str.='Trunk,'; |
|
367 | + } elseif ($custom_search['groupby_1'] == 'pattern') { |
|
368 | + $select_str.='notes,'; |
|
369 | + $order_str.='notes,'; |
|
370 | + $export_select_str.="Code,Destination,"; |
|
371 | + $custom_total_array[$i] = null; |
|
372 | + $i++; |
|
373 | + } elseif($custom_search['groupby_1'] =='package_id'){ |
|
374 | + $export_select_str.='Package,'; |
|
375 | + } |
|
376 | + $custom_total_array[$i] = null; |
|
377 | + $i++; |
|
378 | + } |
|
379 | 379 | |
380 | - if (isset($custom_search['groupby_2']) && !empty($custom_search['groupby_2'])) { |
|
381 | - $group_by_str.=$custom_search['groupby_2'] . ","; |
|
382 | - $select_str.=$custom_search['groupby_2'] . ","; |
|
383 | - $order_str.=$custom_search['groupby_2'] . ","; |
|
384 | - $group_by_2 = $custom_search['groupby_2']; |
|
385 | - if ($custom_search['groupby_2'] == $db_field_name) { |
|
386 | - $export_select_str.='Account,'; |
|
387 | - } elseif ($custom_search['groupby_2'] == 'trunk_id') { |
|
388 | - $export_select_str.='Trunk,'; |
|
389 | - } elseif ($custom_search['groupby_2'] == 'pattern') { |
|
390 | - $select_str.='notes,'; |
|
391 | - $order_str.='notes,'; |
|
392 | - $export_select_str.="Code,Destination,"; |
|
393 | - $custom_total_array[$i] = null; |
|
394 | - $i++; |
|
395 | - } elseif($custom_search['groupby_2'] =='package_id'){ |
|
396 | - $export_select_str.='Package,'; |
|
397 | - } |
|
398 | - $custom_total_array[$i] = null; |
|
399 | - $i++; |
|
400 | - } |
|
380 | + if (isset($custom_search['groupby_2']) && !empty($custom_search['groupby_2'])) { |
|
381 | + $group_by_str.=$custom_search['groupby_2'] . ","; |
|
382 | + $select_str.=$custom_search['groupby_2'] . ","; |
|
383 | + $order_str.=$custom_search['groupby_2'] . ","; |
|
384 | + $group_by_2 = $custom_search['groupby_2']; |
|
385 | + if ($custom_search['groupby_2'] == $db_field_name) { |
|
386 | + $export_select_str.='Account,'; |
|
387 | + } elseif ($custom_search['groupby_2'] == 'trunk_id') { |
|
388 | + $export_select_str.='Trunk,'; |
|
389 | + } elseif ($custom_search['groupby_2'] == 'pattern') { |
|
390 | + $select_str.='notes,'; |
|
391 | + $order_str.='notes,'; |
|
392 | + $export_select_str.="Code,Destination,"; |
|
393 | + $custom_total_array[$i] = null; |
|
394 | + $i++; |
|
395 | + } elseif($custom_search['groupby_2'] =='package_id'){ |
|
396 | + $export_select_str.='Package,'; |
|
397 | + } |
|
398 | + $custom_total_array[$i] = null; |
|
399 | + $i++; |
|
400 | + } |
|
401 | 401 | |
402 | - if (isset($custom_search['groupby_3']) && !empty($custom_search['groupby_3'])) { |
|
403 | - $group_by_str.=$custom_search['groupby_3'] . ","; |
|
404 | - $select_str.=$custom_search['groupby_3'] . ","; |
|
405 | - $order_str.=$custom_search['groupby_3'] . ","; |
|
406 | - $group_by_3 = $custom_search['groupby_3']; |
|
407 | - if ($custom_search['groupby_3'] == 'accountid' || $custom_search['groupby_3'] == 'provider_id') { |
|
408 | - $export_select_str.='Account,'; |
|
409 | - } elseif ($custom_search['groupby_3'] == 'trunk_id') { |
|
410 | - $export_select_str.='Trunk,'; |
|
411 | - } elseif ($custom_search['groupby_3'] == 'pattern') { |
|
412 | - $select_str.='notes,'; |
|
413 | - $order_str.='notes,'; |
|
414 | - $export_select_str.="Code,Destination,"; |
|
415 | - $custom_total_array[$i] = null; |
|
416 | - $i++; |
|
417 | - } elseif($custom_search['groupby_3'] =='package_id'){ |
|
418 | - $export_select_str.='Package,'; |
|
419 | - } |
|
420 | - $custom_total_array[$i] = null; |
|
421 | - $i++; |
|
422 | - } |
|
423 | - $new_arr['search_in'] = (isset($custom_search['search_in']) && !empty($custom_search['search_in'])) ? $custom_search['search_in'] : 'minutes'; |
|
424 | - unset($custom_search['groupby_1'], $custom_search['groupby_2'], $custom_search['groupby_3'], $custom_search['search_in']); |
|
425 | - $this->session->set_userdata('summary_' . $entity . '_search', $custom_search); |
|
426 | - } |
|
427 | - if (!empty($group_by_str)) { |
|
428 | - $group_by_str = rtrim($group_by_str, ","); |
|
429 | - $select_str = rtrim($select_str, ","); |
|
430 | - $order_str = rtrim($order_str, ","); |
|
431 | - $export_select_str = rtrim($export_select_str, ","); |
|
432 | - } else { |
|
433 | - $select_str = $db_field_name; |
|
434 | - $order_str = $db_field_name; |
|
435 | - $group_by_str = $db_field_name; |
|
436 | - $export_select_str = "Account"; |
|
437 | - } |
|
402 | + if (isset($custom_search['groupby_3']) && !empty($custom_search['groupby_3'])) { |
|
403 | + $group_by_str.=$custom_search['groupby_3'] . ","; |
|
404 | + $select_str.=$custom_search['groupby_3'] . ","; |
|
405 | + $order_str.=$custom_search['groupby_3'] . ","; |
|
406 | + $group_by_3 = $custom_search['groupby_3']; |
|
407 | + if ($custom_search['groupby_3'] == 'accountid' || $custom_search['groupby_3'] == 'provider_id') { |
|
408 | + $export_select_str.='Account,'; |
|
409 | + } elseif ($custom_search['groupby_3'] == 'trunk_id') { |
|
410 | + $export_select_str.='Trunk,'; |
|
411 | + } elseif ($custom_search['groupby_3'] == 'pattern') { |
|
412 | + $select_str.='notes,'; |
|
413 | + $order_str.='notes,'; |
|
414 | + $export_select_str.="Code,Destination,"; |
|
415 | + $custom_total_array[$i] = null; |
|
416 | + $i++; |
|
417 | + } elseif($custom_search['groupby_3'] =='package_id'){ |
|
418 | + $export_select_str.='Package,'; |
|
419 | + } |
|
420 | + $custom_total_array[$i] = null; |
|
421 | + $i++; |
|
422 | + } |
|
423 | + $new_arr['search_in'] = (isset($custom_search['search_in']) && !empty($custom_search['search_in'])) ? $custom_search['search_in'] : 'minutes'; |
|
424 | + unset($custom_search['groupby_1'], $custom_search['groupby_2'], $custom_search['groupby_3'], $custom_search['search_in']); |
|
425 | + $this->session->set_userdata('summary_' . $entity . '_search', $custom_search); |
|
426 | + } |
|
427 | + if (!empty($group_by_str)) { |
|
428 | + $group_by_str = rtrim($group_by_str, ","); |
|
429 | + $select_str = rtrim($select_str, ","); |
|
430 | + $order_str = rtrim($order_str, ","); |
|
431 | + $export_select_str = rtrim($export_select_str, ","); |
|
432 | + } else { |
|
433 | + $select_str = $db_field_name; |
|
434 | + $order_str = $db_field_name; |
|
435 | + $group_by_str = $db_field_name; |
|
436 | + $export_select_str = "Account"; |
|
437 | + } |
|
438 | 438 | |
439 | - array_pop($custom_total_array); |
|
440 | - array_unshift($custom_total_array, '<b>Grand Total</b>'); |
|
441 | - $new_arr['export_str'] = $export_select_str; |
|
442 | - $new_arr['select_str'] = $select_str; |
|
443 | - $new_arr['order_str'] = $order_str; |
|
444 | - $new_arr['group_by_str'] = $group_by_str; |
|
445 | - $new_arr['groupby_1'] = $group_by_1; |
|
446 | - $new_arr['groupby_2'] = $group_by_2; |
|
447 | - $new_arr['groupby_3'] = $group_by_3; |
|
448 | - $new_arr['groupby_time']=$group_by_time; |
|
449 | - $new_arr['custom_total_array'] = $custom_total_array; |
|
450 | - return $new_arr; |
|
451 | - } |
|
439 | + array_pop($custom_total_array); |
|
440 | + array_unshift($custom_total_array, '<b>Grand Total</b>'); |
|
441 | + $new_arr['export_str'] = $export_select_str; |
|
442 | + $new_arr['select_str'] = $select_str; |
|
443 | + $new_arr['order_str'] = $order_str; |
|
444 | + $new_arr['group_by_str'] = $group_by_str; |
|
445 | + $new_arr['groupby_1'] = $group_by_1; |
|
446 | + $new_arr['groupby_2'] = $group_by_2; |
|
447 | + $new_arr['groupby_3'] = $group_by_3; |
|
448 | + $new_arr['groupby_time']=$group_by_time; |
|
449 | + $new_arr['custom_total_array'] = $custom_total_array; |
|
450 | + return $new_arr; |
|
451 | + } |
|
452 | 452 | |
453 | - function provider() { |
|
454 | - $data['page_title'] = 'Provider Summary Report'; |
|
455 | - $data['search_flag'] = true; |
|
456 | - $session_info = $this->session->userdata('providersummary_reports_search'); |
|
457 | - $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array("type" => "3")); |
|
458 | - $trunklist = $this->db_model->build_dropdown('id,name', 'trunks', '', array()); |
|
459 | - $data['trunklist'] = $trunklist; |
|
460 | - $data['accountlist'] = $accountlist; |
|
461 | - $data['session_info'] = $session_info; |
|
462 | - $data['seconds'] = $this->session->userdata('provider_seconds'); |
|
463 | - $data['search_report'] = $this->common->search_report_in(); |
|
464 | - $data['grid_fields'] = $this->summary_form->build_providersummary(); |
|
465 | - $data["grid_buttons"] = $this->summary_form->build_grid_buttons_providersummary(); |
|
466 | - $data['search_string_type'] = $this->common->search_string_type(); |
|
467 | - $data['groupby_field'] = $this->common->set_summaryprovider_groupby(); |
|
468 | - $data['groupby_time'] = $this->common->group_by_time(); |
|
469 | - $this->load->view('view_providersummary_report', $data); |
|
470 | - } |
|
453 | + function provider() { |
|
454 | + $data['page_title'] = 'Provider Summary Report'; |
|
455 | + $data['search_flag'] = true; |
|
456 | + $session_info = $this->session->userdata('providersummary_reports_search'); |
|
457 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array("type" => "3")); |
|
458 | + $trunklist = $this->db_model->build_dropdown('id,name', 'trunks', '', array()); |
|
459 | + $data['trunklist'] = $trunklist; |
|
460 | + $data['accountlist'] = $accountlist; |
|
461 | + $data['session_info'] = $session_info; |
|
462 | + $data['seconds'] = $this->session->userdata('provider_seconds'); |
|
463 | + $data['search_report'] = $this->common->search_report_in(); |
|
464 | + $data['grid_fields'] = $this->summary_form->build_providersummary(); |
|
465 | + $data["grid_buttons"] = $this->summary_form->build_grid_buttons_providersummary(); |
|
466 | + $data['search_string_type'] = $this->common->search_string_type(); |
|
467 | + $data['groupby_field'] = $this->common->set_summaryprovider_groupby(); |
|
468 | + $data['groupby_time'] = $this->common->group_by_time(); |
|
469 | + $this->load->view('view_providersummary_report', $data); |
|
470 | + } |
|
471 | 471 | |
472 | - function provider_json() { |
|
473 | - $search_arr = $this->summary_search_info('provider'); |
|
474 | - $count_all = $this->summary_model->get_providersummary_report_list(false,'','', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'],false); |
|
475 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
476 | - $json_data = $paging_data["json_paging"]; |
|
477 | - $query = $this->summary_model->get_providersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], false); |
|
478 | - if ($query->num_rows() > 0) { |
|
479 | - $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'provider', 'grid'); |
|
480 | - } |
|
481 | - $this->session->set_userdata('providersummary_reports_export', $search_arr); |
|
482 | - echo json_encode($json_data); |
|
483 | - } |
|
472 | + function provider_json() { |
|
473 | + $search_arr = $this->summary_search_info('provider'); |
|
474 | + $count_all = $this->summary_model->get_providersummary_report_list(false,'','', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'],false); |
|
475 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
476 | + $json_data = $paging_data["json_paging"]; |
|
477 | + $query = $this->summary_model->get_providersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], false); |
|
478 | + if ($query->num_rows() > 0) { |
|
479 | + $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'provider', 'grid'); |
|
480 | + } |
|
481 | + $this->session->set_userdata('providersummary_reports_export', $search_arr); |
|
482 | + echo json_encode($json_data); |
|
483 | + } |
|
484 | 484 | |
485 | - function provider_export_csv() { |
|
485 | + function provider_export_csv() { |
|
486 | 486 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
487 | 487 | $currency_id=$account_info['currency_id']; |
488 | 488 | $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
489 | - $search_arr = $this->session->userdata('providersummary_reports_export'); |
|
490 | - $data_arr = array(); |
|
491 | - $query = $this->summary_model->get_providersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], true); |
|
492 | - $search_header = explode(",", $search_arr['export_str']); |
|
493 | - ob_clean(); |
|
494 | - $fixed_header = array("Attempted Calls", "Completed Calls", "Duration", "ASR", "ACD", "MCD", "Billable", "Cost($currency)"); |
|
495 | - $header_arr[] = array_merge($search_header, $fixed_header); |
|
496 | - if ($query->num_rows() > 0) { |
|
497 | - $data_arr = $this->summary_report_grid($search_arr, $query, 'provider', 'export'); |
|
498 | - } |
|
499 | - $provider_array = array_merge($header_arr, $data_arr); |
|
489 | + $search_arr = $this->session->userdata('providersummary_reports_export'); |
|
490 | + $data_arr = array(); |
|
491 | + $query = $this->summary_model->get_providersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], true); |
|
492 | + $search_header = explode(",", $search_arr['export_str']); |
|
493 | + ob_clean(); |
|
494 | + $fixed_header = array("Attempted Calls", "Completed Calls", "Duration", "ASR", "ACD", "MCD", "Billable", "Cost($currency)"); |
|
495 | + $header_arr[] = array_merge($search_header, $fixed_header); |
|
496 | + if ($query->num_rows() > 0) { |
|
497 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'provider', 'export'); |
|
498 | + } |
|
499 | + $provider_array = array_merge($header_arr, $data_arr); |
|
500 | 500 | |
501 | - $this->load->helper('csv'); |
|
502 | - array_to_csv($provider_array, 'Provider_Summary_Report_' . date("Y-m-d") . '.csv'); |
|
503 | - } |
|
501 | + $this->load->helper('csv'); |
|
502 | + array_to_csv($provider_array, 'Provider_Summary_Report_' . date("Y-m-d") . '.csv'); |
|
503 | + } |
|
504 | 504 | |
505 | - function provider_search() { |
|
506 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
507 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
508 | - unset($_POST['action'], $_POST['advance_search']); |
|
509 | - $this->session->set_userdata('providersummary_reports_search', $this->input->post()); |
|
510 | - } |
|
511 | - redirect(base_url() . 'summary/provider/'); |
|
512 | - } |
|
505 | + function provider_search() { |
|
506 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
507 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
508 | + unset($_POST['action'], $_POST['advance_search']); |
|
509 | + $this->session->set_userdata('providersummary_reports_search', $this->input->post()); |
|
510 | + } |
|
511 | + redirect(base_url() . 'summary/provider/'); |
|
512 | + } |
|
513 | 513 | |
514 | - function provider_clearsearchfilter() { |
|
515 | - $this->session->set_userdata('advance_search', 0); |
|
516 | - $this->session->set_userdata('providersummary_reports_search', ""); |
|
517 | - $this->session->set_userdata('providersummary_reports_export', ""); |
|
518 | - redirect(base_url() . "summary/provider/"); |
|
519 | - } |
|
514 | + function provider_clearsearchfilter() { |
|
515 | + $this->session->set_userdata('advance_search', 0); |
|
516 | + $this->session->set_userdata('providersummary_reports_search', ""); |
|
517 | + $this->session->set_userdata('providersummary_reports_export', ""); |
|
518 | + redirect(base_url() . "summary/provider/"); |
|
519 | + } |
|
520 | 520 | |
521 | - function reseller() { |
|
522 | - $data['username'] = $this->session->userdata('user_name'); |
|
523 | - $data['page_title'] = 'Reseller Summary Report'; |
|
524 | - $data['search_flag'] = true; |
|
525 | - $session_info = $this->session->userdata('resellersummary_reports_search'); |
|
526 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
527 | - $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
528 | - $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array('reseller_id' => $reseller_id, "type" => "1")); |
|
529 | - $data['accountlist'] = $accountlist; |
|
530 | - $data['seconds'] = $this->session->userdata('reseller_seconds'); |
|
531 | - $data['session_info'] = $session_info; |
|
532 | - $data['search_report'] = $this->common->search_report_in(); |
|
533 | - $data['search_string_type'] = $this->common->search_string_type(); |
|
534 | - $new_column_arr = $this->summary_column_arr('reseller'); |
|
535 | - $data['grid_fields'] = $this->summary_form->build_resellersummary($new_column_arr); |
|
536 | - $data["grid_buttons"] = $this->summary_form->build_grid_buttons_resellersummary(); |
|
537 | - $data['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
538 | - $data['groupby_time'] = $this->common->group_by_time(); |
|
539 | - $this->load->view('view_resellersummary_report', $data); |
|
540 | - } |
|
521 | + function reseller() { |
|
522 | + $data['username'] = $this->session->userdata('user_name'); |
|
523 | + $data['page_title'] = 'Reseller Summary Report'; |
|
524 | + $data['search_flag'] = true; |
|
525 | + $session_info = $this->session->userdata('resellersummary_reports_search'); |
|
526 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
527 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
528 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array('reseller_id' => $reseller_id, "type" => "1")); |
|
529 | + $data['accountlist'] = $accountlist; |
|
530 | + $data['seconds'] = $this->session->userdata('reseller_seconds'); |
|
531 | + $data['session_info'] = $session_info; |
|
532 | + $data['search_report'] = $this->common->search_report_in(); |
|
533 | + $data['search_string_type'] = $this->common->search_string_type(); |
|
534 | + $new_column_arr = $this->summary_column_arr('reseller'); |
|
535 | + $data['grid_fields'] = $this->summary_form->build_resellersummary($new_column_arr); |
|
536 | + $data["grid_buttons"] = $this->summary_form->build_grid_buttons_resellersummary(); |
|
537 | + $data['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
538 | + $data['groupby_time'] = $this->common->group_by_time(); |
|
539 | + $this->load->view('view_resellersummary_report', $data); |
|
540 | + } |
|
541 | 541 | |
542 | - function reseller_json() { |
|
543 | - $search_arr = $this->summary_search_info('reseller'); |
|
544 | - $count_all = $this->summary_model->get_resellersummary_report_list(false, 0, 0, $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'],false); |
|
545 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
546 | - $json_data = $paging_data["json_paging"]; |
|
547 | - $query = $this->summary_model->get_resellersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], false); |
|
548 | - if ($query->num_rows() > 0) { |
|
549 | - $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'reseller', 'grid'); |
|
550 | - } |
|
551 | - $this->session->set_userdata('resellersummary_reports_export', $search_arr); |
|
552 | - echo json_encode($json_data); |
|
553 | - } |
|
542 | + function reseller_json() { |
|
543 | + $search_arr = $this->summary_search_info('reseller'); |
|
544 | + $count_all = $this->summary_model->get_resellersummary_report_list(false, 0, 0, $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'],false); |
|
545 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
546 | + $json_data = $paging_data["json_paging"]; |
|
547 | + $query = $this->summary_model->get_resellersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'], false); |
|
548 | + if ($query->num_rows() > 0) { |
|
549 | + $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'reseller', 'grid'); |
|
550 | + } |
|
551 | + $this->session->set_userdata('resellersummary_reports_export', $search_arr); |
|
552 | + echo json_encode($json_data); |
|
553 | + } |
|
554 | 554 | |
555 | - function reseller_search() { |
|
556 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
557 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
558 | - unset($_POST['action'], $_POST['advance_search']); |
|
559 | - $this->session->set_userdata('resellersummary_reports_search', $this->input->post()); |
|
560 | - } |
|
561 | - redirect(base_url() . "summary/reseller/"); |
|
562 | - } |
|
555 | + function reseller_search() { |
|
556 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
557 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
558 | + unset($_POST['action'], $_POST['advance_search']); |
|
559 | + $this->session->set_userdata('resellersummary_reports_search', $this->input->post()); |
|
560 | + } |
|
561 | + redirect(base_url() . "summary/reseller/"); |
|
562 | + } |
|
563 | 563 | |
564 | - function reseller_clearsearchfilter() { |
|
565 | - $this->session->set_userdata('advance_search', 0); |
|
566 | - $this->session->set_userdata('resellersummary_reports_search', ""); |
|
567 | - $this->session->set_userdata('resellersummary_reports_export', ""); |
|
568 | - redirect(base_url() . "summary/reseller/"); |
|
569 | - } |
|
564 | + function reseller_clearsearchfilter() { |
|
565 | + $this->session->set_userdata('advance_search', 0); |
|
566 | + $this->session->set_userdata('resellersummary_reports_search', ""); |
|
567 | + $this->session->set_userdata('resellersummary_reports_export', ""); |
|
568 | + redirect(base_url() . "summary/reseller/"); |
|
569 | + } |
|
570 | 570 | |
571 | - function reseller_export_csv() { |
|
571 | + function reseller_export_csv() { |
|
572 | 572 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
573 | 573 | $currency_id=$account_info['currency_id']; |
574 | 574 | $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
575 | 575 | |
576 | - $search_arr = $this->session->userdata('resellersummary_reports_export'); |
|
577 | - $data_arr = array(); |
|
578 | - $query = $this->summary_model->get_resellersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'],true); |
|
579 | - $search_header = explode(",", $search_arr['export_str']); |
|
580 | - ob_clean(); |
|
581 | - $fixed_header = array("Attempted Calls", "Completed Calls", "Duration", "ASR", "ACD", "MCD", "Billable", "Debit($currency)", "Cost($currency)", "Profit"); |
|
582 | - $header_arr[] = array_merge($search_header, $fixed_header); |
|
583 | - if ($query->num_rows() > 0) { |
|
584 | - $data_arr = $this->summary_report_grid($search_arr, $query, 'reseller', 'export'); |
|
585 | - } |
|
586 | - $reseller_array = array_merge($header_arr, $data_arr); |
|
587 | - $this->load->helper('csv'); |
|
588 | - array_to_csv($reseller_array, 'Reseller_Summary_Report_' . date("Y-m-d") . '.csv'); |
|
589 | - } |
|
576 | + $search_arr = $this->session->userdata('resellersummary_reports_export'); |
|
577 | + $data_arr = array(); |
|
578 | + $query = $this->summary_model->get_resellersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'],$search_arr['order_str'],true); |
|
579 | + $search_header = explode(",", $search_arr['export_str']); |
|
580 | + ob_clean(); |
|
581 | + $fixed_header = array("Attempted Calls", "Completed Calls", "Duration", "ASR", "ACD", "MCD", "Billable", "Debit($currency)", "Cost($currency)", "Profit"); |
|
582 | + $header_arr[] = array_merge($search_header, $fixed_header); |
|
583 | + if ($query->num_rows() > 0) { |
|
584 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'reseller', 'export'); |
|
585 | + } |
|
586 | + $reseller_array = array_merge($header_arr, $data_arr); |
|
587 | + $this->load->helper('csv'); |
|
588 | + array_to_csv($reseller_array, 'Reseller_Summary_Report_' . date("Y-m-d") . '.csv'); |
|
589 | + } |
|
590 | 590 | |
591 | 591 | } |
592 | 592 | ?> |
@@ -21,186 +21,186 @@ |
||
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 |