@@ -50,8 +50,8 @@ |
||
50 | 50 | <span class="ui-icon ui-icon-circle-arrow-s"></span></div> |
51 | 51 | <div style="color:red;margin-left: 60px;"> |
52 | 52 | <?php if (isset($validation_errors)) { |
53 | - echo $validation_errors; |
|
54 | - } ?> |
|
53 | + echo $validation_errors; |
|
54 | + } ?> |
|
55 | 55 | </div> |
56 | 56 | |
57 | 57 | </div> |
@@ -22,12 +22,12 @@ |
||
22 | 22 | <div class="pull-left"> |
23 | 23 | <ul class="breadcrumb"> |
24 | 24 | <?php $accountinfo=$this->session->userdata('accountinfo'); |
25 | - if($accountinfo['type']==1){ ?> |
|
25 | + if($accountinfo['type']==1){ ?> |
|
26 | 26 | <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li> |
27 | 27 | <?php }else{ ?> |
28 | 28 | <li><a href="#">Configuration</a></li> |
29 | 29 | <?php } |
30 | - ?> |
|
30 | + ?> |
|
31 | 31 | |
32 | 32 | <li class='active'> |
33 | 33 | <a href="<?= base_url() . "user/user_ipmap/"; ?>">IP Settings</a> |
@@ -21,24 +21,24 @@ discard block |
||
21 | 21 | <div class="col-md-12 no-padding color-three border_box"> |
22 | 22 | <div class="pull-left"> |
23 | 23 | <ul class="breadcrumb"> |
24 | - <?php $accountinfo=$this->session->userdata('accountinfo'); |
|
25 | - if($accountinfo['type']==1){ ?> |
|
26 | - <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li> |
|
27 | - <?php }else{ ?> |
|
24 | + <?php $accountinfo = $this->session->userdata('accountinfo'); |
|
25 | + if ($accountinfo['type'] == 1) { ?> |
|
26 | + <li><a href="<?= base_url()."user/user_myprofile/"; ?>">My Profile</a></li> |
|
27 | + <?php } else { ?> |
|
28 | 28 | <li><a href="#">Configuration</a></li> |
29 | 29 | <?php } |
30 | 30 | ?> |
31 | 31 | |
32 | 32 | <li class='active'> |
33 | - <a href="<?= base_url() . "user/user_ipmap/"; ?>">IP Settings</a> |
|
33 | + <a href="<?= base_url()."user/user_ipmap/"; ?>">IP Settings</a> |
|
34 | 34 | </li> |
35 | 35 | </ul> |
36 | 36 | </div> |
37 | - <?php if($accountinfo['type']==1) { ?> |
|
37 | + <?php if ($accountinfo['type'] == 1) { ?> |
|
38 | 38 | <div class="pull-right"> |
39 | 39 | <ul class="breadcrumb"> |
40 | 40 | <li class="active pull-right"> |
41 | - <a href="<?= base_url() . "user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
41 | + <a href="<?= base_url()."user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
42 | 42 | </ul> |
43 | 43 | </div> |
44 | 44 | <?php }?> |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | <div class="margin-b-10 slice color-three pull-left content_border col-md-12" id="left_panel_form" style="cursor: pointer; display: none;"> |
55 | 55 | <fieldset class="margin-b-20"> |
56 | 56 | <legend>IP Settings</legend> |
57 | - <form method="post" name="ip_map" id="ip_map" action="<?= base_url() . "user/user_ipmap_action/add/" ?>"> |
|
57 | + <form method="post" name="ip_map" id="ip_map" action="<?= base_url()."user/user_ipmap_action/add/" ?>"> |
|
58 | 58 | <div class='col-md-4'> |
59 | 59 | <label class="col-md-1 no-padding">Name</label> |
60 | 60 | <input class="col-md-2 form-control" name="name" size="16" type="text"/> |
@@ -24,7 +24,7 @@ |
||
24 | 24 | <?php $accountinfo=$this->session->userdata('accountinfo'); |
25 | 25 | if($accountinfo['type']==1){ ?> |
26 | 26 | <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li> |
27 | - <?php }else{ ?> |
|
27 | + <?php } else{ ?> |
|
28 | 28 | <li><a href="#">Configuration</a></li> |
29 | 29 | <?php } |
30 | 30 | ?> |
@@ -21,16 +21,16 @@ |
||
21 | 21 | <div class="col-md-12 no-padding color-three border_box"> |
22 | 22 | <div class="pull-left"> |
23 | 23 | <ul class="breadcrumb"> |
24 | - <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li> |
|
24 | + <li><a href="<?= base_url()."user/user_myprofile/"; ?>">My Profile</a></li> |
|
25 | 25 | <li> |
26 | - <a href="<?= base_url() . "user/user_cdrs/"; ?>">CDRs</a> |
|
26 | + <a href="<?= base_url()."user/user_cdrs/"; ?>">CDRs</a> |
|
27 | 27 | </li> |
28 | 28 | </ul> |
29 | 29 | </div> |
30 | 30 | <div class="pull-right"> |
31 | 31 | <ul class="breadcrumb"> |
32 | 32 | <li class="active pull-right"> |
33 | - <a href="<?= base_url() . "user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
33 | + <a href="<?= base_url()."user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
34 | 34 | </ul> |
35 | 35 | </div> |
36 | 36 | </div> |
@@ -24,169 +24,169 @@ discard block |
||
24 | 24 | |
25 | 25 | class user_model extends CI_Model { |
26 | 26 | |
27 | - function user_model() { |
|
28 | - parent::__construct(); |
|
29 | - if(Common_model::$global_config['system_config']['opensips']==0){ |
|
27 | + function user_model() { |
|
28 | + parent::__construct(); |
|
29 | + if(Common_model::$global_config['system_config']['opensips']==0){ |
|
30 | 30 | $db_config = Common_model::$global_config['system_config']; |
31 | 31 | $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="; |
32 | 32 | $this->opensips_db = $this->load->database($opensipdsn, true); |
33 | - } |
|
34 | - } |
|
33 | + } |
|
34 | + } |
|
35 | 35 | |
36 | - function validate_password($pass, $id) { |
|
37 | - $this->db->select('password'); |
|
38 | - $this->db->where('number', $id); |
|
39 | - $query = $this->db->get('accounts'); |
|
40 | - $count = $query->num_rows(); |
|
41 | - return $count; |
|
42 | - } |
|
36 | + function validate_password($pass, $id) { |
|
37 | + $this->db->select('password'); |
|
38 | + $this->db->where('number', $id); |
|
39 | + $query = $this->db->get('accounts'); |
|
40 | + $count = $query->num_rows(); |
|
41 | + return $count; |
|
42 | + } |
|
43 | 43 | |
44 | - function update_password($newpass, $id) { |
|
45 | - $this->db->update('password', $newpass); |
|
46 | - $this->db->where('number', $id); |
|
47 | - $result = $this->db->get('accounts'); |
|
48 | - return $result->result(); |
|
49 | - } |
|
44 | + function update_password($newpass, $id) { |
|
45 | + $this->db->update('password', $newpass); |
|
46 | + $this->db->where('number', $id); |
|
47 | + $result = $this->db->get('accounts'); |
|
48 | + return $result->result(); |
|
49 | + } |
|
50 | 50 | |
51 | - function change_password($id) { |
|
52 | - $this->db->select('password'); |
|
53 | - $this->db->where('id', $id); |
|
54 | - $query = $this->db->get('accounts'); |
|
55 | - $result = $query->result(); |
|
56 | - return $result; |
|
57 | - } |
|
51 | + function change_password($id) { |
|
52 | + $this->db->select('password'); |
|
53 | + $this->db->where('id', $id); |
|
54 | + $query = $this->db->get('accounts'); |
|
55 | + $result = $query->result(); |
|
56 | + return $result; |
|
57 | + } |
|
58 | 58 | |
59 | - function change_db_password($update, $id) { |
|
60 | - $this->db->where('id', $id); |
|
61 | - $this->db->update('accounts', array('password' => $update)); |
|
62 | - } |
|
59 | + function change_db_password($update, $id) { |
|
60 | + $this->db->where('id', $id); |
|
61 | + $this->db->update('accounts', array('password' => $update)); |
|
62 | + } |
|
63 | 63 | |
64 | - function edit_account($accountinfo, $edit_id) { |
|
65 | - unset($accountinfo['action']); |
|
66 | - $this->db->where('id', $edit_id); |
|
67 | - $result = $this->db->update('accounts', $accountinfo); |
|
68 | - return true; |
|
69 | - } |
|
64 | + function edit_account($accountinfo, $edit_id) { |
|
65 | + unset($accountinfo['action']); |
|
66 | + $this->db->where('id', $edit_id); |
|
67 | + $result = $this->db->update('accounts', $accountinfo); |
|
68 | + return true; |
|
69 | + } |
|
70 | 70 | |
71 | - function get_user_packages_list($flag, $start = 0, $limit = 0) { |
|
72 | - $this->db_model->build_search('package_list_search'); |
|
73 | - $account_data = $this->session->userdata("accountinfo"); |
|
74 | - $where = array("pricelist_id" => $account_data['pricelist_id']); |
|
75 | - if ($flag) { |
|
76 | - $query = $this->db_model->getSelect("*", "packages", $where, "id", "ASC", $limit, $start); |
|
77 | - } else { |
|
78 | - $query = $this->db_model->countQuery("*", "packages", $where); |
|
79 | - } |
|
80 | - return $query; |
|
81 | - } |
|
71 | + function get_user_packages_list($flag, $start = 0, $limit = 0) { |
|
72 | + $this->db_model->build_search('package_list_search'); |
|
73 | + $account_data = $this->session->userdata("accountinfo"); |
|
74 | + $where = array("pricelist_id" => $account_data['pricelist_id']); |
|
75 | + if ($flag) { |
|
76 | + $query = $this->db_model->getSelect("*", "packages", $where, "id", "ASC", $limit, $start); |
|
77 | + } else { |
|
78 | + $query = $this->db_model->countQuery("*", "packages", $where); |
|
79 | + } |
|
80 | + return $query; |
|
81 | + } |
|
82 | 82 | |
83 | - function get_user_invoices_list($flag, $start = 0, $limit = 0) { |
|
84 | - $this->db_model->build_search('user_invoice_list_search'); |
|
85 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
86 | - $reseller_id = $accountinfo['id']; |
|
87 | - $this->db->where('accountid', $reseller_id); |
|
88 | - if ($flag) { |
|
89 | - $this->db->select('*'); |
|
90 | - } else { |
|
91 | - $this->db->select('count(id) as count'); |
|
92 | - } |
|
93 | - if ($flag) { |
|
94 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
95 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
96 | - }else{ |
|
97 | - $this->db->order_by('invoice_date', 'desc'); |
|
98 | - } |
|
99 | - } |
|
100 | - $result = $this->db->get('invoices'); |
|
101 | - if ($result->num_rows() > 0) { |
|
102 | - if ($flag) { |
|
103 | - return $result; |
|
104 | - } else { |
|
105 | - $result = $result->result_array(); |
|
106 | - return $result[0]['count']; |
|
107 | - } |
|
108 | - } else { |
|
109 | - if ($flag) { |
|
110 | - $query = (object) array('num_rows' => 0); |
|
111 | - } else { |
|
112 | - $query = 0; |
|
113 | - } |
|
114 | - return $query; |
|
115 | - } |
|
116 | - } |
|
83 | + function get_user_invoices_list($flag, $start = 0, $limit = 0) { |
|
84 | + $this->db_model->build_search('user_invoice_list_search'); |
|
85 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
86 | + $reseller_id = $accountinfo['id']; |
|
87 | + $this->db->where('accountid', $reseller_id); |
|
88 | + if ($flag) { |
|
89 | + $this->db->select('*'); |
|
90 | + } else { |
|
91 | + $this->db->select('count(id) as count'); |
|
92 | + } |
|
93 | + if ($flag) { |
|
94 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
95 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
96 | + }else{ |
|
97 | + $this->db->order_by('invoice_date', 'desc'); |
|
98 | + } |
|
99 | + } |
|
100 | + $result = $this->db->get('invoices'); |
|
101 | + if ($result->num_rows() > 0) { |
|
102 | + if ($flag) { |
|
103 | + return $result; |
|
104 | + } else { |
|
105 | + $result = $result->result_array(); |
|
106 | + return $result[0]['count']; |
|
107 | + } |
|
108 | + } else { |
|
109 | + if ($flag) { |
|
110 | + $query = (object) array('num_rows' => 0); |
|
111 | + } else { |
|
112 | + $query = 0; |
|
113 | + } |
|
114 | + return $query; |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | - function get_user_charge_history($flag, $start = 0, $limit = 0) { |
|
119 | - $this->db_model->build_search('user_charge_history_search'); |
|
120 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
121 | - $where['accountid']=$accountinfo['id']; |
|
122 | - if($this->session->userdata('advance_search') != 1){ |
|
123 | - $where['created_date >=']=gmdate("Y-m-1 00:00:00"); |
|
124 | - $where['created_date <=']=gmdate("Y-m-d 23:59:59"); |
|
125 | - } |
|
118 | + function get_user_charge_history($flag, $start = 0, $limit = 0) { |
|
119 | + $this->db_model->build_search('user_charge_history_search'); |
|
120 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
121 | + $where['accountid']=$accountinfo['id']; |
|
122 | + if($this->session->userdata('advance_search') != 1){ |
|
123 | + $where['created_date >=']=gmdate("Y-m-1 00:00:00"); |
|
124 | + $where['created_date <=']=gmdate("Y-m-d 23:59:59"); |
|
125 | + } |
|
126 | 126 | $where['item_type <>']='STANDARD'; |
127 | - if ($flag) { |
|
128 | - $query = $this->db_model->select("*", "invoice_details", $where, "id", "DESC", $limit, $start); |
|
129 | - } else { |
|
130 | - $query = $this->db_model->countQuery("*", "invoice_details", $where); |
|
131 | - } |
|
132 | - return $query; |
|
133 | - } |
|
127 | + if ($flag) { |
|
128 | + $query = $this->db_model->select("*", "invoice_details", $where, "id", "DESC", $limit, $start); |
|
129 | + } else { |
|
130 | + $query = $this->db_model->countQuery("*", "invoice_details", $where); |
|
131 | + } |
|
132 | + return $query; |
|
133 | + } |
|
134 | 134 | |
135 | - function get_user_refill_list($flag, $start = '', $limit = '') { |
|
136 | - $this->db_model->build_search('user_refill_report_search'); |
|
137 | - $accountinfo = $this->session->userdata['accountinfo']; |
|
138 | - $where = array("accountid" => $accountinfo["id"]); |
|
139 | - if ($flag) { |
|
140 | - $query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC", $limit, $start); |
|
141 | - } else { |
|
142 | - $query = $this->db_model->countQuery("*", "payments", $where); |
|
143 | - } |
|
144 | - return $query; |
|
145 | - } |
|
135 | + function get_user_refill_list($flag, $start = '', $limit = '') { |
|
136 | + $this->db_model->build_search('user_refill_report_search'); |
|
137 | + $accountinfo = $this->session->userdata['accountinfo']; |
|
138 | + $where = array("accountid" => $accountinfo["id"]); |
|
139 | + if ($flag) { |
|
140 | + $query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC", $limit, $start); |
|
141 | + } else { |
|
142 | + $query = $this->db_model->countQuery("*", "payments", $where); |
|
143 | + } |
|
144 | + return $query; |
|
145 | + } |
|
146 | 146 | |
147 | - function get_user_emails_list($flag, $start = 0, $limit = 0) { |
|
148 | - $account_data = $this->session->userdata("accountinfo"); |
|
149 | - $this->db_model->build_search('user_emails_search'); |
|
147 | + function get_user_emails_list($flag, $start = 0, $limit = 0) { |
|
148 | + $account_data = $this->session->userdata("accountinfo"); |
|
149 | + $this->db_model->build_search('user_emails_search'); |
|
150 | 150 | |
151 | - $where = array('accountid' => $account_data['id']); |
|
152 | - if ($flag) { |
|
153 | - $query = $this->db_model->select("*", "mail_details", $where, "id", "DESC", $limit, $start); |
|
154 | - } else { |
|
155 | - $query = $this->db_model->countQuery("*", "mail_details", $where); |
|
156 | - } |
|
157 | - return $query; |
|
158 | - } |
|
151 | + $where = array('accountid' => $account_data['id']); |
|
152 | + if ($flag) { |
|
153 | + $query = $this->db_model->select("*", "mail_details", $where, "id", "DESC", $limit, $start); |
|
154 | + } else { |
|
155 | + $query = $this->db_model->countQuery("*", "mail_details", $where); |
|
156 | + } |
|
157 | + return $query; |
|
158 | + } |
|
159 | 159 | |
160 | - function add_invoice_config($add_array) { |
|
161 | - $result = $this->db->insert('invoice_conf', $add_array); |
|
162 | - return true; |
|
163 | - } |
|
160 | + function add_invoice_config($add_array) { |
|
161 | + $result = $this->db->insert('invoice_conf', $add_array); |
|
162 | + return true; |
|
163 | + } |
|
164 | 164 | |
165 | - function edit_invoice_config($add_array, $edit_id) { |
|
166 | - $this->db->where('id', $edit_id); |
|
167 | - $result = $this->db->update('invoice_conf', $add_array); |
|
168 | - return true; |
|
169 | - } |
|
165 | + function edit_invoice_config($add_array, $edit_id) { |
|
166 | + $this->db->where('id', $edit_id); |
|
167 | + $result = $this->db->update('invoice_conf', $add_array); |
|
168 | + return true; |
|
169 | + } |
|
170 | 170 | |
171 | - function edit_alert_threshold($add_array, $edit_id) { |
|
172 | - $this->db->where('id', $edit_id); |
|
173 | - $result = $this->db->update('accounts', $add_array); |
|
174 | - return true; |
|
175 | - } |
|
171 | + function edit_alert_threshold($add_array, $edit_id) { |
|
172 | + $this->db->where('id', $edit_id); |
|
173 | + $result = $this->db->update('accounts', $add_array); |
|
174 | + return true; |
|
175 | + } |
|
176 | 176 | |
177 | - function user_ipmap_list($flag,$limit='',$start=''){ |
|
178 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
179 | - $where['accountid']=$accountinfo['id']; |
|
180 | - $this->db_model->build_search('user_ipmap_search'); |
|
181 | - if ($flag) { |
|
182 | - $query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $limit, $start); |
|
183 | - } else { |
|
184 | - $query = $this->db_model->countQuery("*", "ip_map", $where); |
|
185 | - } |
|
186 | - return $query; |
|
187 | - } |
|
188 | - function user_sipdevices_list($flag, $accountid = "",$start = "", $limit = "") { |
|
189 | - $where = array("accountid" => $accountid); |
|
177 | + function user_ipmap_list($flag,$limit='',$start=''){ |
|
178 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
179 | + $where['accountid']=$accountinfo['id']; |
|
180 | + $this->db_model->build_search('user_ipmap_search'); |
|
181 | + if ($flag) { |
|
182 | + $query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $limit, $start); |
|
183 | + } else { |
|
184 | + $query = $this->db_model->countQuery("*", "ip_map", $where); |
|
185 | + } |
|
186 | + return $query; |
|
187 | + } |
|
188 | + function user_sipdevices_list($flag, $accountid = "",$start = "", $limit = "") { |
|
189 | + $where = array("accountid" => $accountid); |
|
190 | 190 | $this->db_model->build_search('user_sipdevices_search'); |
191 | 191 | $query = array(); |
192 | 192 | if ($flag) { |
@@ -218,30 +218,30 @@ discard block |
||
218 | 218 | $query = $this->db_model->countQuery("*", "sip_devices", $where); |
219 | 219 | } |
220 | 220 | return $query; |
221 | - } |
|
221 | + } |
|
222 | 222 | |
223 | - function user_sipdevice_info($edit_id){ |
|
224 | - $sipdevice_info = $this->db_model->getSelect("*", "sip_devices", array('id' => $edit_id)); |
|
225 | - $sipdevice_arr = (array)$sipdevice_info->first_row(); |
|
226 | - $vars = (array)json_decode($sipdevice_arr['dir_vars']); |
|
227 | - $params = (array)json_decode($sipdevice_arr['dir_params'],true); |
|
228 | - $query = array('id' => $sipdevice_arr['id'], |
|
229 | - 'fs_username' => $sipdevice_arr['username'], |
|
230 | - 'accountcode' => $sipdevice_arr['accountid'], |
|
231 | - 'status' => $sipdevice_arr['status'], |
|
232 | - 'effective_caller_id_name' => $vars['effective_caller_id_name'], |
|
233 | - 'effective_caller_id_number' => $vars['effective_caller_id_number'], |
|
234 | - 'voicemail_enabled' => $params['vm-enabled'], |
|
235 | - 'voicemail_password' => $params['vm-password'], |
|
236 | - 'voicemail_mail_to' => $params['vm-mailto'], |
|
237 | - 'voicemail_attach_file' => $params['vm-attach-file'], |
|
238 | - 'vm_keep_local_after_email' => $params['vm-keep-local-after-email'], |
|
239 | - 'vm_send_all_message' => $params['vm-email-all-messages'], |
|
240 | - 'fs_password' => $params['password']); |
|
241 | - return $query; |
|
242 | - } |
|
243 | - function user_sipdevice_add($add_array){ |
|
244 | - $account_data = $this->session->userdata("accountinfo"); |
|
223 | + function user_sipdevice_info($edit_id){ |
|
224 | + $sipdevice_info = $this->db_model->getSelect("*", "sip_devices", array('id' => $edit_id)); |
|
225 | + $sipdevice_arr = (array)$sipdevice_info->first_row(); |
|
226 | + $vars = (array)json_decode($sipdevice_arr['dir_vars']); |
|
227 | + $params = (array)json_decode($sipdevice_arr['dir_params'],true); |
|
228 | + $query = array('id' => $sipdevice_arr['id'], |
|
229 | + 'fs_username' => $sipdevice_arr['username'], |
|
230 | + 'accountcode' => $sipdevice_arr['accountid'], |
|
231 | + 'status' => $sipdevice_arr['status'], |
|
232 | + 'effective_caller_id_name' => $vars['effective_caller_id_name'], |
|
233 | + 'effective_caller_id_number' => $vars['effective_caller_id_number'], |
|
234 | + 'voicemail_enabled' => $params['vm-enabled'], |
|
235 | + 'voicemail_password' => $params['vm-password'], |
|
236 | + 'voicemail_mail_to' => $params['vm-mailto'], |
|
237 | + 'voicemail_attach_file' => $params['vm-attach-file'], |
|
238 | + 'vm_keep_local_after_email' => $params['vm-keep-local-after-email'], |
|
239 | + 'vm_send_all_message' => $params['vm-email-all-messages'], |
|
240 | + 'fs_password' => $params['password']); |
|
241 | + return $query; |
|
242 | + } |
|
243 | + function user_sipdevice_add($add_array){ |
|
244 | + $account_data = $this->session->userdata("accountinfo"); |
|
245 | 245 | $parms_array = array('password' => $add_array['fs_password'], |
246 | 246 | 'vm-enabled' => $add_array['voicemail_enabled'], |
247 | 247 | 'vm-password' => $add_array['voicemail_password'], |
@@ -251,21 +251,21 @@ discard block |
||
251 | 251 | 'vm-email-all-messages' => $add_array['vm_send_all_message']); |
252 | 252 | $add_array['status'] = isset($add_array['status'])?$add_array['status']:"0"; |
253 | 253 | $parms_array_vars = array('effective_caller_id_name' => $add_array['effective_caller_id_name'], |
254 | - 'effective_caller_id_number' => $add_array['effective_caller_id_number'], |
|
255 | - 'user_context' => 'default'); |
|
254 | + 'effective_caller_id_number' => $add_array['effective_caller_id_number'], |
|
255 | + 'user_context' => 'default'); |
|
256 | 256 | |
257 | 257 | $new_array = array('creation_date'=>gmdate('Y-m-d H:i:s'), |
258 | - 'username' => $add_array['fs_username'], |
|
259 | - 'accountid' => $account_data['id'], |
|
260 | - 'status' => $add_array['status'], |
|
261 | - 'dir_params' => json_encode($parms_array), |
|
262 | - 'dir_vars' => json_encode($parms_array_vars), |
|
263 | - 'sip_profile_id' => $this->common->get_field_name('id','sip_profiles',array('name'=>'default'))); |
|
258 | + 'username' => $add_array['fs_username'], |
|
259 | + 'accountid' => $account_data['id'], |
|
260 | + 'status' => $add_array['status'], |
|
261 | + 'dir_params' => json_encode($parms_array), |
|
262 | + 'dir_vars' => json_encode($parms_array_vars), |
|
263 | + 'sip_profile_id' => $this->common->get_field_name('id','sip_profiles',array('name'=>'default'))); |
|
264 | 264 | $this->db->insert('sip_devices', $new_array); |
265 | 265 | $this->common->mail_to_users('add_sip_device', $account_data); |
266 | 266 | return true; |
267 | - } |
|
268 | - function user_sipdevice_edit($add_array){ |
|
267 | + } |
|
268 | + function user_sipdevice_edit($add_array){ |
|
269 | 269 | $parms_array = array('password' => $add_array['fs_password'], |
270 | 270 | 'vm-enabled' => $add_array['voicemail_enabled'], |
271 | 271 | 'vm-password' => $add_array['voicemail_password'], |
@@ -286,68 +286,68 @@ discard block |
||
286 | 286 | 'dir_vars' => json_encode($parms_array_vars), 'sip_profile_id' => $add_array['sip_profile_id']); |
287 | 287 | $this->db->update('sip_devices', $new_array,array('id'=>$add_array['id'])); |
288 | 288 | return true; |
289 | - } |
|
290 | - function getuser_cdrs_list($flag, $start, $limit,$export=true) { |
|
291 | - $this->db_model->build_search('user_cdrs_report_search'); |
|
292 | - $account_data = $this->session->userdata("accountinfo"); |
|
293 | - $field_name='debit'; |
|
294 | - if($account_data['type']==0 || $account_data['type']==1){ |
|
295 | - $where['accountid']=$account_data['id']; |
|
289 | + } |
|
290 | + function getuser_cdrs_list($flag, $start, $limit,$export=true) { |
|
291 | + $this->db_model->build_search('user_cdrs_report_search'); |
|
292 | + $account_data = $this->session->userdata("accountinfo"); |
|
293 | + $field_name='debit'; |
|
294 | + if($account_data['type']==0 || $account_data['type']==1){ |
|
295 | + $where['accountid']=$account_data['id']; |
|
296 | 296 | |
297 | - } |
|
298 | - if($account_data['type']==3){ |
|
299 | - $where['provider_id']=$account_data['id']; |
|
300 | - $field_name='cost'; |
|
301 | - } |
|
302 | - $table_name=$account_data['type'] !=1 ? 'cdrs': 'reseller_cdrs'; |
|
303 | - if($this->session->userdata('advance_search') != 1){ |
|
304 | - $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
305 | - $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
306 | - } |
|
307 | - $this->db->where($where); |
|
308 | - $this->db->order_by("callstart desc"); |
|
309 | - if ($flag) { |
|
310 | - if (!$export) |
|
311 | - $this->db->limit($limit, $start); |
|
312 | - $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
|
313 | - }else { |
|
314 | - $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids'); |
|
315 | - } |
|
316 | - $result = $this->db->get($table_name); |
|
317 | - return $result; |
|
318 | - } |
|
297 | + } |
|
298 | + if($account_data['type']==3){ |
|
299 | + $where['provider_id']=$account_data['id']; |
|
300 | + $field_name='cost'; |
|
301 | + } |
|
302 | + $table_name=$account_data['type'] !=1 ? 'cdrs': 'reseller_cdrs'; |
|
303 | + if($this->session->userdata('advance_search') != 1){ |
|
304 | + $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
305 | + $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
306 | + } |
|
307 | + $this->db->where($where); |
|
308 | + $this->db->order_by("callstart desc"); |
|
309 | + if ($flag) { |
|
310 | + if (!$export) |
|
311 | + $this->db->limit($limit, $start); |
|
312 | + $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
|
313 | + }else { |
|
314 | + $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids'); |
|
315 | + } |
|
316 | + $result = $this->db->get($table_name); |
|
317 | + return $result; |
|
318 | + } |
|
319 | 319 | |
320 | - function user_fund_transfer($data){ |
|
320 | + function user_fund_transfer($data){ |
|
321 | 321 | $accountinfo = $this->session->userdata['accountinfo']; |
322 | - $data["payment_by"] = $accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : -1 ; |
|
323 | - $data['accountid'] = $data['id']; |
|
324 | - $data['payment_mode'] = $data['payment_type']; |
|
325 | - unset($data['action'],$data['id'],$data['account_currency'],$data['payment_type']); |
|
326 | - if (isset($data)) { |
|
327 | - $data['credit']=$data['credit'] =='' ? 0 : $data['credit']; |
|
328 | - $date = gmdate('Y-m-d H:i:s'); |
|
329 | - $accountid=$data['accountid']; |
|
330 | - while($accountid > 0 ){ |
|
331 | - $customer_id=$accountid; |
|
332 | - $accountid=$this->common_model->get_parent_info($accountid); |
|
333 | - $parent_id=$accountid > 0 ? $accountid : -1; |
|
334 | - $balance = $this->db_model->update_balance($data['credit'], $customer_id,$data['payment_mode']); |
|
335 | - if($data['payment_mode'] == 0){ |
|
336 | - $insert_arr = array("accountid" => $customer_id, |
|
337 | - "credit" => $data['credit'], |
|
338 | - 'payment_mode'=>$data['payment_mode'], |
|
339 | - 'type'=>"SYSTEM", |
|
340 | - "notes" => $data['notes'], |
|
341 | - "payment_date" => $date, |
|
342 | - 'payment_by'=>$parent_id, |
|
343 | - ); |
|
344 | - return $this->db->insert("payments", $insert_arr); |
|
345 | - } |
|
346 | - } |
|
347 | - } |
|
348 | - } |
|
349 | - function user_dashboard_recent_recharge_info() |
|
350 | - { |
|
322 | + $data["payment_by"] = $accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : -1 ; |
|
323 | + $data['accountid'] = $data['id']; |
|
324 | + $data['payment_mode'] = $data['payment_type']; |
|
325 | + unset($data['action'],$data['id'],$data['account_currency'],$data['payment_type']); |
|
326 | + if (isset($data)) { |
|
327 | + $data['credit']=$data['credit'] =='' ? 0 : $data['credit']; |
|
328 | + $date = gmdate('Y-m-d H:i:s'); |
|
329 | + $accountid=$data['accountid']; |
|
330 | + while($accountid > 0 ){ |
|
331 | + $customer_id=$accountid; |
|
332 | + $accountid=$this->common_model->get_parent_info($accountid); |
|
333 | + $parent_id=$accountid > 0 ? $accountid : -1; |
|
334 | + $balance = $this->db_model->update_balance($data['credit'], $customer_id,$data['payment_mode']); |
|
335 | + if($data['payment_mode'] == 0){ |
|
336 | + $insert_arr = array("accountid" => $customer_id, |
|
337 | + "credit" => $data['credit'], |
|
338 | + 'payment_mode'=>$data['payment_mode'], |
|
339 | + 'type'=>"SYSTEM", |
|
340 | + "notes" => $data['notes'], |
|
341 | + "payment_date" => $date, |
|
342 | + 'payment_by'=>$parent_id, |
|
343 | + ); |
|
344 | + return $this->db->insert("payments", $insert_arr); |
|
345 | + } |
|
346 | + } |
|
347 | + } |
|
348 | + } |
|
349 | + function user_dashboard_recent_recharge_info() |
|
350 | + { |
|
351 | 351 | $accountinfo=$this->session->userdata('accountinfo'); |
352 | 352 | $userlevel_logintype=$this->session->userdata('userlevel_logintype'); |
353 | 353 | |
@@ -358,132 +358,132 @@ discard block |
||
358 | 358 | if($userlevel_logintype == 0 || $userlevel_logintype == 3){ |
359 | 359 | $where_arr=array('accountid'=>$accountinfo['id']); |
360 | 360 | } |
361 | - $this->db->where($where_arr); |
|
362 | - $this->db->select('id,accountid,credit,payment_date,notes'); |
|
363 | - $this->db->from('payments'); |
|
364 | - $this->db->limit(10); |
|
365 | - $this->db->order_by('payment_date','desc'); |
|
361 | + $this->db->where($where_arr); |
|
362 | + $this->db->select('id,accountid,credit,payment_date,notes'); |
|
363 | + $this->db->from('payments'); |
|
364 | + $this->db->limit(10); |
|
365 | + $this->db->order_by('payment_date','desc'); |
|
366 | 366 | return $this->db->get(); |
367 | - } |
|
367 | + } |
|
368 | 368 | |
369 | - function get_user_rates_list($flag, $start = 0, $limit = 0) { |
|
370 | - $this->db_model->build_search('user_rates_list_search'); |
|
371 | - $account_data = $this->session->userdata("accountinfo"); |
|
372 | - $where = array("pricelist_id" => $account_data["pricelist_id"],"status" => '0'); |
|
373 | - if ($flag) { |
|
374 | - $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start); |
|
375 | - } else { |
|
376 | - $query = $this->db_model->countQuery("*", "routes", $where); |
|
377 | - } |
|
378 | - return $query; |
|
379 | - } |
|
380 | - function get_user_opensips($flag, $account_number = "", $start = "0", $limit = "0") { |
|
381 | - $this->db_model->build_search_opensips($this->opensips_db,'user_opensips_search'); |
|
382 | - $this->opensips_db->where('accountcode',$account_number); |
|
383 | - if ($flag) { |
|
384 | - $this->opensips_db->limit($limit,$start); |
|
385 | - } |
|
386 | - $result = $this->opensips_db->get("subscriber"); |
|
387 | - if($result->num_rows() > 0){ |
|
369 | + function get_user_rates_list($flag, $start = 0, $limit = 0) { |
|
370 | + $this->db_model->build_search('user_rates_list_search'); |
|
371 | + $account_data = $this->session->userdata("accountinfo"); |
|
372 | + $where = array("pricelist_id" => $account_data["pricelist_id"],"status" => '0'); |
|
373 | + if ($flag) { |
|
374 | + $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start); |
|
375 | + } else { |
|
376 | + $query = $this->db_model->countQuery("*", "routes", $where); |
|
377 | + } |
|
378 | + return $query; |
|
379 | + } |
|
380 | + function get_user_opensips($flag, $account_number = "", $start = "0", $limit = "0") { |
|
381 | + $this->db_model->build_search_opensips($this->opensips_db,'user_opensips_search'); |
|
382 | + $this->opensips_db->where('accountcode',$account_number); |
|
383 | + if ($flag) { |
|
384 | + $this->opensips_db->limit($limit,$start); |
|
385 | + } |
|
386 | + $result = $this->opensips_db->get("subscriber"); |
|
387 | + if($result->num_rows() > 0){ |
|
388 | 388 | if($flag){ |
389 | - return $result; |
|
389 | + return $result; |
|
390 | 390 | } |
391 | 391 | else{ |
392 | - return $result->num_rows(); |
|
392 | + return $result->num_rows(); |
|
393 | 393 | } |
394 | - }else{ |
|
395 | - if($flag){ |
|
396 | - $result=(object)array('num_rows'=>0); |
|
394 | + }else{ |
|
395 | + if($flag){ |
|
396 | + $result=(object)array('num_rows'=>0); |
|
397 | 397 | } |
398 | 398 | else{ |
399 | - $result=0; |
|
399 | + $result=0; |
|
400 | 400 | } |
401 | 401 | return $result; |
402 | - } |
|
403 | - } |
|
404 | - function user_opensips_add($data) { |
|
405 | - unset($data["action"]); |
|
406 | - $data['creation_date']=gmdate("Y-m-d H:i:s"); |
|
407 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
402 | + } |
|
403 | + } |
|
404 | + function user_opensips_add($data) { |
|
405 | + unset($data["action"]); |
|
406 | + $data['creation_date']=gmdate("Y-m-d H:i:s"); |
|
407 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
408 | 408 | $data['reseller_id']=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
409 | - $this->opensips_db->insert("subscriber", $data); |
|
410 | - } |
|
409 | + $this->opensips_db->insert("subscriber", $data); |
|
410 | + } |
|
411 | 411 | |
412 | - function user_opensips_edit($data, $id) { |
|
413 | - unset($data["action"]); |
|
414 | - $data=array("username"=>$data['username'],"password"=>$data['password'],"accountcode"=>$data['accountcode'],"domain"=>$data['domain']); |
|
415 | - $this->opensips_db->where("id", $id); |
|
416 | - $data['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
417 | - $this->opensips_db->update("subscriber", $data); |
|
418 | - } |
|
419 | - function user_opensips_delete($id) { |
|
420 | - $this->opensips_db->where("id", $id); |
|
421 | - $this->opensips_db->delete("subscriber"); |
|
422 | - return true; |
|
423 | - } |
|
424 | - function get_user_invoice_list($flag, $start = 0, $limit = 0){ |
|
412 | + function user_opensips_edit($data, $id) { |
|
413 | + unset($data["action"]); |
|
414 | + $data=array("username"=>$data['username'],"password"=>$data['password'],"accountcode"=>$data['accountcode'],"domain"=>$data['domain']); |
|
415 | + $this->opensips_db->where("id", $id); |
|
416 | + $data['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
417 | + $this->opensips_db->update("subscriber", $data); |
|
418 | + } |
|
419 | + function user_opensips_delete($id) { |
|
420 | + $this->opensips_db->where("id", $id); |
|
421 | + $this->opensips_db->delete("subscriber"); |
|
422 | + return true; |
|
423 | + } |
|
424 | + function get_user_invoice_list($flag, $start = 0, $limit = 0){ |
|
425 | 425 | $this->db_model->build_search('user_invoice_list_search'); |
426 | 426 | $accountinfo=$this->session->userdata('accountinfo'); |
427 | - $where = array("accountid" => $accountinfo['id'],'confirm'=>1); |
|
427 | + $where = array("accountid" => $accountinfo['id'],'confirm'=>1); |
|
428 | 428 | $this->db->where($where); |
429 | 429 | $or_where= "(type='I' OR type='R')"; |
430 | 430 | $this->db->where($or_where); |
431 | - if ($flag) { |
|
432 | - $query = $this->db_model->select("*", "invoices", "", "invoice_date", "desc", $limit, $start); |
|
431 | + if ($flag) { |
|
432 | + $query = $this->db_model->select("*", "invoices", "", "invoice_date", "desc", $limit, $start); |
|
433 | 433 | |
434 | - } else { |
|
435 | - $query = $this->db_model->countQuery("*", "invoices", ""); |
|
436 | - } |
|
434 | + } else { |
|
435 | + $query = $this->db_model->countQuery("*", "invoices", ""); |
|
436 | + } |
|
437 | 437 | |
438 | - return $query; |
|
439 | - } |
|
440 | - function get_user_cdrs_info($flag,$accountid,$start = 0, $limit = 0){ |
|
441 | - if ($flag) { |
|
442 | - $query = $this->db_model->select("*", "reseller_cdrs", "", "invoice_date", "desc", $limit, $start); |
|
438 | + return $query; |
|
439 | + } |
|
440 | + function get_user_cdrs_info($flag,$accountid,$start = 0, $limit = 0){ |
|
441 | + if ($flag) { |
|
442 | + $query = $this->db_model->select("*", "reseller_cdrs", "", "invoice_date", "desc", $limit, $start); |
|
443 | 443 | |
444 | - } else { |
|
445 | - $query = $this->db_model->countQuery("*", "invoices", ""); |
|
446 | - } |
|
444 | + } else { |
|
445 | + $query = $this->db_model->countQuery("*", "invoices", ""); |
|
446 | + } |
|
447 | 447 | |
448 | - } |
|
449 | - function get_invoiceconf($accountid) { |
|
450 | - $return_array=array(); |
|
448 | + } |
|
449 | + function get_invoiceconf($accountid) { |
|
450 | + $return_array=array(); |
|
451 | 451 | $logintype = $this->session->userdata('logintype'); |
452 | - if ($logintype == 1 || $logintype == 5) { |
|
452 | + if ($logintype == 1 || $logintype == 5) { |
|
453 | 453 | |
454 | 454 | $where = array("accountid" => $this->session->userdata["accountinfo"]['id']); |
455 | - }else{ |
|
456 | - $where=array('id'=> $accountid); |
|
455 | + }else{ |
|
456 | + $where=array('id'=> $accountid); |
|
457 | 457 | } |
458 | - $query = $this->db_model->getSelect("*","invoice_conf",$where); |
|
459 | - foreach($query->result_array() as $key => $value) |
|
460 | - { |
|
461 | - $return_array=$value; |
|
462 | - } |
|
463 | - return $return_array; |
|
464 | - } |
|
458 | + $query = $this->db_model->getSelect("*","invoice_conf",$where); |
|
459 | + foreach($query->result_array() as $key => $value) |
|
460 | + { |
|
461 | + $return_array=$value; |
|
462 | + } |
|
463 | + return $return_array; |
|
464 | + } |
|
465 | 465 | |
466 | 466 | |
467 | - function getprovider_cdrs_list($flag, $start, $limit,$export=true) { |
|
468 | - $this->db_model->build_search('user_provider_cdrs_report_search'); |
|
469 | - $account_data = $this->session->userdata("accountinfo"); |
|
470 | - $where['provider_id']=$account_data['id']; |
|
471 | - if($this->session->userdata('advance_search') != 1){ |
|
472 | - $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
473 | - $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
474 | - } |
|
475 | - $this->db->where($where); |
|
476 | - $this->db->order_by("callstart","desc"); |
|
477 | - if ($flag) { |
|
478 | - if (!$export) |
|
479 | - $this->db->limit($limit, $start); |
|
480 | - $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
|
481 | - }else { |
|
482 | - $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost,group_concat(distinct(trunk_id)) as trunk_ids'); |
|
483 | - } |
|
484 | - $result = $this->db->get('cdrs'); |
|
485 | - return $result; |
|
486 | - } |
|
467 | + function getprovider_cdrs_list($flag, $start, $limit,$export=true) { |
|
468 | + $this->db_model->build_search('user_provider_cdrs_report_search'); |
|
469 | + $account_data = $this->session->userdata("accountinfo"); |
|
470 | + $where['provider_id']=$account_data['id']; |
|
471 | + if($this->session->userdata('advance_search') != 1){ |
|
472 | + $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
473 | + $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
474 | + } |
|
475 | + $this->db->where($where); |
|
476 | + $this->db->order_by("callstart","desc"); |
|
477 | + if ($flag) { |
|
478 | + if (!$export) |
|
479 | + $this->db->limit($limit, $start); |
|
480 | + $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
|
481 | + }else { |
|
482 | + $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost,group_concat(distinct(trunk_id)) as trunk_ids'); |
|
483 | + } |
|
484 | + $result = $this->db->get('cdrs'); |
|
485 | + return $result; |
|
486 | + } |
|
487 | 487 | |
488 | 488 | } |
489 | 489 |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | |
27 | 27 | function user_model() { |
28 | 28 | parent::__construct(); |
29 | - if(Common_model::$global_config['system_config']['opensips']==0){ |
|
29 | + if (Common_model::$global_config['system_config']['opensips'] == 0) { |
|
30 | 30 | $db_config = Common_model::$global_config['system_config']; |
31 | - $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="; |
|
31 | + $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="; |
|
32 | 32 | $this->opensips_db = $this->load->database($opensipdsn, true); |
33 | 33 | } |
34 | 34 | } |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | $this->db->select('count(id) as count'); |
92 | 92 | } |
93 | 93 | if ($flag) { |
94 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
95 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
96 | - }else{ |
|
94 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') { |
|
95 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']); |
|
96 | + } else { |
|
97 | 97 | $this->db->order_by('invoice_date', 'desc'); |
98 | 98 | } |
99 | 99 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | } else { |
109 | 109 | if ($flag) { |
110 | - $query = (object) array('num_rows' => 0); |
|
110 | + $query = (object)array('num_rows' => 0); |
|
111 | 111 | } else { |
112 | 112 | $query = 0; |
113 | 113 | } |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | |
118 | 118 | function get_user_charge_history($flag, $start = 0, $limit = 0) { |
119 | 119 | $this->db_model->build_search('user_charge_history_search'); |
120 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
121 | - $where['accountid']=$accountinfo['id']; |
|
122 | - if($this->session->userdata('advance_search') != 1){ |
|
123 | - $where['created_date >=']=gmdate("Y-m-1 00:00:00"); |
|
124 | - $where['created_date <=']=gmdate("Y-m-d 23:59:59"); |
|
120 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
121 | + $where['accountid'] = $accountinfo['id']; |
|
122 | + if ($this->session->userdata('advance_search') != 1) { |
|
123 | + $where['created_date >='] = gmdate("Y-m-1 00:00:00"); |
|
124 | + $where['created_date <='] = gmdate("Y-m-d 23:59:59"); |
|
125 | 125 | } |
126 | - $where['item_type <>']='STANDARD'; |
|
126 | + $where['item_type <>'] = 'STANDARD'; |
|
127 | 127 | if ($flag) { |
128 | 128 | $query = $this->db_model->select("*", "invoice_details", $where, "id", "DESC", $limit, $start); |
129 | 129 | } else { |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | return true; |
175 | 175 | } |
176 | 176 | |
177 | - function user_ipmap_list($flag,$limit='',$start=''){ |
|
178 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
179 | - $where['accountid']=$accountinfo['id']; |
|
177 | + function user_ipmap_list($flag, $limit = '', $start = '') { |
|
178 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
179 | + $where['accountid'] = $accountinfo['id']; |
|
180 | 180 | $this->db_model->build_search('user_ipmap_search'); |
181 | 181 | if ($flag) { |
182 | 182 | $query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $limit, $start); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | return $query; |
187 | 187 | } |
188 | - function user_sipdevices_list($flag, $accountid = "",$start = "", $limit = "") { |
|
188 | + function user_sipdevices_list($flag, $accountid = "", $start = "", $limit = "") { |
|
189 | 189 | $where = array("accountid" => $accountid); |
190 | 190 | $this->db_model->build_search('user_sipdevices_search'); |
191 | 191 | $query = array(); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $add_array = $deviceinfo->result_array(); |
196 | 196 | foreach ($add_array as $key => $value) { |
197 | 197 | $vars = json_decode($value['dir_vars']); |
198 | - $vars_new = json_decode($value['dir_params'],true); |
|
198 | + $vars_new = json_decode($value['dir_params'], true); |
|
199 | 199 | $passowrds = json_decode($value['dir_params']); |
200 | 200 | $query[] = array('id' => $value['id'], |
201 | 201 | 'username' => $value['username'], |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | return $query; |
221 | 221 | } |
222 | 222 | |
223 | - function user_sipdevice_info($edit_id){ |
|
223 | + function user_sipdevice_info($edit_id) { |
|
224 | 224 | $sipdevice_info = $this->db_model->getSelect("*", "sip_devices", array('id' => $edit_id)); |
225 | 225 | $sipdevice_arr = (array)$sipdevice_info->first_row(); |
226 | 226 | $vars = (array)json_decode($sipdevice_arr['dir_vars']); |
227 | - $params = (array)json_decode($sipdevice_arr['dir_params'],true); |
|
227 | + $params = (array)json_decode($sipdevice_arr['dir_params'], true); |
|
228 | 228 | $query = array('id' => $sipdevice_arr['id'], |
229 | 229 | 'fs_username' => $sipdevice_arr['username'], |
230 | 230 | 'accountcode' => $sipdevice_arr['accountid'], |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | 'fs_password' => $params['password']); |
241 | 241 | return $query; |
242 | 242 | } |
243 | - function user_sipdevice_add($add_array){ |
|
243 | + function user_sipdevice_add($add_array) { |
|
244 | 244 | $account_data = $this->session->userdata("accountinfo"); |
245 | 245 | $parms_array = array('password' => $add_array['fs_password'], |
246 | 246 | 'vm-enabled' => $add_array['voicemail_enabled'], |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | 'vm-attach-file' => $add_array['voicemail_attach_file'], |
250 | 250 | 'vm-keep-local-after-email' => $add_array['vm_keep_local_after_email'], |
251 | 251 | 'vm-email-all-messages' => $add_array['vm_send_all_message']); |
252 | - $add_array['status'] = isset($add_array['status'])?$add_array['status']:"0"; |
|
252 | + $add_array['status'] = isset($add_array['status']) ? $add_array['status'] : "0"; |
|
253 | 253 | $parms_array_vars = array('effective_caller_id_name' => $add_array['effective_caller_id_name'], |
254 | 254 | 'effective_caller_id_number' => $add_array['effective_caller_id_number'], |
255 | 255 | 'user_context' => 'default'); |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | 'status' => $add_array['status'], |
261 | 261 | 'dir_params' => json_encode($parms_array), |
262 | 262 | 'dir_vars' => json_encode($parms_array_vars), |
263 | - 'sip_profile_id' => $this->common->get_field_name('id','sip_profiles',array('name'=>'default'))); |
|
263 | + 'sip_profile_id' => $this->common->get_field_name('id', 'sip_profiles', array('name'=>'default'))); |
|
264 | 264 | $this->db->insert('sip_devices', $new_array); |
265 | 265 | $this->common->mail_to_users('add_sip_device', $account_data); |
266 | 266 | return true; |
267 | 267 | } |
268 | - function user_sipdevice_edit($add_array){ |
|
268 | + function user_sipdevice_edit($add_array) { |
|
269 | 269 | $parms_array = array('password' => $add_array['fs_password'], |
270 | 270 | 'vm-enabled' => $add_array['voicemail_enabled'], |
271 | 271 | 'vm-password' => $add_array['voicemail_password'], |
@@ -277,62 +277,62 @@ discard block |
||
277 | 277 | $parms_array_vars = array('effective_caller_id_name' => $add_array['effective_caller_id_name'], |
278 | 278 | 'effective_caller_id_number' => $add_array['effective_caller_id_number'],); |
279 | 279 | $log_type = $this->session->userdata("logintype"); |
280 | - if($log_type == 0 || $log_type == 3 || $log_type == 1){ |
|
281 | - $add_array['sip_profile_id']=$this->common->get_field_name('id','sip_profiles',array('name'=>'default')); |
|
280 | + if ($log_type == 0 || $log_type == 3 || $log_type == 1) { |
|
281 | + $add_array['sip_profile_id'] = $this->common->get_field_name('id', 'sip_profiles', array('name'=>'default')); |
|
282 | 282 | } |
283 | - $add_array['status'] = isset($add_array['status'])?$add_array['status']:"0"; |
|
284 | - $new_array = array('last_modified_date'=>gmdate('Y-m-d H:i:s'),'username' => $add_array['fs_username'],'status' => $add_array['status'], |
|
283 | + $add_array['status'] = isset($add_array['status']) ? $add_array['status'] : "0"; |
|
284 | + $new_array = array('last_modified_date'=>gmdate('Y-m-d H:i:s'), 'username' => $add_array['fs_username'], 'status' => $add_array['status'], |
|
285 | 285 | 'dir_params' => json_encode($parms_array), |
286 | 286 | 'dir_vars' => json_encode($parms_array_vars), 'sip_profile_id' => $add_array['sip_profile_id']); |
287 | - $this->db->update('sip_devices', $new_array,array('id'=>$add_array['id'])); |
|
287 | + $this->db->update('sip_devices', $new_array, array('id'=>$add_array['id'])); |
|
288 | 288 | return true; |
289 | 289 | } |
290 | - function getuser_cdrs_list($flag, $start, $limit,$export=true) { |
|
290 | + function getuser_cdrs_list($flag, $start, $limit, $export = true) { |
|
291 | 291 | $this->db_model->build_search('user_cdrs_report_search'); |
292 | 292 | $account_data = $this->session->userdata("accountinfo"); |
293 | - $field_name='debit'; |
|
294 | - if($account_data['type']==0 || $account_data['type']==1){ |
|
295 | - $where['accountid']=$account_data['id']; |
|
293 | + $field_name = 'debit'; |
|
294 | + if ($account_data['type'] == 0 || $account_data['type'] == 1) { |
|
295 | + $where['accountid'] = $account_data['id']; |
|
296 | 296 | |
297 | 297 | } |
298 | - if($account_data['type']==3){ |
|
299 | - $where['provider_id']=$account_data['id']; |
|
300 | - $field_name='cost'; |
|
298 | + if ($account_data['type'] == 3) { |
|
299 | + $where['provider_id'] = $account_data['id']; |
|
300 | + $field_name = 'cost'; |
|
301 | 301 | } |
302 | - $table_name=$account_data['type'] !=1 ? 'cdrs': 'reseller_cdrs'; |
|
303 | - if($this->session->userdata('advance_search') != 1){ |
|
304 | - $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
305 | - $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
302 | + $table_name = $account_data['type'] != 1 ? 'cdrs' : 'reseller_cdrs'; |
|
303 | + if ($this->session->userdata('advance_search') != 1) { |
|
304 | + $where['callstart >= '] = date("Y-m-d")." 00:00:00"; |
|
305 | + $where['callstart <='] = date("Y-m-d")." 23:59:59"; |
|
306 | 306 | } |
307 | 307 | $this->db->where($where); |
308 | 308 | $this->db->order_by("callstart desc"); |
309 | 309 | if ($flag) { |
310 | - if (!$export) |
|
310 | + if ( ! $export) |
|
311 | 311 | $this->db->limit($limit, $start); |
312 | 312 | $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
313 | - }else { |
|
313 | + } else { |
|
314 | 314 | $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids'); |
315 | 315 | } |
316 | 316 | $result = $this->db->get($table_name); |
317 | 317 | return $result; |
318 | 318 | } |
319 | 319 | |
320 | - function user_fund_transfer($data){ |
|
320 | + function user_fund_transfer($data) { |
|
321 | 321 | $accountinfo = $this->session->userdata['accountinfo']; |
322 | - $data["payment_by"] = $accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : -1 ; |
|
322 | + $data["payment_by"] = $accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : -1; |
|
323 | 323 | $data['accountid'] = $data['id']; |
324 | 324 | $data['payment_mode'] = $data['payment_type']; |
325 | - unset($data['action'],$data['id'],$data['account_currency'],$data['payment_type']); |
|
325 | + unset($data['action'], $data['id'], $data['account_currency'], $data['payment_type']); |
|
326 | 326 | if (isset($data)) { |
327 | - $data['credit']=$data['credit'] =='' ? 0 : $data['credit']; |
|
327 | + $data['credit'] = $data['credit'] == '' ? 0 : $data['credit']; |
|
328 | 328 | $date = gmdate('Y-m-d H:i:s'); |
329 | - $accountid=$data['accountid']; |
|
330 | - while($accountid > 0 ){ |
|
331 | - $customer_id=$accountid; |
|
332 | - $accountid=$this->common_model->get_parent_info($accountid); |
|
333 | - $parent_id=$accountid > 0 ? $accountid : -1; |
|
334 | - $balance = $this->db_model->update_balance($data['credit'], $customer_id,$data['payment_mode']); |
|
335 | - if($data['payment_mode'] == 0){ |
|
329 | + $accountid = $data['accountid']; |
|
330 | + while ($accountid > 0) { |
|
331 | + $customer_id = $accountid; |
|
332 | + $accountid = $this->common_model->get_parent_info($accountid); |
|
333 | + $parent_id = $accountid > 0 ? $accountid : -1; |
|
334 | + $balance = $this->db_model->update_balance($data['credit'], $customer_id, $data['payment_mode']); |
|
335 | + if ($data['payment_mode'] == 0) { |
|
336 | 336 | $insert_arr = array("accountid" => $customer_id, |
337 | 337 | "credit" => $data['credit'], |
338 | 338 | 'payment_mode'=>$data['payment_mode'], |
@@ -348,28 +348,28 @@ discard block |
||
348 | 348 | } |
349 | 349 | function user_dashboard_recent_recharge_info() |
350 | 350 | { |
351 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
352 | - $userlevel_logintype=$this->session->userdata('userlevel_logintype'); |
|
351 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
352 | + $userlevel_logintype = $this->session->userdata('userlevel_logintype'); |
|
353 | 353 | |
354 | - $where_arr=array('payment_by'=>-1); |
|
355 | - if($userlevel_logintype == 1){ |
|
356 | - $where_arr=array('payment_by'=>$accountinfo['id']); |
|
354 | + $where_arr = array('payment_by'=>-1); |
|
355 | + if ($userlevel_logintype == 1) { |
|
356 | + $where_arr = array('payment_by'=>$accountinfo['id']); |
|
357 | 357 | } |
358 | - if($userlevel_logintype == 0 || $userlevel_logintype == 3){ |
|
359 | - $where_arr=array('accountid'=>$accountinfo['id']); |
|
358 | + if ($userlevel_logintype == 0 || $userlevel_logintype == 3) { |
|
359 | + $where_arr = array('accountid'=>$accountinfo['id']); |
|
360 | 360 | } |
361 | 361 | $this->db->where($where_arr); |
362 | 362 | $this->db->select('id,accountid,credit,payment_date,notes'); |
363 | 363 | $this->db->from('payments'); |
364 | 364 | $this->db->limit(10); |
365 | - $this->db->order_by('payment_date','desc'); |
|
365 | + $this->db->order_by('payment_date', 'desc'); |
|
366 | 366 | return $this->db->get(); |
367 | 367 | } |
368 | 368 | |
369 | 369 | function get_user_rates_list($flag, $start = 0, $limit = 0) { |
370 | 370 | $this->db_model->build_search('user_rates_list_search'); |
371 | 371 | $account_data = $this->session->userdata("accountinfo"); |
372 | - $where = array("pricelist_id" => $account_data["pricelist_id"],"status" => '0'); |
|
372 | + $where = array("pricelist_id" => $account_data["pricelist_id"], "status" => '0'); |
|
373 | 373 | if ($flag) { |
374 | 374 | $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start); |
375 | 375 | } else { |
@@ -378,42 +378,42 @@ discard block |
||
378 | 378 | return $query; |
379 | 379 | } |
380 | 380 | function get_user_opensips($flag, $account_number = "", $start = "0", $limit = "0") { |
381 | - $this->db_model->build_search_opensips($this->opensips_db,'user_opensips_search'); |
|
382 | - $this->opensips_db->where('accountcode',$account_number); |
|
381 | + $this->db_model->build_search_opensips($this->opensips_db, 'user_opensips_search'); |
|
382 | + $this->opensips_db->where('accountcode', $account_number); |
|
383 | 383 | if ($flag) { |
384 | - $this->opensips_db->limit($limit,$start); |
|
384 | + $this->opensips_db->limit($limit, $start); |
|
385 | 385 | } |
386 | 386 | $result = $this->opensips_db->get("subscriber"); |
387 | - if($result->num_rows() > 0){ |
|
388 | - if($flag){ |
|
387 | + if ($result->num_rows() > 0) { |
|
388 | + if ($flag) { |
|
389 | 389 | return $result; |
390 | 390 | } |
391 | - else{ |
|
391 | + else { |
|
392 | 392 | return $result->num_rows(); |
393 | 393 | } |
394 | - }else{ |
|
395 | - if($flag){ |
|
396 | - $result=(object)array('num_rows'=>0); |
|
394 | + } else { |
|
395 | + if ($flag) { |
|
396 | + $result = (object)array('num_rows'=>0); |
|
397 | 397 | } |
398 | - else{ |
|
399 | - $result=0; |
|
398 | + else { |
|
399 | + $result = 0; |
|
400 | 400 | } |
401 | 401 | return $result; |
402 | 402 | } |
403 | 403 | } |
404 | 404 | function user_opensips_add($data) { |
405 | 405 | unset($data["action"]); |
406 | - $data['creation_date']=gmdate("Y-m-d H:i:s"); |
|
407 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
408 | - $data['reseller_id']=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
|
406 | + $data['creation_date'] = gmdate("Y-m-d H:i:s"); |
|
407 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
408 | + $data['reseller_id'] = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
409 | 409 | $this->opensips_db->insert("subscriber", $data); |
410 | 410 | } |
411 | 411 | |
412 | 412 | function user_opensips_edit($data, $id) { |
413 | 413 | unset($data["action"]); |
414 | - $data=array("username"=>$data['username'],"password"=>$data['password'],"accountcode"=>$data['accountcode'],"domain"=>$data['domain']); |
|
414 | + $data = array("username"=>$data['username'], "password"=>$data['password'], "accountcode"=>$data['accountcode'], "domain"=>$data['domain']); |
|
415 | 415 | $this->opensips_db->where("id", $id); |
416 | - $data['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
416 | + $data['last_modified_date'] = gmdate("Y-m-d H:i:s"); |
|
417 | 417 | $this->opensips_db->update("subscriber", $data); |
418 | 418 | } |
419 | 419 | function user_opensips_delete($id) { |
@@ -421,12 +421,12 @@ discard block |
||
421 | 421 | $this->opensips_db->delete("subscriber"); |
422 | 422 | return true; |
423 | 423 | } |
424 | - function get_user_invoice_list($flag, $start = 0, $limit = 0){ |
|
424 | + function get_user_invoice_list($flag, $start = 0, $limit = 0) { |
|
425 | 425 | $this->db_model->build_search('user_invoice_list_search'); |
426 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
427 | - $where = array("accountid" => $accountinfo['id'],'confirm'=>1); |
|
426 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
427 | + $where = array("accountid" => $accountinfo['id'], 'confirm'=>1); |
|
428 | 428 | $this->db->where($where); |
429 | - $or_where= "(type='I' OR type='R')"; |
|
429 | + $or_where = "(type='I' OR type='R')"; |
|
430 | 430 | $this->db->where($or_where); |
431 | 431 | if ($flag) { |
432 | 432 | $query = $this->db_model->select("*", "invoices", "", "invoice_date", "desc", $limit, $start); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | |
438 | 438 | return $query; |
439 | 439 | } |
440 | - function get_user_cdrs_info($flag,$accountid,$start = 0, $limit = 0){ |
|
440 | + function get_user_cdrs_info($flag, $accountid, $start = 0, $limit = 0) { |
|
441 | 441 | if ($flag) { |
442 | 442 | $query = $this->db_model->select("*", "reseller_cdrs", "", "invoice_date", "desc", $limit, $start); |
443 | 443 | |
@@ -447,38 +447,38 @@ discard block |
||
447 | 447 | |
448 | 448 | } |
449 | 449 | function get_invoiceconf($accountid) { |
450 | - $return_array=array(); |
|
450 | + $return_array = array(); |
|
451 | 451 | $logintype = $this->session->userdata('logintype'); |
452 | 452 | if ($logintype == 1 || $logintype == 5) { |
453 | 453 | |
454 | 454 | $where = array("accountid" => $this->session->userdata["accountinfo"]['id']); |
455 | - }else{ |
|
456 | - $where=array('id'=> $accountid); |
|
455 | + } else { |
|
456 | + $where = array('id'=> $accountid); |
|
457 | 457 | } |
458 | - $query = $this->db_model->getSelect("*","invoice_conf",$where); |
|
459 | - foreach($query->result_array() as $key => $value) |
|
458 | + $query = $this->db_model->getSelect("*", "invoice_conf", $where); |
|
459 | + foreach ($query->result_array() as $key => $value) |
|
460 | 460 | { |
461 | - $return_array=$value; |
|
461 | + $return_array = $value; |
|
462 | 462 | } |
463 | 463 | return $return_array; |
464 | 464 | } |
465 | 465 | |
466 | 466 | |
467 | - function getprovider_cdrs_list($flag, $start, $limit,$export=true) { |
|
467 | + function getprovider_cdrs_list($flag, $start, $limit, $export = true) { |
|
468 | 468 | $this->db_model->build_search('user_provider_cdrs_report_search'); |
469 | 469 | $account_data = $this->session->userdata("accountinfo"); |
470 | - $where['provider_id']=$account_data['id']; |
|
471 | - if($this->session->userdata('advance_search') != 1){ |
|
472 | - $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
473 | - $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
470 | + $where['provider_id'] = $account_data['id']; |
|
471 | + if ($this->session->userdata('advance_search') != 1) { |
|
472 | + $where['callstart >= '] = date("Y-m-d")." 00:00:00"; |
|
473 | + $where['callstart <='] = date("Y-m-d")." 23:59:59"; |
|
474 | 474 | } |
475 | 475 | $this->db->where($where); |
476 | - $this->db->order_by("callstart","desc"); |
|
476 | + $this->db->order_by("callstart", "desc"); |
|
477 | 477 | if ($flag) { |
478 | - if (!$export) |
|
478 | + if ( ! $export) |
|
479 | 479 | $this->db->limit($limit, $start); |
480 | 480 | $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
481 | - }else { |
|
481 | + } else { |
|
482 | 482 | $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost,group_concat(distinct(trunk_id)) as trunk_ids'); |
483 | 483 | } |
484 | 484 | $result = $this->db->get('cdrs'); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if ($flag) { |
94 | 94 | if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
95 | 95 | $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
96 | - }else{ |
|
96 | + } else{ |
|
97 | 97 | $this->db->order_by('invoice_date', 'desc'); |
98 | 98 | } |
99 | 99 | } |
@@ -307,10 +307,11 @@ discard block |
||
307 | 307 | $this->db->where($where); |
308 | 308 | $this->db->order_by("callstart desc"); |
309 | 309 | if ($flag) { |
310 | - if (!$export) |
|
311 | - $this->db->limit($limit, $start); |
|
310 | + if (!$export) { |
|
311 | + $this->db->limit($limit, $start); |
|
312 | + } |
|
312 | 313 | $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
313 | - }else { |
|
314 | + } else { |
|
314 | 315 | $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids'); |
315 | 316 | } |
316 | 317 | $result = $this->db->get($table_name); |
@@ -387,15 +388,13 @@ discard block |
||
387 | 388 | if($result->num_rows() > 0){ |
388 | 389 | if($flag){ |
389 | 390 | return $result; |
390 | - } |
|
391 | - else{ |
|
391 | + } else{ |
|
392 | 392 | return $result->num_rows(); |
393 | 393 | } |
394 | - }else{ |
|
394 | + } else{ |
|
395 | 395 | if($flag){ |
396 | 396 | $result=(object)array('num_rows'=>0); |
397 | - } |
|
398 | - else{ |
|
397 | + } else{ |
|
399 | 398 | $result=0; |
400 | 399 | } |
401 | 400 | return $result; |
@@ -452,7 +451,7 @@ discard block |
||
452 | 451 | if ($logintype == 1 || $logintype == 5) { |
453 | 452 | |
454 | 453 | $where = array("accountid" => $this->session->userdata["accountinfo"]['id']); |
455 | - }else{ |
|
454 | + } else{ |
|
456 | 455 | $where=array('id'=> $accountid); |
457 | 456 | } |
458 | 457 | $query = $this->db_model->getSelect("*","invoice_conf",$where); |
@@ -475,10 +474,11 @@ discard block |
||
475 | 474 | $this->db->where($where); |
476 | 475 | $this->db->order_by("callstart","desc"); |
477 | 476 | if ($flag) { |
478 | - if (!$export) |
|
479 | - $this->db->limit($limit, $start); |
|
477 | + if (!$export) { |
|
478 | + $this->db->limit($limit, $start); |
|
479 | + } |
|
480 | 480 | $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
481 | - }else { |
|
481 | + } else { |
|
482 | 482 | $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost,group_concat(distinct(trunk_id)) as trunk_ids'); |
483 | 483 | } |
484 | 484 | $result = $this->db->get('cdrs'); |
@@ -22,77 +22,77 @@ discard block |
||
22 | 22 | ############################################################################### |
23 | 23 | class Systems extends CI_Controller { |
24 | 24 | |
25 | - function Systems() { |
|
26 | - parent::__construct(); |
|
25 | + function Systems() { |
|
26 | + parent::__construct(); |
|
27 | 27 | |
28 | - $this->load->helper('template_inheritance'); |
|
28 | + $this->load->helper('template_inheritance'); |
|
29 | 29 | $this->load->helper('file'); |
30 | - $this->load->library('session'); |
|
31 | - $this->load->library("system_form"); |
|
32 | - $this->load->library('astpp/form'); |
|
33 | - $this->load->model('system_model'); |
|
34 | - $this->load->dbutil(); |
|
35 | - |
|
36 | - if ($this->session->userdata('user_login') == FALSE) |
|
37 | - redirect(base_url() . '/astpp/login'); |
|
38 | - } |
|
39 | - |
|
40 | - function configuration_edit($edit_id = '') { |
|
41 | - $data['page_title'] = 'Edit Settings'; |
|
42 | - $where = array('id' => $edit_id); |
|
43 | - $account = $this->db_model->getSelect("*", "system", $where); |
|
44 | - foreach ($account->result_array() as $key => $value) { |
|
45 | - $edit_data = $value; |
|
46 | - } |
|
47 | - $data['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $edit_data); |
|
48 | - $this->load->view('view_configuration_add_edit', $data); |
|
49 | - } |
|
50 | - |
|
51 | - function configuration_search() { |
|
52 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
53 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
54 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
55 | - $action = $this->input->post(); |
|
56 | - unset($action['action']); |
|
57 | - unset($action['advance_search']); |
|
58 | - $this->session->set_userdata('configuration_search', $action); |
|
59 | - } |
|
60 | - if (@$ajax_search != 1) { |
|
61 | - redirect(base_url() . 'systems/configuration/'); |
|
62 | - } |
|
63 | - } |
|
64 | - |
|
65 | - function configuration_clearsearchfilter() { |
|
66 | - $this->session->set_userdata('advance_search', 0); |
|
67 | - $this->session->set_userdata('did_search', ""); |
|
68 | - } |
|
69 | - |
|
70 | - function configuration_save() { |
|
71 | - $add_array = $this->input->post(); |
|
72 | - $data['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $add_array); |
|
73 | - if ($add_array['id'] != '') { |
|
74 | - $data['page_title'] = 'Edit Settings'; |
|
75 | - if ($this->form_validation->run() == FALSE) { |
|
76 | - $data['validation_errors'] = validation_errors(); |
|
77 | - echo $data['validation_errors']; |
|
78 | - exit; |
|
79 | - } else { |
|
80 | - $this->system_model->edit_configuration($add_array, $add_array['id']); |
|
81 | - echo json_encode(array("SUCCESS"=> "setting updated successfully!")); |
|
82 | - exit; |
|
83 | - } |
|
84 | - } |
|
85 | - } |
|
86 | - |
|
87 | - function configuration($group_title='') { |
|
30 | + $this->load->library('session'); |
|
31 | + $this->load->library("system_form"); |
|
32 | + $this->load->library('astpp/form'); |
|
33 | + $this->load->model('system_model'); |
|
34 | + $this->load->dbutil(); |
|
35 | + |
|
36 | + if ($this->session->userdata('user_login') == FALSE) |
|
37 | + redirect(base_url() . '/astpp/login'); |
|
38 | + } |
|
39 | + |
|
40 | + function configuration_edit($edit_id = '') { |
|
41 | + $data['page_title'] = 'Edit Settings'; |
|
42 | + $where = array('id' => $edit_id); |
|
43 | + $account = $this->db_model->getSelect("*", "system", $where); |
|
44 | + foreach ($account->result_array() as $key => $value) { |
|
45 | + $edit_data = $value; |
|
46 | + } |
|
47 | + $data['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $edit_data); |
|
48 | + $this->load->view('view_configuration_add_edit', $data); |
|
49 | + } |
|
50 | + |
|
51 | + function configuration_search() { |
|
52 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
53 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
54 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
55 | + $action = $this->input->post(); |
|
56 | + unset($action['action']); |
|
57 | + unset($action['advance_search']); |
|
58 | + $this->session->set_userdata('configuration_search', $action); |
|
59 | + } |
|
60 | + if (@$ajax_search != 1) { |
|
61 | + redirect(base_url() . 'systems/configuration/'); |
|
62 | + } |
|
63 | + } |
|
64 | + |
|
65 | + function configuration_clearsearchfilter() { |
|
66 | + $this->session->set_userdata('advance_search', 0); |
|
67 | + $this->session->set_userdata('did_search', ""); |
|
68 | + } |
|
69 | + |
|
70 | + function configuration_save() { |
|
71 | + $add_array = $this->input->post(); |
|
72 | + $data['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $add_array); |
|
73 | + if ($add_array['id'] != '') { |
|
74 | + $data['page_title'] = 'Edit Settings'; |
|
75 | + if ($this->form_validation->run() == FALSE) { |
|
76 | + $data['validation_errors'] = validation_errors(); |
|
77 | + echo $data['validation_errors']; |
|
78 | + exit; |
|
79 | + } else { |
|
80 | + $this->system_model->edit_configuration($add_array, $add_array['id']); |
|
81 | + echo json_encode(array("SUCCESS"=> "setting updated successfully!")); |
|
82 | + exit; |
|
83 | + } |
|
84 | + } |
|
85 | + } |
|
86 | + |
|
87 | + function configuration($group_title='') { |
|
88 | 88 | if($group_title==""){ |
89 | 89 | redirect(base_url() . '/dashboard'); |
90 | 90 | } |
91 | 91 | if($group_title=="email"){ |
92 | - $data['test_email_flag'] = true; |
|
92 | + $data['test_email_flag'] = true; |
|
93 | 93 | } |
94 | - $data['username'] = $this->session->userdata('user_name'); |
|
95 | - $data['page_title'] = ucfirst($group_title); |
|
94 | + $data['username'] = $this->session->userdata('user_name'); |
|
95 | + $data['page_title'] = ucfirst($group_title); |
|
96 | 96 | $data['group_title']=$group_title; |
97 | 97 | $where=array("group_title"=>$group_title); |
98 | 98 | $details = $this->db_model->getSelect("*", "system", $where); |
@@ -104,545 +104,545 @@ discard block |
||
104 | 104 | $update_array=array('value'=>$val); |
105 | 105 | $this->system_model->edit_configuration($update_array, $key); |
106 | 106 | } |
107 | - $this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!'); |
|
108 | - redirect(base_url() . 'systems/configuration/'.$group_title); |
|
109 | - }else{ |
|
107 | + $this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!'); |
|
108 | + redirect(base_url() . 'systems/configuration/'.$group_title); |
|
109 | + }else{ |
|
110 | 110 | $this->load->view('view_systemconf', $data); |
111 | 111 | } |
112 | - } |
|
112 | + } |
|
113 | 113 | |
114 | - function configuration_json() { |
|
115 | - |
|
116 | - $json_data = array(); |
|
117 | - $count_all = $this->system_model->getsystem_list(false, "", ""); |
|
118 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
119 | - $json_data = $paging_data["json_paging"]; |
|
120 | - |
|
121 | - $query = $this->system_model->getsystem_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
122 | - $grid_fields = json_decode($this->system_form->build_system_list_for_admin()); |
|
123 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
124 | - |
|
125 | - echo json_encode($json_data); |
|
126 | - } |
|
127 | - |
|
128 | - function template() { |
|
129 | - $data['username'] = $this->session->userdata('user_name'); |
|
130 | - $data['page_title'] = 'Email Templates'; |
|
131 | - $data['search_flag'] = true; |
|
132 | - $this->session->set_userdata('advance_search', 0); |
|
133 | - $data['grid_fields'] = $this->system_form->build_template_list_for_admin(); |
|
134 | - $data["grid_buttons"] = $this->system_form->build_grid_buttons(); |
|
135 | - $data['form_search'] = $this->form->build_serach_form($this->system_form->get_template_search_form()); |
|
136 | - $this->load->view('view_template_list', $data); |
|
137 | - } |
|
138 | - |
|
139 | - function template_json() { |
|
140 | - $json_data = array(); |
|
141 | - $count_all = $this->system_model->gettemplate_list(false, "", ""); |
|
142 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
143 | - $json_data = $paging_data["json_paging"]; |
|
144 | - |
|
145 | - $query = $this->system_model->gettemplate_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
146 | - $grid_fields = json_decode($this->system_form->build_template_list_for_admin()); |
|
147 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
148 | - |
|
149 | - echo json_encode($json_data); |
|
150 | - } |
|
151 | - |
|
152 | - function template_edit($edit_id = '') { |
|
153 | - $data['page_title'] = 'Edit Email template'; |
|
154 | - $where = array('id' => $edit_id); |
|
155 | - $account = $this->db_model->getSelect("*", "default_templates", $where); |
|
156 | - foreach ($account->result_array() as $key => $value) { |
|
157 | - $edit_data = $value; |
|
158 | - } |
|
159 | - $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $edit_data); |
|
160 | - $this->load->view('view_template_add_edit', $data); |
|
161 | - } |
|
162 | - |
|
163 | - function template_save() { |
|
164 | - $add_array = $this->input->post(); |
|
114 | + function configuration_json() { |
|
115 | + |
|
116 | + $json_data = array(); |
|
117 | + $count_all = $this->system_model->getsystem_list(false, "", ""); |
|
118 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
119 | + $json_data = $paging_data["json_paging"]; |
|
120 | + |
|
121 | + $query = $this->system_model->getsystem_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
122 | + $grid_fields = json_decode($this->system_form->build_system_list_for_admin()); |
|
123 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
124 | + |
|
125 | + echo json_encode($json_data); |
|
126 | + } |
|
127 | + |
|
128 | + function template() { |
|
129 | + $data['username'] = $this->session->userdata('user_name'); |
|
130 | + $data['page_title'] = 'Email Templates'; |
|
131 | + $data['search_flag'] = true; |
|
132 | + $this->session->set_userdata('advance_search', 0); |
|
133 | + $data['grid_fields'] = $this->system_form->build_template_list_for_admin(); |
|
134 | + $data["grid_buttons"] = $this->system_form->build_grid_buttons(); |
|
135 | + $data['form_search'] = $this->form->build_serach_form($this->system_form->get_template_search_form()); |
|
136 | + $this->load->view('view_template_list', $data); |
|
137 | + } |
|
138 | + |
|
139 | + function template_json() { |
|
140 | + $json_data = array(); |
|
141 | + $count_all = $this->system_model->gettemplate_list(false, "", ""); |
|
142 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
143 | + $json_data = $paging_data["json_paging"]; |
|
144 | + |
|
145 | + $query = $this->system_model->gettemplate_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
146 | + $grid_fields = json_decode($this->system_form->build_template_list_for_admin()); |
|
147 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
148 | + |
|
149 | + echo json_encode($json_data); |
|
150 | + } |
|
151 | + |
|
152 | + function template_edit($edit_id = '') { |
|
153 | + $data['page_title'] = 'Edit Email template'; |
|
154 | + $where = array('id' => $edit_id); |
|
155 | + $account = $this->db_model->getSelect("*", "default_templates", $where); |
|
156 | + foreach ($account->result_array() as $key => $value) { |
|
157 | + $edit_data = $value; |
|
158 | + } |
|
159 | + $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $edit_data); |
|
160 | + $this->load->view('view_template_add_edit', $data); |
|
161 | + } |
|
162 | + |
|
163 | + function template_save() { |
|
164 | + $add_array = $this->input->post(); |
|
165 | 165 | |
166 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
167 | - $account_data = $this->session->userdata("accountinfo"); |
|
166 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
167 | + $account_data = $this->session->userdata("accountinfo"); |
|
168 | 168 | $reseller = $account_data['id']; |
169 | - $this->resellertemplate_save($add_array,$reseller); |
|
170 | - } |
|
171 | - else |
|
172 | - { |
|
173 | - $this->admintemplate_save($add_array); |
|
174 | - } |
|
175 | - } |
|
169 | + $this->resellertemplate_save($add_array,$reseller); |
|
170 | + } |
|
171 | + else |
|
172 | + { |
|
173 | + $this->admintemplate_save($add_array); |
|
174 | + } |
|
175 | + } |
|
176 | 176 | |
177 | - function resellertemplate_save($data,$resellerid) |
|
178 | - { |
|
179 | - $where = array('name' => $data['name'],'reseller_id'=>$resellerid); |
|
180 | - $count = $this->db_model->countQuery("*", "default_templates", $where); |
|
181 | - $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
182 | - if($count >0) |
|
183 | - { |
|
184 | - $data['page_title'] = 'Edit Template'; |
|
185 | - if ($this->form_validation->run() == FALSE) { |
|
186 | - $data['validation_errors'] = validation_errors(); |
|
187 | - } else { |
|
177 | + function resellertemplate_save($data,$resellerid) |
|
178 | + { |
|
179 | + $where = array('name' => $data['name'],'reseller_id'=>$resellerid); |
|
180 | + $count = $this->db_model->countQuery("*", "default_templates", $where); |
|
181 | + $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
182 | + if($count >0) |
|
183 | + { |
|
184 | + $data['page_title'] = 'Edit Template'; |
|
185 | + if ($this->form_validation->run() == FALSE) { |
|
186 | + $data['validation_errors'] = validation_errors(); |
|
187 | + } else { |
|
188 | 188 | |
189 | - $this->system_model->edit_resellertemplate($data, $data['id']); |
|
190 | - $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
191 | - redirect(base_url() . 'systems/template/'); |
|
192 | - exit; |
|
193 | - } |
|
194 | - } else { |
|
195 | - if ($this->form_validation->run() == FALSE) { |
|
196 | - $data['validation_errors'] = validation_errors(); |
|
197 | - } else { |
|
198 | - unset($data['form']); |
|
199 | - $data['reseller_id'] = $resellerid; |
|
200 | - $this->system_model->add_resellertemplate($data); |
|
201 | - $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
202 | - redirect(base_url() . 'systems/template/'); |
|
203 | - exit; |
|
204 | - } |
|
205 | - } |
|
206 | - $this->load->view('view_template_add_edit', $data); |
|
207 | - } |
|
208 | - function admintemplate_save($data) |
|
209 | - { |
|
210 | - $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
211 | - if ($data['id'] != '') { |
|
212 | - $data['page_title'] = 'Edit Template'; |
|
213 | - if ($this->form_validation->run() == FALSE) { |
|
214 | - $data['validation_errors'] = validation_errors(); |
|
215 | - } else { |
|
216 | - unset($data['form']); |
|
217 | - unset($data['page_title']); |
|
218 | - $this->system_model->edit_template($data, $data['id']); |
|
219 | - $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
220 | - redirect(base_url() . 'systems/template/'); |
|
221 | - exit; |
|
222 | - } |
|
223 | - } else { |
|
224 | - $data['page_title'] = 'Termination Details'; |
|
225 | - if ($this->form_validation->run() == FALSE) { |
|
226 | - $data['validation_errors'] = validation_errors(); |
|
227 | - } else { |
|
228 | - unset($data['form']); |
|
229 | - $this->system_model->add_template($data); |
|
230 | - $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
231 | - redirect(base_url() . 'systems/template/'); |
|
232 | - exit; |
|
233 | - } |
|
234 | - } |
|
235 | - $this->load->view('view_template_add_edit', $data); |
|
236 | - } |
|
237 | - function template_search() { |
|
238 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
239 | - |
|
240 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
241 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
242 | - $action = $this->input->post(); |
|
243 | - unset($action['action']); |
|
244 | - unset($action['advance_search']); |
|
245 | - $this->session->set_userdata('template_search', $action); |
|
246 | - } |
|
247 | - if (@$ajax_search != 1) { |
|
248 | - redirect(base_url() . 'systems/template/'); |
|
249 | - } |
|
250 | - } |
|
251 | - |
|
252 | - function template_clearsearchfilter() { |
|
253 | - $this->session->set_userdata('advance_search', 0); |
|
254 | - $this->session->set_userdata('did_search', ""); |
|
255 | - } |
|
189 | + $this->system_model->edit_resellertemplate($data, $data['id']); |
|
190 | + $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
191 | + redirect(base_url() . 'systems/template/'); |
|
192 | + exit; |
|
193 | + } |
|
194 | + } else { |
|
195 | + if ($this->form_validation->run() == FALSE) { |
|
196 | + $data['validation_errors'] = validation_errors(); |
|
197 | + } else { |
|
198 | + unset($data['form']); |
|
199 | + $data['reseller_id'] = $resellerid; |
|
200 | + $this->system_model->add_resellertemplate($data); |
|
201 | + $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
202 | + redirect(base_url() . 'systems/template/'); |
|
203 | + exit; |
|
204 | + } |
|
205 | + } |
|
206 | + $this->load->view('view_template_add_edit', $data); |
|
207 | + } |
|
208 | + function admintemplate_save($data) |
|
209 | + { |
|
210 | + $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
211 | + if ($data['id'] != '') { |
|
212 | + $data['page_title'] = 'Edit Template'; |
|
213 | + if ($this->form_validation->run() == FALSE) { |
|
214 | + $data['validation_errors'] = validation_errors(); |
|
215 | + } else { |
|
216 | + unset($data['form']); |
|
217 | + unset($data['page_title']); |
|
218 | + $this->system_model->edit_template($data, $data['id']); |
|
219 | + $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
220 | + redirect(base_url() . 'systems/template/'); |
|
221 | + exit; |
|
222 | + } |
|
223 | + } else { |
|
224 | + $data['page_title'] = 'Termination Details'; |
|
225 | + if ($this->form_validation->run() == FALSE) { |
|
226 | + $data['validation_errors'] = validation_errors(); |
|
227 | + } else { |
|
228 | + unset($data['form']); |
|
229 | + $this->system_model->add_template($data); |
|
230 | + $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
231 | + redirect(base_url() . 'systems/template/'); |
|
232 | + exit; |
|
233 | + } |
|
234 | + } |
|
235 | + $this->load->view('view_template_add_edit', $data); |
|
236 | + } |
|
237 | + function template_search() { |
|
238 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
239 | + |
|
240 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
241 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
242 | + $action = $this->input->post(); |
|
243 | + unset($action['action']); |
|
244 | + unset($action['advance_search']); |
|
245 | + $this->session->set_userdata('template_search', $action); |
|
246 | + } |
|
247 | + if (@$ajax_search != 1) { |
|
248 | + redirect(base_url() . 'systems/template/'); |
|
249 | + } |
|
250 | + } |
|
251 | + |
|
252 | + function template_clearsearchfilter() { |
|
253 | + $this->session->set_userdata('advance_search', 0); |
|
254 | + $this->session->set_userdata('did_search', ""); |
|
255 | + } |
|
256 | 256 | |
257 | - function country_list() { |
|
258 | - $data['username'] = $this->session->userdata('user_name'); |
|
259 | - $data['page_title'] = 'Countries'; |
|
260 | - $data['search_flag'] = true; |
|
261 | - $data['cur_menu_no'] = 4; |
|
257 | + function country_list() { |
|
258 | + $data['username'] = $this->session->userdata('user_name'); |
|
259 | + $data['page_title'] = 'Countries'; |
|
260 | + $data['search_flag'] = true; |
|
261 | + $data['cur_menu_no'] = 4; |
|
262 | 262 | $this->session->set_userdata('country_search', 0); |
263 | - $data['grid_fields'] = $this->system_form->build_country_list_for_admin(); |
|
264 | - if ($this->session->userdata('logintype') == 2) { |
|
265 | - $data["grid_buttons"] = $this->system_form->build_admin_grid_buttons(); |
|
266 | - } else { |
|
267 | - $data["grid_buttons"] = json_encode(array()); |
|
268 | - } |
|
263 | + $data['grid_fields'] = $this->system_form->build_country_list_for_admin(); |
|
264 | + if ($this->session->userdata('logintype') == 2) { |
|
265 | + $data["grid_buttons"] = $this->system_form->build_admin_grid_buttons(); |
|
266 | + } else { |
|
267 | + $data["grid_buttons"] = json_encode(array()); |
|
268 | + } |
|
269 | 269 | $data['form_search'] = $this->form->build_serach_form($this->system_form->get_search_country_form()); |
270 | - $this->load->view('view_country_list', $data); |
|
271 | - } |
|
270 | + $this->load->view('view_country_list', $data); |
|
271 | + } |
|
272 | 272 | |
273 | - function country_list_json() { |
|
273 | + function country_list_json() { |
|
274 | 274 | $json_data = array(); |
275 | - $count_all = $this->system_model->getcountry_list(false); |
|
276 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
277 | - $json_data = $paging_data["json_paging"]; |
|
278 | - $query = $this->system_model->getcountry_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
279 | - $grid_fields = json_decode($this->system_form->build_country_list_for_admin()); |
|
280 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
281 | - |
|
282 | - echo json_encode($json_data); |
|
283 | - } |
|
275 | + $count_all = $this->system_model->getcountry_list(false); |
|
276 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
277 | + $json_data = $paging_data["json_paging"]; |
|
278 | + $query = $this->system_model->getcountry_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
279 | + $grid_fields = json_decode($this->system_form->build_country_list_for_admin()); |
|
280 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
281 | + |
|
282 | + echo json_encode($json_data); |
|
283 | + } |
|
284 | 284 | |
285 | - function country_list_search() { |
|
286 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
285 | + function country_list_search() { |
|
286 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
287 | 287 | |
288 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
289 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
290 | - $action = $this->input->post(); |
|
291 | - unset($action['action']); |
|
292 | - unset($action['advance_search']); |
|
293 | - $this->session->set_userdata('country_list_search', $action); |
|
294 | - } |
|
295 | - if (@$ajax_search != 1) { |
|
296 | - redirect(base_url() . 'systems/country_list/'); |
|
297 | - } |
|
298 | - } |
|
299 | - |
|
300 | - function country_list_clearsearchfilter() { |
|
301 | - $this->session->set_userdata('advance_search', 0); |
|
302 | - $this->session->set_userdata('country_search', ""); |
|
303 | - } |
|
288 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
289 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
290 | + $action = $this->input->post(); |
|
291 | + unset($action['action']); |
|
292 | + unset($action['advance_search']); |
|
293 | + $this->session->set_userdata('country_list_search', $action); |
|
294 | + } |
|
295 | + if (@$ajax_search != 1) { |
|
296 | + redirect(base_url() . 'systems/country_list/'); |
|
297 | + } |
|
298 | + } |
|
299 | + |
|
300 | + function country_list_clearsearchfilter() { |
|
301 | + $this->session->set_userdata('advance_search', 0); |
|
302 | + $this->session->set_userdata('country_search', ""); |
|
303 | + } |
|
304 | 304 | |
305 | - function country_add() { |
|
305 | + function country_add() { |
|
306 | 306 | $data['username'] = $this->session->userdata('user_name'); |
307 | - $data['flag'] = 'create'; |
|
308 | - $data['page_title'] = 'Add Country'; |
|
309 | - $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), ''); |
|
310 | - $this->load->view('view_country_add_edit', $data); |
|
311 | - } |
|
307 | + $data['flag'] = 'create'; |
|
308 | + $data['page_title'] = 'Add Country'; |
|
309 | + $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), ''); |
|
310 | + $this->load->view('view_country_add_edit', $data); |
|
311 | + } |
|
312 | 312 | |
313 | - function country_list_edit($edit_id = '') { |
|
313 | + function country_list_edit($edit_id = '') { |
|
314 | 314 | $data['page_title'] = 'Edit Country'; |
315 | - $where = array('id' => $edit_id); |
|
316 | - $account = $this->db_model->getSelect("*", "countrycode", $where); |
|
317 | - foreach ($account->result_array() as $key => $value) { |
|
318 | - $edit_data = $value; |
|
319 | - } |
|
320 | - $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $edit_data); |
|
321 | - $this->load->view('view_country_add_edit', $data); |
|
322 | - } |
|
315 | + $where = array('id' => $edit_id); |
|
316 | + $account = $this->db_model->getSelect("*", "countrycode", $where); |
|
317 | + foreach ($account->result_array() as $key => $value) { |
|
318 | + $edit_data = $value; |
|
319 | + } |
|
320 | + $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $edit_data); |
|
321 | + $this->load->view('view_country_add_edit', $data); |
|
322 | + } |
|
323 | 323 | |
324 | 324 | |
325 | - function country_save() { |
|
325 | + function country_save() { |
|
326 | 326 | $add_array = $this->input->post(); |
327 | - $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $add_array); |
|
328 | - if ($add_array['id'] != '') { |
|
329 | - $data['page_title'] = 'Edit Country'; |
|
330 | - if ($this->form_validation->run() == FALSE) { |
|
331 | - $data['validation_errors'] = validation_errors(); |
|
332 | - echo $data['validation_errors']; |
|
333 | - exit; |
|
334 | - } else { |
|
335 | - $this->system_model->edit_country($add_array, $add_array['id']); |
|
336 | - echo json_encode(array("SUCCESS"=> $add_array["country"]." country updated successfully!")); |
|
337 | - exit; |
|
338 | - } |
|
339 | - } else { |
|
340 | - $data['page_title'] = 'Add Country'; |
|
341 | - if ($this->form_validation->run() == FALSE) { |
|
342 | - $data['validation_errors'] = validation_errors(); |
|
343 | - echo $data['validation_errors']; |
|
344 | - exit; |
|
345 | - } else { |
|
346 | - $response = $this->system_model->add_country($add_array); |
|
347 | - echo json_encode(array("SUCCESS"=> $add_array["country"]." country added successfully!")); |
|
348 | - exit; |
|
349 | - } |
|
350 | - } |
|
351 | - } |
|
327 | + $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $add_array); |
|
328 | + if ($add_array['id'] != '') { |
|
329 | + $data['page_title'] = 'Edit Country'; |
|
330 | + if ($this->form_validation->run() == FALSE) { |
|
331 | + $data['validation_errors'] = validation_errors(); |
|
332 | + echo $data['validation_errors']; |
|
333 | + exit; |
|
334 | + } else { |
|
335 | + $this->system_model->edit_country($add_array, $add_array['id']); |
|
336 | + echo json_encode(array("SUCCESS"=> $add_array["country"]." country updated successfully!")); |
|
337 | + exit; |
|
338 | + } |
|
339 | + } else { |
|
340 | + $data['page_title'] = 'Add Country'; |
|
341 | + if ($this->form_validation->run() == FALSE) { |
|
342 | + $data['validation_errors'] = validation_errors(); |
|
343 | + echo $data['validation_errors']; |
|
344 | + exit; |
|
345 | + } else { |
|
346 | + $response = $this->system_model->add_country($add_array); |
|
347 | + echo json_encode(array("SUCCESS"=> $add_array["country"]." country added successfully!")); |
|
348 | + exit; |
|
349 | + } |
|
350 | + } |
|
351 | + } |
|
352 | 352 | |
353 | - function country_remove($id) { |
|
354 | - $this->system_model->remove_country($id); |
|
355 | - $country=$this->common->get_field_name('country','countrycode',$id); |
|
356 | - $this->session->set_flashdata('astpp_notification', $country.'Country removed successfully!'); |
|
357 | - redirect(base_url() . 'systems/country_list/'); |
|
358 | - } |
|
359 | - |
|
360 | - function country_delete_multiple() { |
|
361 | - $ids = $this->input->post("selected_ids", true); |
|
362 | - $where = "id IN ($ids)"; |
|
363 | - $this->db->where($where); |
|
364 | - echo $this->db->delete("countrycode"); |
|
365 | - } |
|
366 | - function currency_list() { |
|
353 | + function country_remove($id) { |
|
354 | + $this->system_model->remove_country($id); |
|
355 | + $country=$this->common->get_field_name('country','countrycode',$id); |
|
356 | + $this->session->set_flashdata('astpp_notification', $country.'Country removed successfully!'); |
|
357 | + redirect(base_url() . 'systems/country_list/'); |
|
358 | + } |
|
359 | + |
|
360 | + function country_delete_multiple() { |
|
361 | + $ids = $this->input->post("selected_ids", true); |
|
362 | + $where = "id IN ($ids)"; |
|
363 | + $this->db->where($where); |
|
364 | + echo $this->db->delete("countrycode"); |
|
365 | + } |
|
366 | + function currency_list() { |
|
367 | 367 | $base_currency = Common_model::$global_config['system_config']['base_currency']; |
368 | - $data['username'] = $this->session->userdata('user_name'); |
|
369 | - $data['page_title'] = 'Currencies'; |
|
370 | - $data['search_flag'] = true; |
|
371 | - $data['cur_menu_no'] = 4; |
|
368 | + $data['username'] = $this->session->userdata('user_name'); |
|
369 | + $data['page_title'] = 'Currencies'; |
|
370 | + $data['search_flag'] = true; |
|
371 | + $data['cur_menu_no'] = 4; |
|
372 | 372 | $this->session->set_userdata('currency_search', 0); |
373 | - $data['grid_fields'] = $this->system_form->build_currency_list_for_admin(); |
|
374 | - if ($this->session->userdata('logintype') == 2) { |
|
375 | - $data["grid_buttons"] = $this->system_form->build_admin_currency_grid_buttons(); |
|
376 | - } else { |
|
377 | - $data["grid_buttons"] = json_encode(array()); |
|
378 | - } |
|
373 | + $data['grid_fields'] = $this->system_form->build_currency_list_for_admin(); |
|
374 | + if ($this->session->userdata('logintype') == 2) { |
|
375 | + $data["grid_buttons"] = $this->system_form->build_admin_currency_grid_buttons(); |
|
376 | + } else { |
|
377 | + $data["grid_buttons"] = json_encode(array()); |
|
378 | + } |
|
379 | 379 | $data['form_search'] = $this->form->build_serach_form($this->system_form->get_search_currency_form()); |
380 | - $this->load->view('view_currency_list', $data); |
|
381 | - } |
|
380 | + $this->load->view('view_currency_list', $data); |
|
381 | + } |
|
382 | 382 | |
383 | - function currency_list_json() { |
|
384 | - $json_data = array(); |
|
383 | + function currency_list_json() { |
|
384 | + $json_data = array(); |
|
385 | 385 | |
386 | - $count_all = $this->system_model->getcurrency_list(false); |
|
387 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
388 | - $json_data = $paging_data["json_paging"]; |
|
386 | + $count_all = $this->system_model->getcurrency_list(false); |
|
387 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
388 | + $json_data = $paging_data["json_paging"]; |
|
389 | 389 | |
390 | - $query = $this->system_model->getcurrency_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
391 | - $grid_fields = json_decode($this->system_form->build_currency_list_for_admin()); |
|
392 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
390 | + $query = $this->system_model->getcurrency_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
391 | + $grid_fields = json_decode($this->system_form->build_currency_list_for_admin()); |
|
392 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
393 | 393 | |
394 | - echo json_encode($json_data); |
|
395 | - } |
|
394 | + echo json_encode($json_data); |
|
395 | + } |
|
396 | 396 | |
397 | - function currency_list_search() { |
|
398 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
397 | + function currency_list_search() { |
|
398 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
399 | 399 | |
400 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
401 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
402 | - $action = $this->input->post(); |
|
403 | - unset($action['action']); |
|
404 | - unset($action['advance_search']); |
|
405 | - $this->session->set_userdata('currency_list_search', $action); |
|
406 | - } |
|
407 | - if (@$ajax_search != 1) { |
|
408 | - redirect(base_url() . 'systems/currency_list/'); |
|
409 | - } |
|
410 | - } |
|
411 | - |
|
412 | - function currency_list_clearsearchfilter() { |
|
413 | - $this->session->set_userdata('advance_search', 0); |
|
414 | - $this->session->set_userdata('currency_search', ""); |
|
415 | - } |
|
416 | - |
|
417 | - function currency_add() { |
|
400 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
401 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
402 | + $action = $this->input->post(); |
|
403 | + unset($action['action']); |
|
404 | + unset($action['advance_search']); |
|
405 | + $this->session->set_userdata('currency_list_search', $action); |
|
406 | + } |
|
407 | + if (@$ajax_search != 1) { |
|
408 | + redirect(base_url() . 'systems/currency_list/'); |
|
409 | + } |
|
410 | + } |
|
411 | + |
|
412 | + function currency_list_clearsearchfilter() { |
|
413 | + $this->session->set_userdata('advance_search', 0); |
|
414 | + $this->session->set_userdata('currency_search', ""); |
|
415 | + } |
|
416 | + |
|
417 | + function currency_add() { |
|
418 | 418 | $data['username'] = $this->session->userdata('user_name'); |
419 | - $data['flag'] = 'create'; |
|
420 | - $data['page_title'] = 'Add Currency'; |
|
421 | - $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), ''); |
|
422 | - $this->load->view('view_currency_add_edit', $data); |
|
423 | - } |
|
419 | + $data['flag'] = 'create'; |
|
420 | + $data['page_title'] = 'Add Currency'; |
|
421 | + $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), ''); |
|
422 | + $this->load->view('view_currency_add_edit', $data); |
|
423 | + } |
|
424 | 424 | |
425 | - function currency_list_edit($edit_id = '') { |
|
425 | + function currency_list_edit($edit_id = '') { |
|
426 | 426 | $data['page_title'] = 'Edit Currency'; |
427 | - $where = array('id' => $edit_id); |
|
428 | - $account = $this->db_model->getSelect("*", "currency", $where); |
|
429 | - foreach ($account->result_array() as $key => $value) { |
|
430 | - $edit_data = $value; |
|
431 | - } |
|
432 | - $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $edit_data); |
|
433 | - $this->load->view('view_country_add_edit', $data); |
|
434 | - } |
|
427 | + $where = array('id' => $edit_id); |
|
428 | + $account = $this->db_model->getSelect("*", "currency", $where); |
|
429 | + foreach ($account->result_array() as $key => $value) { |
|
430 | + $edit_data = $value; |
|
431 | + } |
|
432 | + $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $edit_data); |
|
433 | + $this->load->view('view_country_add_edit', $data); |
|
434 | + } |
|
435 | 435 | |
436 | 436 | |
437 | - function currency_save() { |
|
437 | + function currency_save() { |
|
438 | 438 | $add_array = $this->input->post(); |
439 | - $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $add_array); |
|
440 | - if ($add_array['id'] != '') { |
|
441 | - $data['page_title'] = 'Edit Currency'; |
|
442 | - $data['page_title'] = 'Edit Currency'; |
|
443 | - if ($this->form_validation->run() == FALSE) { |
|
444 | - $data['validation_errors'] = validation_errors(); |
|
445 | - echo $data['validation_errors']; |
|
446 | - exit; |
|
447 | - } else { |
|
448 | - $this->system_model->edit_currency($add_array, $add_array['id']); |
|
449 | - echo json_encode(array("SUCCESS"=> $add_array["currencyname"]." currency updated successfully!")); |
|
450 | - exit; |
|
451 | - } |
|
452 | - } else { |
|
453 | - $data['page_title'] = 'Create Currency'; |
|
454 | - if ($this->form_validation->run() == FALSE) { |
|
455 | - $data['validation_errors'] = validation_errors(); |
|
456 | - echo $data['validation_errors']; |
|
457 | - exit; |
|
458 | - } else { |
|
459 | - $response = $this->system_model->add_currency($add_array); |
|
460 | - echo json_encode(array("SUCCESS"=> $add_array["currencyname"]." currency added successfully!")); |
|
461 | - exit; |
|
462 | - } |
|
463 | - } |
|
464 | - } |
|
439 | + $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $add_array); |
|
440 | + if ($add_array['id'] != '') { |
|
441 | + $data['page_title'] = 'Edit Currency'; |
|
442 | + $data['page_title'] = 'Edit Currency'; |
|
443 | + if ($this->form_validation->run() == FALSE) { |
|
444 | + $data['validation_errors'] = validation_errors(); |
|
445 | + echo $data['validation_errors']; |
|
446 | + exit; |
|
447 | + } else { |
|
448 | + $this->system_model->edit_currency($add_array, $add_array['id']); |
|
449 | + echo json_encode(array("SUCCESS"=> $add_array["currencyname"]." currency updated successfully!")); |
|
450 | + exit; |
|
451 | + } |
|
452 | + } else { |
|
453 | + $data['page_title'] = 'Create Currency'; |
|
454 | + if ($this->form_validation->run() == FALSE) { |
|
455 | + $data['validation_errors'] = validation_errors(); |
|
456 | + echo $data['validation_errors']; |
|
457 | + exit; |
|
458 | + } else { |
|
459 | + $response = $this->system_model->add_currency($add_array); |
|
460 | + echo json_encode(array("SUCCESS"=> $add_array["currencyname"]." currency added successfully!")); |
|
461 | + exit; |
|
462 | + } |
|
463 | + } |
|
464 | + } |
|
465 | 465 | |
466 | - function currency_remove($id) { |
|
466 | + function currency_remove($id) { |
|
467 | 467 | $currencyname=$this->common->get_field_name('currencyname','currency',$id); |
468 | - $this->system_model->remove_currency($id); |
|
469 | - $this->session->set_flashdata('astpp_notification',$currencyname. ' Currency removed successfully!'); |
|
470 | - redirect(base_url() . 'systems/currency_list/'); |
|
471 | - } |
|
472 | - |
|
473 | - function currency_delete_multiple() { |
|
474 | - $ids = $this->input->post("selected_ids", true); |
|
475 | - $where = "id IN ($ids)"; |
|
476 | - $this->db->where($where); |
|
477 | - echo $this->db->delete("currency"); |
|
478 | - } |
|
479 | - function database_backup() |
|
480 | - { |
|
481 | - $data=array(); |
|
482 | - $data['username'] = $this->session->userdata('user_name'); |
|
483 | - $data['page_title'] = 'Database Backup'; |
|
484 | - $filename=$this->db->database."_".date("YmdHms").".sql.gz"; |
|
485 | - $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($filename), ''); |
|
486 | - $this->load->view('view_database_backup', $data); |
|
487 | - } |
|
488 | - function database_backup_save() |
|
489 | - { |
|
490 | - |
|
491 | - $add_array=$this->input->post(); |
|
468 | + $this->system_model->remove_currency($id); |
|
469 | + $this->session->set_flashdata('astpp_notification',$currencyname. ' Currency removed successfully!'); |
|
470 | + redirect(base_url() . 'systems/currency_list/'); |
|
471 | + } |
|
472 | + |
|
473 | + function currency_delete_multiple() { |
|
474 | + $ids = $this->input->post("selected_ids", true); |
|
475 | + $where = "id IN ($ids)"; |
|
476 | + $this->db->where($where); |
|
477 | + echo $this->db->delete("currency"); |
|
478 | + } |
|
479 | + function database_backup() |
|
480 | + { |
|
481 | + $data=array(); |
|
482 | + $data['username'] = $this->session->userdata('user_name'); |
|
483 | + $data['page_title'] = 'Database Backup'; |
|
484 | + $filename=$this->db->database."_".date("YmdHms").".sql.gz"; |
|
485 | + $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($filename), ''); |
|
486 | + $this->load->view('view_database_backup', $data); |
|
487 | + } |
|
488 | + function database_backup_save() |
|
489 | + { |
|
490 | + |
|
491 | + $add_array=$this->input->post(); |
|
492 | 492 | |
493 | - $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'],$add_array['id']),$add_array); |
|
494 | - $data['page_title'] = 'Database Backup'; |
|
495 | - if($add_array['id'] != ''){ |
|
493 | + $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'],$add_array['id']),$add_array); |
|
494 | + $data['page_title'] = 'Database Backup'; |
|
495 | + if($add_array['id'] != ''){ |
|
496 | 496 | |
497 | - }else{ |
|
498 | - if($this->form_validation->run() == FALSE) { |
|
499 | - $data['validation_errors'] = validation_errors(); |
|
500 | - echo $data['validation_errors']; |
|
501 | - exit; |
|
502 | - }else{ |
|
503 | - $db_name = $this->db->database; |
|
504 | - $db_username = $this->db->username; |
|
505 | - $db_password = $this->db->password; |
|
506 | - $db_hostname = $this->db->hostname; |
|
507 | - $filename = $add_array['path']; |
|
508 | - $backup_file=DATABASE_DIRECTORY.$filename; |
|
509 | - if (substr($backup_file,-3)=='.gz'){ |
|
510 | - $backup_file = substr($backup_file,0,-3); |
|
511 | - $do_gzip=1; |
|
512 | - } |
|
513 | - |
|
514 | - $run_backup="/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'"; |
|
515 | - $error_zip=0; |
|
516 | - exec($run_backup,$output,$error); |
|
517 | - if ($do_gzip){ |
|
518 | - $gzip = $this->config->item('gzip-path'); |
|
519 | - $run_gzip = $gzip." ".$backup_file; |
|
520 | - exec($run_gzip,$output,$error_zip); |
|
521 | - } |
|
497 | + }else{ |
|
498 | + if($this->form_validation->run() == FALSE) { |
|
499 | + $data['validation_errors'] = validation_errors(); |
|
500 | + echo $data['validation_errors']; |
|
501 | + exit; |
|
502 | + }else{ |
|
503 | + $db_name = $this->db->database; |
|
504 | + $db_username = $this->db->username; |
|
505 | + $db_password = $this->db->password; |
|
506 | + $db_hostname = $this->db->hostname; |
|
507 | + $filename = $add_array['path']; |
|
508 | + $backup_file=DATABASE_DIRECTORY.$filename; |
|
509 | + if (substr($backup_file,-3)=='.gz'){ |
|
510 | + $backup_file = substr($backup_file,0,-3); |
|
511 | + $do_gzip=1; |
|
512 | + } |
|
513 | + |
|
514 | + $run_backup="/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'"; |
|
515 | + $error_zip=0; |
|
516 | + exec($run_backup,$output,$error); |
|
517 | + if ($do_gzip){ |
|
518 | + $gzip = $this->config->item('gzip-path'); |
|
519 | + $run_gzip = $gzip." ".$backup_file; |
|
520 | + exec($run_gzip,$output,$error_zip); |
|
521 | + } |
|
522 | 522 | |
523 | - if($error == 0 && $error_zip == 0 ){ |
|
524 | - $this->system_model->backup_insert($add_array); |
|
525 | - echo json_encode(array("SUCCESS"=> $add_array['backup_name']." backup exported successfully!")); |
|
526 | - exit; |
|
527 | - }else{ |
|
528 | - echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section'; |
|
529 | - exit; |
|
530 | - } |
|
531 | - } |
|
532 | - } |
|
533 | - } |
|
534 | - function database_restore() { |
|
535 | - $data['page_title'] = 'Database Restore'; |
|
536 | - $data['grid_fields'] = $this->system_form->build_backupdastabase_list(); |
|
537 | - $data["grid_buttons"] = $this->system_form->build_backupdastabase_buttons(); |
|
538 | - $this->load->view('view_database_list', $data); |
|
539 | - } |
|
523 | + if($error == 0 && $error_zip == 0 ){ |
|
524 | + $this->system_model->backup_insert($add_array); |
|
525 | + echo json_encode(array("SUCCESS"=> $add_array['backup_name']." backup exported successfully!")); |
|
526 | + exit; |
|
527 | + }else{ |
|
528 | + echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section'; |
|
529 | + exit; |
|
530 | + } |
|
531 | + } |
|
532 | + } |
|
533 | + } |
|
534 | + function database_restore() { |
|
535 | + $data['page_title'] = 'Database Restore'; |
|
536 | + $data['grid_fields'] = $this->system_form->build_backupdastabase_list(); |
|
537 | + $data["grid_buttons"] = $this->system_form->build_backupdastabase_buttons(); |
|
538 | + $this->load->view('view_database_list', $data); |
|
539 | + } |
|
540 | 540 | function database_restore_json() |
541 | - { |
|
542 | - $json_data = array(); |
|
543 | - $count_all = $this->system_model->getbackup_list(false, "", ""); |
|
544 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'],$_GET['page']); |
|
545 | - $json_data = $paging_data["json_paging"]; |
|
546 | - |
|
547 | - $query = $this->system_model->getbackup_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
548 | - $grid_fields = json_decode($this->system_form->build_backupdastabase_list()); |
|
549 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
550 | - |
|
551 | - echo json_encode($json_data); |
|
552 | - exit; |
|
553 | - } |
|
554 | - function database_restore_one($id='') |
|
555 | - { |
|
556 | - $result = $this->system_model->get_backup_data($id); |
|
557 | - $result_array=$result->result_array(); |
|
558 | - if($result->num_rows() > 0) |
|
559 | - { |
|
560 | - $db_name = $this->db->database; |
|
561 | - $db_username = $this->db->username; |
|
562 | - $db_password = $this->db->password; |
|
563 | - $db_hostname = $this->db->hostname; |
|
564 | - $path=DATABASE_DIRECTORY.$result_array[0]['path']; |
|
565 | - if(file_exists($path)){ |
|
566 | - if (substr($path,-3)=='.gz') { |
|
567 | - $GUNZIP_EXE = $this->config->item('gunzip-path'); |
|
568 | - $run_gzip = $GUNZIP_EXE." < ".$path." | "; |
|
569 | - } |
|
570 | - $MYSQL="/usr/bin/mysql"; |
|
571 | - $run_restore = $run_gzip.$MYSQL." -h".$db_hostname." -u".$db_username." -p".$db_password." ".$db_name; |
|
572 | - exec($run_restore); |
|
573 | - $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.'); |
|
574 | - redirect(base_url() . 'systems/database_restore/'); |
|
575 | - }else{ |
|
576 | - $this->session->set_flashdata('astpp_notification', 'File not exists!'); |
|
577 | - redirect(base_url() . 'systems/database_restore/'); |
|
578 | - } |
|
579 | - } |
|
580 | - redirect(base_url() . 'systems/database_restore/'); |
|
581 | - } |
|
541 | + { |
|
542 | + $json_data = array(); |
|
543 | + $count_all = $this->system_model->getbackup_list(false, "", ""); |
|
544 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'],$_GET['page']); |
|
545 | + $json_data = $paging_data["json_paging"]; |
|
546 | + |
|
547 | + $query = $this->system_model->getbackup_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
548 | + $grid_fields = json_decode($this->system_form->build_backupdastabase_list()); |
|
549 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
550 | + |
|
551 | + echo json_encode($json_data); |
|
552 | + exit; |
|
553 | + } |
|
554 | + function database_restore_one($id='') |
|
555 | + { |
|
556 | + $result = $this->system_model->get_backup_data($id); |
|
557 | + $result_array=$result->result_array(); |
|
558 | + if($result->num_rows() > 0) |
|
559 | + { |
|
560 | + $db_name = $this->db->database; |
|
561 | + $db_username = $this->db->username; |
|
562 | + $db_password = $this->db->password; |
|
563 | + $db_hostname = $this->db->hostname; |
|
564 | + $path=DATABASE_DIRECTORY.$result_array[0]['path']; |
|
565 | + if(file_exists($path)){ |
|
566 | + if (substr($path,-3)=='.gz') { |
|
567 | + $GUNZIP_EXE = $this->config->item('gunzip-path'); |
|
568 | + $run_gzip = $GUNZIP_EXE." < ".$path." | "; |
|
569 | + } |
|
570 | + $MYSQL="/usr/bin/mysql"; |
|
571 | + $run_restore = $run_gzip.$MYSQL." -h".$db_hostname." -u".$db_username." -p".$db_password." ".$db_name; |
|
572 | + exec($run_restore); |
|
573 | + $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.'); |
|
574 | + redirect(base_url() . 'systems/database_restore/'); |
|
575 | + }else{ |
|
576 | + $this->session->set_flashdata('astpp_notification', 'File not exists!'); |
|
577 | + redirect(base_url() . 'systems/database_restore/'); |
|
578 | + } |
|
579 | + } |
|
580 | + redirect(base_url() . 'systems/database_restore/'); |
|
581 | + } |
|
582 | 582 | |
583 | 583 | function database_download($id=''){ |
584 | 584 | |
585 | - $result = $this->system_model->get_backup_data($id); |
|
586 | - $result_array=$result->result_array(); |
|
587 | - if($result->num_rows() > 0) |
|
588 | - { |
|
589 | - $path=$result_array[0]['path']; |
|
590 | - $filename = basename($path); |
|
591 | - $len = filesize($path); |
|
585 | + $result = $this->system_model->get_backup_data($id); |
|
586 | + $result_array=$result->result_array(); |
|
587 | + if($result->num_rows() > 0) |
|
588 | + { |
|
589 | + $path=$result_array[0]['path']; |
|
590 | + $filename = basename($path); |
|
591 | + $len = filesize($path); |
|
592 | 592 | |
593 | - header("Content-Encoding: binary"); |
|
594 | - header("Content-Type: application/octet-stream"); |
|
595 | - header( "content-length: " . $len ); |
|
596 | - header( "content-disposition: attachment; filename=" . $filename ); |
|
597 | - header("Expires: 0"); |
|
598 | - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
|
599 | - header("Cache-Control: private"); |
|
600 | - header("Pragma: public"); |
|
601 | - ob_clean(); |
|
602 | - $fp=fopen( $path, "r" ); |
|
603 | - fpassthru( $fp ); |
|
604 | - exit; |
|
605 | - } |
|
606 | - } |
|
607 | - |
|
608 | - function database_import() |
|
609 | - { |
|
610 | - $data['page_title'] = 'Import Database'; |
|
611 | - $this->load->view('view_import_database', $data); |
|
593 | + header("Content-Encoding: binary"); |
|
594 | + header("Content-Type: application/octet-stream"); |
|
595 | + header( "content-length: " . $len ); |
|
596 | + header( "content-disposition: attachment; filename=" . $filename ); |
|
597 | + header("Expires: 0"); |
|
598 | + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
|
599 | + header("Cache-Control: private"); |
|
600 | + header("Pragma: public"); |
|
601 | + ob_clean(); |
|
602 | + $fp=fopen( $path, "r" ); |
|
603 | + fpassthru( $fp ); |
|
604 | + exit; |
|
605 | + } |
|
606 | + } |
|
607 | + |
|
608 | + function database_import() |
|
609 | + { |
|
610 | + $data['page_title'] = 'Import Database'; |
|
611 | + $this->load->view('view_import_database', $data); |
|
612 | 612 | |
613 | - } |
|
613 | + } |
|
614 | 614 | function database_import_file() |
615 | - { |
|
616 | - $filename = $_POST['fname']; |
|
617 | - $upload_greeting_file= $_FILES['userfile']['name']; |
|
618 | - $db_file = explode(".",$upload_greeting_file); |
|
619 | - if( $db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql'){ |
|
620 | - $target_path = basename( $_FILES['userfile']['name']); |
|
621 | - move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path ); |
|
615 | + { |
|
616 | + $filename = $_POST['fname']; |
|
617 | + $upload_greeting_file= $_FILES['userfile']['name']; |
|
618 | + $db_file = explode(".",$upload_greeting_file); |
|
619 | + if( $db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql'){ |
|
620 | + $target_path = basename( $_FILES['userfile']['name']); |
|
621 | + move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path ); |
|
622 | 622 | |
623 | - $query = $this->system_model->import_database($filename,$_FILES['userfile']['name']); |
|
624 | - $this->session->set_flashdata('astpp_errormsg',"The file ". basename( $_FILES['userfile']['name'])." has been uploaded"); |
|
625 | - redirect(base_url()."systems/database_restore/"); |
|
626 | - }else{ |
|
627 | - $this->session->set_flashdata('astpp_notification',"There is a some issue or invalid file format."); |
|
628 | - redirect(base_url()."systems/database_restore/"); |
|
629 | - } |
|
630 | - } |
|
631 | - function database_delete($id) |
|
632 | - { |
|
633 | - $where = array("id"=>$id); |
|
634 | - $this->db->where($where); |
|
635 | - $this->db->delete("backup_database"); |
|
636 | - $this->session->set_flashdata('astpp_errormsg', 'Database backup deleted successfully.'); |
|
637 | - redirect(base_url() . 'systems/database_restore/'); |
|
638 | - return true; |
|
639 | - } |
|
640 | - function database_backup_delete_multiple() { |
|
641 | - $ids = $this->input->post("selected_ids", true); |
|
642 | - $where = "id IN ($ids)"; |
|
643 | - $this->db->where($where); |
|
644 | - echo $this->db->delete("backup_database"); |
|
645 | - } |
|
623 | + $query = $this->system_model->import_database($filename,$_FILES['userfile']['name']); |
|
624 | + $this->session->set_flashdata('astpp_errormsg',"The file ". basename( $_FILES['userfile']['name'])." has been uploaded"); |
|
625 | + redirect(base_url()."systems/database_restore/"); |
|
626 | + }else{ |
|
627 | + $this->session->set_flashdata('astpp_notification',"There is a some issue or invalid file format."); |
|
628 | + redirect(base_url()."systems/database_restore/"); |
|
629 | + } |
|
630 | + } |
|
631 | + function database_delete($id) |
|
632 | + { |
|
633 | + $where = array("id"=>$id); |
|
634 | + $this->db->where($where); |
|
635 | + $this->db->delete("backup_database"); |
|
636 | + $this->session->set_flashdata('astpp_errormsg', 'Database backup deleted successfully.'); |
|
637 | + redirect(base_url() . 'systems/database_restore/'); |
|
638 | + return true; |
|
639 | + } |
|
640 | + function database_backup_delete_multiple() { |
|
641 | + $ids = $this->input->post("selected_ids", true); |
|
642 | + $where = "id IN ($ids)"; |
|
643 | + $this->db->where($where); |
|
644 | + echo $this->db->delete("backup_database"); |
|
645 | + } |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | ?> |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $this->load->dbutil(); |
35 | 35 | |
36 | 36 | if ($this->session->userdata('user_login') == FALSE) |
37 | - redirect(base_url() . '/astpp/login'); |
|
37 | + redirect(base_url().'/astpp/login'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | function configuration_edit($edit_id = '') { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->session->set_userdata('configuration_search', $action); |
59 | 59 | } |
60 | 60 | if (@$ajax_search != 1) { |
61 | - redirect(base_url() . 'systems/configuration/'); |
|
61 | + redirect(base_url().'systems/configuration/'); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -84,29 +84,29 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - function configuration($group_title='') { |
|
88 | - if($group_title==""){ |
|
89 | - redirect(base_url() . '/dashboard'); |
|
87 | + function configuration($group_title = '') { |
|
88 | + if ($group_title == "") { |
|
89 | + redirect(base_url().'/dashboard'); |
|
90 | 90 | } |
91 | - if($group_title=="email"){ |
|
91 | + if ($group_title == "email") { |
|
92 | 92 | $data['test_email_flag'] = true; |
93 | 93 | } |
94 | 94 | $data['username'] = $this->session->userdata('user_name'); |
95 | 95 | $data['page_title'] = ucfirst($group_title); |
96 | - $data['group_title']=$group_title; |
|
97 | - $where=array("group_title"=>$group_title); |
|
96 | + $data['group_title'] = $group_title; |
|
97 | + $where = array("group_title"=>$group_title); |
|
98 | 98 | $details = $this->db_model->getSelect("*", "system", $where); |
99 | - $data['details']=$details->result_array(); |
|
99 | + $data['details'] = $details->result_array(); |
|
100 | 100 | $add_array = $this->input->post(); |
101 | - if (!empty($add_array)) { |
|
101 | + if ( ! empty($add_array)) { |
|
102 | 102 | |
103 | - foreach($add_array as $key=>$val){ |
|
104 | - $update_array=array('value'=>$val); |
|
103 | + foreach ($add_array as $key=>$val) { |
|
104 | + $update_array = array('value'=>$val); |
|
105 | 105 | $this->system_model->edit_configuration($update_array, $key); |
106 | 106 | } |
107 | 107 | $this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!'); |
108 | - redirect(base_url() . 'systems/configuration/'.$group_title); |
|
109 | - }else{ |
|
108 | + redirect(base_url().'systems/configuration/'.$group_title); |
|
109 | + } else { |
|
110 | 110 | $this->load->view('view_systemconf', $data); |
111 | 111 | } |
112 | 112 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
167 | 167 | $account_data = $this->session->userdata("accountinfo"); |
168 | 168 | $reseller = $account_data['id']; |
169 | - $this->resellertemplate_save($add_array,$reseller); |
|
169 | + $this->resellertemplate_save($add_array, $reseller); |
|
170 | 170 | } |
171 | 171 | else |
172 | 172 | { |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | - function resellertemplate_save($data,$resellerid) |
|
177 | + function resellertemplate_save($data, $resellerid) |
|
178 | 178 | { |
179 | - $where = array('name' => $data['name'],'reseller_id'=>$resellerid); |
|
179 | + $where = array('name' => $data['name'], 'reseller_id'=>$resellerid); |
|
180 | 180 | $count = $this->db_model->countQuery("*", "default_templates", $where); |
181 | 181 | $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
182 | - if($count >0) |
|
182 | + if ($count > 0) |
|
183 | 183 | { |
184 | 184 | $data['page_title'] = 'Edit Template'; |
185 | 185 | if ($this->form_validation->run() == FALSE) { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | $this->system_model->edit_resellertemplate($data, $data['id']); |
190 | 190 | $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
191 | - redirect(base_url() . 'systems/template/'); |
|
191 | + redirect(base_url().'systems/template/'); |
|
192 | 192 | exit; |
193 | 193 | } |
194 | 194 | } else { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $data['reseller_id'] = $resellerid; |
200 | 200 | $this->system_model->add_resellertemplate($data); |
201 | 201 | $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
202 | - redirect(base_url() . 'systems/template/'); |
|
202 | + redirect(base_url().'systems/template/'); |
|
203 | 203 | exit; |
204 | 204 | } |
205 | 205 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | unset($data['page_title']); |
218 | 218 | $this->system_model->edit_template($data, $data['id']); |
219 | 219 | $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
220 | - redirect(base_url() . 'systems/template/'); |
|
220 | + redirect(base_url().'systems/template/'); |
|
221 | 221 | exit; |
222 | 222 | } |
223 | 223 | } else { |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | unset($data['form']); |
229 | 229 | $this->system_model->add_template($data); |
230 | 230 | $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
231 | - redirect(base_url() . 'systems/template/'); |
|
231 | + redirect(base_url().'systems/template/'); |
|
232 | 232 | exit; |
233 | 233 | } |
234 | 234 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $this->session->set_userdata('template_search', $action); |
246 | 246 | } |
247 | 247 | if (@$ajax_search != 1) { |
248 | - redirect(base_url() . 'systems/template/'); |
|
248 | + redirect(base_url().'systems/template/'); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $this->session->set_userdata('country_list_search', $action); |
294 | 294 | } |
295 | 295 | if (@$ajax_search != 1) { |
296 | - redirect(base_url() . 'systems/country_list/'); |
|
296 | + redirect(base_url().'systems/country_list/'); |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | |
353 | 353 | function country_remove($id) { |
354 | 354 | $this->system_model->remove_country($id); |
355 | - $country=$this->common->get_field_name('country','countrycode',$id); |
|
355 | + $country = $this->common->get_field_name('country', 'countrycode', $id); |
|
356 | 356 | $this->session->set_flashdata('astpp_notification', $country.'Country removed successfully!'); |
357 | - redirect(base_url() . 'systems/country_list/'); |
|
357 | + redirect(base_url().'systems/country_list/'); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | function country_delete_multiple() { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $this->session->set_userdata('currency_list_search', $action); |
406 | 406 | } |
407 | 407 | if (@$ajax_search != 1) { |
408 | - redirect(base_url() . 'systems/currency_list/'); |
|
408 | + redirect(base_url().'systems/currency_list/'); |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | |
@@ -464,10 +464,10 @@ discard block |
||
464 | 464 | } |
465 | 465 | |
466 | 466 | function currency_remove($id) { |
467 | - $currencyname=$this->common->get_field_name('currencyname','currency',$id); |
|
467 | + $currencyname = $this->common->get_field_name('currencyname', 'currency', $id); |
|
468 | 468 | $this->system_model->remove_currency($id); |
469 | - $this->session->set_flashdata('astpp_notification',$currencyname. ' Currency removed successfully!'); |
|
470 | - redirect(base_url() . 'systems/currency_list/'); |
|
469 | + $this->session->set_flashdata('astpp_notification', $currencyname.' Currency removed successfully!'); |
|
470 | + redirect(base_url().'systems/currency_list/'); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | function currency_delete_multiple() { |
@@ -478,53 +478,53 @@ discard block |
||
478 | 478 | } |
479 | 479 | function database_backup() |
480 | 480 | { |
481 | - $data=array(); |
|
481 | + $data = array(); |
|
482 | 482 | $data['username'] = $this->session->userdata('user_name'); |
483 | 483 | $data['page_title'] = 'Database Backup'; |
484 | - $filename=$this->db->database."_".date("YmdHms").".sql.gz"; |
|
484 | + $filename = $this->db->database."_".date("YmdHms").".sql.gz"; |
|
485 | 485 | $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($filename), ''); |
486 | 486 | $this->load->view('view_database_backup', $data); |
487 | 487 | } |
488 | 488 | function database_backup_save() |
489 | 489 | { |
490 | 490 | |
491 | - $add_array=$this->input->post(); |
|
491 | + $add_array = $this->input->post(); |
|
492 | 492 | |
493 | - $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'],$add_array['id']),$add_array); |
|
493 | + $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'], $add_array['id']), $add_array); |
|
494 | 494 | $data['page_title'] = 'Database Backup'; |
495 | - if($add_array['id'] != ''){ |
|
495 | + if ($add_array['id'] != '') { |
|
496 | 496 | |
497 | - }else{ |
|
498 | - if($this->form_validation->run() == FALSE) { |
|
497 | + } else { |
|
498 | + if ($this->form_validation->run() == FALSE) { |
|
499 | 499 | $data['validation_errors'] = validation_errors(); |
500 | 500 | echo $data['validation_errors']; |
501 | 501 | exit; |
502 | - }else{ |
|
502 | + } else { |
|
503 | 503 | $db_name = $this->db->database; |
504 | 504 | $db_username = $this->db->username; |
505 | 505 | $db_password = $this->db->password; |
506 | 506 | $db_hostname = $this->db->hostname; |
507 | 507 | $filename = $add_array['path']; |
508 | - $backup_file=DATABASE_DIRECTORY.$filename; |
|
509 | - if (substr($backup_file,-3)=='.gz'){ |
|
510 | - $backup_file = substr($backup_file,0,-3); |
|
511 | - $do_gzip=1; |
|
508 | + $backup_file = DATABASE_DIRECTORY.$filename; |
|
509 | + if (substr($backup_file, -3) == '.gz') { |
|
510 | + $backup_file = substr($backup_file, 0, -3); |
|
511 | + $do_gzip = 1; |
|
512 | 512 | } |
513 | 513 | |
514 | - $run_backup="/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'"; |
|
515 | - $error_zip=0; |
|
516 | - exec($run_backup,$output,$error); |
|
517 | - if ($do_gzip){ |
|
514 | + $run_backup = "/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'"; |
|
515 | + $error_zip = 0; |
|
516 | + exec($run_backup, $output, $error); |
|
517 | + if ($do_gzip) { |
|
518 | 518 | $gzip = $this->config->item('gzip-path'); |
519 | 519 | $run_gzip = $gzip." ".$backup_file; |
520 | - exec($run_gzip,$output,$error_zip); |
|
520 | + exec($run_gzip, $output, $error_zip); |
|
521 | 521 | } |
522 | 522 | |
523 | - if($error == 0 && $error_zip == 0 ){ |
|
523 | + if ($error == 0 && $error_zip == 0) { |
|
524 | 524 | $this->system_model->backup_insert($add_array); |
525 | 525 | echo json_encode(array("SUCCESS"=> $add_array['backup_name']." backup exported successfully!")); |
526 | 526 | exit; |
527 | - }else{ |
|
527 | + } else { |
|
528 | 528 | echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section'; |
529 | 529 | exit; |
530 | 530 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | { |
542 | 542 | $json_data = array(); |
543 | 543 | $count_all = $this->system_model->getbackup_list(false, "", ""); |
544 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'],$_GET['page']); |
|
544 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
545 | 545 | $json_data = $paging_data["json_paging"]; |
546 | 546 | |
547 | 547 | $query = $this->system_model->getbackup_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
@@ -551,56 +551,56 @@ discard block |
||
551 | 551 | echo json_encode($json_data); |
552 | 552 | exit; |
553 | 553 | } |
554 | - function database_restore_one($id='') |
|
554 | + function database_restore_one($id = '') |
|
555 | 555 | { |
556 | 556 | $result = $this->system_model->get_backup_data($id); |
557 | - $result_array=$result->result_array(); |
|
558 | - if($result->num_rows() > 0) |
|
557 | + $result_array = $result->result_array(); |
|
558 | + if ($result->num_rows() > 0) |
|
559 | 559 | { |
560 | 560 | $db_name = $this->db->database; |
561 | 561 | $db_username = $this->db->username; |
562 | 562 | $db_password = $this->db->password; |
563 | 563 | $db_hostname = $this->db->hostname; |
564 | - $path=DATABASE_DIRECTORY.$result_array[0]['path']; |
|
565 | - if(file_exists($path)){ |
|
566 | - if (substr($path,-3)=='.gz') { |
|
564 | + $path = DATABASE_DIRECTORY.$result_array[0]['path']; |
|
565 | + if (file_exists($path)) { |
|
566 | + if (substr($path, -3) == '.gz') { |
|
567 | 567 | $GUNZIP_EXE = $this->config->item('gunzip-path'); |
568 | 568 | $run_gzip = $GUNZIP_EXE." < ".$path." | "; |
569 | 569 | } |
570 | - $MYSQL="/usr/bin/mysql"; |
|
570 | + $MYSQL = "/usr/bin/mysql"; |
|
571 | 571 | $run_restore = $run_gzip.$MYSQL." -h".$db_hostname." -u".$db_username." -p".$db_password." ".$db_name; |
572 | 572 | exec($run_restore); |
573 | 573 | $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.'); |
574 | - redirect(base_url() . 'systems/database_restore/'); |
|
575 | - }else{ |
|
574 | + redirect(base_url().'systems/database_restore/'); |
|
575 | + } else { |
|
576 | 576 | $this->session->set_flashdata('astpp_notification', 'File not exists!'); |
577 | - redirect(base_url() . 'systems/database_restore/'); |
|
577 | + redirect(base_url().'systems/database_restore/'); |
|
578 | 578 | } |
579 | 579 | } |
580 | - redirect(base_url() . 'systems/database_restore/'); |
|
580 | + redirect(base_url().'systems/database_restore/'); |
|
581 | 581 | } |
582 | 582 | |
583 | - function database_download($id=''){ |
|
583 | + function database_download($id = '') { |
|
584 | 584 | |
585 | 585 | $result = $this->system_model->get_backup_data($id); |
586 | - $result_array=$result->result_array(); |
|
587 | - if($result->num_rows() > 0) |
|
586 | + $result_array = $result->result_array(); |
|
587 | + if ($result->num_rows() > 0) |
|
588 | 588 | { |
589 | - $path=$result_array[0]['path']; |
|
589 | + $path = $result_array[0]['path']; |
|
590 | 590 | $filename = basename($path); |
591 | 591 | $len = filesize($path); |
592 | 592 | |
593 | 593 | header("Content-Encoding: binary"); |
594 | 594 | header("Content-Type: application/octet-stream"); |
595 | - header( "content-length: " . $len ); |
|
596 | - header( "content-disposition: attachment; filename=" . $filename ); |
|
595 | + header("content-length: ".$len); |
|
596 | + header("content-disposition: attachment; filename=".$filename); |
|
597 | 597 | header("Expires: 0"); |
598 | 598 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
599 | 599 | header("Cache-Control: private"); |
600 | 600 | header("Pragma: public"); |
601 | 601 | ob_clean(); |
602 | - $fp=fopen( $path, "r" ); |
|
603 | - fpassthru( $fp ); |
|
602 | + $fp = fopen($path, "r"); |
|
603 | + fpassthru($fp); |
|
604 | 604 | exit; |
605 | 605 | } |
606 | 606 | } |
@@ -614,17 +614,17 @@ discard block |
||
614 | 614 | function database_import_file() |
615 | 615 | { |
616 | 616 | $filename = $_POST['fname']; |
617 | - $upload_greeting_file= $_FILES['userfile']['name']; |
|
618 | - $db_file = explode(".",$upload_greeting_file); |
|
619 | - if( $db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql'){ |
|
620 | - $target_path = basename( $_FILES['userfile']['name']); |
|
621 | - move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path ); |
|
617 | + $upload_greeting_file = $_FILES['userfile']['name']; |
|
618 | + $db_file = explode(".", $upload_greeting_file); |
|
619 | + if ($db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql') { |
|
620 | + $target_path = basename($_FILES['userfile']['name']); |
|
621 | + move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path); |
|
622 | 622 | |
623 | - $query = $this->system_model->import_database($filename,$_FILES['userfile']['name']); |
|
624 | - $this->session->set_flashdata('astpp_errormsg',"The file ". basename( $_FILES['userfile']['name'])." has been uploaded"); |
|
623 | + $query = $this->system_model->import_database($filename, $_FILES['userfile']['name']); |
|
624 | + $this->session->set_flashdata('astpp_errormsg', "The file ".basename($_FILES['userfile']['name'])." has been uploaded"); |
|
625 | 625 | redirect(base_url()."systems/database_restore/"); |
626 | - }else{ |
|
627 | - $this->session->set_flashdata('astpp_notification',"There is a some issue or invalid file format."); |
|
626 | + } else { |
|
627 | + $this->session->set_flashdata('astpp_notification', "There is a some issue or invalid file format."); |
|
628 | 628 | redirect(base_url()."systems/database_restore/"); |
629 | 629 | } |
630 | 630 | } |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | $this->db->where($where); |
635 | 635 | $this->db->delete("backup_database"); |
636 | 636 | $this->session->set_flashdata('astpp_errormsg', 'Database backup deleted successfully.'); |
637 | - redirect(base_url() . 'systems/database_restore/'); |
|
637 | + redirect(base_url().'systems/database_restore/'); |
|
638 | 638 | return true; |
639 | 639 | } |
640 | 640 | function database_backup_delete_multiple() { |
@@ -33,8 +33,9 @@ discard block |
||
33 | 33 | $this->load->model('system_model'); |
34 | 34 | $this->load->dbutil(); |
35 | 35 | |
36 | - if ($this->session->userdata('user_login') == FALSE) |
|
37 | - redirect(base_url() . '/astpp/login'); |
|
36 | + if ($this->session->userdata('user_login') == FALSE) { |
|
37 | + redirect(base_url() . '/astpp/login'); |
|
38 | + } |
|
38 | 39 | } |
39 | 40 | |
40 | 41 | function configuration_edit($edit_id = '') { |
@@ -106,7 +107,7 @@ discard block |
||
106 | 107 | } |
107 | 108 | $this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!'); |
108 | 109 | redirect(base_url() . 'systems/configuration/'.$group_title); |
109 | - }else{ |
|
110 | + } else{ |
|
110 | 111 | $this->load->view('view_systemconf', $data); |
111 | 112 | } |
112 | 113 | } |
@@ -167,8 +168,7 @@ discard block |
||
167 | 168 | $account_data = $this->session->userdata("accountinfo"); |
168 | 169 | $reseller = $account_data['id']; |
169 | 170 | $this->resellertemplate_save($add_array,$reseller); |
170 | - } |
|
171 | - else |
|
171 | + } else |
|
172 | 172 | { |
173 | 173 | $this->admintemplate_save($add_array); |
174 | 174 | } |
@@ -494,12 +494,12 @@ discard block |
||
494 | 494 | $data['page_title'] = 'Database Backup'; |
495 | 495 | if($add_array['id'] != ''){ |
496 | 496 | |
497 | - }else{ |
|
497 | + } else{ |
|
498 | 498 | if($this->form_validation->run() == FALSE) { |
499 | 499 | $data['validation_errors'] = validation_errors(); |
500 | 500 | echo $data['validation_errors']; |
501 | 501 | exit; |
502 | - }else{ |
|
502 | + } else{ |
|
503 | 503 | $db_name = $this->db->database; |
504 | 504 | $db_username = $this->db->username; |
505 | 505 | $db_password = $this->db->password; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | $this->system_model->backup_insert($add_array); |
525 | 525 | echo json_encode(array("SUCCESS"=> $add_array['backup_name']." backup exported successfully!")); |
526 | 526 | exit; |
527 | - }else{ |
|
527 | + } else{ |
|
528 | 528 | echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section'; |
529 | 529 | exit; |
530 | 530 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | exec($run_restore); |
573 | 573 | $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.'); |
574 | 574 | redirect(base_url() . 'systems/database_restore/'); |
575 | - }else{ |
|
575 | + } else{ |
|
576 | 576 | $this->session->set_flashdata('astpp_notification', 'File not exists!'); |
577 | 577 | redirect(base_url() . 'systems/database_restore/'); |
578 | 578 | } |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | $query = $this->system_model->import_database($filename,$_FILES['userfile']['name']); |
624 | 624 | $this->session->set_flashdata('astpp_errormsg',"The file ". basename( $_FILES['userfile']['name'])." has been uploaded"); |
625 | 625 | redirect(base_url()."systems/database_restore/"); |
626 | - }else{ |
|
626 | + } else{ |
|
627 | 627 | $this->session->set_flashdata('astpp_notification',"There is a some issue or invalid file format."); |
628 | 628 | redirect(base_url()."systems/database_restore/"); |
629 | 629 | } |
@@ -22,221 +22,221 @@ discard block |
||
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 System_form { |
28 | 28 | |
29 | - function get_template_form_fields() { |
|
29 | + function get_template_form_fields() { |
|
30 | 30 | |
31 | - $form['forms'] = array(base_url() . 'systems/template_save/', array("template_form", "name" => "template_form")); |
|
32 | - $form['Email Template'] = array( |
|
33 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
34 | - array(' Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
35 | - array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | - array('Body', 'TEXTAREA', array('name' => 'template', 'id' => 'template', 'size' => '20', 'class' => "textarea medium"), 'trim|required', 'tOOL TIP', ''), |
|
37 | - ); |
|
38 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'systems/template/\')'); |
|
39 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
31 | + $form['forms'] = array(base_url() . 'systems/template_save/', array("template_form", "name" => "template_form")); |
|
32 | + $form['Email Template'] = array( |
|
33 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
34 | + array(' Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
35 | + array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | + array('Body', 'TEXTAREA', array('name' => 'template', 'id' => 'template', 'size' => '20', 'class' => "textarea medium"), 'trim|required', 'tOOL TIP', ''), |
|
37 | + ); |
|
38 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'systems/template/\')'); |
|
39 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
40 | 40 | |
41 | - return $form; |
|
42 | - } |
|
41 | + return $form; |
|
42 | + } |
|
43 | 43 | |
44 | - function get_template_search_form() { |
|
45 | - $form['forms'] = array("", array('id' => "template_search")); |
|
46 | - $form['Search'] = array( |
|
44 | + function get_template_search_form() { |
|
45 | + $form['forms'] = array("", array('id' => "template_search")); |
|
46 | + $form['Search'] = array( |
|
47 | 47 | |
48 | - array(' Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
|
49 | - array('Subject', 'INPUT', array('name' => 'subject[subject]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'subject[subject-string]', '', '', '', 'search_string_type', ''),array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
50 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
51 | - ); |
|
52 | - $form['button_search'] = array('name' => 'action', 'id' => "template_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
53 | - $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'); |
|
54 | - return $form; |
|
55 | - } |
|
48 | + array(' Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
|
49 | + array('Subject', 'INPUT', array('name' => 'subject[subject]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'subject[subject-string]', '', '', '', 'search_string_type', ''),array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
50 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
51 | + ); |
|
52 | + $form['button_search'] = array('name' => 'action', 'id' => "template_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
53 | + $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'); |
|
54 | + return $form; |
|
55 | + } |
|
56 | 56 | |
57 | - function get_configuration_form_fields() { |
|
57 | + function get_configuration_form_fields() { |
|
58 | 58 | |
59 | - $form['forms'] = array(base_url() . 'systems/configuration_save/', array("id" => "config_form", "name" => "config_form")); |
|
60 | - $form['Edit Settings '] = array( |
|
61 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
62 | - array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
63 | - array('Value', 'INPUT', array('name' => 'value', 'size' => '20', 'class' => "text field medium"), 'trim|required', 'tOOL TIP', ''), |
|
64 | - array('Comment', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
65 | - ); |
|
59 | + $form['forms'] = array(base_url() . 'systems/configuration_save/', array("id" => "config_form", "name" => "config_form")); |
|
60 | + $form['Edit Settings '] = array( |
|
61 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
62 | + array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
63 | + array('Value', 'INPUT', array('name' => 'value', 'size' => '20', 'class' => "text field medium"), 'trim|required', 'tOOL TIP', ''), |
|
64 | + array('Comment', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
65 | + ); |
|
66 | 66 | |
67 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
68 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
67 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
68 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
69 | 69 | |
70 | - return $form; |
|
71 | - } |
|
70 | + return $form; |
|
71 | + } |
|
72 | 72 | |
73 | - function get_configuration_search_form() { |
|
74 | - $form['forms'] = array("", array('id' => "configuration_search")); |
|
75 | - $form['Search'] = array( |
|
73 | + function get_configuration_search_form() { |
|
74 | + $form['forms'] = array("", array('id' => "configuration_search")); |
|
75 | + $form['Search'] = array( |
|
76 | 76 | |
77 | - array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
|
78 | - array('Value', 'INPUT', array('name' => 'value[value]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'value[value-string]', '', '', '', 'search_string_type', ''), |
|
79 | - array('Description', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''), |
|
80 | - array('Group', 'group_title', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'group_title', 'group_title', 'system', 'build_dropdown','where_arr',"group_title NOT IN ('asterisk','osc','freepbx')", 'group_by', 'group_title'), |
|
77 | + array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
|
78 | + array('Value', 'INPUT', array('name' => 'value[value]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'value[value-string]', '', '', '', 'search_string_type', ''), |
|
79 | + array('Description', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''), |
|
80 | + array('Group', 'group_title', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'group_title', 'group_title', 'system', 'build_dropdown','where_arr',"group_title NOT IN ('asterisk','osc','freepbx')", 'group_by', 'group_title'), |
|
81 | 81 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
82 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
83 | - ); |
|
84 | - $form['button_search'] = array('name' => 'action', 'id' => "configuration_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
85 | - $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'); |
|
86 | - return $form; |
|
87 | - } |
|
82 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
83 | + ); |
|
84 | + $form['button_search'] = array('name' => 'action', 'id' => "configuration_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
85 | + $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'); |
|
86 | + return $form; |
|
87 | + } |
|
88 | 88 | |
89 | - function build_system_list_for_admin() { |
|
90 | - $grid_field_arr = json_encode(array( |
|
91 | - array("Name", "190", "name", "", "", ""), |
|
92 | - array("Value", "190", "value", "", "", ""), |
|
93 | - array("Description", "320", "comment", "", "", ""), |
|
94 | - array("Group", "120", "group_title", "", "", ""), |
|
95 | - array("Action", "442", "", "", "",array("EDIT" => array("url" => "systems/configuration_edit/", "mode" => "popup"), |
|
96 | - )) |
|
97 | - )); |
|
98 | - return $grid_field_arr; |
|
99 | - } |
|
89 | + function build_system_list_for_admin() { |
|
90 | + $grid_field_arr = json_encode(array( |
|
91 | + array("Name", "190", "name", "", "", ""), |
|
92 | + array("Value", "190", "value", "", "", ""), |
|
93 | + array("Description", "320", "comment", "", "", ""), |
|
94 | + array("Group", "120", "group_title", "", "", ""), |
|
95 | + array("Action", "442", "", "", "",array("EDIT" => array("url" => "systems/configuration_edit/", "mode" => "popup"), |
|
96 | + )) |
|
97 | + )); |
|
98 | + return $grid_field_arr; |
|
99 | + } |
|
100 | 100 | |
101 | - function build_grid_buttons() { |
|
102 | - $buttons_json = json_encode(array( |
|
103 | - )); |
|
104 | - return $buttons_json; |
|
105 | - } |
|
101 | + function build_grid_buttons() { |
|
102 | + $buttons_json = json_encode(array( |
|
103 | + )); |
|
104 | + return $buttons_json; |
|
105 | + } |
|
106 | 106 | |
107 | - function build_template_list_for_admin() { |
|
108 | - $grid_field_arr = json_encode(array(array("Name", "425", "name", "", "", "","","true","center"), |
|
109 | - array("Subject", "650", "subject", "", "", "","","true","center"), |
|
110 | - array("Action", "200", "", "", "",array("EDIT" => array("url" => "systems/template_edit/", "mode" => "single"), |
|
111 | - )) |
|
112 | - )); |
|
113 | - return $grid_field_arr; |
|
114 | - } |
|
107 | + function build_template_list_for_admin() { |
|
108 | + $grid_field_arr = json_encode(array(array("Name", "425", "name", "", "", "","","true","center"), |
|
109 | + array("Subject", "650", "subject", "", "", "","","true","center"), |
|
110 | + array("Action", "200", "", "", "",array("EDIT" => array("url" => "systems/template_edit/", "mode" => "single"), |
|
111 | + )) |
|
112 | + )); |
|
113 | + return $grid_field_arr; |
|
114 | + } |
|
115 | 115 | |
116 | - function build_country_list_for_admin() { |
|
117 | - $action = 'systems/country_list_edit/'; |
|
118 | - $action_remove = 'systems/country_remove/'; |
|
119 | - $mode="popup"; |
|
120 | - $grid_field_arr = json_encode(array( |
|
121 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "","","false","center"), |
|
122 | - array("Name", "705", "country", "", "", "","","true","center"), |
|
123 | - array("Action", "100", "", "", "", array("EDIT" => array("url" => "$action", "mode" => "$mode"), |
|
124 | - "DELETE" => array("url" => "$action_remove", "mode" => "single") |
|
125 | - )) |
|
126 | - )); |
|
127 | - return $grid_field_arr; |
|
128 | - } |
|
116 | + function build_country_list_for_admin() { |
|
117 | + $action = 'systems/country_list_edit/'; |
|
118 | + $action_remove = 'systems/country_remove/'; |
|
119 | + $mode="popup"; |
|
120 | + $grid_field_arr = json_encode(array( |
|
121 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "","","false","center"), |
|
122 | + array("Name", "705", "country", "", "", "","","true","center"), |
|
123 | + array("Action", "100", "", "", "", array("EDIT" => array("url" => "$action", "mode" => "$mode"), |
|
124 | + "DELETE" => array("url" => "$action_remove", "mode" => "single") |
|
125 | + )) |
|
126 | + )); |
|
127 | + return $grid_field_arr; |
|
128 | + } |
|
129 | 129 | |
130 | - function build_admin_grid_buttons() { |
|
131 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/country_add/", "popup"), |
|
132 | - array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "systems/country_delete_multiple"), |
|
133 | - )); |
|
134 | - return $buttons_json; |
|
135 | - } |
|
130 | + function build_admin_grid_buttons() { |
|
131 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/country_add/", "popup"), |
|
132 | + array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "systems/country_delete_multiple"), |
|
133 | + )); |
|
134 | + return $buttons_json; |
|
135 | + } |
|
136 | 136 | |
137 | - function get_search_country_form() { |
|
137 | + function get_search_country_form() { |
|
138 | 138 | |
139 | - $form['forms'] = array("", array('id' => "country_search")); |
|
140 | - $form['Search'] = array( |
|
141 | - array('Name', 'id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
142 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
143 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
139 | + $form['forms'] = array("", array('id' => "country_search")); |
|
140 | + $form['Search'] = array( |
|
141 | + array('Name', 'id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
142 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
143 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
144 | 144 | |
145 | - ); |
|
145 | + ); |
|
146 | 146 | |
147 | - $form['button_search'] = array('name' => 'action', 'id' => "country_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
148 | - $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'); |
|
147 | + $form['button_search'] = array('name' => 'action', 'id' => "country_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
148 | + $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'); |
|
149 | 149 | |
150 | - return $form; |
|
151 | - } |
|
150 | + return $form; |
|
151 | + } |
|
152 | 152 | |
153 | - function get_country_form_fields() { |
|
153 | + function get_country_form_fields() { |
|
154 | 154 | |
155 | 155 | |
156 | - $form['forms'] = array(base_url() . 'systems/country_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
157 | - $form['Country List'] = array( |
|
158 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
159 | - array('Name', 'INPUT', array('name' => 'country', 'size' => '20', 'class' => "text field medium"), 'trim|required|char|min_length[2]|max_length[20]|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
156 | + $form['forms'] = array(base_url() . 'systems/country_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
157 | + $form['Country List'] = array( |
|
158 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
159 | + array('Name', 'INPUT', array('name' => 'country', 'size' => '20', 'class' => "text field medium"), 'trim|required|char|min_length[2]|max_length[20]|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
160 | 160 | |
161 | - ); |
|
162 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
163 | - $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\')'); |
|
164 | - return $form; |
|
165 | - } |
|
161 | + ); |
|
162 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
163 | + $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\')'); |
|
164 | + return $form; |
|
165 | + } |
|
166 | 166 | |
167 | - function build_currency_list_for_admin() { |
|
168 | - $action = 'systems/currency_list_edit/'; |
|
169 | - $action_remove = 'systems/currency_remove/'; |
|
170 | - $mode="popup"; |
|
167 | + function build_currency_list_for_admin() { |
|
168 | + $action = 'systems/currency_list_edit/'; |
|
169 | + $action_remove = 'systems/currency_remove/'; |
|
170 | + $mode="popup"; |
|
171 | 171 | |
172 | - $grid_field_arr = json_encode(array( |
|
173 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "70", "", "", "", "","","false","center"), |
|
174 | - array("Name", "320", "currencyname", "", "", "","","true","center"), |
|
175 | - array("Code", "290", "currency", "", "", "","","true","center"), |
|
176 | - array(" Rate", "330", "currencyrate", "", "", "","","true","right"), |
|
177 | - array("Action", "265", "", "", "", array("EDIT" => array("url" => "$action", "mode" => "$mode"), |
|
178 | - "DELETE" => array("url" => "$action_remove", "mode" => "single") |
|
179 | - )) |
|
180 | - )); |
|
181 | - return $grid_field_arr; |
|
182 | - } |
|
172 | + $grid_field_arr = json_encode(array( |
|
173 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "70", "", "", "", "","","false","center"), |
|
174 | + array("Name", "320", "currencyname", "", "", "","","true","center"), |
|
175 | + array("Code", "290", "currency", "", "", "","","true","center"), |
|
176 | + array(" Rate", "330", "currencyrate", "", "", "","","true","right"), |
|
177 | + array("Action", "265", "", "", "", array("EDIT" => array("url" => "$action", "mode" => "$mode"), |
|
178 | + "DELETE" => array("url" => "$action_remove", "mode" => "single") |
|
179 | + )) |
|
180 | + )); |
|
181 | + return $grid_field_arr; |
|
182 | + } |
|
183 | 183 | |
184 | - function get_search_currency_form() { |
|
184 | + function get_search_currency_form() { |
|
185 | 185 | |
186 | - $form['forms'] = array("", array('id' => "currency_search")); |
|
187 | - $form['Search'] = array( |
|
186 | + $form['forms'] = array("", array('id' => "currency_search")); |
|
187 | + $form['Search'] = array( |
|
188 | 188 | |
189 | - array('Name', 'INPUT', array('name' => 'currencyname[currencyname]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'currencyname[currencyname-string]', '', '', '', 'search_string_type', ''), |
|
190 | - array('Code', 'INPUT', array('name' => 'currency[currency]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'currency[currency-string]', '', '', '', 'search_string_type', ''), |
|
191 | - array('Rate', 'INPUT', array('name' => 'currencyrate[currencyrate]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'currencyrate[currencyrate-integer]', '', '', '', 'search_int_type', ''), |
|
192 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
193 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
189 | + array('Name', 'INPUT', array('name' => 'currencyname[currencyname]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'currencyname[currencyname-string]', '', '', '', 'search_string_type', ''), |
|
190 | + array('Code', 'INPUT', array('name' => 'currency[currency]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'currency[currency-string]', '', '', '', 'search_string_type', ''), |
|
191 | + array('Rate', 'INPUT', array('name' => 'currencyrate[currencyrate]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'currencyrate[currencyrate-integer]', '', '', '', 'search_int_type', ''), |
|
192 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
193 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
194 | 194 | |
195 | - $form['button_search'] = array('name' => 'action', 'id' => "currency_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
196 | - $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'); |
|
195 | + $form['button_search'] = array('name' => 'action', 'id' => "currency_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
196 | + $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'); |
|
197 | 197 | |
198 | - return $form; |
|
199 | - } |
|
198 | + return $form; |
|
199 | + } |
|
200 | 200 | |
201 | - function get_currency_form_fields() { |
|
201 | + function get_currency_form_fields() { |
|
202 | 202 | |
203 | 203 | |
204 | - $form['forms'] = array(base_url() . 'systems/currency_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
205 | - $form['Currency List'] = array( |
|
206 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
207 | - array('Name', 'INPUT', array('name' => 'currencyname', 'size' => '20','maxlength' => '40', 'class' => "text field medium"), 'trim|required|char|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
204 | + $form['forms'] = array(base_url() . 'systems/currency_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
205 | + $form['Currency List'] = array( |
|
206 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
207 | + array('Name', 'INPUT', array('name' => 'currencyname', 'size' => '20','maxlength' => '40', 'class' => "text field medium"), 'trim|required|char|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
208 | 208 | array('Code', 'INPUT', array('name' => 'currency', 'size' => '20','maxlength' => '3', 'class' => "text field medium"), 'trim|required|char|xss_clean', 'tOOL TIP', 'Please Enter country'), |
209 | - array('Rate', 'INPUT', array('name' => 'currencyrate', 'size' => '20','maxlength' => '7', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
209 | + array('Rate', 'INPUT', array('name' => 'currencyrate', 'size' => '20','maxlength' => '7', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
210 | 210 | |
211 | - ); |
|
212 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
213 | - $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\')'); |
|
214 | - return $form; |
|
215 | - } |
|
211 | + ); |
|
212 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
213 | + $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\')'); |
|
214 | + return $form; |
|
215 | + } |
|
216 | 216 | |
217 | - function build_admin_currency_grid_buttons() { |
|
218 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/currency_add/", "popup"), |
|
219 | - array("Update Currencies","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "currencyupdate/update_currency/", 'single'), |
|
220 | - array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "systems/currency_delete_multiple"), |
|
221 | - )); |
|
222 | - return $buttons_json; |
|
223 | - } |
|
217 | + function build_admin_currency_grid_buttons() { |
|
218 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/currency_add/", "popup"), |
|
219 | + array("Update Currencies","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "currencyupdate/update_currency/", 'single'), |
|
220 | + array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "systems/currency_delete_multiple"), |
|
221 | + )); |
|
222 | + return $buttons_json; |
|
223 | + } |
|
224 | 224 | |
225 | 225 | |
226 | 226 | function get_backup_database_form_fields($file_name,$id='') { |
227 | 227 | $val = $id > 0 ? "backup_database.path.$id" : 'backup_database.path'; |
228 | - $form['forms'] = array(base_url() . 'systems/database_backup_save/',array('id' => 'backup_form', 'method' => 'POST', 'name' => 'backup_form')); |
|
229 | - $form['Database Information'] = array( |
|
228 | + $form['forms'] = array(base_url() . 'systems/database_backup_save/',array('id' => 'backup_form', 'method' => 'POST', 'name' => 'backup_form')); |
|
229 | + $form['Database Information'] = array( |
|
230 | 230 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
231 | 231 | array('Name', 'INPUT', array('name' => 'backup_name', 'size' => '20', 'class' => "text field medium"), 'required', 'tOOL TIP', ''), |
232 | 232 | array('File Name', 'INPUT', array('name' => 'path', 'size' => '20', 'value'=>$file_name,'class' => "text field medium"), 'trim|required|is_unique[' . $val . ']', 'tOOL TIP', ''), |
233 | - ); |
|
234 | - $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\')'); |
|
235 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
236 | - return $form; |
|
233 | + ); |
|
234 | + $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\')'); |
|
235 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
236 | + return $form; |
|
237 | 237 | } |
238 | 238 | function build_backupdastabase_list() { |
239 | - $grid_field_arr = json_encode(array( |
|
239 | + $grid_field_arr = json_encode(array( |
|
240 | 240 | array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "","","false","center"), |
241 | 241 | array("Date", "260", "date", "date", "date", "convert_GMT_to","","true","center"), |
242 | 242 | array("Name", "295", "backup_name", "", "", "","","true","center"), |
@@ -245,16 +245,16 @@ discard block |
||
245 | 245 | array("EDIT_RESTORE" => array("url" => "systems/database_restore_one/", "mode" => ""), |
246 | 246 | "DOWNLOAD_DATABASE" => array("url" => "systems/database_download/", "mode" => ""), |
247 | 247 | "Delete" => array("url" => "systems/database_delete/", "mode" => ""), |
248 | - )))); |
|
249 | - return $grid_field_arr; |
|
250 | - } |
|
251 | - function build_backupdastabase_buttons() { |
|
252 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/database_backup/", "popup"), |
|
248 | + )))); |
|
249 | + return $grid_field_arr; |
|
250 | + } |
|
251 | + function build_backupdastabase_buttons() { |
|
252 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/database_backup/", "popup"), |
|
253 | 253 | array("import","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "systems/database_import/", "popup"), |
254 | 254 | array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "systems/database_backup_delete_multiple") |
255 | 255 | )); |
256 | - return $buttons_json; |
|
257 | - } |
|
256 | + return $buttons_json; |
|
257 | + } |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | ?> |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if ( ! defined('BASEPATH')) |
|
25 | 25 | exit('No direct script access allowed'); |
26 | 26 | |
27 | 27 | class System_form { |
28 | 28 | |
29 | 29 | function get_template_form_fields() { |
30 | 30 | |
31 | - $form['forms'] = array(base_url() . 'systems/template_save/', array("template_form", "name" => "template_form")); |
|
31 | + $form['forms'] = array(base_url().'systems/template_save/', array("template_form", "name" => "template_form")); |
|
32 | 32 | $form['Email Template'] = array( |
33 | 33 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
34 | - array(' Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
35 | - array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | - array('Body', 'TEXTAREA', array('name' => 'template', 'id' => 'template', 'size' => '20', 'class' => "textarea medium"), 'trim|required', 'tOOL TIP', ''), |
|
34 | + array(' Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
35 | + array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | + array('Body', 'TEXTAREA', array('name' => 'template', 'id' => 'template', 'size' => '20', 'class' => "textarea medium"), 'trim|required', 'tOOL TIP', ''), |
|
37 | 37 | ); |
38 | 38 | $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'systems/template/\')'); |
39 | 39 | $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $form['Search'] = array( |
47 | 47 | |
48 | 48 | array(' Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
49 | - array('Subject', 'INPUT', array('name' => 'subject[subject]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'subject[subject-string]', '', '', '', 'search_string_type', ''),array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
49 | + array('Subject', 'INPUT', array('name' => 'subject[subject]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'subject[subject-string]', '', '', '', 'search_string_type', ''), array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
50 | 50 | array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
51 | 51 | ); |
52 | 52 | $form['button_search'] = array('name' => 'action', 'id' => "template_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | |
57 | 57 | function get_configuration_form_fields() { |
58 | 58 | |
59 | - $form['forms'] = array(base_url() . 'systems/configuration_save/', array("id" => "config_form", "name" => "config_form")); |
|
59 | + $form['forms'] = array(base_url().'systems/configuration_save/', array("id" => "config_form", "name" => "config_form")); |
|
60 | 60 | $form['Edit Settings '] = array( |
61 | 61 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
62 | - array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
62 | + array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
63 | 63 | array('Value', 'INPUT', array('name' => 'value', 'size' => '20', 'class' => "text field medium"), 'trim|required', 'tOOL TIP', ''), |
64 | - array('Comment', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
64 | + array('Comment', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
65 | 65 | ); |
66 | 66 | |
67 | 67 | $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
78 | 78 | array('Value', 'INPUT', array('name' => 'value[value]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'value[value-string]', '', '', '', 'search_string_type', ''), |
79 | 79 | array('Description', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''), |
80 | - array('Group', 'group_title', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'group_title', 'group_title', 'system', 'build_dropdown','where_arr',"group_title NOT IN ('asterisk','osc','freepbx')", 'group_by', 'group_title'), |
|
80 | + array('Group', 'group_title', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'group_title', 'group_title', 'system', 'build_dropdown', 'where_arr', "group_title NOT IN ('asterisk','osc','freepbx')", 'group_by', 'group_title'), |
|
81 | 81 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
82 | 82 | array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
83 | 83 | ); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | array("Value", "190", "value", "", "", ""), |
93 | 93 | array("Description", "320", "comment", "", "", ""), |
94 | 94 | array("Group", "120", "group_title", "", "", ""), |
95 | - array("Action", "442", "", "", "",array("EDIT" => array("url" => "systems/configuration_edit/", "mode" => "popup"), |
|
95 | + array("Action", "442", "", "", "", array("EDIT" => array("url" => "systems/configuration_edit/", "mode" => "popup"), |
|
96 | 96 | )) |
97 | 97 | )); |
98 | 98 | return $grid_field_arr; |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | function build_template_list_for_admin() { |
108 | - $grid_field_arr = json_encode(array(array("Name", "425", "name", "", "", "","","true","center"), |
|
109 | - array("Subject", "650", "subject", "", "", "","","true","center"), |
|
110 | - array("Action", "200", "", "", "",array("EDIT" => array("url" => "systems/template_edit/", "mode" => "single"), |
|
108 | + $grid_field_arr = json_encode(array(array("Name", "425", "name", "", "", "", "", "true", "center"), |
|
109 | + array("Subject", "650", "subject", "", "", "", "", "true", "center"), |
|
110 | + array("Action", "200", "", "", "", array("EDIT" => array("url" => "systems/template_edit/", "mode" => "single"), |
|
111 | 111 | )) |
112 | 112 | )); |
113 | 113 | return $grid_field_arr; |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | function build_country_list_for_admin() { |
117 | 117 | $action = 'systems/country_list_edit/'; |
118 | 118 | $action_remove = 'systems/country_remove/'; |
119 | - $mode="popup"; |
|
119 | + $mode = "popup"; |
|
120 | 120 | $grid_field_arr = json_encode(array( |
121 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "","","false","center"), |
|
122 | - array("Name", "705", "country", "", "", "","","true","center"), |
|
121 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "", "", "false", "center"), |
|
122 | + array("Name", "705", "country", "", "", "", "", "true", "center"), |
|
123 | 123 | array("Action", "100", "", "", "", array("EDIT" => array("url" => "$action", "mode" => "$mode"), |
124 | 124 | "DELETE" => array("url" => "$action_remove", "mode" => "single") |
125 | 125 | )) |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | function build_admin_grid_buttons() { |
131 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/country_add/", "popup"), |
|
132 | - array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "systems/country_delete_multiple"), |
|
131 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "systems/country_add/", "popup"), |
|
132 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "systems/country_delete_multiple"), |
|
133 | 133 | )); |
134 | 134 | return $buttons_json; |
135 | 135 | } |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | function get_country_form_fields() { |
154 | 154 | |
155 | 155 | |
156 | - $form['forms'] = array(base_url() . 'systems/country_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
156 | + $form['forms'] = array(base_url().'systems/country_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
157 | 157 | $form['Country List'] = array( |
158 | 158 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
159 | - array('Name', 'INPUT', array('name' => 'country', 'size' => '20', 'class' => "text field medium"), 'trim|required|char|min_length[2]|max_length[20]|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
159 | + array('Name', 'INPUT', array('name' => 'country', 'size' => '20', 'class' => "text field medium"), 'trim|required|char|min_length[2]|max_length[20]|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
160 | 160 | |
161 | 161 | ); |
162 | 162 | $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | function build_currency_list_for_admin() { |
168 | 168 | $action = 'systems/currency_list_edit/'; |
169 | 169 | $action_remove = 'systems/currency_remove/'; |
170 | - $mode="popup"; |
|
170 | + $mode = "popup"; |
|
171 | 171 | |
172 | 172 | $grid_field_arr = json_encode(array( |
173 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "70", "", "", "", "","","false","center"), |
|
174 | - array("Name", "320", "currencyname", "", "", "","","true","center"), |
|
175 | - array("Code", "290", "currency", "", "", "","","true","center"), |
|
176 | - array(" Rate", "330", "currencyrate", "", "", "","","true","right"), |
|
173 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "70", "", "", "", "", "", "false", "center"), |
|
174 | + array("Name", "320", "currencyname", "", "", "", "", "true", "center"), |
|
175 | + array("Code", "290", "currency", "", "", "", "", "true", "center"), |
|
176 | + array(" Rate", "330", "currencyrate", "", "", "", "", "true", "right"), |
|
177 | 177 | array("Action", "265", "", "", "", array("EDIT" => array("url" => "$action", "mode" => "$mode"), |
178 | 178 | "DELETE" => array("url" => "$action_remove", "mode" => "single") |
179 | 179 | )) |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | function get_currency_form_fields() { |
202 | 202 | |
203 | 203 | |
204 | - $form['forms'] = array(base_url() . 'systems/currency_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
204 | + $form['forms'] = array(base_url().'systems/currency_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
205 | 205 | $form['Currency List'] = array( |
206 | 206 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
207 | - array('Name', 'INPUT', array('name' => 'currencyname', 'size' => '20','maxlength' => '40', 'class' => "text field medium"), 'trim|required|char|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
208 | - array('Code', 'INPUT', array('name' => 'currency', 'size' => '20','maxlength' => '3', 'class' => "text field medium"), 'trim|required|char|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
209 | - array('Rate', 'INPUT', array('name' => 'currencyrate', 'size' => '20','maxlength' => '7', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
207 | + array('Name', 'INPUT', array('name' => 'currencyname', 'size' => '20', 'maxlength' => '40', 'class' => "text field medium"), 'trim|required|char|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
208 | + array('Code', 'INPUT', array('name' => 'currency', 'size' => '20', 'maxlength' => '3', 'class' => "text field medium"), 'trim|required|char|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
209 | + array('Rate', 'INPUT', array('name' => 'currencyrate', 'size' => '20', 'maxlength' => '7', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
210 | 210 | |
211 | 211 | ); |
212 | 212 | $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
@@ -215,21 +215,21 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | function build_admin_currency_grid_buttons() { |
218 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/currency_add/", "popup"), |
|
219 | - array("Update Currencies","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "currencyupdate/update_currency/", 'single'), |
|
220 | - array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "systems/currency_delete_multiple"), |
|
218 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "systems/currency_add/", "popup"), |
|
219 | + array("Update Currencies", "btn btn-line-blue", "fa fa-upload fa-lg", "button_action", "currencyupdate/update_currency/", 'single'), |
|
220 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "systems/currency_delete_multiple"), |
|
221 | 221 | )); |
222 | 222 | return $buttons_json; |
223 | 223 | } |
224 | 224 | |
225 | 225 | |
226 | - function get_backup_database_form_fields($file_name,$id='') { |
|
226 | + function get_backup_database_form_fields($file_name, $id = '') { |
|
227 | 227 | $val = $id > 0 ? "backup_database.path.$id" : 'backup_database.path'; |
228 | - $form['forms'] = array(base_url() . 'systems/database_backup_save/',array('id' => 'backup_form', 'method' => 'POST', 'name' => 'backup_form')); |
|
228 | + $form['forms'] = array(base_url().'systems/database_backup_save/', array('id' => 'backup_form', 'method' => 'POST', 'name' => 'backup_form')); |
|
229 | 229 | $form['Database Information'] = array( |
230 | 230 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
231 | 231 | array('Name', 'INPUT', array('name' => 'backup_name', 'size' => '20', 'class' => "text field medium"), 'required', 'tOOL TIP', ''), |
232 | - array('File Name', 'INPUT', array('name' => 'path', 'size' => '20', 'value'=>$file_name,'class' => "text field medium"), 'trim|required|is_unique[' . $val . ']', 'tOOL TIP', ''), |
|
232 | + array('File Name', 'INPUT', array('name' => 'path', 'size' => '20', 'value'=>$file_name, 'class' => "text field medium"), 'trim|required|is_unique['.$val.']', 'tOOL TIP', ''), |
|
233 | 233 | ); |
234 | 234 | $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\')'); |
235 | 235 | $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | } |
238 | 238 | function build_backupdastabase_list() { |
239 | 239 | $grid_field_arr = json_encode(array( |
240 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "","","false","center"), |
|
241 | - array("Date", "260", "date", "date", "date", "convert_GMT_to","","true","center"), |
|
242 | - array("Name", "295", "backup_name", "", "", "","","true","center"), |
|
243 | - array("File Name", "480", "path", "", "", "","","true","center"), |
|
240 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "", "", "false", "center"), |
|
241 | + array("Date", "260", "date", "date", "date", "convert_GMT_to", "", "true", "center"), |
|
242 | + array("Name", "295", "backup_name", "", "", "", "", "true", "center"), |
|
243 | + array("File Name", "480", "path", "", "", "", "", "true", "center"), |
|
244 | 244 | array("Action", "185", "", "", "", |
245 | 245 | array("EDIT_RESTORE" => array("url" => "systems/database_restore_one/", "mode" => ""), |
246 | 246 | "DOWNLOAD_DATABASE" => array("url" => "systems/database_download/", "mode" => ""), |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | return $grid_field_arr; |
250 | 250 | } |
251 | 251 | function build_backupdastabase_buttons() { |
252 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/database_backup/", "popup"), |
|
253 | - array("import","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "systems/database_import/", "popup"), |
|
254 | - array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "systems/database_backup_delete_multiple") |
|
252 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "systems/database_backup/", "popup"), |
|
253 | + array("import", "btn btn-line-blue", "fa fa-upload fa-lg", "button_action", "systems/database_import/", "popup"), |
|
254 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "systems/database_backup_delete_multiple") |
|
255 | 255 | )); |
256 | 256 | return $buttons_json; |
257 | 257 | } |
@@ -22,8 +22,9 @@ |
||
22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ############################################################################### |
24 | 24 | |
25 | -if (!defined('BASEPATH')) |
|
26 | - exit('No direct script access allowed'); |
|
25 | +if (!defined('BASEPATH')) { |
|
26 | + exit('No direct script access allowed'); |
|
27 | +} |
|
27 | 28 | |
28 | 29 | class Package_form { |
29 | 30 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <? extend('master.php') ?> |
2 | -<?php error_reporting(E_ERROR);?> |
|
2 | +<?php error_reporting(E_ERROR); ?> |
|
3 | 3 | <? startblock('extra_head') ?> |
4 | 4 | |
5 | 5 | <script type="text/javascript" src="<?php echo base_url(); ?>assets/tinymce/tinymce.min.js"> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | <div class="w-section inverse no-padding"> |
45 | 45 | <?php echo $form; ?> |
46 | 46 | <?php |
47 | - if(isset($validation_errors) && $validation_errors != ''){ ?> |
|
47 | + if (isset($validation_errors) && $validation_errors != '') { ?> |
|
48 | 48 | <script> |
49 | 49 | var ERR_STR = '<?php echo $validation_errors; ?>'; |
50 | 50 | print_error(ERR_STR); |
@@ -180,25 +180,25 @@ |
||
180 | 180 | <?php $count=ceil(sizeof($details)/2); $i=0; $class="tleft";?> |
181 | 181 | <?php foreach($details as$key=>$val){ ?> |
182 | 182 | <?php if($count==$i){ |
183 | - echo '</div><div style="width:50%;float:left;">'; |
|
184 | - $class="tright"; |
|
185 | - } ?> |
|
183 | + echo '</div><div style="width:50%;float:left;">'; |
|
184 | + $class="tright"; |
|
185 | + } ?> |
|
186 | 186 | <div class="col-md-12"> |
187 | 187 | <div class="<?=$class?>" href='#'> |
188 | 188 | <label class="col-md-5 no-padding"><?php echo $val['display_name'];?> * </label> |
189 | 189 | <?php if(method_exists($this->common,$val['field_type'])){ |
190 | - $option_array = $this->common->$val['field_type'](); |
|
191 | - $drpstr = '<select name="'.$val['name'].'" class="col-md-5 form-control selectpicker" data-live-search="true">'; |
|
192 | - foreach($option_array as $option_key=>$option_val){ |
|
193 | - $selected = ($val['value'] == $option_key)? "selected='selected'":""; |
|
194 | - $drpstr .= '<option value="'.$option_key.'"'.$selected.'>'.$option_val.'</option>'; |
|
195 | - } |
|
196 | - $drpstr .= '</select>'; |
|
197 | - echo $drpstr; |
|
198 | - unset($drpstr); |
|
199 | - } else{ |
|
200 | - echo '<input name="'.$val["name"].'" value="'.$val['value'].'" size="20" maxlength="100" class="col-md-5 form-control" type="text">'; |
|
201 | - }?> |
|
190 | + $option_array = $this->common->$val['field_type'](); |
|
191 | + $drpstr = '<select name="'.$val['name'].'" class="col-md-5 form-control selectpicker" data-live-search="true">'; |
|
192 | + foreach($option_array as $option_key=>$option_val){ |
|
193 | + $selected = ($val['value'] == $option_key)? "selected='selected'":""; |
|
194 | + $drpstr .= '<option value="'.$option_key.'"'.$selected.'>'.$option_val.'</option>'; |
|
195 | + } |
|
196 | + $drpstr .= '</select>'; |
|
197 | + echo $drpstr; |
|
198 | + unset($drpstr); |
|
199 | + } else{ |
|
200 | + echo '<input name="'.$val["name"].'" value="'.$val['value'].'" size="20" maxlength="100" class="col-md-5 form-control" type="text">'; |
|
201 | + }?> |
|
202 | 202 | <span class="demo"><?php echo str_replace('smtp',"SMTP",$val['comment']);?></span> |
203 | 203 | |
204 | 204 | </div> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <? extend('left_panel_setting_master.php') ?> |
2 | -<?php error_reporting(E_ERROR);?> |
|
2 | +<?php error_reporting(E_ERROR); ?> |
|
3 | 3 | <? startblock('extra_head') ?> |
4 | 4 | <?php endblock() ?> |
5 | 5 | |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | <div class="pull-right"> |
161 | 161 | <ul class="breadcrumb"> |
162 | 162 | <li> |
163 | - <a href="<?= base_url() . "systems/configuration/global"; ?>"> Global</a> |
|
163 | + <a href="<?= base_url()."systems/configuration/global"; ?>"> Global</a> |
|
164 | 164 | </li> |
165 | - <?php if($group_title != "global") { ?> |
|
165 | + <?php if ($group_title != "global") { ?> |
|
166 | 166 | <li class="active"> |
167 | - <a href="<?= base_url() . "systems/configuration/".$group_title ; ?>"> <?php echo ucfirst($group_title); ?></a> |
|
167 | + <a href="<?= base_url()."systems/configuration/".$group_title; ?>"> <?php echo ucfirst($group_title); ?></a> |
|
168 | 168 | </li> |
169 | 169 | <?php } ?> |
170 | 170 | </ul> |
@@ -176,35 +176,35 @@ discard block |
||
176 | 176 | <fieldset> |
177 | 177 | <legend> <?=ucfirst($group_title)?></legend> |
178 | 178 | <div style="width:50%;float:left;"> |
179 | - <?php $currency = Common_model::$global_config['system_config']['base_currency'];?> |
|
180 | - <?php $count=ceil(sizeof($details)/2); $i=0; $class="tleft";?> |
|
181 | - <?php foreach($details as$key=>$val){ ?> |
|
182 | - <?php if($count==$i){ |
|
179 | + <?php $currency = Common_model::$global_config['system_config']['base_currency']; ?> |
|
180 | + <?php $count = ceil(sizeof($details) / 2); $i = 0; $class = "tleft"; ?> |
|
181 | + <?php foreach ($details as$key=>$val) { ?> |
|
182 | + <?php if ($count == $i) { |
|
183 | 183 | echo '</div><div style="width:50%;float:left;">'; |
184 | - $class="tright"; |
|
184 | + $class = "tright"; |
|
185 | 185 | } ?> |
186 | 186 | <div class="col-md-12"> |
187 | 187 | <div class="<?=$class?>" href='#'> |
188 | - <label class="col-md-5 no-padding"><?php echo $val['display_name'];?> * </label> |
|
189 | - <?php if(method_exists($this->common,$val['field_type'])){ |
|
190 | - $option_array = $this->common->$val['field_type'](); |
|
188 | + <label class="col-md-5 no-padding"><?php echo $val['display_name']; ?> * </label> |
|
189 | + <?php if (method_exists($this->common, $val['field_type'])) { |
|
190 | + $option_array = $this->common->$val['field_type'](); |
|
191 | 191 | $drpstr = '<select name="'.$val['name'].'" class="col-md-5 form-control selectpicker" data-live-search="true">'; |
192 | - foreach($option_array as $option_key=>$option_val){ |
|
193 | - $selected = ($val['value'] == $option_key)? "selected='selected'":""; |
|
192 | + foreach ($option_array as $option_key=>$option_val) { |
|
193 | + $selected = ($val['value'] == $option_key) ? "selected='selected'" : ""; |
|
194 | 194 | $drpstr .= '<option value="'.$option_key.'"'.$selected.'>'.$option_val.'</option>'; |
195 | 195 | } |
196 | 196 | $drpstr .= '</select>'; |
197 | 197 | echo $drpstr; |
198 | 198 | unset($drpstr); |
199 | - } else{ |
|
199 | + } else { |
|
200 | 200 | echo '<input name="'.$val["name"].'" value="'.$val['value'].'" size="20" maxlength="100" class="col-md-5 form-control" type="text">'; |
201 | 201 | }?> |
202 | - <span class="demo"><?php echo str_replace('smtp',"SMTP",$val['comment']);?></span> |
|
202 | + <span class="demo"><?php echo str_replace('smtp', "SMTP", $val['comment']); ?></span> |
|
203 | 203 | |
204 | 204 | </div> |
205 | 205 | </div> |
206 | 206 | |
207 | - <?php $i++;?> |
|
207 | + <?php $i++; ?> |
|
208 | 208 | <?php }?> |
209 | 209 | </div> |
210 | 210 | </fieldset> |
@@ -22,33 +22,33 @@ discard block |
||
22 | 22 | ############################################################################### |
23 | 23 | class System_model extends CI_Model { |
24 | 24 | |
25 | - function System_model() { |
|
26 | - parent::__construct(); |
|
27 | - } |
|
25 | + function System_model() { |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | 28 | |
29 | - function getsystem_list($flag, $start, $limit) { |
|
29 | + function getsystem_list($flag, $start, $limit) { |
|
30 | 30 | |
31 | - $this->db_model->build_search('configuration_search'); |
|
32 | - $where = "group_title NOT IN ('asterisk','osc','freepbx')"; |
|
33 | - $this->db->where($where); |
|
34 | - if ($flag) { |
|
35 | - $query = $this->db_model->select("*", "system", "", "group_title,name", "ASC", $limit, $start); |
|
36 | - } else { |
|
37 | - $query = $this->db_model->countQuery("*", "system", ""); |
|
38 | - } |
|
39 | - return $query; |
|
40 | - } |
|
31 | + $this->db_model->build_search('configuration_search'); |
|
32 | + $where = "group_title NOT IN ('asterisk','osc','freepbx')"; |
|
33 | + $this->db->where($where); |
|
34 | + if ($flag) { |
|
35 | + $query = $this->db_model->select("*", "system", "", "group_title,name", "ASC", $limit, $start); |
|
36 | + } else { |
|
37 | + $query = $this->db_model->countQuery("*", "system", ""); |
|
38 | + } |
|
39 | + return $query; |
|
40 | + } |
|
41 | 41 | |
42 | - function gettemplate_list($flag="", $start, $limit="") { |
|
42 | + function gettemplate_list($flag="", $start, $limit="") { |
|
43 | 43 | |
44 | 44 | |
45 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
46 | - $account_data = $this->session->userdata("accountinfo"); |
|
47 | - $reseller = $account_data['id']; |
|
48 | - $this->db->where('reseller_id',$reseller); |
|
49 | - $query = $this->db_model->select("*", "default_templates","","","","",""); |
|
45 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
46 | + $account_data = $this->session->userdata("accountinfo"); |
|
47 | + $reseller = $account_data['id']; |
|
48 | + $this->db->where('reseller_id',$reseller); |
|
49 | + $query = $this->db_model->select("*", "default_templates","","","","",""); |
|
50 | 50 | |
51 | - if($query->num_rows() >0){ |
|
51 | + if($query->num_rows() >0){ |
|
52 | 52 | $result =$query->result_array(); |
53 | 53 | $match_array =array(); |
54 | 54 | $unmatch_array= array(); |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | $str=0; |
57 | 57 | foreach($result as $value) |
58 | 58 | { |
59 | - $this->db->where('name',$value['name']); |
|
60 | - $this->db->where('reseller_id',0); |
|
61 | - $query = $this->db_model->select("id", "default_templates","", "id", "ASC", $limit, $start); |
|
62 | - $innerresult =$query->result_array(); |
|
63 | - foreach($innerresult as $value) |
|
64 | - { |
|
65 | - $str.=$value['id'].","; |
|
66 | - } |
|
59 | + $this->db->where('name',$value['name']); |
|
60 | + $this->db->where('reseller_id',0); |
|
61 | + $query = $this->db_model->select("id", "default_templates","", "id", "ASC", $limit, $start); |
|
62 | + $innerresult =$query->result_array(); |
|
63 | + foreach($innerresult as $value) |
|
64 | + { |
|
65 | + $str.=$value['id'].","; |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | $str= rtrim($str,','); |
69 | 69 | |
@@ -71,164 +71,164 @@ discard block |
||
71 | 71 | $this->db->where('reseller_id',$reseller); |
72 | 72 | $this->db->or_where('reseller_id',0); |
73 | 73 | $this->db->where($where); |
74 | - } |
|
75 | - else |
|
76 | - { |
|
77 | - $this->db->where('reseller_id',0); |
|
78 | - } |
|
74 | + } |
|
75 | + else |
|
76 | + { |
|
77 | + $this->db->where('reseller_id',0); |
|
78 | + } |
|
79 | 79 | |
80 | - if($flag) { |
|
80 | + if($flag) { |
|
81 | 81 | |
82 | 82 | $query = $this->db_model->select("*", "default_templates","", "id", "ASC", $limit, $start); |
83 | - }else { |
|
83 | + }else { |
|
84 | 84 | |
85 | 85 | $query = $this->db_model->countQuery("*", "default_templates",""); |
86 | 86 | |
87 | - } |
|
87 | + } |
|
88 | 88 | } |
89 | 89 | else { |
90 | 90 | |
91 | - $where = array('reseller_id' => 0); |
|
92 | - $this->db->where($where); |
|
93 | - $this->db_model->build_search('template_search'); |
|
91 | + $where = array('reseller_id' => 0); |
|
92 | + $this->db->where($where); |
|
93 | + $this->db_model->build_search('template_search'); |
|
94 | 94 | if ($flag) { |
95 | - $query = $this->db_model->select("*", "default_templates","", "id", "ASC", $limit, $start); |
|
95 | + $query = $this->db_model->select("*", "default_templates","", "id", "ASC", $limit, $start); |
|
96 | 96 | } else { |
97 | - $query = $this->db_model->countQuery("*", "default_templates",""); |
|
97 | + $query = $this->db_model->countQuery("*", "default_templates",""); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | 101 | return $query; |
102 | - } |
|
102 | + } |
|
103 | 103 | |
104 | - function edit_configuration($add_array, $name) { |
|
105 | - unset($add_array["action"]); |
|
104 | + function edit_configuration($add_array, $name) { |
|
105 | + unset($add_array["action"]); |
|
106 | 106 | |
107 | - $this->db->where("name", $name); |
|
108 | - $this->db->update("system", $add_array); |
|
109 | - if($name == 'base_currency'){ |
|
107 | + $this->db->where("name", $name); |
|
108 | + $this->db->update("system", $add_array); |
|
109 | + if($name == 'base_currency'){ |
|
110 | 110 | |
111 | - $screen_path = getcwd() . "/cron"; |
|
112 | - $screen_filename = "CurrencyUpdate" . strtotime('now'); |
|
113 | - $command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S $screen_filename php cron.php CurrencyUpdate"; |
|
114 | - exec($command); |
|
115 | - $this->db->update("currency",array("currencyrate"=>'1'),array("currency"=>"INR")); |
|
116 | - } |
|
117 | - } |
|
118 | - |
|
119 | - function edit_template($data, $id) { |
|
120 | - unset($data["action"]); |
|
121 | - $data["last_modified_date"] = date("Y-m-d H:i:s"); |
|
122 | - $this->db->where("id", $id); |
|
123 | - $this->db->update("default_templates", $data); |
|
124 | - } |
|
125 | - function edit_resellertemplate($data, $id) { |
|
126 | - $arraydata = $data; |
|
127 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
128 | - $account_data = $this->session->userdata("accountinfo"); |
|
129 | - $reseller = $account_data['id']; |
|
130 | - $array = $data; |
|
131 | - $data = array('reseller_id' => $reseller); |
|
132 | - $this->db->where("id", $id); |
|
133 | - } |
|
134 | - unset($arraydata["action"]); |
|
135 | - unset($arraydata["form"]); |
|
136 | - unset($arraydata["page_title"]); |
|
137 | - $this->db->update("default_templates", $arraydata); |
|
138 | - } |
|
139 | - function remove_template($id) { |
|
140 | - $this->db->where("id", $id); |
|
141 | - $this->db->update("default_templates", array("status" => 2)); |
|
142 | - return true; |
|
143 | - } |
|
144 | - function add_resellertemplate($data) |
|
145 | - { |
|
146 | - unset($data["action"]); |
|
147 | - unset($data['id']); |
|
148 | - $this->db->insert('default_templates', $data); |
|
149 | - return true; |
|
150 | - } |
|
151 | - function getcountry_list($flag, $start = 0, $limit = 0) { |
|
152 | - $this->db_model->build_search('country_list_search'); |
|
153 | - if ($flag) { |
|
154 | - $query = $this->db_model->select("*", "countrycode", '', "id", "ASC", $limit, $start); |
|
155 | - } else { |
|
156 | - $query = $this->db_model->countQuery("*", "countrycode", ''); |
|
157 | - } |
|
158 | - return $query; |
|
159 | - } |
|
160 | - |
|
161 | - function add_country($add_array) { |
|
162 | - unset($add_array["action"]); |
|
163 | - $this->db->insert("countrycode", $add_array); |
|
164 | - return true; |
|
165 | - } |
|
166 | - |
|
167 | - function edit_country($data, $id) { |
|
168 | - unset($data["action"]); |
|
169 | - $this->db->where("id", $id); |
|
170 | - $this->db->update("countrycode", $data); |
|
171 | - } |
|
172 | - |
|
173 | - function remove_country($id) { |
|
174 | - $this->db->where("id", $id); |
|
175 | - $this->db->delete("countrycode"); |
|
176 | - return true; |
|
177 | - } |
|
178 | - |
|
179 | - function getcurrency_list($flag, $start = 0, $limit = 0) { |
|
180 | - $this->db_model->build_search('currency_list_search'); |
|
111 | + $screen_path = getcwd() . "/cron"; |
|
112 | + $screen_filename = "CurrencyUpdate" . strtotime('now'); |
|
113 | + $command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S $screen_filename php cron.php CurrencyUpdate"; |
|
114 | + exec($command); |
|
115 | + $this->db->update("currency",array("currencyrate"=>'1'),array("currency"=>"INR")); |
|
116 | + } |
|
117 | + } |
|
118 | + |
|
119 | + function edit_template($data, $id) { |
|
120 | + unset($data["action"]); |
|
121 | + $data["last_modified_date"] = date("Y-m-d H:i:s"); |
|
122 | + $this->db->where("id", $id); |
|
123 | + $this->db->update("default_templates", $data); |
|
124 | + } |
|
125 | + function edit_resellertemplate($data, $id) { |
|
126 | + $arraydata = $data; |
|
127 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
128 | + $account_data = $this->session->userdata("accountinfo"); |
|
129 | + $reseller = $account_data['id']; |
|
130 | + $array = $data; |
|
131 | + $data = array('reseller_id' => $reseller); |
|
132 | + $this->db->where("id", $id); |
|
133 | + } |
|
134 | + unset($arraydata["action"]); |
|
135 | + unset($arraydata["form"]); |
|
136 | + unset($arraydata["page_title"]); |
|
137 | + $this->db->update("default_templates", $arraydata); |
|
138 | + } |
|
139 | + function remove_template($id) { |
|
140 | + $this->db->where("id", $id); |
|
141 | + $this->db->update("default_templates", array("status" => 2)); |
|
142 | + return true; |
|
143 | + } |
|
144 | + function add_resellertemplate($data) |
|
145 | + { |
|
146 | + unset($data["action"]); |
|
147 | + unset($data['id']); |
|
148 | + $this->db->insert('default_templates', $data); |
|
149 | + return true; |
|
150 | + } |
|
151 | + function getcountry_list($flag, $start = 0, $limit = 0) { |
|
152 | + $this->db_model->build_search('country_list_search'); |
|
153 | + if ($flag) { |
|
154 | + $query = $this->db_model->select("*", "countrycode", '', "id", "ASC", $limit, $start); |
|
155 | + } else { |
|
156 | + $query = $this->db_model->countQuery("*", "countrycode", ''); |
|
157 | + } |
|
158 | + return $query; |
|
159 | + } |
|
160 | + |
|
161 | + function add_country($add_array) { |
|
162 | + unset($add_array["action"]); |
|
163 | + $this->db->insert("countrycode", $add_array); |
|
164 | + return true; |
|
165 | + } |
|
166 | + |
|
167 | + function edit_country($data, $id) { |
|
168 | + unset($data["action"]); |
|
169 | + $this->db->where("id", $id); |
|
170 | + $this->db->update("countrycode", $data); |
|
171 | + } |
|
172 | + |
|
173 | + function remove_country($id) { |
|
174 | + $this->db->where("id", $id); |
|
175 | + $this->db->delete("countrycode"); |
|
176 | + return true; |
|
177 | + } |
|
178 | + |
|
179 | + function getcurrency_list($flag, $start = 0, $limit = 0) { |
|
180 | + $this->db_model->build_search('currency_list_search'); |
|
181 | 181 | |
182 | 182 | $where=array('currency <>' =>Common_model::$global_config['system_config']['base_currency']); |
183 | - if ($flag) { |
|
184 | - $query = $this->db_model->select("*", "currency", $where, "id", "ASC", $limit, $start); |
|
185 | - } else { |
|
186 | - $query = $this->db_model->countQuery("*", "currency", $where); |
|
187 | - } |
|
188 | - return $query; |
|
189 | - } |
|
190 | - |
|
191 | - function add_currency($add_array) { |
|
192 | - unset($add_array["action"]); |
|
193 | - $this->db->insert("currency", $add_array); |
|
194 | - return true; |
|
195 | - } |
|
196 | - |
|
197 | - function edit_currency($data, $id) { |
|
198 | - unset($data["action"]); |
|
199 | - $this->db->where("id", $id); |
|
200 | - $this->db->update("currency", $data); |
|
201 | - } |
|
202 | - |
|
203 | - function remove_currency($id) { |
|
204 | - $this->db->where("id", $id); |
|
205 | - $this->db->delete("currency"); |
|
206 | - return true; |
|
207 | - } |
|
208 | - function backup_insert($add_array='') |
|
209 | - { |
|
183 | + if ($flag) { |
|
184 | + $query = $this->db_model->select("*", "currency", $where, "id", "ASC", $limit, $start); |
|
185 | + } else { |
|
186 | + $query = $this->db_model->countQuery("*", "currency", $where); |
|
187 | + } |
|
188 | + return $query; |
|
189 | + } |
|
190 | + |
|
191 | + function add_currency($add_array) { |
|
192 | + unset($add_array["action"]); |
|
193 | + $this->db->insert("currency", $add_array); |
|
194 | + return true; |
|
195 | + } |
|
196 | + |
|
197 | + function edit_currency($data, $id) { |
|
198 | + unset($data["action"]); |
|
199 | + $this->db->where("id", $id); |
|
200 | + $this->db->update("currency", $data); |
|
201 | + } |
|
202 | + |
|
203 | + function remove_currency($id) { |
|
204 | + $this->db->where("id", $id); |
|
205 | + $this->db->delete("currency"); |
|
206 | + return true; |
|
207 | + } |
|
208 | + function backup_insert($add_array='') |
|
209 | + { |
|
210 | 210 | unset($add_array["action"]); |
211 | - $this->db->insert("backup_database", $add_array); |
|
212 | - return true; |
|
213 | - } |
|
214 | - function getbackup_list($flag, $start, $limit) { |
|
215 | - |
|
216 | - if ($flag) { |
|
217 | - $query = $this->db_model->select("*", "backup_database", "", "date", "DESC", $limit, $start); |
|
218 | - } else { |
|
219 | - $query = $this->db_model->countQuery("*", "backup_database", ""); |
|
220 | - } |
|
221 | - return $query; |
|
222 | - } |
|
223 | - function get_backup_data($id) |
|
224 | - { |
|
225 | - $where=array('id'=>$id); |
|
226 | - $query = $this->db_model->getSelect("*", "backup_database", $where); |
|
227 | - return $query; |
|
228 | - } |
|
211 | + $this->db->insert("backup_database", $add_array); |
|
212 | + return true; |
|
213 | + } |
|
214 | + function getbackup_list($flag, $start, $limit) { |
|
215 | + |
|
216 | + if ($flag) { |
|
217 | + $query = $this->db_model->select("*", "backup_database", "", "date", "DESC", $limit, $start); |
|
218 | + } else { |
|
219 | + $query = $this->db_model->countQuery("*", "backup_database", ""); |
|
220 | + } |
|
221 | + return $query; |
|
222 | + } |
|
223 | + function get_backup_data($id) |
|
224 | + { |
|
225 | + $where=array('id'=>$id); |
|
226 | + $query = $this->db_model->getSelect("*", "backup_database", $where); |
|
227 | + return $query; |
|
228 | + } |
|
229 | 229 | function import_database($filename,$target_path) |
230 | - { |
|
230 | + { |
|
231 | 231 | $this->db->insert("backup_database", array('backup_name'=>$filename , 'path'=>$target_path)); |
232 | - return true; |
|
233 | - } |
|
232 | + return true; |
|
233 | + } |
|
234 | 234 | } |
@@ -39,50 +39,50 @@ discard block |
||
39 | 39 | return $query; |
40 | 40 | } |
41 | 41 | |
42 | - function gettemplate_list($flag="", $start, $limit="") { |
|
42 | + function gettemplate_list($flag = "", $start, $limit = "") { |
|
43 | 43 | |
44 | 44 | |
45 | 45 | if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
46 | 46 | $account_data = $this->session->userdata("accountinfo"); |
47 | 47 | $reseller = $account_data['id']; |
48 | - $this->db->where('reseller_id',$reseller); |
|
49 | - $query = $this->db_model->select("*", "default_templates","","","","",""); |
|
50 | - |
|
51 | - if($query->num_rows() >0){ |
|
52 | - $result =$query->result_array(); |
|
53 | - $match_array =array(); |
|
54 | - $unmatch_array= array(); |
|
55 | - $i=0; |
|
56 | - $str=0; |
|
57 | - foreach($result as $value) |
|
48 | + $this->db->where('reseller_id', $reseller); |
|
49 | + $query = $this->db_model->select("*", "default_templates", "", "", "", "", ""); |
|
50 | + |
|
51 | + if ($query->num_rows() > 0) { |
|
52 | + $result = $query->result_array(); |
|
53 | + $match_array = array(); |
|
54 | + $unmatch_array = array(); |
|
55 | + $i = 0; |
|
56 | + $str = 0; |
|
57 | + foreach ($result as $value) |
|
58 | 58 | { |
59 | - $this->db->where('name',$value['name']); |
|
60 | - $this->db->where('reseller_id',0); |
|
61 | - $query = $this->db_model->select("id", "default_templates","", "id", "ASC", $limit, $start); |
|
62 | - $innerresult =$query->result_array(); |
|
63 | - foreach($innerresult as $value) |
|
59 | + $this->db->where('name', $value['name']); |
|
60 | + $this->db->where('reseller_id', 0); |
|
61 | + $query = $this->db_model->select("id", "default_templates", "", "id", "ASC", $limit, $start); |
|
62 | + $innerresult = $query->result_array(); |
|
63 | + foreach ($innerresult as $value) |
|
64 | 64 | { |
65 | - $str.=$value['id'].","; |
|
65 | + $str .= $value['id'].","; |
|
66 | 66 | } |
67 | 67 | } |
68 | - $str= rtrim($str,','); |
|
68 | + $str = rtrim($str, ','); |
|
69 | 69 | |
70 | 70 | $where = "id NOT IN ($str)"; |
71 | - $this->db->where('reseller_id',$reseller); |
|
72 | - $this->db->or_where('reseller_id',0); |
|
71 | + $this->db->where('reseller_id', $reseller); |
|
72 | + $this->db->or_where('reseller_id', 0); |
|
73 | 73 | $this->db->where($where); |
74 | 74 | } |
75 | 75 | else |
76 | 76 | { |
77 | - $this->db->where('reseller_id',0); |
|
77 | + $this->db->where('reseller_id', 0); |
|
78 | 78 | } |
79 | 79 | |
80 | - if($flag) { |
|
80 | + if ($flag) { |
|
81 | 81 | |
82 | - $query = $this->db_model->select("*", "default_templates","", "id", "ASC", $limit, $start); |
|
83 | - }else { |
|
82 | + $query = $this->db_model->select("*", "default_templates", "", "id", "ASC", $limit, $start); |
|
83 | + } else { |
|
84 | 84 | |
85 | - $query = $this->db_model->countQuery("*", "default_templates",""); |
|
85 | + $query = $this->db_model->countQuery("*", "default_templates", ""); |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | } |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | $this->db->where($where); |
93 | 93 | $this->db_model->build_search('template_search'); |
94 | 94 | if ($flag) { |
95 | - $query = $this->db_model->select("*", "default_templates","", "id", "ASC", $limit, $start); |
|
95 | + $query = $this->db_model->select("*", "default_templates", "", "id", "ASC", $limit, $start); |
|
96 | 96 | } else { |
97 | - $query = $this->db_model->countQuery("*", "default_templates",""); |
|
97 | + $query = $this->db_model->countQuery("*", "default_templates", ""); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | |
107 | 107 | $this->db->where("name", $name); |
108 | 108 | $this->db->update("system", $add_array); |
109 | - if($name == 'base_currency'){ |
|
109 | + if ($name == 'base_currency') { |
|
110 | 110 | |
111 | - $screen_path = getcwd() . "/cron"; |
|
112 | - $screen_filename = "CurrencyUpdate" . strtotime('now'); |
|
113 | - $command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S $screen_filename php cron.php CurrencyUpdate"; |
|
111 | + $screen_path = getcwd()."/cron"; |
|
112 | + $screen_filename = "CurrencyUpdate".strtotime('now'); |
|
113 | + $command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php CurrencyUpdate"; |
|
114 | 114 | exec($command); |
115 | - $this->db->update("currency",array("currencyrate"=>'1'),array("currency"=>"INR")); |
|
115 | + $this->db->update("currency", array("currencyrate"=>'1'), array("currency"=>"INR")); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | function getcurrency_list($flag, $start = 0, $limit = 0) { |
180 | 180 | $this->db_model->build_search('currency_list_search'); |
181 | 181 | |
182 | - $where=array('currency <>' =>Common_model::$global_config['system_config']['base_currency']); |
|
182 | + $where = array('currency <>' =>Common_model::$global_config['system_config']['base_currency']); |
|
183 | 183 | if ($flag) { |
184 | 184 | $query = $this->db_model->select("*", "currency", $where, "id", "ASC", $limit, $start); |
185 | 185 | } else { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $this->db->delete("currency"); |
206 | 206 | return true; |
207 | 207 | } |
208 | - function backup_insert($add_array='') |
|
208 | + function backup_insert($add_array = '') |
|
209 | 209 | { |
210 | 210 | unset($add_array["action"]); |
211 | 211 | $this->db->insert("backup_database", $add_array); |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | } |
223 | 223 | function get_backup_data($id) |
224 | 224 | { |
225 | - $where=array('id'=>$id); |
|
225 | + $where = array('id'=>$id); |
|
226 | 226 | $query = $this->db_model->getSelect("*", "backup_database", $where); |
227 | 227 | return $query; |
228 | 228 | } |
229 | - function import_database($filename,$target_path) |
|
229 | + function import_database($filename, $target_path) |
|
230 | 230 | { |
231 | - $this->db->insert("backup_database", array('backup_name'=>$filename , 'path'=>$target_path)); |
|
231 | + $this->db->insert("backup_database", array('backup_name'=>$filename, 'path'=>$target_path)); |
|
232 | 232 | return true; |
233 | 233 | } |
234 | 234 | } |
@@ -71,8 +71,7 @@ discard block |
||
71 | 71 | $this->db->where('reseller_id',$reseller); |
72 | 72 | $this->db->or_where('reseller_id',0); |
73 | 73 | $this->db->where($where); |
74 | - } |
|
75 | - else |
|
74 | + } else |
|
76 | 75 | { |
77 | 76 | $this->db->where('reseller_id',0); |
78 | 77 | } |
@@ -80,13 +79,12 @@ discard block |
||
80 | 79 | if($flag) { |
81 | 80 | |
82 | 81 | $query = $this->db_model->select("*", "default_templates","", "id", "ASC", $limit, $start); |
83 | - }else { |
|
82 | + } else { |
|
84 | 83 | |
85 | 84 | $query = $this->db_model->countQuery("*", "default_templates",""); |
86 | 85 | |
87 | 86 | } |
88 | - } |
|
89 | - else { |
|
87 | + } else { |
|
90 | 88 | |
91 | 89 | $where = array('reseller_id' => 0); |
92 | 90 | $this->db->where($where); |