@@ -141,18 +141,23 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | public function languages($languages) { |
144 | - foreach ($languages as $_language) $this->language($_language); |
|
144 | + foreach ($languages as $_language) { |
|
145 | + $this->language($_language); |
|
146 | + } |
|
145 | 147 | } |
146 | 148 | |
147 | 149 | /** Load a module library **/ |
148 | 150 | public function library($library = '', $params = NULL, $object_name = NULL) { |
149 | 151 | |
150 | - if (is_array($library)) return $this->libraries($library); |
|
152 | + if (is_array($library)) { |
|
153 | + return $this->libraries($library); |
|
154 | + } |
|
151 | 155 | |
152 | 156 | $class = strtolower(basename($library)); |
153 | 157 | |
154 | - if (isset($this->_ci_classes[$class]) AND $_alias = $this->_ci_classes[$class]) |
|
155 | - return CI::$APP->$_alias; |
|
158 | + if (isset($this->_ci_classes[$class]) AND $_alias = $this->_ci_classes[$class]) { |
|
159 | + return CI::$APP->$_alias; |
|
160 | + } |
|
156 | 161 | |
157 | 162 | ($_alias = strtolower($object_name)) OR $_alias = $class; |
158 | 163 | |
@@ -234,13 +239,17 @@ discard block |
||
234 | 239 | |
235 | 240 | /** Load an array of models **/ |
236 | 241 | public function models($models) { |
237 | - foreach ($models as $_model) $this->model($_model); |
|
242 | + foreach ($models as $_model) { |
|
243 | + $this->model($_model); |
|
244 | + } |
|
238 | 245 | } |
239 | 246 | |
240 | 247 | /** Load a module controller **/ |
241 | 248 | public function module($module, $params = NULL) { |
242 | 249 | |
243 | - if (is_array($module)) return $this->modules($module); |
|
250 | + if (is_array($module)) { |
|
251 | + return $this->modules($module); |
|
252 | + } |
|
244 | 253 | |
245 | 254 | $_alias = strtolower(basename($module)); |
246 | 255 | CI::$APP->$_alias = Modules::load(array($module => $params)); |
@@ -249,16 +258,21 @@ discard block |
||
249 | 258 | |
250 | 259 | /** Load an array of controllers **/ |
251 | 260 | public function modules($modules) { |
252 | - foreach ($modules as $_module) $this->module($_module); |
|
261 | + foreach ($modules as $_module) { |
|
262 | + $this->module($_module); |
|
263 | + } |
|
253 | 264 | } |
254 | 265 | |
255 | 266 | /** Load a module plugin **/ |
256 | 267 | public function plugin($plugin) { |
257 | 268 | |
258 | - if (is_array($plugin)) return $this->plugins($plugin); |
|
269 | + if (is_array($plugin)) { |
|
270 | + return $this->plugins($plugin); |
|
271 | + } |
|
259 | 272 | |
260 | - if (isset($this->_ci_plugins[$plugin])) |
|
261 | - return; |
|
273 | + if (isset($this->_ci_plugins[$plugin])) { |
|
274 | + return; |
|
275 | + } |
|
262 | 276 | |
263 | 277 | list($path, $_plugin) = Modules::find($plugin.'_pi', $this->_module, 'plugins/'); |
264 | 278 | |
@@ -314,20 +328,26 @@ discard block |
||
314 | 328 | break; |
315 | 329 | } |
316 | 330 | |
317 | - if ( ! $cascade) break; |
|
331 | + if ( ! $cascade) { |
|
332 | + break; |
|
333 | + } |
|
318 | 334 | } |
319 | 335 | |
320 | 336 | } elseif (isset($_ci_path)) { |
321 | 337 | |
322 | 338 | $_ci_file = basename($_ci_path); |
323 | - if ( ! file_exists($_ci_path)) $_ci_path = ''; |
|
339 | + if ( ! file_exists($_ci_path)) { |
|
340 | + $_ci_path = ''; |
|
341 | + } |
|
324 | 342 | } |
325 | 343 | |
326 | - if (empty($_ci_path)) |
|
327 | - show_error('Unable to load the requested file: '.$_ci_file); |
|
344 | + if (empty($_ci_path)) { |
|
345 | + show_error('Unable to load the requested file: '.$_ci_file); |
|
346 | + } |
|
328 | 347 | |
329 | - if (isset($_ci_vars)) |
|
330 | - $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, (array)$_ci_vars); |
|
348 | + if (isset($_ci_vars)) { |
|
349 | + $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, (array)$_ci_vars); |
|
350 | + } |
|
331 | 351 | |
332 | 352 | extract($this->_ci_cached_vars); |
333 | 353 |
@@ -31,11 +31,11 @@ |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | - function customer_list_status($id){ |
|
34 | + function customer_list_status($id) { |
|
35 | 35 | $post_data = $this->input->post(); |
36 | - $post_data['table']=$this->common->decode($post_data['table']); |
|
37 | - $data['status']=$post_data['status'] =='true'? 0:1; |
|
38 | - $result=$post_data['table'] =='accounts' && $post_data['id'] == 1 ? null:$this->db->update($post_data['table'],$data,array("id"=>$post_data['id'])); |
|
36 | + $post_data['table'] = $this->common->decode($post_data['table']); |
|
37 | + $data['status'] = $post_data['status'] == 'true' ? 0 : 1; |
|
38 | + $result = $post_data['table'] == 'accounts' && $post_data['id'] == 1 ? null : $this->db->update($post_data['table'], $data, array("id"=>$post_data['id'])); |
|
39 | 39 | echo TRUE; |
40 | 40 | } |
41 | 41 |
@@ -41,8 +41,9 @@ discard block |
||
41 | 41 | function __construct() |
42 | 42 | { |
43 | 43 | parent::__construct(); |
44 | - if ( ! defined('CRON')) |
|
45 | - exit(); |
|
44 | + if ( ! defined('CRON')) { |
|
45 | + exit(); |
|
46 | + } |
|
46 | 47 | } |
47 | 48 | |
48 | 49 | |
@@ -76,8 +77,9 @@ discard block |
||
76 | 77 | function generate_sitemap() |
77 | 78 | { |
78 | 79 | // Live Mode: |
79 | - if ( ! CRON_BETA_MODE) |
|
80 | - $cron_id = $this->cron->create('Sitemap (Google|Bing|Ask|Yahoo!)'); |
|
80 | + if ( ! CRON_BETA_MODE) { |
|
81 | + $cron_id = $this->cron->create('Sitemap (Google|Bing|Ask|Yahoo!)'); |
|
82 | + } |
|
81 | 83 | |
82 | 84 | // Example Code |
83 | 85 | |
@@ -89,8 +91,9 @@ discard block |
||
89 | 91 | // ... |
90 | 92 | |
91 | 93 | // Sandbox Mode: |
92 | - if (CRON_BETA_MODE) |
|
93 | - $this->sitemap->generate_xml(null, false); |
|
94 | + if (CRON_BETA_MODE) { |
|
95 | + $this->sitemap->generate_xml(null, false); |
|
96 | + } |
|
94 | 97 | |
95 | 98 | // Live Mode: |
96 | 99 | else { |
@@ -31,83 +31,83 @@ |
||
31 | 31 | $this->load->model('db_model'); |
32 | 32 | $this->load->model('Astpp_common'); |
33 | 33 | } |
34 | - function index($sipnumber=''){ |
|
35 | - $opensips_flag=common_model::$global_config['system_config']['opensips']; |
|
36 | - $accountid_arr=0; |
|
37 | - if($opensips_flag == '1'){ |
|
38 | - $where=array('username'=>$sipnumber); |
|
39 | - $accountid_arr=$this->db_model->getSelect('accountid','sip_devices',$where); |
|
34 | + function index($sipnumber = '') { |
|
35 | + $opensips_flag = common_model::$global_config['system_config']['opensips']; |
|
36 | + $accountid_arr = 0; |
|
37 | + if ($opensips_flag == '1') { |
|
38 | + $where = array('username'=>$sipnumber); |
|
39 | + $accountid_arr = $this->db_model->getSelect('accountid', 'sip_devices', $where); |
|
40 | 40 | } |
41 | - else{ |
|
41 | + else { |
|
42 | 42 | $db_config = Common_model::$global_config['system_config']; |
43 | - $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="; |
|
43 | + $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="; |
|
44 | 44 | $this->opensips_db = $this->load->database($opensipdsn, true); |
45 | 45 | $this->opensips_db->where(array("username"=>$sipnumber)); |
46 | - $accountnum_arr=$this->opensips_db->get("subscriber"); |
|
47 | - $accountnum_arr=$accountnum_arr->result_array(); |
|
48 | - foreach($accountnum_arr as $value_num){ |
|
49 | - $accountid_arr = $this->db_model->getSelect('id','accounts',array('number'=>$value_num['accountcode'])); |
|
46 | + $accountnum_arr = $this->opensips_db->get("subscriber"); |
|
47 | + $accountnum_arr = $accountnum_arr->result_array(); |
|
48 | + foreach ($accountnum_arr as $value_num) { |
|
49 | + $accountid_arr = $this->db_model->getSelect('id', 'accounts', array('number'=>$value_num['accountcode'])); |
|
50 | 50 | } |
51 | 51 | } |
52 | - if($accountid_arr == ''){ |
|
52 | + if ($accountid_arr == '') { |
|
53 | 53 | echo "Please enter proper username of SIP Account"; |
54 | 54 | } |
55 | - if($accountid_arr->num_rows()==0 ){ |
|
56 | - $where=array('number'=>$sipnumber); |
|
57 | - $accountid_arr=$this->db_model->getSelect('id','accounts',$where); |
|
55 | + if ($accountid_arr->num_rows() == 0) { |
|
56 | + $where = array('number'=>$sipnumber); |
|
57 | + $accountid_arr = $this->db_model->getSelect('id', 'accounts', $where); |
|
58 | 58 | } |
59 | - if($accountid_arr->num_rows()>0){ |
|
60 | - $accountid_arr=$accountid_arr->result_array(); |
|
61 | - if($opensips_flag == '1'){ |
|
62 | - foreach($accountid_arr[0] as $key=>$value){ |
|
59 | + if ($accountid_arr->num_rows() > 0) { |
|
60 | + $accountid_arr = $accountid_arr->result_array(); |
|
61 | + if ($opensips_flag == '1') { |
|
62 | + foreach ($accountid_arr[0] as $key=>$value) { |
|
63 | 63 | } |
64 | - if($key== 'id'){ |
|
65 | - $accountid=$accountid_arr[0]['id']; |
|
66 | - } else{ |
|
67 | - $accountid=$accountid_arr[0]['accountid']; |
|
64 | + if ($key == 'id') { |
|
65 | + $accountid = $accountid_arr[0]['id']; |
|
66 | + } else { |
|
67 | + $accountid = $accountid_arr[0]['accountid']; |
|
68 | 68 | } |
69 | - } else{ |
|
70 | - $accountid=$accountid_arr[0]['id']; |
|
69 | + } else { |
|
70 | + $accountid = $accountid_arr[0]['id']; |
|
71 | 71 | } |
72 | 72 | $to_currency = common_model::$global_config['system_config']['base_currency']; |
73 | - if($accountid > 0){ |
|
74 | - $where=array('id'=>$accountid); |
|
75 | - $balance=$this->db_model->getSelect('balance,currency_id','accounts',$where); |
|
76 | - if($balance->num_rows() > 0){ |
|
73 | + if ($accountid > 0) { |
|
74 | + $where = array('id'=>$accountid); |
|
75 | + $balance = $this->db_model->getSelect('balance,currency_id', 'accounts', $where); |
|
76 | + if ($balance->num_rows() > 0) { |
|
77 | 77 | //get balance,currency using by user from account number. |
78 | 78 | $balance_arr = $balance->result_array(); |
79 | - $balance=$balance_arr['0']['balance']; |
|
80 | - $currency=$balance_arr['0']['currency_id']; |
|
79 | + $balance = $balance_arr['0']['balance']; |
|
80 | + $currency = $balance_arr['0']['currency_id']; |
|
81 | 81 | //Get Base Currency From System which is main currency of system. |
82 | - $base_currency_arr=$this->db_model->getSelect('value','system',array('name'=>'base_currency')); |
|
83 | - $base_currency_arr=$base_currency_arr->result_array(); |
|
84 | - $base_currency=$base_currency_arr['0']['value']; |
|
82 | + $base_currency_arr = $this->db_model->getSelect('value', 'system', array('name'=>'base_currency')); |
|
83 | + $base_currency_arr = $base_currency_arr->result_array(); |
|
84 | + $base_currency = $base_currency_arr['0']['value']; |
|
85 | 85 | //Get basse Currency rate from Currency Name. |
86 | - $base_currency_info=$this->db_model->getSelect('*','currency',array('currency'=>$base_currency)); |
|
87 | - $base_currency_info=$base_currency_info->result_array(); |
|
88 | - $base_currency_rate=$base_currency_info['0']['currencyrate']; |
|
89 | - $base_currency_name=$base_currency_info['0']['currency']; |
|
86 | + $base_currency_info = $this->db_model->getSelect('*', 'currency', array('currency'=>$base_currency)); |
|
87 | + $base_currency_info = $base_currency_info->result_array(); |
|
88 | + $base_currency_rate = $base_currency_info['0']['currencyrate']; |
|
89 | + $base_currency_name = $base_currency_info['0']['currency']; |
|
90 | 90 | //Find Currency Rate of user Currency from its currency_id |
91 | - $where= array('id'=>$currency); |
|
92 | - $user_currency_info=$this->db_model->getSelect("*",'currency',$where); |
|
91 | + $where = array('id'=>$currency); |
|
92 | + $user_currency_info = $this->db_model->getSelect("*", 'currency', $where); |
|
93 | 93 | //user Currency Is deleted or Not |
94 | - if($user_currency_info->num_rows() > 0){ |
|
95 | - $user_currency_info=$user_currency_info->result_array(); |
|
96 | - $user_currency=$user_currency_info['0']['currencyrate']; |
|
97 | - $user_currency_name=$user_currency_info['0']['currency']; |
|
98 | - } else{ |
|
99 | - $user_currency=$base_currency_rate; |
|
100 | - $user_currency_name=$base_currency_name; |
|
94 | + if ($user_currency_info->num_rows() > 0) { |
|
95 | + $user_currency_info = $user_currency_info->result_array(); |
|
96 | + $user_currency = $user_currency_info['0']['currencyrate']; |
|
97 | + $user_currency_name = $user_currency_info['0']['currency']; |
|
98 | + } else { |
|
99 | + $user_currency = $base_currency_rate; |
|
100 | + $user_currency_name = $base_currency_name; |
|
101 | 101 | } |
102 | 102 | // Convert Balance of user in user currency |
103 | - $convert_balance=round(($balance * $user_currency)/$base_currency_rate,2); |
|
104 | - $convert_balance=sprintf("%.2f", $convert_balance).' '.$user_currency_name; |
|
103 | + $convert_balance = round(($balance * $user_currency) / $base_currency_rate, 2); |
|
104 | + $convert_balance = sprintf("%.2f", $convert_balance).' '.$user_currency_name; |
|
105 | 105 | echo "Balance : ".$convert_balance; |
106 | 106 | } |
107 | - } else{ |
|
107 | + } else { |
|
108 | 108 | echo "0.00 ".$to_currency; |
109 | 109 | } |
110 | - } else{ |
|
110 | + } else { |
|
111 | 111 | echo "Please enter proper username of SIP Account"; |
112 | 112 | } |
113 | 113 | } |
@@ -37,8 +37,7 @@ |
||
37 | 37 | if($opensips_flag == '1'){ |
38 | 38 | $where=array('username'=>$sipnumber); |
39 | 39 | $accountid_arr=$this->db_model->getSelect('accountid','sip_devices',$where); |
40 | - } |
|
41 | - else{ |
|
40 | + } else{ |
|
42 | 41 | $db_config = Common_model::$global_config['system_config']; |
43 | 42 | $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="; |
44 | 43 | $this->opensips_db = $this->load->database($opensipdsn, true); |
@@ -28,59 +28,59 @@ discard block |
||
28 | 28 | parent::__construct(); |
29 | 29 | } |
30 | 30 | |
31 | - function index(){ |
|
31 | + function index() { |
|
32 | 32 | $data['account_info'] = $this->session->userdata['accountinfo']; |
33 | 33 | $data['username'] = $this->session->userdata('user_name'); |
34 | 34 | $data['page_title'] = "Feedback"; |
35 | - $this->load->view('view_feedback',$data); |
|
35 | + $this->load->view('view_feedback', $data); |
|
36 | 36 | } |
37 | - function customer_feedback_result($flag=FALSE){ |
|
38 | - if($flag){ |
|
37 | + function customer_feedback_result($flag = FALSE) { |
|
38 | + if ($flag) { |
|
39 | 39 | $account_info = array(); |
40 | - $this->db->where("accountid","1"); |
|
40 | + $this->db->where("accountid", "1"); |
|
41 | 41 | $res = $this->db->get('invoice_conf'); |
42 | - if($res->num_rows > 0){ |
|
42 | + if ($res->num_rows > 0) { |
|
43 | 43 | $masterdata = $res->result_array(); |
44 | 44 | $account_info = $masterdata['0']; |
45 | 45 | |
46 | - $company_name=$account_info['company_name']; |
|
47 | - $address=$account_info['address']; |
|
48 | - $city=$account_info['city']; |
|
49 | - $province=$account_info['province']; |
|
50 | - $country=$account_info['country']; |
|
51 | - $zipcode=$account_info['zipcode']; |
|
52 | - $telephone=$account_info['telephone']; |
|
53 | - $fax=$account_info['fax']; |
|
54 | - $emailaddress=$account_info['emailaddress']; |
|
55 | - $website=$account_info['website']; |
|
46 | + $company_name = $account_info['company_name']; |
|
47 | + $address = $account_info['address']; |
|
48 | + $city = $account_info['city']; |
|
49 | + $province = $account_info['province']; |
|
50 | + $country = $account_info['country']; |
|
51 | + $zipcode = $account_info['zipcode']; |
|
52 | + $telephone = $account_info['telephone']; |
|
53 | + $fax = $account_info['fax']; |
|
54 | + $emailaddress = $account_info['emailaddress']; |
|
55 | + $website = $account_info['website']; |
|
56 | 56 | |
57 | - $data=array("name"=>"Admin","company_name"=>$company_name,"address"=>$address,"city"=>$city,"province"=>$province,"country"=>$country,"zipcode"=>$zipcode,"telephone"=>$telephone,"fax"=>$fax,"emailaddress"=>$emailaddress,"website"=>$website,"serverip"=>$_SERVER['SERVER_NAME'],"FLAG"=>"TRUE"); |
|
57 | + $data = array("name"=>"Admin", "company_name"=>$company_name, "address"=>$address, "city"=>$city, "province"=>$province, "country"=>$country, "zipcode"=>$zipcode, "telephone"=>$telephone, "fax"=>$fax, "emailaddress"=>$emailaddress, "website"=>$website, "serverip"=>$_SERVER['SERVER_NAME'], "FLAG"=>"TRUE"); |
|
58 | 58 | } |
59 | - } else{ |
|
59 | + } else { |
|
60 | 60 | $account_info = array(); |
61 | - $this->db->where("type","-1"); |
|
61 | + $this->db->where("type", "-1"); |
|
62 | 62 | $res = $this->db->get('accounts'); |
63 | - if($res->num_rows > 0){ |
|
63 | + if ($res->num_rows > 0) { |
|
64 | 64 | $masterdata = $res->result_array(); |
65 | 65 | $account_info = $masterdata['0']; |
66 | 66 | |
67 | - $name=$_REQUEST['name']="Admin"; |
|
68 | - $email=$_REQUEST['email']=$account_info['email']; |
|
69 | - $feedback=$_REQUEST['feedback']; |
|
70 | - $first_name=$account_info['first_name']; |
|
71 | - $last_name=$account_info['last_name']; |
|
72 | - $city=$account_info['city']; |
|
73 | - $telephone_1=$account_info['telephone_1']; |
|
74 | - $account_email=$account_info['email']; |
|
75 | - $company_name=$account_info['company_name']; |
|
76 | - $address_1=$account_info['address_1']; |
|
77 | - $address_2=$account_info['address_2']; |
|
78 | - $telephone_2=$account_info['telephone_2']; |
|
79 | - $province=$account_info['province']; |
|
67 | + $name = $_REQUEST['name'] = "Admin"; |
|
68 | + $email = $_REQUEST['email'] = $account_info['email']; |
|
69 | + $feedback = $_REQUEST['feedback']; |
|
70 | + $first_name = $account_info['first_name']; |
|
71 | + $last_name = $account_info['last_name']; |
|
72 | + $city = $account_info['city']; |
|
73 | + $telephone_1 = $account_info['telephone_1']; |
|
74 | + $account_email = $account_info['email']; |
|
75 | + $company_name = $account_info['company_name']; |
|
76 | + $address_1 = $account_info['address_1']; |
|
77 | + $address_2 = $account_info['address_2']; |
|
78 | + $telephone_2 = $account_info['telephone_2']; |
|
79 | + $province = $account_info['province']; |
|
80 | 80 | |
81 | - $data=array("name"=>$name,"email"=>$email,"feedback"=>$feedback,"first_name"=>$first_name,"last_name"=>$last_name,"city"=>$city,"telephone_1"=>$telephone_1,"account_email"=>$account_email,"company_name"=>$company_name,"address_1"=>$address_1,"address_2"=>$address_2,"telephone_2"=>$telephone_2,"province"=>$province,"serverip"=>$_SERVER['SERVER_ADDR'],"FLAG"=>"FALSE"); |
|
81 | + $data = array("name"=>$name, "email"=>$email, "feedback"=>$feedback, "first_name"=>$first_name, "last_name"=>$last_name, "city"=>$city, "telephone_1"=>$telephone_1, "account_email"=>$account_email, "company_name"=>$company_name, "address_1"=>$address_1, "address_2"=>$address_2, "telephone_2"=>$telephone_2, "province"=>$province, "serverip"=>$_SERVER['SERVER_ADDR'], "FLAG"=>"FALSE"); |
|
82 | 82 | |
83 | - $data_new= json_encode($data); |
|
83 | + $data_new = json_encode($data); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | $ch = curl_init(); |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
97 | 97 | |
98 | 98 | $response = curl_exec($ch); |
99 | - if(!$flag) |
|
100 | - redirect(base_url() . 'feedback/thanks'); |
|
99 | + if ( ! $flag) |
|
100 | + redirect(base_url().'feedback/thanks'); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | } |
104 | - function thanks(){ |
|
104 | + function thanks() { |
|
105 | 105 | $this->load->view('view_feedback_response'); |
106 | 106 | } |
107 | 107 |
@@ -96,8 +96,9 @@ |
||
96 | 96 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
97 | 97 | |
98 | 98 | $response = curl_exec($ch); |
99 | - if(!$flag) |
|
100 | - redirect(base_url() . 'feedback/thanks'); |
|
99 | + if(!$flag) { |
|
100 | + redirect(base_url() . 'feedback/thanks'); |
|
101 | + } |
|
101 | 102 | |
102 | 103 | |
103 | 104 | } |
@@ -21,48 +21,48 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | class Currencyupdate extends CI_Controller { |
24 | - function __construct() |
|
25 | - { |
|
26 | - parent::__construct(); |
|
27 | - // if(!defined( 'CRON' ) ) |
|
28 | - // exit(); |
|
29 | - $this->load->model("db_model"); |
|
30 | - $this->load->library("astpp/common"); |
|
31 | - } |
|
32 | - function update_currency() { |
|
33 | - $where = array("currency <>"=> Common_model::$global_config['system_config']['base_currency']); |
|
34 | - $query = $this->db_model->getSelect("*", "currency", $where); |
|
24 | + function __construct() |
|
25 | + { |
|
26 | + parent::__construct(); |
|
27 | + // if(!defined( 'CRON' ) ) |
|
28 | + // exit(); |
|
29 | + $this->load->model("db_model"); |
|
30 | + $this->load->library("astpp/common"); |
|
31 | + } |
|
32 | + function update_currency() { |
|
33 | + $where = array("currency <>"=> Common_model::$global_config['system_config']['base_currency']); |
|
34 | + $query = $this->db_model->getSelect("*", "currency", $where); |
|
35 | 35 | |
36 | - if ($query->num_rows > 0) { |
|
37 | - $currency_data = $query->result_array(); |
|
38 | - $url = "http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s="; |
|
39 | - foreach ($currency_data as $currency_value) { |
|
40 | - $url .= Common_model::$global_config['system_config']['base_currency'].$currency_value['currency'].'=X+'; |
|
41 | - } |
|
42 | - $url .= '&f=l1'; |
|
36 | + if ($query->num_rows > 0) { |
|
37 | + $currency_data = $query->result_array(); |
|
38 | + $url = "http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s="; |
|
39 | + foreach ($currency_data as $currency_value) { |
|
40 | + $url .= Common_model::$global_config['system_config']['base_currency'].$currency_value['currency'].'=X+'; |
|
41 | + } |
|
42 | + $url .= '&f=l1'; |
|
43 | 43 | |
44 | - $sql = ''; |
|
45 | - $response = $this->curl_response($url); |
|
46 | - $content_data = explode(' ', $response); |
|
44 | + $sql = ''; |
|
45 | + $response = $this->curl_response($url); |
|
46 | + $content_data = explode(' ', $response); |
|
47 | 47 | |
48 | - foreach ($content_data as $content_data1) { |
|
49 | - $currency_arr = explode("\n", $content_data1); |
|
50 | - foreach ($currency_arr as $final_val) |
|
51 | - { |
|
52 | - $currency_final = array(); |
|
53 | - $currency_final = explode(',', $final_val); |
|
54 | - if (isset($currency_final[1]) && $currency_final[1] != "" && $currency_final[0] != '' && $currency_final[1] != 'N/A') { |
|
55 | - $sql = "UPDATE currency SET currencyRate = ".$currency_final[1]." WHERE currency = '".substr($currency_final[0], 4, 3)."'"; |
|
56 | - $this->db->query($sql); |
|
57 | - } |
|
58 | - } |
|
59 | - } |
|
60 | - $sql = "UPDATE currency SET currencyRate = '1' WHERE currency = '".Common_model::$global_config['system_config']['base_currency']."'"; |
|
61 | - $this->db->query($sql); |
|
62 | - } |
|
63 | - $this->session->set_flashdata("astpp_errormsg", "Currency exchange rates successfully updated."); |
|
64 | - redirect(base_url()."/systems/currency_list/"); |
|
65 | - exit; |
|
48 | + foreach ($content_data as $content_data1) { |
|
49 | + $currency_arr = explode("\n", $content_data1); |
|
50 | + foreach ($currency_arr as $final_val) |
|
51 | + { |
|
52 | + $currency_final = array(); |
|
53 | + $currency_final = explode(',', $final_val); |
|
54 | + if (isset($currency_final[1]) && $currency_final[1] != "" && $currency_final[0] != '' && $currency_final[1] != 'N/A') { |
|
55 | + $sql = "UPDATE currency SET currencyRate = ".$currency_final[1]." WHERE currency = '".substr($currency_final[0], 4, 3)."'"; |
|
56 | + $this->db->query($sql); |
|
57 | + } |
|
58 | + } |
|
59 | + } |
|
60 | + $sql = "UPDATE currency SET currencyRate = '1' WHERE currency = '".Common_model::$global_config['system_config']['base_currency']."'"; |
|
61 | + $this->db->query($sql); |
|
62 | + } |
|
63 | + $this->session->set_flashdata("astpp_errormsg", "Currency exchange rates successfully updated."); |
|
64 | + redirect(base_url()."/systems/currency_list/"); |
|
65 | + exit; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | */ |
71 | 71 | function curl_response($url) |
72 | 72 | { |
73 | - $ch = curl_init(); // Initialising cURL |
|
74 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
75 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
|
76 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
77 | - curl_setopt($ch, CURLOPT_ENCODING, ""); |
|
78 | - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)"); |
|
79 | - $data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable |
|
80 | - curl_close($ch); // Closing cURL |
|
81 | - return $data; |
|
73 | + $ch = curl_init(); // Initialising cURL |
|
74 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
75 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
|
76 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
77 | + curl_setopt($ch, CURLOPT_ENCODING, ""); |
|
78 | + curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)"); |
|
79 | + $data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable |
|
80 | + curl_close($ch); // Closing cURL |
|
81 | + return $data; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | ?> |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class CSVReader { |
14 | 14 | |
15 | - var $fields; /** columns names retrieved after parsing */ |
|
16 | - var $separator = ','; /** separator used to explode each line */ |
|
15 | + var $fields; /** columns names retrieved after parsing */ |
|
16 | + var $separator = ','; /** separator used to explode each line */ |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Parse a text containing CSV formatted data. |
@@ -34,23 +34,23 @@ discard block |
||
34 | 34 | * @param string |
35 | 35 | * @return array |
36 | 36 | */ |
37 | - function parse_file($p_Filepath,$config_variable,$check_header_flag=false) { |
|
37 | + function parse_file($p_Filepath, $config_variable, $check_header_flag = false) { |
|
38 | 38 | $lines = file($p_Filepath); |
39 | 39 | //Giving line numbers |
40 | - for($i=0;$i<sizeof($lines);$i++) |
|
40 | + for ($i = 0; $i < sizeof($lines); $i++) |
|
41 | 41 | { |
42 | 42 | |
43 | - if(trim($lines[$i]) != "") |
|
43 | + if (trim($lines[$i]) != "") |
|
44 | 44 | { |
45 | 45 | $columnname = explode($this->separator, $lines[$i]); |
46 | - for($i=0;$i<sizeof($columnname);$i++) |
|
46 | + for ($i = 0; $i < sizeof($columnname); $i++) |
|
47 | 47 | { |
48 | - $columnname[$i]=$columnname[$i]; |
|
48 | + $columnname[$i] = $columnname[$i]; |
|
49 | 49 | } |
50 | 50 | break; |
51 | 51 | } |
52 | 52 | } |
53 | - return $this->parse_lines($lines,$config_variable,$check_header_flag); |
|
53 | + return $this->parse_lines($lines, $config_variable, $check_header_flag); |
|
54 | 54 | } |
55 | 55 | /** |
56 | 56 | * Parse an array of text lines containing CSV formatted data. |
@@ -59,47 +59,47 @@ discard block |
||
59 | 59 | * @param array |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - function parse_lines($p_CSVLines,$config_variable,$check_header_flag=false) { |
|
62 | + function parse_lines($p_CSVLines, $config_variable, $check_header_flag = false) { |
|
63 | 63 | // echo "<pre>"; |
64 | - $t=0; |
|
65 | - $content=array(); |
|
66 | - $custom_array=array(); |
|
67 | - $i=0; |
|
68 | - $flag_data=false; |
|
69 | - $data_arr[0]=$config_variable; |
|
70 | - $field_name_arr=array_keys($config_variable); |
|
71 | - foreach( $p_CSVLines as $line_num => $line ) |
|
64 | + $t = 0; |
|
65 | + $content = array(); |
|
66 | + $custom_array = array(); |
|
67 | + $i = 0; |
|
68 | + $flag_data = false; |
|
69 | + $data_arr[0] = $config_variable; |
|
70 | + $field_name_arr = array_keys($config_variable); |
|
71 | + foreach ($p_CSVLines as $line_num => $line) |
|
72 | 72 | { |
73 | - $line=trim($line); |
|
74 | - if(!empty($line)){ |
|
73 | + $line = trim($line); |
|
74 | + if ( ! empty($line)) { |
|
75 | 75 | // skip empty lines |
76 | 76 | $elements = explode($this->separator, $line); |
77 | 77 | |
78 | - if(array_filter($elements,'trim')) { |
|
79 | - $custom_array[]=$elements; |
|
78 | + if (array_filter($elements, 'trim')) { |
|
79 | + $custom_array[] = $elements; |
|
80 | 80 | } |
81 | 81 | $i++; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | - if($check_header_flag == 'on'){ |
|
85 | + if ($check_header_flag == 'on') { |
|
86 | 86 | unset($custom_array[0]); |
87 | 87 | } |
88 | - foreach($custom_array as $data){ |
|
89 | - $j=0; |
|
90 | - foreach($data as $key=>$value){ |
|
91 | - $value=str_replace('"', '', $value); |
|
92 | - $value=str_replace("'", '', $value); |
|
93 | - if(isset($field_name_arr[$j])){ |
|
94 | - $field_key_value =$config_variable[$field_name_arr[$j]]; |
|
95 | - $value= strip_slashes(trim($value)); |
|
88 | + foreach ($custom_array as $data) { |
|
89 | + $j = 0; |
|
90 | + foreach ($data as $key=>$value) { |
|
91 | + $value = str_replace('"', '', $value); |
|
92 | + $value = str_replace("'", '', $value); |
|
93 | + if (isset($field_name_arr[$j])) { |
|
94 | + $field_key_value = $config_variable[$field_name_arr[$j]]; |
|
95 | + $value = strip_slashes(trim($value)); |
|
96 | 96 | $value = preg_replace('#<script.*</script>#is', '', $value); |
97 | - if(isset($field_key_value) && !empty($field_key_value)) |
|
98 | - $content[$field_key_value] = strip_tags(filter_var($value, FILTER_SANITIZE_STRING)); |
|
97 | + if (isset($field_key_value) && ! empty($field_key_value)) |
|
98 | + $content[$field_key_value] = strip_tags(filter_var($value, FILTER_SANITIZE_STRING)); |
|
99 | 99 | $j++; |
100 | 100 | } |
101 | 101 | } |
102 | - $data_arr[]=$content; |
|
102 | + $data_arr[] = $content; |
|
103 | 103 | } |
104 | 104 | return $data_arr; |
105 | 105 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CSVReader Class |
4 | 6 | * |
@@ -94,8 +96,9 @@ discard block |
||
94 | 96 | $field_key_value =$config_variable[$field_name_arr[$j]]; |
95 | 97 | $value= strip_slashes(trim($value)); |
96 | 98 | $value = preg_replace('#<script.*</script>#is', '', $value); |
97 | - if(isset($field_key_value) && !empty($field_key_value)) |
|
98 | - $content[$field_key_value] = strip_tags(filter_var($value, FILTER_SANITIZE_STRING)); |
|
99 | + if(isset($field_key_value) && !empty($field_key_value)) { |
|
100 | + $content[$field_key_value] = strip_tags(filter_var($value, FILTER_SANITIZE_STRING)); |
|
101 | + } |
|
99 | 102 | $j++; |
100 | 103 | } |
101 | 104 | } |
@@ -24,22 +24,22 @@ discard block |
||
24 | 24 | exit('No direct script access allowed'); |
25 | 25 | } |
26 | 26 | class Timezone { |
27 | - function __construct(){ |
|
28 | - $this->CI =& get_instance(); |
|
27 | + function __construct() { |
|
28 | + $this->CI = & get_instance(); |
|
29 | 29 | $this->CI->load->library('session'); |
30 | 30 | $this->CI->load->database(); |
31 | 31 | } |
32 | 32 | |
33 | - function uset_timezone(){ |
|
33 | + function uset_timezone() { |
|
34 | 34 | $account_data = $this->CI->session->userdata('accountinfo'); |
35 | - return $account_data['timezone_id'] ; |
|
35 | + return $account_data['timezone_id']; |
|
36 | 36 | } |
37 | - function display_GMT($currDate,$fulldate = 1) |
|
37 | + function display_GMT($currDate, $fulldate = 1) |
|
38 | 38 | { |
39 | 39 | $number = $this->uset_timezone(); |
40 | - $SERVER_GMT='0'; |
|
40 | + $SERVER_GMT = '0'; |
|
41 | 41 | |
42 | - $result=$this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
42 | + $result = $this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
43 | 43 | $timezone_offset = $result->result(); |
44 | 44 | |
45 | 45 | $USER_GMT = $timezone_offset['0']->gmtoffset; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $year = $date_time_array['year']; |
55 | 55 | $timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year); |
56 | 56 | |
57 | - $timestamp = $timestamp+($USER_GMT-$SERVER_GMT); |
|
57 | + $timestamp = $timestamp + ($USER_GMT - $SERVER_GMT); |
|
58 | 58 | if ($fulldate == 1) { |
59 | 59 | $date = date("Y-m-d H:i:s", $timestamp); |
60 | 60 | } else { |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | return $date; |
65 | 65 | } |
66 | 66 | |
67 | - function convert_to_GMT($currDate,$fulldate = 1){ |
|
67 | + function convert_to_GMT($currDate, $fulldate = 1) { |
|
68 | 68 | $number = $this->uset_timezone(); |
69 | - $SERVER_GMT='0'; |
|
69 | + $SERVER_GMT = '0'; |
|
70 | 70 | |
71 | - $result=$this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
71 | + $result = $this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
72 | 72 | $timezone_offset = $result->result(); |
73 | 73 | |
74 | 74 | $USER_GMT = $timezone_offset['0']->gmtoffset; |
@@ -22,180 +22,180 @@ |
||
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 | /** |
28 | 28 | * Dynamically build forms for display |
29 | 29 | */ |
30 | 30 | class Form { |
31 | 31 | |
32 | - protected $CI; // codeigniter |
|
33 | - protected $fields = array(); // array of fields |
|
34 | - protected $form_title = 'Form'; |
|
35 | - protected $form_id = 'form'; |
|
36 | - protected $form_action = ''; |
|
37 | - protected $form_class = ''; |
|
38 | - protected $hidden = array(); |
|
39 | - protected $multipart = FALSE; // default to standard form |
|
40 | - protected $submit_button = 'Submit'; |
|
41 | - protected $after_button = ''; |
|
42 | - protected $rules = array(); // storage for validation rules |
|
43 | - |
|
44 | - function __construct() { |
|
45 | - $this->CI = & get_instance(); |
|
46 | - $this->CI->load->library('form_validation'); |
|
47 | - $this->CI->load->library('astpp/common'); |
|
48 | - $this->CI->load->model('db_model'); |
|
49 | - $this->check_permissions(); |
|
50 | - } |
|
32 | + protected $CI; // codeigniter |
|
33 | + protected $fields = array(); // array of fields |
|
34 | + protected $form_title = 'Form'; |
|
35 | + protected $form_id = 'form'; |
|
36 | + protected $form_action = ''; |
|
37 | + protected $form_class = ''; |
|
38 | + protected $hidden = array(); |
|
39 | + protected $multipart = FALSE; // default to standard form |
|
40 | + protected $submit_button = 'Submit'; |
|
41 | + protected $after_button = ''; |
|
42 | + protected $rules = array(); // storage for validation rules |
|
43 | + |
|
44 | + function __construct() { |
|
45 | + $this->CI = & get_instance(); |
|
46 | + $this->CI->load->library('form_validation'); |
|
47 | + $this->CI->load->library('astpp/common'); |
|
48 | + $this->CI->load->model('db_model'); |
|
49 | + $this->check_permissions(); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | // __construct |
53 | - /** |
|
54 | - * adds raw html to the field array |
|
55 | - */ |
|
56 | - function check_permissions() { |
|
57 | - if ($this->CI->session->userdata('user_login') == TRUE) { |
|
58 | - $module_info = unserialize($this->CI->session->userdata("permited_modules")); |
|
59 | - if ($this->CI->session->userdata('userlevel_logintype') != 0 && $this->CI->session->userdata('userlevel_logintype') != 3) { |
|
60 | - $module_info[] = 'dashboard'; |
|
61 | - } |
|
62 | - $url = $this->CI->uri->uri_string; |
|
63 | - $file_name = explode("/", $url); |
|
64 | - if (isset($file_name['1'])) { |
|
65 | - $module = explode('_', $file_name['1']); |
|
66 | - } else { |
|
67 | - $module = $file_name; |
|
68 | - } |
|
69 | - if ($this->CI->session->userdata('userlevel_logintype') == 1) { |
|
53 | + /** |
|
54 | + * adds raw html to the field array |
|
55 | + */ |
|
56 | + function check_permissions() { |
|
57 | + if ($this->CI->session->userdata('user_login') == TRUE) { |
|
58 | + $module_info = unserialize($this->CI->session->userdata("permited_modules")); |
|
59 | + if ($this->CI->session->userdata('userlevel_logintype') != 0 && $this->CI->session->userdata('userlevel_logintype') != 3) { |
|
60 | + $module_info[] = 'dashboard'; |
|
61 | + } |
|
62 | + $url = $this->CI->uri->uri_string; |
|
63 | + $file_name = explode("/", $url); |
|
64 | + if (isset($file_name['1'])) { |
|
65 | + $module = explode('_', $file_name['1']); |
|
66 | + } else { |
|
67 | + $module = $file_name; |
|
68 | + } |
|
69 | + if ($this->CI->session->userdata('userlevel_logintype') == 1) { |
|
70 | 70 | $module_info[] = 'user'; |
71 | 71 | } |
72 | - if (in_array($module[0], $module_info)) { |
|
73 | - if ($this->CI->session->userdata('userlevel_logintype') == 0 && $module[0] == 'customer' && isset($file_name[1]) && $file_name[1] != 'customer_transfer') { |
|
74 | - redirect(base_url().'user/user/'); |
|
75 | - } else { |
|
76 | - return true; |
|
77 | - } |
|
78 | - } else { |
|
79 | - $this->CI->session->set_userdata('astpp_errormsg', 'You do not have permission to access this module..!'); |
|
80 | - if ($this->CI->session->userdata('userlevel_logintype') == '-1' || $this->CI->session->userdata('logintype') == '1') { |
|
81 | - redirect(base_url().'dashboard/'); |
|
82 | - } else { |
|
83 | - redirect(base_url().'user/user/'); |
|
84 | - } |
|
85 | - } |
|
86 | - } else { |
|
87 | - redirect(base_url()); |
|
88 | - } |
|
89 | - } |
|
90 | - |
|
91 | - function build_form($fields_array, $values) { |
|
92 | - $form_contents = ''; |
|
93 | - $form_contents .= '<div class="pop_md col-md-12 margin-t-10 padding-x-8">'; |
|
94 | - if (isset($fields_array['breadcrumb'])) { |
|
95 | - $form_contents .= form_breadcrumb($fields_array['breadcrumb']); |
|
96 | - unset($fields_array['breadcrumb']); |
|
97 | - } |
|
98 | - $form_contents .= form_open($fields_array['forms'][0], $fields_array['forms'][1]); |
|
99 | - unset($fields_array['forms']); |
|
100 | - $button_array = array(); |
|
101 | - if (isset($fields_array['button_save']) || isset($fields_array['button_cancel']) || isset($fields_array['additional_button'])) { |
|
102 | - $save = $fields_array['button_save']; |
|
103 | - unset($fields_array['button_save']); |
|
104 | - if (isset($fields_array['button_cancel'])) { |
|
105 | - $cancel = $fields_array['button_cancel']; |
|
106 | - unset($fields_array['button_cancel']); |
|
107 | - } |
|
108 | - if (isset($fields_array['additional_button'])) { |
|
109 | - $additiopnal_button = $fields_array['additional_button']; |
|
110 | - unset($fields_array['additional_button']); |
|
111 | - } |
|
112 | - } |
|
113 | - if (isset($additiopnal_button)) { |
|
114 | - $form_contents .= form_button(gettext($additiopnal_button)); |
|
115 | - } |
|
116 | - $i = 0; |
|
117 | - foreach ($fields_array as $fieldset_key => $form_fileds) { |
|
118 | - if (count($fields_array) > 1) { |
|
119 | - if ($i == 1 || $i == 3) { |
|
120 | - $form_contents .= '<div class="col-md-6 no-padding pull-right">'; |
|
121 | - $form_contents .= '<div class="col-md-12 padding-x-4">'; |
|
122 | - } else { |
|
123 | - $form_contents .= '<div class="col-md-6 no-padding">'; |
|
124 | - $form_contents .= '<div class="col-md-12 padding-x-4">'; |
|
125 | - } |
|
126 | - } else { |
|
127 | - $form_contents .= '<div class="col-md-12 no-padding">'; |
|
128 | - $form_contents .= '<div class="col-md-12 no-padding">'; |
|
129 | - } |
|
130 | - $form_contents .= '<ul class="no-padding">'; |
|
131 | - $form_contents .= '<div class="col-md-12 no-padding">'; |
|
132 | - if ($i == 1 || $i == 3) { |
|
133 | - $form_contents .= form_fieldset(gettext($fieldset_key)); |
|
134 | - } else { |
|
135 | - $form_contents .= form_fieldset(gettext($fieldset_key)); |
|
136 | - } |
|
137 | - foreach ($form_fileds as $fieldkey => $fieldvalue) { |
|
138 | - $form_contents .= '<li class="col-md-12">'; |
|
139 | - if ($fieldvalue[1] == 'HIDDEN') { |
|
140 | - if (isset($this->CI->input->post)) |
|
141 | - $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
142 | - else |
|
143 | - $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : ''); |
|
144 | - $form_contents .= form_hidden($fieldvalue[2]['name'], $fieldvalue[2]['value']); |
|
145 | - } else { |
|
146 | - $validation_arr = array(); |
|
147 | - if ($fieldvalue[1] == 'INPUT') { |
|
148 | - if ( ! empty($fieldvalue[3])) { |
|
149 | - $validation_arr = explode("|", $fieldvalue[3]); |
|
150 | - } |
|
151 | - } |
|
152 | - elseif ($fieldvalue[2] == 'SELECT') { |
|
153 | - |
|
154 | - if (is_array($fieldvalue[4])) { |
|
155 | - $validation_arr = explode("|", $fieldvalue[4]['rules']); |
|
156 | - } else { |
|
157 | - $validation_arr = explode("|", $fieldvalue[4]); |
|
158 | - } |
|
159 | - } |
|
160 | - if ( ! empty($validation_arr)) { |
|
161 | - $fieldvalue[0] = in_array('required', $validation_arr) ? $fieldvalue[0]."<span style='color:black;'> *</span>" : $fieldvalue[0]; |
|
162 | - $fieldvalue[0] = in_array('dropdown', $validation_arr) ? $fieldvalue[0]."<span style='color:black;'> *</span>" : $fieldvalue[0]; |
|
163 | - } |
|
72 | + if (in_array($module[0], $module_info)) { |
|
73 | + if ($this->CI->session->userdata('userlevel_logintype') == 0 && $module[0] == 'customer' && isset($file_name[1]) && $file_name[1] != 'customer_transfer') { |
|
74 | + redirect(base_url().'user/user/'); |
|
75 | + } else { |
|
76 | + return true; |
|
77 | + } |
|
78 | + } else { |
|
79 | + $this->CI->session->set_userdata('astpp_errormsg', 'You do not have permission to access this module..!'); |
|
80 | + if ($this->CI->session->userdata('userlevel_logintype') == '-1' || $this->CI->session->userdata('logintype') == '1') { |
|
81 | + redirect(base_url().'dashboard/'); |
|
82 | + } else { |
|
83 | + redirect(base_url().'user/user/'); |
|
84 | + } |
|
85 | + } |
|
86 | + } else { |
|
87 | + redirect(base_url()); |
|
88 | + } |
|
89 | + } |
|
90 | + |
|
91 | + function build_form($fields_array, $values) { |
|
92 | + $form_contents = ''; |
|
93 | + $form_contents .= '<div class="pop_md col-md-12 margin-t-10 padding-x-8">'; |
|
94 | + if (isset($fields_array['breadcrumb'])) { |
|
95 | + $form_contents .= form_breadcrumb($fields_array['breadcrumb']); |
|
96 | + unset($fields_array['breadcrumb']); |
|
97 | + } |
|
98 | + $form_contents .= form_open($fields_array['forms'][0], $fields_array['forms'][1]); |
|
99 | + unset($fields_array['forms']); |
|
100 | + $button_array = array(); |
|
101 | + if (isset($fields_array['button_save']) || isset($fields_array['button_cancel']) || isset($fields_array['additional_button'])) { |
|
102 | + $save = $fields_array['button_save']; |
|
103 | + unset($fields_array['button_save']); |
|
104 | + if (isset($fields_array['button_cancel'])) { |
|
105 | + $cancel = $fields_array['button_cancel']; |
|
106 | + unset($fields_array['button_cancel']); |
|
107 | + } |
|
108 | + if (isset($fields_array['additional_button'])) { |
|
109 | + $additiopnal_button = $fields_array['additional_button']; |
|
110 | + unset($fields_array['additional_button']); |
|
111 | + } |
|
112 | + } |
|
113 | + if (isset($additiopnal_button)) { |
|
114 | + $form_contents .= form_button(gettext($additiopnal_button)); |
|
115 | + } |
|
116 | + $i = 0; |
|
117 | + foreach ($fields_array as $fieldset_key => $form_fileds) { |
|
118 | + if (count($fields_array) > 1) { |
|
119 | + if ($i == 1 || $i == 3) { |
|
120 | + $form_contents .= '<div class="col-md-6 no-padding pull-right">'; |
|
121 | + $form_contents .= '<div class="col-md-12 padding-x-4">'; |
|
122 | + } else { |
|
123 | + $form_contents .= '<div class="col-md-6 no-padding">'; |
|
124 | + $form_contents .= '<div class="col-md-12 padding-x-4">'; |
|
125 | + } |
|
126 | + } else { |
|
127 | + $form_contents .= '<div class="col-md-12 no-padding">'; |
|
128 | + $form_contents .= '<div class="col-md-12 no-padding">'; |
|
129 | + } |
|
130 | + $form_contents .= '<ul class="no-padding">'; |
|
131 | + $form_contents .= '<div class="col-md-12 no-padding">'; |
|
132 | + if ($i == 1 || $i == 3) { |
|
133 | + $form_contents .= form_fieldset(gettext($fieldset_key)); |
|
134 | + } else { |
|
135 | + $form_contents .= form_fieldset(gettext($fieldset_key)); |
|
136 | + } |
|
137 | + foreach ($form_fileds as $fieldkey => $fieldvalue) { |
|
138 | + $form_contents .= '<li class="col-md-12">'; |
|
139 | + if ($fieldvalue[1] == 'HIDDEN') { |
|
140 | + if (isset($this->CI->input->post)) |
|
141 | + $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
142 | + else |
|
143 | + $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : ''); |
|
144 | + $form_contents .= form_hidden($fieldvalue[2]['name'], $fieldvalue[2]['value']); |
|
145 | + } else { |
|
146 | + $validation_arr = array(); |
|
147 | + if ($fieldvalue[1] == 'INPUT') { |
|
148 | + if ( ! empty($fieldvalue[3])) { |
|
149 | + $validation_arr = explode("|", $fieldvalue[3]); |
|
150 | + } |
|
151 | + } |
|
152 | + elseif ($fieldvalue[2] == 'SELECT') { |
|
153 | + |
|
154 | + if (is_array($fieldvalue[4])) { |
|
155 | + $validation_arr = explode("|", $fieldvalue[4]['rules']); |
|
156 | + } else { |
|
157 | + $validation_arr = explode("|", $fieldvalue[4]); |
|
158 | + } |
|
159 | + } |
|
160 | + if ( ! empty($validation_arr)) { |
|
161 | + $fieldvalue[0] = in_array('required', $validation_arr) ? $fieldvalue[0]."<span style='color:black;'> *</span>" : $fieldvalue[0]; |
|
162 | + $fieldvalue[0] = in_array('dropdown', $validation_arr) ? $fieldvalue[0]."<span style='color:black;'> *</span>" : $fieldvalue[0]; |
|
163 | + } |
|
164 | 164 | |
165 | - if (is_array($fieldvalue[1]) || (is_array($fieldvalue[2]) && isset($fieldvalue[2]['hidden']))) { |
|
166 | - $form_contents .= form_label(gettext($fieldvalue[0]), $fieldvalue[0], array('class' => 'col-md-3 no-padding add_settings')); |
|
167 | - } else { |
|
168 | - $form_contents .= form_label(gettext($fieldvalue[0]), "", array("class" => "col-md-3 no-padding")); |
|
169 | - } |
|
170 | - } |
|
171 | - if ($fieldvalue[2] == 'SELECT' && ! isset($fieldvalue[13])) { |
|
172 | - |
|
173 | - /* |
|
165 | + if (is_array($fieldvalue[1]) || (is_array($fieldvalue[2]) && isset($fieldvalue[2]['hidden']))) { |
|
166 | + $form_contents .= form_label(gettext($fieldvalue[0]), $fieldvalue[0], array('class' => 'col-md-3 no-padding add_settings')); |
|
167 | + } else { |
|
168 | + $form_contents .= form_label(gettext($fieldvalue[0]), "", array("class" => "col-md-3 no-padding")); |
|
169 | + } |
|
170 | + } |
|
171 | + if ($fieldvalue[2] == 'SELECT' && ! isset($fieldvalue[13])) { |
|
172 | + |
|
173 | + /* |
|
174 | 174 | To make Drop down enabled disabled |
175 | 175 | */ |
176 | - $extra = isset($fieldvalue[1]['extra']) ? $fieldvalue[1]['extra'] : ''; |
|
177 | - /***************************/ |
|
178 | - if ($fieldvalue[7] != '' && $fieldvalue[8] != '') { |
|
179 | - $str = $fieldvalue[7].",".$fieldvalue[8]; |
|
180 | - |
|
181 | - if (isset($this->CI->input->post)) { |
|
182 | - $fieldvalue['value'] = ( ! $this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
183 | - } else { |
|
184 | - if (is_array($fieldvalue[1])) { |
|
185 | - $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]['name']] : @$fieldvalue[1]; |
|
186 | - } else { |
|
187 | - $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
188 | - } |
|
189 | - } |
|
190 | - $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
|
191 | - |
|
192 | - if ($fieldset_key == gettext('System Configuration Information') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Force Trunk') || ($fieldset_key == 'Card Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Account') || $fieldset_key == 'Freeswitch Devices' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Origination Rate Add/Edit' && $fieldvalue[0] == 'Trunks' )||$fieldset_key== 'Billing Information' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #1') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #2') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Sip Profile') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Account')) { |
|
193 | - $form_contents.=form_dropdown_all($fieldvalue[1], $drp_array, $fieldvalue['value'],$extra); |
|
194 | - } else { |
|
195 | - $form_contents.=form_dropdown($fieldvalue[1], $drp_array, $fieldvalue['value'], $extra); |
|
196 | - } |
|
197 | - if(isset($fieldvalue[4]) && $fieldvalue[4] != ''){ |
|
198 | - if(is_array($fieldvalue[4])){ |
|
176 | + $extra = isset($fieldvalue[1]['extra']) ? $fieldvalue[1]['extra'] : ''; |
|
177 | + /***************************/ |
|
178 | + if ($fieldvalue[7] != '' && $fieldvalue[8] != '') { |
|
179 | + $str = $fieldvalue[7].",".$fieldvalue[8]; |
|
180 | + |
|
181 | + if (isset($this->CI->input->post)) { |
|
182 | + $fieldvalue['value'] = ( ! $this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
183 | + } else { |
|
184 | + if (is_array($fieldvalue[1])) { |
|
185 | + $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]['name']] : @$fieldvalue[1]; |
|
186 | + } else { |
|
187 | + $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
188 | + } |
|
189 | + } |
|
190 | + $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
|
191 | + |
|
192 | + if ($fieldset_key == gettext('System Configuration Information') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Force Trunk') || ($fieldset_key == 'Card Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Account') || $fieldset_key == 'Freeswitch Devices' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Origination Rate Add/Edit' && $fieldvalue[0] == 'Trunks' )||$fieldset_key== 'Billing Information' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #1') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #2') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Sip Profile') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Account')) { |
|
193 | + $form_contents.=form_dropdown_all($fieldvalue[1], $drp_array, $fieldvalue['value'],$extra); |
|
194 | + } else { |
|
195 | + $form_contents.=form_dropdown($fieldvalue[1], $drp_array, $fieldvalue['value'], $extra); |
|
196 | + } |
|
197 | + if(isset($fieldvalue[4]) && $fieldvalue[4] != ''){ |
|
198 | + if(is_array($fieldvalue[4])){ |
|
199 | 199 | |
200 | 200 | if(isset($fieldvalue[1]['name'])){ |
201 | 201 | $fieldvalue_pass=$fieldvalue[1]['name']; |
@@ -189,38 +189,38 @@ discard block |
||
189 | 189 | } |
190 | 190 | $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
191 | 191 | |
192 | - if ($fieldset_key == gettext('System Configuration Information') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Force Trunk') || ($fieldset_key == 'Card Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Account') || $fieldset_key == 'Freeswitch Devices' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Origination Rate Add/Edit' && $fieldvalue[0] == 'Trunks' )||$fieldset_key== 'Billing Information' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #1') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #2') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Sip Profile') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Account')) { |
|
193 | - $form_contents.=form_dropdown_all($fieldvalue[1], $drp_array, $fieldvalue['value'],$extra); |
|
192 | + if ($fieldset_key == gettext('System Configuration Information') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Force Trunk') || ($fieldset_key == 'Card Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Account') || $fieldset_key == 'Freeswitch Devices' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key == 'Origination Rate Add/Edit' && $fieldvalue[0] == 'Trunks') || $fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key == 'Information' && $fieldvalue[0] == 'Failover GW Name #1') || ($fieldset_key == 'Information' && $fieldvalue[0] == 'Failover GW Name #2') || ($fieldset_key == 'Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key == 'Sip Devices' && $fieldvalue[0] == 'Sip Profile') || ($fieldset_key == 'Sip Devices' && $fieldvalue[0] == 'Account')) { |
|
193 | + $form_contents .= form_dropdown_all($fieldvalue[1], $drp_array, $fieldvalue['value'], $extra); |
|
194 | 194 | } else { |
195 | - $form_contents.=form_dropdown($fieldvalue[1], $drp_array, $fieldvalue['value'], $extra); |
|
195 | + $form_contents .= form_dropdown($fieldvalue[1], $drp_array, $fieldvalue['value'], $extra); |
|
196 | 196 | } |
197 | - if(isset($fieldvalue[4]) && $fieldvalue[4] != ''){ |
|
198 | - if(is_array($fieldvalue[4])){ |
|
197 | + if (isset($fieldvalue[4]) && $fieldvalue[4] != '') { |
|
198 | + if (is_array($fieldvalue[4])) { |
|
199 | 199 | |
200 | - if(isset($fieldvalue[1]['name'])){ |
|
201 | - $fieldvalue_pass=$fieldvalue[1]['name']; |
|
202 | - }else{ |
|
203 | - $fieldvalue_pass=$fieldvalue[1]; |
|
200 | + if (isset($fieldvalue[1]['name'])) { |
|
201 | + $fieldvalue_pass = $fieldvalue[1]['name']; |
|
202 | + } else { |
|
203 | + $fieldvalue_pass = $fieldvalue[1]; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | $this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]['rules']); |
207 | - }else{ |
|
207 | + } else { |
|
208 | 208 | |
209 | - if(isset($fieldvalue[1]['name'])){ |
|
210 | - $fieldvalue_pass=$fieldvalue[1]['name']; |
|
211 | - }else{ |
|
212 | - $fieldvalue_pass=$fieldvalue[1]; |
|
209 | + if (isset($fieldvalue[1]['name'])) { |
|
210 | + $fieldvalue_pass = $fieldvalue[1]['name']; |
|
211 | + } else { |
|
212 | + $fieldvalue_pass = $fieldvalue[1]; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | $this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]); |
216 | 216 | } |
217 | 217 | } |
218 | - $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1]).'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
219 | - $form_contents.= '<span class="popup_error error no-padding" id="'.(gettext(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1])).'_error"> |
|
218 | + $form_contents .= '<div class="tooltips error_div pull-left no-padding" id="'.(is_array($fieldvalue[1]) ? $fieldvalue[1]['name'] : $fieldvalue[1]).'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
219 | + $form_contents .= '<span class="popup_error error no-padding" id="'.(gettext(is_array($fieldvalue[1]) ? $fieldvalue[1]['name'] : $fieldvalue[1])).'_error"> |
|
220 | 220 | </span></div>'; |
221 | 221 | } else { |
222 | 222 | if (isset($this->CI->input->post)) { |
223 | - $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
223 | + $fieldvalue['value'] = ( ! $this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
224 | 224 | } else { |
225 | 225 | if (is_array($fieldvalue[1])) { |
226 | 226 | $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]['name']] : @$fieldvalue[1]; |
@@ -229,53 +229,53 @@ discard block |
||
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | - $str = $fieldvalue[7] . "," . $fieldvalue[8]; |
|
232 | + $str = $fieldvalue[7].",".$fieldvalue[8]; |
|
233 | 233 | $drp_array = call_user_func_array(array($this->CI->common, $fieldvalue[10]), array($fieldvalue[9])); |
234 | - $form_contents.=form_dropdown($fieldvalue[1], $drp_array, $fieldvalue['value'],$extra); |
|
235 | - if(isset($fieldvalue[4]) && $fieldvalue[4] != ''){ |
|
234 | + $form_contents .= form_dropdown($fieldvalue[1], $drp_array, $fieldvalue['value'], $extra); |
|
235 | + if (isset($fieldvalue[4]) && $fieldvalue[4] != '') { |
|
236 | 236 | $this->CI->form_validation->set_rules($fieldvalue[1], $fieldvalue[0], $fieldvalue[4]); |
237 | 237 | } |
238 | - $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1]).'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
239 | - $form_contents.= '<span class="popup_error error no-padding" id="'.(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1]).'_error"> |
|
238 | + $form_contents .= '<div class="tooltips error_div pull-left no-padding" id="'.(is_array($fieldvalue[1]) ? $fieldvalue[1]['name'] : $fieldvalue[1]).'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
239 | + $form_contents .= '<span class="popup_error error no-padding" id="'.(is_array($fieldvalue[1]) ? $fieldvalue[1]['name'] : $fieldvalue[1]).'_error"> |
|
240 | 240 | </span></div>'; |
241 | 241 | } |
242 | 242 | } else if (isset($fieldvalue[13]) && $fieldvalue[13] != '') { |
243 | 243 | |
244 | 244 | /* For multi select code */ |
245 | - $str = $fieldvalue[7] . "," . $fieldvalue[8]; |
|
245 | + $str = $fieldvalue[7].",".$fieldvalue[8]; |
|
246 | 246 | |
247 | 247 | if (isset($this->CI->input->post)) |
248 | - $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
248 | + $fieldvalue['value'] = ( ! $this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
249 | 249 | else |
250 | 250 | $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
251 | 251 | |
252 | 252 | $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
253 | 253 | if ($fieldset_key === 'System Configuration Information') { |
254 | - $form_contents.=form_dropdown_multiselect($fieldvalue[1], $drp_array, ''); |
|
254 | + $form_contents .= form_dropdown_multiselect($fieldvalue[1], $drp_array, ''); |
|
255 | 255 | } else { |
256 | - $form_contents.=form_dropdown_multiselect($fieldvalue[1] . "[]", $drp_array, $fieldvalue['value']); |
|
256 | + $form_contents .= form_dropdown_multiselect($fieldvalue[1]."[]", $drp_array, $fieldvalue['value']); |
|
257 | 257 | } |
258 | - if(isset($fieldvalue[4]) && $fieldvalue[4] != ''){ |
|
258 | + if (isset($fieldvalue[4]) && $fieldvalue[4] != '') { |
|
259 | 259 | $this->CI->form_validation->set_rules($fieldvalue[1], $fieldvalue[0], $fieldvalue[4]); |
260 | 260 | } |
261 | - $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[1].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
262 | - $form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[1].'_error"></span></div>'; |
|
261 | + $form_contents .= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[1].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
262 | + $form_contents .= '<span class="popup_error error no-padding" id="'.$fieldvalue[1].'_error"></span></div>'; |
|
263 | 263 | /* End--------------------- For multi select code */ |
264 | 264 | } else if ($fieldvalue[1] == 'INPUT') { |
265 | 265 | |
266 | 266 | |
267 | 267 | if (isset($this->CI->input->post)) |
268 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
269 | - else{ |
|
270 | - $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : ''):(isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] :''); |
|
268 | + $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
269 | + else { |
|
270 | + $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : ''); |
|
271 | 271 | } |
272 | - $form_contents.= form_input($fieldvalue[2], 'readonly'); |
|
273 | - if(isset($fieldvalue[6]) && !empty($fieldvalue[6])){ |
|
274 | - $form_contents.=$fieldvalue[6]; |
|
272 | + $form_contents .= form_input($fieldvalue[2], 'readonly'); |
|
273 | + if (isset($fieldvalue[6]) && ! empty($fieldvalue[6])) { |
|
274 | + $form_contents .= $fieldvalue[6]; |
|
275 | 275 | } |
276 | 276 | $this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
277 | - $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
278 | - $form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
277 | + $form_contents .= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
278 | + $form_contents .= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
279 | 279 | </span></div>'; |
280 | 280 | } |
281 | 281 | /* |
@@ -283,98 +283,98 @@ discard block |
||
283 | 283 | */ |
284 | 284 | else if ($fieldvalue[1] == 'IMAGE') { |
285 | 285 | if (isset($this->CI->input->post)) |
286 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
286 | + $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
287 | 287 | |
288 | 288 | else |
289 | 289 | $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
290 | 290 | $fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
291 | - $form_contents.= form_image($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
|
292 | - $form_contents.=@$fieldvalue[6]; |
|
291 | + $form_contents .= form_image($fieldvalue[2], 'readonly', $fieldvalue[2]['style']); |
|
292 | + $form_contents .= @$fieldvalue[6]; |
|
293 | 293 | $this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
294 | - $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
295 | - $form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
294 | + $form_contents .= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
295 | + $form_contents .= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
296 | 296 | </span></div>'; |
297 | 297 | } |
298 | 298 | else if ($fieldvalue[1] == 'DEL_BUTTON') { |
299 | 299 | if (isset($this->CI->input->post)) |
300 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
300 | + $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
301 | 301 | |
302 | 302 | else |
303 | 303 | $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
304 | 304 | $fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
305 | - $form_contents.= form_img_delete($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
|
306 | - $form_contents.=@$fieldvalue[6]; |
|
305 | + $form_contents .= form_img_delete($fieldvalue[2], 'readonly', $fieldvalue[2]['style']); |
|
306 | + $form_contents .= @$fieldvalue[6]; |
|
307 | 307 | $this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
308 | - $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
309 | - $form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
308 | + $form_contents .= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
309 | + $form_contents .= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
310 | 310 | </span></div>'; |
311 | 311 | } |
312 | 312 | /**********************************************************************************/ |
313 | 313 | else if ($fieldvalue[1] == 'PASSWORD') { |
314 | 314 | if (isset($this->CI->input->post)) |
315 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
315 | + $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
316 | 316 | else |
317 | - $fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
318 | - $form_contents.= form_password($fieldvalue[2]); |
|
317 | + $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
318 | + $form_contents .= form_password($fieldvalue[2]); |
|
319 | 319 | $this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
320 | - $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
321 | - $form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
320 | + $form_contents .= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
321 | + $form_contents .= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
|
322 | 322 | </span></div>'; |
323 | 323 | } else if ($fieldvalue[2] == 'CHECKBOX') { |
324 | 324 | $OptionArray = array(); |
325 | 325 | |
326 | - if(isset($fieldvalue[7]) && $fieldvalue[7] != '') |
|
326 | + if (isset($fieldvalue[7]) && $fieldvalue[7] != '') |
|
327 | 327 | $OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6])); |
328 | - if (isset($this->CI->input->post)){ |
|
329 | - $fieldvalue[3]['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[3]['value'] : $this->CI->input->post($fieldvalue[1]); |
|
328 | + if (isset($this->CI->input->post)) { |
|
329 | + $fieldvalue[3]['value'] = ( ! $this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[3]['value'] : $this->CI->input->post($fieldvalue[1]); |
|
330 | 330 | } |
331 | 331 | else |
332 | 332 | { |
333 | - $fieldvalue[3]['value'] = ($values) ? (isset($values[$fieldvalue[1]]) && $values[$fieldvalue[1]] ? 1: 0) : @$fieldvalue[3]['value']; |
|
333 | + $fieldvalue[3]['value'] = ($values) ? (isset($values[$fieldvalue[1]]) && $values[$fieldvalue[1]] ? 1 : 0) : @$fieldvalue[3]['value']; |
|
334 | 334 | } |
335 | 335 | if ($fieldvalue[3]['value'] == "1") { |
336 | 336 | $checked = true; |
337 | 337 | } else { |
338 | 338 | $checked = false; |
339 | 339 | }; |
340 | - if(isset($fieldvalue[3]['table_name']) && $fieldvalue[3]['table_name'] != ""){ |
|
340 | + if (isset($fieldvalue[3]['table_name']) && $fieldvalue[3]['table_name'] != "") { |
|
341 | 341 | |
342 | - $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked , $OptionArray); |
|
343 | - }else{ |
|
344 | - $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked ,$OptionArray); |
|
342 | + $form_contents .= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'], $checked, $OptionArray); |
|
343 | + } else { |
|
344 | + $form_contents .= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'], $checked, $OptionArray); |
|
345 | 345 | } |
346 | 346 | } else if ($fieldvalue[1] == 'TEXTAREA') { |
347 | 347 | |
348 | 348 | if (isset($this->CI->input->post)) |
349 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
349 | + $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
350 | 350 | else |
351 | 351 | $fieldvalue[2]['value'] = ($values) ? $values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
352 | - $form_contents.= form_textarea($fieldvalue[2]); |
|
352 | + $form_contents .= form_textarea($fieldvalue[2]); |
|
353 | 353 | } |
354 | 354 | else if ($fieldvalue[2] == 'RADIO') { |
355 | 355 | |
356 | - $form_contents.= form_radio($fieldvalue[1], $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
|
356 | + $form_contents .= form_radio($fieldvalue[1], $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
|
357 | 357 | } |
358 | - $form_contents.= '</li>'; |
|
358 | + $form_contents .= '</li>'; |
|
359 | 359 | } |
360 | 360 | |
361 | - $form_contents.= '</ul>'; |
|
362 | - $form_contents.= '</div>'; |
|
363 | - $form_contents.= '</div>'; |
|
361 | + $form_contents .= '</ul>'; |
|
362 | + $form_contents .= '</div>'; |
|
363 | + $form_contents .= '</div>'; |
|
364 | 364 | $i++; |
365 | 365 | } |
366 | 366 | |
367 | - $form_contents.= '<center><div class="col-md-12 margin-t-20 margin-b-20">'; |
|
367 | + $form_contents .= '<center><div class="col-md-12 margin-t-20 margin-b-20">'; |
|
368 | 368 | |
369 | - $form_contents.= form_button($save); |
|
369 | + $form_contents .= form_button($save); |
|
370 | 370 | |
371 | 371 | if (isset($cancel)) { |
372 | - $form_contents.= form_button($cancel); |
|
372 | + $form_contents .= form_button($cancel); |
|
373 | 373 | } |
374 | - $form_contents.= '</center></div>'; |
|
375 | - $form_contents.= form_fieldset_close(); |
|
376 | - $form_contents.= form_close(); |
|
377 | - $form_contents.= '</div>'; |
|
374 | + $form_contents .= '</center></div>'; |
|
375 | + $form_contents .= form_fieldset_close(); |
|
376 | + $form_contents .= form_close(); |
|
377 | + $form_contents .= '</div>'; |
|
378 | 378 | |
379 | 379 | |
380 | 380 | return $form_contents; |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | |
383 | 383 | function build_serach_form($fields_array) { |
384 | 384 | $form_contents = ''; |
385 | - $form_contents.= '<div>'; |
|
386 | - $form_contents.= form_open($fields_array['forms'][0], $fields_array['forms'][1]); |
|
385 | + $form_contents .= '<div>'; |
|
386 | + $form_contents .= form_open($fields_array['forms'][0], $fields_array['forms'][1]); |
|
387 | 387 | unset($fields_array['forms']); |
388 | 388 | $button_array = array(); |
389 | 389 | /******* |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | $cancel = $fields_array['button_reset']; |
397 | 397 | unset($fields_array['button_reset']); |
398 | 398 | } |
399 | - $button_search_delete=''; |
|
399 | + $button_search_delete = ''; |
|
400 | 400 | if (isset($fields_array['button_search_delete'])) { |
401 | 401 | $button_search_delete = $fields_array['button_search_delete']; |
402 | 402 | unset($fields_array['button_search_delete']); |
403 | 403 | } |
404 | - if(isset($fields_array['display_in'])){ |
|
405 | - $display_in=$fields_array['display_in']; |
|
404 | + if (isset($fields_array['display_in'])) { |
|
405 | + $display_in = $fields_array['display_in']; |
|
406 | 406 | unset($fields_array['display_in']); |
407 | 407 | } |
408 | 408 | } |
@@ -410,31 +410,31 @@ discard block |
||
410 | 410 | $i = 1; |
411 | 411 | foreach ($fields_array as $fieldset_key => $form_fileds) { |
412 | 412 | |
413 | - $form_contents.= '<ul class="padding-15">'; |
|
414 | - $form_contents.= form_fieldset(gettext($fieldset_key),array('style' => 'font-weight:bold;'),"search"); |
|
413 | + $form_contents .= '<ul class="padding-15">'; |
|
414 | + $form_contents .= form_fieldset(gettext($fieldset_key), array('style' => 'font-weight:bold;'), "search"); |
|
415 | 415 | |
416 | 416 | foreach ($form_fileds as $fieldkey => $fieldvalue) { |
417 | 417 | if ($i == 0) { |
418 | - $form_contents.= '<li class="col-md-12">'; |
|
418 | + $form_contents .= '<li class="col-md-12">'; |
|
419 | 419 | } |
420 | - $form_contents.= '<div class="col-md-3 no-padding">'; |
|
420 | + $form_contents .= '<div class="col-md-3 no-padding">'; |
|
421 | 421 | if ($fieldvalue[1] == 'HIDDEN') { |
422 | - $form_contents.= form_hidden($fieldvalue[2], $fieldvalue[3]); |
|
422 | + $form_contents .= form_hidden($fieldvalue[2], $fieldvalue[3]); |
|
423 | 423 | } else { |
424 | - $form_contents.= form_label(gettext($fieldvalue[0]), "", array("class" => "search_label col-md-12 no-padding")); |
|
424 | + $form_contents .= form_label(gettext($fieldvalue[0]), "", array("class" => "search_label col-md-12 no-padding")); |
|
425 | 425 | } |
426 | 426 | if ($fieldvalue[1] == 'INPUT') { |
427 | - $form_contents.= form_input($fieldvalue[2]); |
|
427 | + $form_contents .= form_input($fieldvalue[2]); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | |
431 | 431 | if ($fieldvalue[2] == 'SELECT' || $fieldvalue[5] == '1') { |
432 | 432 | |
433 | 433 | if ($fieldvalue[7] != '' && $fieldvalue[8] != '') { |
434 | - $str = $fieldvalue[7] . "," . $fieldvalue[8]; |
|
434 | + $str = $fieldvalue[7].",".$fieldvalue[8]; |
|
435 | 435 | |
436 | 436 | $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
437 | - $form_contents.=form_dropdown_all(gettext($fieldvalue[1]), $drp_array, ''); |
|
437 | + $form_contents .= form_dropdown_all(gettext($fieldvalue[1]), $drp_array, ''); |
|
438 | 438 | } else { |
439 | 439 | |
440 | 440 | if ($fieldvalue[1] == 'INPUT') { |
@@ -442,54 +442,54 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | $drp_array = call_user_func_array(array($this->CI->common, $fieldvalue[10]), array($fieldvalue[9])); |
445 | - $form_contents.=form_dropdown_all_search(gettext($fieldvalue[1]), $drp_array, ''); |
|
445 | + $form_contents .= form_dropdown_all_search(gettext($fieldvalue[1]), $drp_array, ''); |
|
446 | 446 | } |
447 | 447 | } else if ($fieldvalue[1] == 'PASSWORD') { |
448 | - $form_contents.= form_password($fieldvalue[2]); |
|
448 | + $form_contents .= form_password($fieldvalue[2]); |
|
449 | 449 | } else if ($fieldvalue[2] == 'CHECKBOX') { |
450 | - $form_contents.= form_checkbox(gettext($fieldvalue[1]), $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
|
450 | + $form_contents .= form_checkbox(gettext($fieldvalue[1]), $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
|
451 | 451 | } |
452 | - $form_contents.= '</div>'; |
|
452 | + $form_contents .= '</div>'; |
|
453 | 453 | if ($i % 5 == 0) { |
454 | - $form_contents.= '</li>'; |
|
454 | + $form_contents .= '</li>'; |
|
455 | 455 | $i = 0; |
456 | 456 | } |
457 | 457 | $i++; |
458 | 458 | } |
459 | 459 | } |
460 | - $form_contents.= '<div class="col-md-12 margin-t-20 margin-b-20">'; |
|
461 | - $form_contents.= form_button($cancel); |
|
462 | - $form_contents.= form_button($save); |
|
463 | - if(!empty($display_in)){ |
|
464 | - $form_contents.="<div class='col-md-5 pull-right'>"; |
|
465 | - $form_contents.="<div class='col-md-3'></div>"; |
|
466 | - $extra_parameters['class']=$display_in['label_class']; |
|
467 | - $extra_parameters['style']=$display_in['label_style']; |
|
468 | - $form_contents.=form_label($display_in['content'], "",$extra_parameters); |
|
469 | - $drp_array = call_user_func_array(array($this->CI->common,$display_in['function']),array()); |
|
470 | - $extra_parameters['class']=$display_in['dropdown_class']; |
|
471 | - $extra_parameters['style']=$display_in['dropdown_style']; |
|
472 | - $form_contents.=form_dropdown_all_search($display_in, $drp_array, '',$extra_parameters); |
|
473 | - $form_contents.="</div>"; |
|
460 | + $form_contents .= '<div class="col-md-12 margin-t-20 margin-b-20">'; |
|
461 | + $form_contents .= form_button($cancel); |
|
462 | + $form_contents .= form_button($save); |
|
463 | + if ( ! empty($display_in)) { |
|
464 | + $form_contents .= "<div class='col-md-5 pull-right'>"; |
|
465 | + $form_contents .= "<div class='col-md-3'></div>"; |
|
466 | + $extra_parameters['class'] = $display_in['label_class']; |
|
467 | + $extra_parameters['style'] = $display_in['label_style']; |
|
468 | + $form_contents .= form_label($display_in['content'], "", $extra_parameters); |
|
469 | + $drp_array = call_user_func_array(array($this->CI->common, $display_in['function']), array()); |
|
470 | + $extra_parameters['class'] = $display_in['dropdown_class']; |
|
471 | + $extra_parameters['style'] = $display_in['dropdown_style']; |
|
472 | + $form_contents .= form_dropdown_all_search($display_in, $drp_array, '', $extra_parameters); |
|
473 | + $form_contents .= "</div>"; |
|
474 | 474 | } |
475 | - if(isset($button_search_delete) && $button_search_delete != ''){ |
|
476 | - $form_contents.= form_button($button_search_delete); |
|
475 | + if (isset($button_search_delete) && $button_search_delete != '') { |
|
476 | + $form_contents .= form_button($button_search_delete); |
|
477 | 477 | } |
478 | - $form_contents.='<div class="col-md-12 no-padding margin-t-15" style=""> |
|
478 | + $form_contents .= '<div class="col-md-12 no-padding margin-t-15" style=""> |
|
479 | 479 | <div class="pull-right btn-close" id="global_clearsearch_filter">Close</div> |
480 | 480 | </div>'; |
481 | - $form_contents.= '</ul>'; |
|
482 | - $form_contents.= '</div>'; |
|
483 | - $form_contents.= form_fieldset_close(); |
|
484 | - $form_contents.= form_close(); |
|
485 | - $form_contents.= '</div>'; |
|
481 | + $form_contents .= '</ul>'; |
|
482 | + $form_contents .= '</div>'; |
|
483 | + $form_contents .= form_fieldset_close(); |
|
484 | + $form_contents .= form_close(); |
|
485 | + $form_contents .= '</div>'; |
|
486 | 486 | |
487 | 487 | return $form_contents; |
488 | 488 | } |
489 | 489 | function build_batchupdate_form($fields_array) { |
490 | 490 | $form_contents = ''; |
491 | - $form_contents.= '<div >'; |
|
492 | - $form_contents.= form_open($fields_array['forms'][0], $fields_array['forms'][1]); |
|
491 | + $form_contents .= '<div >'; |
|
492 | + $form_contents .= form_open($fields_array['forms'][0], $fields_array['forms'][1]); |
|
493 | 493 | unset($fields_array['forms']); |
494 | 494 | $button_array = array(); |
495 | 495 | if (isset($fields_array['button_search']) || isset($fields_array['button_reset'])) { |
@@ -503,69 +503,69 @@ discard block |
||
503 | 503 | $i = 1; |
504 | 504 | foreach ($fields_array as $fieldset_key => $form_fileds) { |
505 | 505 | |
506 | - $form_contents.= '<ul>'; |
|
507 | - $form_contents.= form_fieldset(gettext($fieldset_key), array('style' => 'margin-left:-22px;font-weight:bold;')); |
|
506 | + $form_contents .= '<ul>'; |
|
507 | + $form_contents .= form_fieldset(gettext($fieldset_key), array('style' => 'margin-left:-22px;font-weight:bold;')); |
|
508 | 508 | foreach ($form_fileds as $fieldkey => $fieldvalue) { |
509 | 509 | if ($i == 0) { |
510 | - $form_contents.= '<li>'; |
|
510 | + $form_contents .= '<li>'; |
|
511 | 511 | } |
512 | - $form_contents.= '<div class="col-md-4 no-padding">'; |
|
512 | + $form_contents .= '<div class="col-md-4 no-padding">'; |
|
513 | 513 | if ($fieldvalue[1] == 'HIDDEN') { |
514 | - $form_contents.= form_hidden($fieldvalue[2], $fieldvalue[3]); |
|
514 | + $form_contents .= form_hidden($fieldvalue[2], $fieldvalue[3]); |
|
515 | 515 | } else { |
516 | - $form_contents.= form_label(gettext($fieldvalue[0]), "", array("class" => "search_label col-md-12 no-padding")); |
|
516 | + $form_contents .= form_label(gettext($fieldvalue[0]), "", array("class" => "search_label col-md-12 no-padding")); |
|
517 | 517 | } |
518 | 518 | if ($fieldvalue[2] == 'SELECT' || $fieldvalue[5] == '1') { |
519 | 519 | if ($fieldvalue[7] != '' && $fieldvalue[8] != '') { |
520 | - $str = $fieldvalue[7] . "," . $fieldvalue[8]; |
|
521 | - if(is_array($fieldvalue[13])){ |
|
520 | + $str = $fieldvalue[7].",".$fieldvalue[8]; |
|
521 | + if (is_array($fieldvalue[13])) { |
|
522 | 522 | $drp_array = call_user_func_array(array($this->CI->common, $fieldvalue[14]), array($fieldvalue[13])); |
523 | - $form_contents.=form_dropdown($fieldvalue[13], $drp_array, ''); |
|
523 | + $form_contents .= form_dropdown($fieldvalue[13], $drp_array, ''); |
|
524 | 524 | } |
525 | 525 | /** |
526 | 526 | ASTPP 3.0 |
527 | 527 | Reseller Batch Update |
528 | 528 | **/ |
529 | - if($fieldvalue[10] == 'set_status'){ |
|
530 | - $drp_array =array('0'=>'Active','1'=>'Inactive'); |
|
529 | + if ($fieldvalue[10] == 'set_status') { |
|
530 | + $drp_array = array('0'=>'Active', '1'=>'Inactive'); |
|
531 | 531 | } |
532 | 532 | /************************************************************/ |
533 | - else{ |
|
534 | - $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12]));} |
|
535 | - $form_contents.=form_dropdown_all($fieldvalue[1], $drp_array, ''); |
|
533 | + else { |
|
534 | + $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); } |
|
535 | + $form_contents .= form_dropdown_all($fieldvalue[1], $drp_array, ''); |
|
536 | 536 | } else { |
537 | 537 | if ($fieldvalue[1] == 'INPUT') { |
538 | 538 | $drp_name = $fieldvalue[6]; |
539 | 539 | } |
540 | 540 | $drp_array = call_user_func_array(array($this->CI->common, $fieldvalue[10]), array($fieldvalue[9])); |
541 | - $form_contents.=form_dropdown($drp_name, $drp_array, ''); |
|
541 | + $form_contents .= form_dropdown($drp_name, $drp_array, ''); |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | if ($fieldvalue[1] == 'INPUT') { |
545 | - $form_contents.= form_input($fieldvalue[2]); |
|
545 | + $form_contents .= form_input($fieldvalue[2]); |
|
546 | 546 | } else if ($fieldvalue[2] == 'CHECKBOX') { |
547 | - $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
|
547 | + $form_contents .= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
|
548 | 548 | } |
549 | - $form_contents.= '</div>'; |
|
549 | + $form_contents .= '</div>'; |
|
550 | 550 | if ($i % 5 == 0) { |
551 | - $form_contents.= '</li>'; |
|
551 | + $form_contents .= '</li>'; |
|
552 | 552 | $i = 0; |
553 | 553 | } |
554 | 554 | $i++; |
555 | 555 | } |
556 | 556 | } |
557 | 557 | |
558 | - $form_contents.= '</ul>'; |
|
559 | - $form_contents.= '<div class="col-md-12 margin-t-20 margin-b-20">'; |
|
558 | + $form_contents .= '</ul>'; |
|
559 | + $form_contents .= '<div class="col-md-12 margin-t-20 margin-b-20">'; |
|
560 | 560 | |
561 | - $form_contents.= form_button($cancel); |
|
562 | - $form_contents.= form_button($save); |
|
563 | - $form_contents.='<div class="col-md-12 no-padding margin-t-15" style="margin-bottom:10px; !important"> |
|
561 | + $form_contents .= form_button($cancel); |
|
562 | + $form_contents .= form_button($save); |
|
563 | + $form_contents .= '<div class="col-md-12 no-padding margin-t-15" style="margin-bottom:10px; !important"> |
|
564 | 564 | <div class="pull-right btn-close" id="global_clearbatchupdate_filter">Close</div></div>'; |
565 | - $form_contents.= form_fieldset_close(); |
|
566 | - $form_contents.= form_close(); |
|
567 | - $form_contents.= '</div>'; |
|
568 | - $form_contents.= '</div>'; |
|
565 | + $form_contents .= form_fieldset_close(); |
|
566 | + $form_contents .= form_close(); |
|
567 | + $form_contents .= '</div>'; |
|
568 | + $form_contents .= '</div>'; |
|
569 | 569 | |
570 | 570 | return $form_contents; |
571 | 571 | } |
@@ -597,21 +597,21 @@ discard block |
||
597 | 597 | ASTPP 3.0 |
598 | 598 | For Edit on Account number or name |
599 | 599 | */ |
600 | - $row_id = isset($row['id']) ? $row["id"]: ''; |
|
600 | + $row_id = isset($row['id']) ? $row["id"] : ''; |
|
601 | 601 | /*****************************/ |
602 | 602 | foreach ($grid_fields as $field_key => $field_arr) { |
603 | 603 | /** |
604 | 604 | ASTPP 3.0 |
605 | 605 | For Edit on Account number or name |
606 | 606 | **/ |
607 | - $Actionkey = array_search(gettext('Action'), $this->CI->common->array_column($grid_fields,0)); |
|
607 | + $Actionkey = array_search(gettext('Action'), $this->CI->common->array_column($grid_fields, 0)); |
|
608 | 608 | /*********************************/ |
609 | 609 | if ($field_arr[2] != "") { |
610 | 610 | if ($field_arr[3] != "") { |
611 | - if($field_arr[2]=="status"){ |
|
611 | + if ($field_arr[2] == "status") { |
|
612 | 612 | $row['id'] = $row_id; |
613 | 613 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
614 | - }else{ |
|
614 | + } else { |
|
615 | 615 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]])); |
616 | 616 | } |
617 | 617 | |
@@ -620,53 +620,53 @@ discard block |
||
620 | 620 | For Edit on Account number or name |
621 | 621 | **/ |
622 | 622 | $row[$field_arr[2]] = $jsn_tmp[$field_key]; |
623 | - } if(array_search("EDITABLE", $field_arr)){ |
|
623 | + } if (array_search("EDITABLE", $field_arr)) { |
|
624 | 624 | $ActionArr = $grid_fields[$Actionkey]; |
625 | - if($ActionArr[5]->EDIT->url =="accounts/customer_edit/" || $ActionArr[5]->EDIT->url =="accounts/provider_edit/"){ |
|
626 | - $ActionArr[5]->EDIT->url=$row['type']==0 ? "accounts/customer_edit/" : "accounts/provider_edit/"; |
|
625 | + if ($ActionArr[5]->EDIT->url == "accounts/customer_edit/" || $ActionArr[5]->EDIT->url == "accounts/provider_edit/") { |
|
626 | + $ActionArr[5]->EDIT->url = $row['type'] == 0 ? "accounts/customer_edit/" : "accounts/provider_edit/"; |
|
627 | 627 | } |
628 | - if($ActionArr[5]->EDIT->url =="accounts/admin_edit/" || $ActionArr[5]->EDIT->url =="accounts/subadmin_edit/"){ |
|
629 | - $ActionArr[5]->EDIT->url=$row['type']==4 ? "accounts/subadmin_edit/" : "accounts/admin_edit/"; |
|
628 | + if ($ActionArr[5]->EDIT->url == "accounts/admin_edit/" || $ActionArr[5]->EDIT->url == "accounts/subadmin_edit/") { |
|
629 | + $ActionArr[5]->EDIT->url = $row['type'] == 4 ? "accounts/subadmin_edit/" : "accounts/admin_edit/"; |
|
630 | 630 | } |
631 | 631 | $acctype = ""; |
632 | - if(isset($row["type"]) && ($row["type"] == '0' || $row["type"] == '1' || $row["type"] == '3')){ |
|
633 | - $acctype = (isset($row["posttoexternal"]) && $row["posttoexternal"] != '')? "<span class='label label-default pull-right'>".$this->CI->common->get_account_type("","",$row["posttoexternal"])."</span>":""; |
|
632 | + if (isset($row["type"]) && ($row["type"] == '0' || $row["type"] == '1' || $row["type"] == '3')) { |
|
633 | + $acctype = (isset($row["posttoexternal"]) && $row["posttoexternal"] != '') ? "<span class='label label-default pull-right'>".$this->CI->common->get_account_type("", "", $row["posttoexternal"])."</span>" : ""; |
|
634 | 634 | } |
635 | 635 | |
636 | - $fieldstr = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
|
637 | - if($acctype != ''){ |
|
636 | + $fieldstr = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT, $row[$field_arr[2]], $row["id"]); |
|
637 | + if ($acctype != '') { |
|
638 | 638 | $jsn_tmp[$field_key] = $fieldstr."<br/>".$acctype; |
639 | - }else{ |
|
639 | + } else { |
|
640 | 640 | $jsn_tmp[$field_key] = $fieldstr; |
641 | 641 | } |
642 | 642 | |
643 | 643 | |
644 | 644 | /*********************************/ |
645 | - }else { |
|
645 | + } else { |
|
646 | 646 | $jsn_tmp[$field_key] = $row[$field_arr[2]]; |
647 | 647 | } |
648 | 648 | } else { |
649 | 649 | if ($field_arr[0] == gettext("Action")) { |
650 | - if(isset($field_arr[5]) && isset($field_arr[5]->EDIT) && isset($field_arr[5]->DELETE)){ |
|
650 | + if (isset($field_arr[5]) && isset($field_arr[5]->EDIT) && isset($field_arr[5]->DELETE)) { |
|
651 | 651 | |
652 | - if($field_arr[5]->EDIT->url == 'accounts/customer_edit/' || $field_arr[5]->EDIT->url == 'accounts/provider_edit/' || $field_arr[5]->DELETE->url == 'accounts/provider_delete/' ||$field_arr[5]->DELETE->url == 'accounts/customer_delete/'){ |
|
653 | - if( $row['type'] == '0'|| strtolower($row['type']) == 'customer'){ |
|
654 | - $field_arr[5]->EDIT->url ='accounts/customer_edit/'; |
|
655 | - $field_arr[5]->DELETE->url ='accounts/customer_delete/'; |
|
652 | + if ($field_arr[5]->EDIT->url == 'accounts/customer_edit/' || $field_arr[5]->EDIT->url == 'accounts/provider_edit/' || $field_arr[5]->DELETE->url == 'accounts/provider_delete/' || $field_arr[5]->DELETE->url == 'accounts/customer_delete/') { |
|
653 | + if ($row['type'] == '0' || strtolower($row['type']) == 'customer') { |
|
654 | + $field_arr[5]->EDIT->url = 'accounts/customer_edit/'; |
|
655 | + $field_arr[5]->DELETE->url = 'accounts/customer_delete/'; |
|
656 | 656 | } |
657 | - if($row['type'] == 3 || strtolower($row['type']) == 'provider'){ |
|
658 | - $field_arr[5]->EDIT->url ='accounts/provider_edit/'; |
|
659 | - $field_arr[5]->DELETE->url ='accounts/provider_delete/'; |
|
657 | + if ($row['type'] == 3 || strtolower($row['type']) == 'provider') { |
|
658 | + $field_arr[5]->EDIT->url = 'accounts/provider_edit/'; |
|
659 | + $field_arr[5]->DELETE->url = 'accounts/provider_delete/'; |
|
660 | 660 | } |
661 | 661 | } |
662 | - if($field_arr[5]->EDIT->url == 'accounts/admin_edit/' || $field_arr[5]->EDIT->url == 'accounts/subadmin_edit/' || $field_arr[5]->DELETE->url == 'accounts/admin_delete/' ||$field_arr[5]->DELETE->url == 'accounts/subadmin_delete/'){ |
|
663 | - if($row['type'] == 2 || strtolower($row['type']) == 'administrator'){ |
|
664 | - $field_arr[5]->EDIT->url ='accounts/admin_edit/'; |
|
665 | - $field_arr[5]->DELETE->url ='accounts/admin_delete/'; |
|
662 | + if ($field_arr[5]->EDIT->url == 'accounts/admin_edit/' || $field_arr[5]->EDIT->url == 'accounts/subadmin_edit/' || $field_arr[5]->DELETE->url == 'accounts/admin_delete/' || $field_arr[5]->DELETE->url == 'accounts/subadmin_delete/') { |
|
663 | + if ($row['type'] == 2 || strtolower($row['type']) == 'administrator') { |
|
664 | + $field_arr[5]->EDIT->url = 'accounts/admin_edit/'; |
|
665 | + $field_arr[5]->DELETE->url = 'accounts/admin_delete/'; |
|
666 | 666 | } |
667 | - if($row['type'] == 4 || strtolower($row['type']) == 'sub admin'){ |
|
668 | - $field_arr[5]->EDIT->url ='accounts/subadmin_edit/'; |
|
669 | - $field_arr[5]->DELETE->url ='accounts/subadmin_delete/'; |
|
667 | + if ($row['type'] == 4 || strtolower($row['type']) == 'sub admin') { |
|
668 | + $field_arr[5]->EDIT->url = 'accounts/subadmin_edit/'; |
|
669 | + $field_arr[5]->DELETE->url = 'accounts/subadmin_delete/'; |
|
670 | 670 | } |
671 | 671 | } |
672 | 672 | } |
@@ -677,16 +677,16 @@ discard block |
||
677 | 677 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row_id); |
678 | 678 | /****************************************************************************/ |
679 | 679 | } |
680 | - elseif($field_arr[0] == gettext("Profile Action")) |
|
680 | + elseif ($field_arr[0] == gettext("Profile Action")) |
|
681 | 681 | { |
682 | - if(isset($field_arr[5]) && isset($field_arr[5]->START) && isset($field_arr[5]->STOP) && isset($field_arr[5]->RELOAD) && isset($field_arr[5]->RESCAN)){ |
|
682 | + if (isset($field_arr[5]) && isset($field_arr[5]->START) && isset($field_arr[5]->STOP) && isset($field_arr[5]->RELOAD) && isset($field_arr[5]->RESCAN)) { |
|
683 | 683 | } |
684 | 684 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
685 | 685 | |
686 | 686 | } |
687 | 687 | else { |
688 | - $className = (isset($field_arr['9']) && $field_arr['9'] != '')?$field_arr['9']:"chkRefNos"; |
|
689 | - $jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace '.$className.'" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>'; } |
|
688 | + $className = (isset($field_arr['9']) && $field_arr['9'] != '') ? $field_arr['9'] : "chkRefNos"; |
|
689 | + $jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id='.$row['id'].' class="ace '.$className.'" onclick="clickchkbox('.$row['id'].')" value='.$row['id'].'><lable class="lbl"></lable>'; } |
|
690 | 690 | } |
691 | 691 | } |
692 | 692 | $json_data[] = array('cell' => $jsn_tmp); |
@@ -700,20 +700,20 @@ discard block |
||
700 | 700 | $json_data = array(); |
701 | 701 | foreach ($query as $row) { |
702 | 702 | foreach ($grid_fields as $field_key => $field_arr) { |
703 | - $row_id = isset($row['id']) ? $row["id"]: ''; |
|
703 | + $row_id = isset($row['id']) ? $row["id"] : ''; |
|
704 | 704 | /** |
705 | 705 | ASTPP 3.0 |
706 | 706 | For Edit on Account number or name |
707 | 707 | **/ |
708 | - $Actionkey = array_search('Action',$this->CI->common->array_column($grid_fields,0)); |
|
708 | + $Actionkey = array_search('Action', $this->CI->common->array_column($grid_fields, 0)); |
|
709 | 709 | /*******************************/ |
710 | 710 | |
711 | 711 | if ($field_arr[2] != "") { |
712 | 712 | if ($field_arr[3] != "") { |
713 | - if($field_arr[2]=="status"){ |
|
713 | + if ($field_arr[2] == "status") { |
|
714 | 714 | $row['id'] = $row_id; |
715 | 715 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
716 | - }else{ |
|
716 | + } else { |
|
717 | 717 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]])); |
718 | 718 | } |
719 | 719 | /** |
@@ -721,17 +721,17 @@ discard block |
||
721 | 721 | For Edit on Account number or name |
722 | 722 | **/ |
723 | 723 | $row[$field_arr[2]] = $jsn_tmp[$field_key]; |
724 | - } if(array_search("EDITABLE", $field_arr)){ |
|
724 | + } if (array_search("EDITABLE", $field_arr)) { |
|
725 | 725 | $ActionArr = $grid_fields[$Actionkey]; |
726 | - if($ActionArr[5]->EDIT->url =="accounts/customer_edit/" || $ActionArr[5]->EDIT->url =="accounts/provider_edit/"){ |
|
727 | - $ActionArr[5]->EDIT->url=$row['type']==0 ? "accounts/customer_edit/" : "accounts/provider_edit/"; |
|
726 | + if ($ActionArr[5]->EDIT->url == "accounts/customer_edit/" || $ActionArr[5]->EDIT->url == "accounts/provider_edit/") { |
|
727 | + $ActionArr[5]->EDIT->url = $row['type'] == 0 ? "accounts/customer_edit/" : "accounts/provider_edit/"; |
|
728 | 728 | } |
729 | - if($ActionArr[5]->EDIT->url =="accounts/admin_edit/" || $ActionArr[5]->EDIT->url =="accounts/subadmin_edit/"){ |
|
730 | - $ActionArr[5]->EDIT->url=$row['type']==4 ? "accounts/subadmin_edit/" : "accounts/admin_edit/"; |
|
729 | + if ($ActionArr[5]->EDIT->url == "accounts/admin_edit/" || $ActionArr[5]->EDIT->url == "accounts/subadmin_edit/") { |
|
730 | + $ActionArr[5]->EDIT->url = $row['type'] == 4 ? "accounts/subadmin_edit/" : "accounts/admin_edit/"; |
|
731 | 731 | } |
732 | - $jsn_tmp[$field_key] = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
|
732 | + $jsn_tmp[$field_key] = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT, $row[$field_arr[2]], $row["id"]); |
|
733 | 733 | /*******************************/ |
734 | - }else { |
|
734 | + } else { |
|
735 | 735 | $jsn_tmp[$field_key] = isset($row[$field_arr[2]]) ? $row[$field_arr[2]] : ""; |
736 | 736 | } |
737 | 737 | } else { |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
740 | 740 | } |
741 | 741 | else { |
742 | - $jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace chkRefNos" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>'; |
|
742 | + $jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id='.$row['id'].' class="ace chkRefNos" onclick="clickchkbox('.$row['id'].')" value='.$row['id'].'><lable class="lbl"></lable>'; |
|
743 | 743 | } |
744 | 744 | } |
745 | 745 | } |
@@ -21,8 +21,9 @@ 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 | 28 | /** |
28 | 29 | * Dynamically build forms for display |
@@ -137,10 +138,11 @@ discard block |
||
137 | 138 | foreach ($form_fileds as $fieldkey => $fieldvalue) { |
138 | 139 | $form_contents .= '<li class="col-md-12">'; |
139 | 140 | if ($fieldvalue[1] == 'HIDDEN') { |
140 | - if (isset($this->CI->input->post)) |
|
141 | - $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
142 | - else |
|
143 | - $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : ''); |
|
141 | + if (isset($this->CI->input->post)) { |
|
142 | + $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
143 | + } else { |
|
144 | + $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : ''); |
|
145 | + } |
|
144 | 146 | $form_contents .= form_hidden($fieldvalue[2]['name'], $fieldvalue[2]['value']); |
145 | 147 | } else { |
146 | 148 | $validation_arr = array(); |
@@ -148,8 +150,7 @@ discard block |
||
148 | 150 | if ( ! empty($fieldvalue[3])) { |
149 | 151 | $validation_arr = explode("|", $fieldvalue[3]); |
150 | 152 | } |
151 | - } |
|
152 | - elseif ($fieldvalue[2] == 'SELECT') { |
|
153 | + } elseif ($fieldvalue[2] == 'SELECT') { |
|
153 | 154 | |
154 | 155 | if (is_array($fieldvalue[4])) { |
155 | 156 | $validation_arr = explode("|", $fieldvalue[4]['rules']); |
@@ -199,16 +200,16 @@ discard block |
||
199 | 200 | |
200 | 201 | if(isset($fieldvalue[1]['name'])){ |
201 | 202 | $fieldvalue_pass=$fieldvalue[1]['name']; |
202 | - }else{ |
|
203 | + } else{ |
|
203 | 204 | $fieldvalue_pass=$fieldvalue[1]; |
204 | 205 | } |
205 | 206 | |
206 | 207 | $this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]['rules']); |
207 | - }else{ |
|
208 | + } else{ |
|
208 | 209 | |
209 | 210 | if(isset($fieldvalue[1]['name'])){ |
210 | 211 | $fieldvalue_pass=$fieldvalue[1]['name']; |
211 | - }else{ |
|
212 | + } else{ |
|
212 | 213 | $fieldvalue_pass=$fieldvalue[1]; |
213 | 214 | } |
214 | 215 | |
@@ -244,10 +245,11 @@ discard block |
||
244 | 245 | /* For multi select code */ |
245 | 246 | $str = $fieldvalue[7] . "," . $fieldvalue[8]; |
246 | 247 | |
247 | - if (isset($this->CI->input->post)) |
|
248 | - $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
249 | - else |
|
250 | - $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
248 | + if (isset($this->CI->input->post)) { |
|
249 | + $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
250 | + } else { |
|
251 | + $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
252 | + } |
|
251 | 253 | |
252 | 254 | $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
253 | 255 | if ($fieldset_key === 'System Configuration Information') { |
@@ -264,9 +266,9 @@ discard block |
||
264 | 266 | } else if ($fieldvalue[1] == 'INPUT') { |
265 | 267 | |
266 | 268 | |
267 | - if (isset($this->CI->input->post)) |
|
268 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
269 | - else{ |
|
269 | + if (isset($this->CI->input->post)) { |
|
270 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
271 | + } else{ |
|
270 | 272 | $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : ''):(isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] :''); |
271 | 273 | } |
272 | 274 | $form_contents.= form_input($fieldvalue[2], 'readonly'); |
@@ -282,11 +284,11 @@ discard block |
||
282 | 284 | * Image upload from invoice configuration code. |
283 | 285 | */ |
284 | 286 | else if ($fieldvalue[1] == 'IMAGE') { |
285 | - if (isset($this->CI->input->post)) |
|
286 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
287 | - |
|
288 | - else |
|
289 | - $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
287 | + if (isset($this->CI->input->post)) { |
|
288 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
289 | + } else { |
|
290 | + $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
291 | + } |
|
290 | 292 | $fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
291 | 293 | $form_contents.= form_image($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
292 | 294 | $form_contents.=@$fieldvalue[6]; |
@@ -294,13 +296,12 @@ discard block |
||
294 | 296 | $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
295 | 297 | $form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
296 | 298 | </span></div>'; |
297 | - } |
|
298 | - else if ($fieldvalue[1] == 'DEL_BUTTON') { |
|
299 | - if (isset($this->CI->input->post)) |
|
300 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
301 | - |
|
302 | - else |
|
303 | - $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
299 | + } else if ($fieldvalue[1] == 'DEL_BUTTON') { |
|
300 | + if (isset($this->CI->input->post)) { |
|
301 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
302 | + } else { |
|
303 | + $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
304 | + } |
|
304 | 305 | $fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
305 | 306 | $form_contents.= form_img_delete($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
306 | 307 | $form_contents.=@$fieldvalue[6]; |
@@ -311,10 +312,11 @@ discard block |
||
311 | 312 | } |
312 | 313 | /**********************************************************************************/ |
313 | 314 | else if ($fieldvalue[1] == 'PASSWORD') { |
314 | - if (isset($this->CI->input->post)) |
|
315 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
316 | - else |
|
317 | - $fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
315 | + if (isset($this->CI->input->post)) { |
|
316 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
317 | + } else { |
|
318 | + $fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
319 | + } |
|
318 | 320 | $form_contents.= form_password($fieldvalue[2]); |
319 | 321 | $this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
320 | 322 | $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
@@ -323,12 +325,12 @@ discard block |
||
323 | 325 | } else if ($fieldvalue[2] == 'CHECKBOX') { |
324 | 326 | $OptionArray = array(); |
325 | 327 | |
326 | - if(isset($fieldvalue[7]) && $fieldvalue[7] != '') |
|
327 | - $OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6])); |
|
328 | + if(isset($fieldvalue[7]) && $fieldvalue[7] != '') { |
|
329 | + $OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6])); |
|
330 | + } |
|
328 | 331 | if (isset($this->CI->input->post)){ |
329 | 332 | $fieldvalue[3]['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[3]['value'] : $this->CI->input->post($fieldvalue[1]); |
330 | - } |
|
331 | - else |
|
333 | + } else |
|
332 | 334 | { |
333 | 335 | $fieldvalue[3]['value'] = ($values) ? (isset($values[$fieldvalue[1]]) && $values[$fieldvalue[1]] ? 1: 0) : @$fieldvalue[3]['value']; |
334 | 336 | } |
@@ -340,18 +342,18 @@ discard block |
||
340 | 342 | if(isset($fieldvalue[3]['table_name']) && $fieldvalue[3]['table_name'] != ""){ |
341 | 343 | |
342 | 344 | $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked , $OptionArray); |
343 | - }else{ |
|
345 | + } else{ |
|
344 | 346 | $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked ,$OptionArray); |
345 | 347 | } |
346 | 348 | } else if ($fieldvalue[1] == 'TEXTAREA') { |
347 | 349 | |
348 | - if (isset($this->CI->input->post)) |
|
349 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
350 | - else |
|
351 | - $fieldvalue[2]['value'] = ($values) ? $values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
350 | + if (isset($this->CI->input->post)) { |
|
351 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
352 | + } else { |
|
353 | + $fieldvalue[2]['value'] = ($values) ? $values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
354 | + } |
|
352 | 355 | $form_contents.= form_textarea($fieldvalue[2]); |
353 | - } |
|
354 | - else if ($fieldvalue[2] == 'RADIO') { |
|
356 | + } else if ($fieldvalue[2] == 'RADIO') { |
|
355 | 357 | |
356 | 358 | $form_contents.= form_radio($fieldvalue[1], $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
357 | 359 | } |
@@ -581,8 +583,9 @@ discard block |
||
581 | 583 | $json_data["json_paging"]['total'] = $config['total_rows']; |
582 | 584 | $perpage = $config['per_page']; |
583 | 585 | $start = ($page_no - 1) * $perpage; |
584 | - if ($start < 0) |
|
585 | - $start = 0; |
|
586 | + if ($start < 0) { |
|
587 | + $start = 0; |
|
588 | + } |
|
586 | 589 | $json_data["paging"]['start'] = $start; |
587 | 590 | $json_data["paging"]['page_no'] = $perpage; |
588 | 591 | return $json_data; |
@@ -611,7 +614,7 @@ discard block |
||
611 | 614 | if($field_arr[2]=="status"){ |
612 | 615 | $row['id'] = $row_id; |
613 | 616 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
614 | - }else{ |
|
617 | + } else{ |
|
615 | 618 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]])); |
616 | 619 | } |
617 | 620 | |
@@ -636,13 +639,13 @@ discard block |
||
636 | 639 | $fieldstr = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
637 | 640 | if($acctype != ''){ |
638 | 641 | $jsn_tmp[$field_key] = $fieldstr."<br/>".$acctype; |
639 | - }else{ |
|
642 | + } else{ |
|
640 | 643 | $jsn_tmp[$field_key] = $fieldstr; |
641 | 644 | } |
642 | 645 | |
643 | 646 | |
644 | 647 | /*********************************/ |
645 | - }else { |
|
648 | + } else { |
|
646 | 649 | $jsn_tmp[$field_key] = $row[$field_arr[2]]; |
647 | 650 | } |
648 | 651 | } else { |
@@ -676,15 +679,13 @@ discard block |
||
676 | 679 | */ |
677 | 680 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row_id); |
678 | 681 | /****************************************************************************/ |
679 | - } |
|
680 | - elseif($field_arr[0] == gettext("Profile Action")) |
|
682 | + } elseif($field_arr[0] == gettext("Profile Action")) |
|
681 | 683 | { |
682 | 684 | if(isset($field_arr[5]) && isset($field_arr[5]->START) && isset($field_arr[5]->STOP) && isset($field_arr[5]->RELOAD) && isset($field_arr[5]->RESCAN)){ |
683 | 685 | } |
684 | 686 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
685 | 687 | |
686 | - } |
|
687 | - else { |
|
688 | + } else { |
|
688 | 689 | $className = (isset($field_arr['9']) && $field_arr['9'] != '')?$field_arr['9']:"chkRefNos"; |
689 | 690 | $jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace '.$className.'" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>'; } |
690 | 691 | } |
@@ -713,7 +714,7 @@ discard block |
||
713 | 714 | if($field_arr[2]=="status"){ |
714 | 715 | $row['id'] = $row_id; |
715 | 716 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
716 | - }else{ |
|
717 | + } else{ |
|
717 | 718 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]])); |
718 | 719 | } |
719 | 720 | /** |
@@ -731,14 +732,13 @@ discard block |
||
731 | 732 | } |
732 | 733 | $jsn_tmp[$field_key] = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
733 | 734 | /*******************************/ |
734 | - }else { |
|
735 | + } else { |
|
735 | 736 | $jsn_tmp[$field_key] = isset($row[$field_arr[2]]) ? $row[$field_arr[2]] : ""; |
736 | 737 | } |
737 | 738 | } else { |
738 | 739 | if ($field_arr[0] == "Action") { |
739 | 740 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
740 | - } |
|
741 | - else { |
|
741 | + } else { |
|
742 | 742 | $jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace chkRefNos" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>'; |
743 | 743 | } |
744 | 744 | } |