@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $this->load->dbutil(); |
35 | 35 | |
36 | 36 | if ($this->session->userdata('user_login') == FALSE) |
37 | - redirect(base_url() . '/astpp/login'); |
|
37 | + redirect(base_url().'/astpp/login'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | function configuration_edit($edit_id = '') { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->session->set_userdata('configuration_search', $action); |
59 | 59 | } |
60 | 60 | if (@$ajax_search != 1) { |
61 | - redirect(base_url() . 'systems/configuration/'); |
|
61 | + redirect(base_url().'systems/configuration/'); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -84,29 +84,29 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - function configuration($group_title='') { |
|
88 | - if($group_title==""){ |
|
89 | - redirect(base_url() . '/dashboard'); |
|
87 | + function configuration($group_title = '') { |
|
88 | + if ($group_title == "") { |
|
89 | + redirect(base_url().'/dashboard'); |
|
90 | 90 | } |
91 | - if($group_title=="email"){ |
|
91 | + if ($group_title == "email") { |
|
92 | 92 | $data['test_email_flag'] = true; |
93 | 93 | } |
94 | 94 | $data['username'] = $this->session->userdata('user_name'); |
95 | 95 | $data['page_title'] = ucfirst($group_title); |
96 | - $data['group_title']=$group_title; |
|
97 | - $where=array("group_title"=>$group_title); |
|
96 | + $data['group_title'] = $group_title; |
|
97 | + $where = array("group_title"=>$group_title); |
|
98 | 98 | $details = $this->db_model->getSelect("*", "system", $where); |
99 | - $data['details']=$details->result_array(); |
|
99 | + $data['details'] = $details->result_array(); |
|
100 | 100 | $add_array = $this->input->post(); |
101 | - if (!empty($add_array)) { |
|
101 | + if ( ! empty($add_array)) { |
|
102 | 102 | |
103 | - foreach($add_array as $key=>$val){ |
|
104 | - $update_array=array('value'=>$val); |
|
103 | + foreach ($add_array as $key=>$val) { |
|
104 | + $update_array = array('value'=>$val); |
|
105 | 105 | $this->system_model->edit_configuration($update_array, $key); |
106 | 106 | } |
107 | 107 | $this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!'); |
108 | - redirect(base_url() . 'systems/configuration/'.$group_title); |
|
109 | - }else{ |
|
108 | + redirect(base_url().'systems/configuration/'.$group_title); |
|
109 | + } else { |
|
110 | 110 | $this->load->view('view_systemconf', $data); |
111 | 111 | } |
112 | 112 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
167 | 167 | $account_data = $this->session->userdata("accountinfo"); |
168 | 168 | $reseller = $account_data['id']; |
169 | - $this->resellertemplate_save($add_array,$reseller); |
|
169 | + $this->resellertemplate_save($add_array, $reseller); |
|
170 | 170 | } |
171 | 171 | else |
172 | 172 | { |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | - function resellertemplate_save($data,$resellerid) |
|
177 | + function resellertemplate_save($data, $resellerid) |
|
178 | 178 | { |
179 | - $where = array('name' => $data['name'],'reseller_id'=>$resellerid); |
|
179 | + $where = array('name' => $data['name'], 'reseller_id'=>$resellerid); |
|
180 | 180 | $count = $this->db_model->countQuery("*", "default_templates", $where); |
181 | 181 | $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
182 | - if($count >0) |
|
182 | + if ($count > 0) |
|
183 | 183 | { |
184 | 184 | $data['page_title'] = 'Edit Template'; |
185 | 185 | if ($this->form_validation->run() == FALSE) { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | $this->system_model->edit_resellertemplate($data, $data['id']); |
190 | 190 | $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
191 | - redirect(base_url() . 'systems/template/'); |
|
191 | + redirect(base_url().'systems/template/'); |
|
192 | 192 | exit; |
193 | 193 | } |
194 | 194 | } else { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $data['reseller_id'] = $resellerid; |
200 | 200 | $this->system_model->add_resellertemplate($data); |
201 | 201 | $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
202 | - redirect(base_url() . 'systems/template/'); |
|
202 | + redirect(base_url().'systems/template/'); |
|
203 | 203 | exit; |
204 | 204 | } |
205 | 205 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | unset($data['page_title']); |
218 | 218 | $this->system_model->edit_template($data, $data['id']); |
219 | 219 | $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
220 | - redirect(base_url() . 'systems/template/'); |
|
220 | + redirect(base_url().'systems/template/'); |
|
221 | 221 | exit; |
222 | 222 | } |
223 | 223 | } else { |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | unset($data['form']); |
229 | 229 | $this->system_model->add_template($data); |
230 | 230 | $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
231 | - redirect(base_url() . 'systems/template/'); |
|
231 | + redirect(base_url().'systems/template/'); |
|
232 | 232 | exit; |
233 | 233 | } |
234 | 234 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $this->session->set_userdata('template_search', $action); |
246 | 246 | } |
247 | 247 | if (@$ajax_search != 1) { |
248 | - redirect(base_url() . 'systems/template/'); |
|
248 | + redirect(base_url().'systems/template/'); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $this->session->set_userdata('country_list_search', $action); |
294 | 294 | } |
295 | 295 | if (@$ajax_search != 1) { |
296 | - redirect(base_url() . 'systems/country_list/'); |
|
296 | + redirect(base_url().'systems/country_list/'); |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | |
353 | 353 | function country_remove($id) { |
354 | 354 | $this->system_model->remove_country($id); |
355 | - $country=$this->common->get_field_name('country','countrycode',$id); |
|
355 | + $country = $this->common->get_field_name('country', 'countrycode', $id); |
|
356 | 356 | $this->session->set_flashdata('astpp_notification', $country.'Country removed successfully!'); |
357 | - redirect(base_url() . 'systems/country_list/'); |
|
357 | + redirect(base_url().'systems/country_list/'); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | function country_delete_multiple() { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $this->session->set_userdata('currency_list_search', $action); |
406 | 406 | } |
407 | 407 | if (@$ajax_search != 1) { |
408 | - redirect(base_url() . 'systems/currency_list/'); |
|
408 | + redirect(base_url().'systems/currency_list/'); |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | |
@@ -464,10 +464,10 @@ discard block |
||
464 | 464 | } |
465 | 465 | |
466 | 466 | function currency_remove($id) { |
467 | - $currencyname=$this->common->get_field_name('currencyname','currency',$id); |
|
467 | + $currencyname = $this->common->get_field_name('currencyname', 'currency', $id); |
|
468 | 468 | $this->system_model->remove_currency($id); |
469 | - $this->session->set_flashdata('astpp_notification',$currencyname. ' Currency removed successfully!'); |
|
470 | - redirect(base_url() . 'systems/currency_list/'); |
|
469 | + $this->session->set_flashdata('astpp_notification', $currencyname.' Currency removed successfully!'); |
|
470 | + redirect(base_url().'systems/currency_list/'); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | function currency_delete_multiple() { |
@@ -478,53 +478,53 @@ discard block |
||
478 | 478 | } |
479 | 479 | function database_backup() |
480 | 480 | { |
481 | - $data=array(); |
|
481 | + $data = array(); |
|
482 | 482 | $data['username'] = $this->session->userdata('user_name'); |
483 | 483 | $data['page_title'] = 'Database Backup'; |
484 | - $filename=$this->db->database."_".date("YmdHms").".sql.gz"; |
|
484 | + $filename = $this->db->database."_".date("YmdHms").".sql.gz"; |
|
485 | 485 | $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($filename), ''); |
486 | 486 | $this->load->view('view_database_backup', $data); |
487 | 487 | } |
488 | 488 | function database_backup_save() |
489 | 489 | { |
490 | 490 | |
491 | - $add_array=$this->input->post(); |
|
491 | + $add_array = $this->input->post(); |
|
492 | 492 | |
493 | - $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'],$add_array['id']),$add_array); |
|
493 | + $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'], $add_array['id']), $add_array); |
|
494 | 494 | $data['page_title'] = 'Database Backup'; |
495 | - if($add_array['id'] != ''){ |
|
495 | + if ($add_array['id'] != '') { |
|
496 | 496 | |
497 | - }else{ |
|
498 | - if($this->form_validation->run() == FALSE) { |
|
497 | + } else { |
|
498 | + if ($this->form_validation->run() == FALSE) { |
|
499 | 499 | $data['validation_errors'] = validation_errors(); |
500 | 500 | echo $data['validation_errors']; |
501 | 501 | exit; |
502 | - }else{ |
|
502 | + } else { |
|
503 | 503 | $db_name = $this->db->database; |
504 | 504 | $db_username = $this->db->username; |
505 | 505 | $db_password = $this->db->password; |
506 | 506 | $db_hostname = $this->db->hostname; |
507 | 507 | $filename = $add_array['path']; |
508 | - $backup_file=DATABASE_DIRECTORY.$filename; |
|
509 | - if (substr($backup_file,-3)=='.gz'){ |
|
510 | - $backup_file = substr($backup_file,0,-3); |
|
511 | - $do_gzip=1; |
|
508 | + $backup_file = DATABASE_DIRECTORY.$filename; |
|
509 | + if (substr($backup_file, -3) == '.gz') { |
|
510 | + $backup_file = substr($backup_file, 0, -3); |
|
511 | + $do_gzip = 1; |
|
512 | 512 | } |
513 | 513 | |
514 | - $run_backup="/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'"; |
|
515 | - $error_zip=0; |
|
516 | - exec($run_backup,$output,$error); |
|
517 | - if ($do_gzip){ |
|
514 | + $run_backup = "/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'"; |
|
515 | + $error_zip = 0; |
|
516 | + exec($run_backup, $output, $error); |
|
517 | + if ($do_gzip) { |
|
518 | 518 | $gzip = $this->config->item('gzip-path'); |
519 | 519 | $run_gzip = $gzip." ".$backup_file; |
520 | - exec($run_gzip,$output,$error_zip); |
|
520 | + exec($run_gzip, $output, $error_zip); |
|
521 | 521 | } |
522 | 522 | |
523 | - if($error == 0 && $error_zip == 0 ){ |
|
523 | + if ($error == 0 && $error_zip == 0) { |
|
524 | 524 | $this->system_model->backup_insert($add_array); |
525 | 525 | echo json_encode(array("SUCCESS"=> $add_array['backup_name']." backup exported successfully!")); |
526 | 526 | exit; |
527 | - }else{ |
|
527 | + } else { |
|
528 | 528 | echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section'; |
529 | 529 | exit; |
530 | 530 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | { |
542 | 542 | $json_data = array(); |
543 | 543 | $count_all = $this->system_model->getbackup_list(false, "", ""); |
544 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'],$_GET['page']); |
|
544 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
545 | 545 | $json_data = $paging_data["json_paging"]; |
546 | 546 | |
547 | 547 | $query = $this->system_model->getbackup_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
@@ -551,56 +551,56 @@ discard block |
||
551 | 551 | echo json_encode($json_data); |
552 | 552 | exit; |
553 | 553 | } |
554 | - function database_restore_one($id='') |
|
554 | + function database_restore_one($id = '') |
|
555 | 555 | { |
556 | 556 | $result = $this->system_model->get_backup_data($id); |
557 | - $result_array=$result->result_array(); |
|
558 | - if($result->num_rows() > 0) |
|
557 | + $result_array = $result->result_array(); |
|
558 | + if ($result->num_rows() > 0) |
|
559 | 559 | { |
560 | 560 | $db_name = $this->db->database; |
561 | 561 | $db_username = $this->db->username; |
562 | 562 | $db_password = $this->db->password; |
563 | 563 | $db_hostname = $this->db->hostname; |
564 | - $path=DATABASE_DIRECTORY.$result_array[0]['path']; |
|
565 | - if(file_exists($path)){ |
|
566 | - if (substr($path,-3)=='.gz') { |
|
564 | + $path = DATABASE_DIRECTORY.$result_array[0]['path']; |
|
565 | + if (file_exists($path)) { |
|
566 | + if (substr($path, -3) == '.gz') { |
|
567 | 567 | $GUNZIP_EXE = $this->config->item('gunzip-path'); |
568 | 568 | $run_gzip = $GUNZIP_EXE." < ".$path." | "; |
569 | 569 | } |
570 | - $MYSQL="/usr/bin/mysql"; |
|
570 | + $MYSQL = "/usr/bin/mysql"; |
|
571 | 571 | $run_restore = $run_gzip.$MYSQL." -h".$db_hostname." -u".$db_username." -p".$db_password." ".$db_name; |
572 | 572 | exec($run_restore); |
573 | 573 | $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.'); |
574 | - redirect(base_url() . 'systems/database_restore/'); |
|
575 | - }else{ |
|
574 | + redirect(base_url().'systems/database_restore/'); |
|
575 | + } else { |
|
576 | 576 | $this->session->set_flashdata('astpp_notification', 'File not exists!'); |
577 | - redirect(base_url() . 'systems/database_restore/'); |
|
577 | + redirect(base_url().'systems/database_restore/'); |
|
578 | 578 | } |
579 | 579 | } |
580 | - redirect(base_url() . 'systems/database_restore/'); |
|
580 | + redirect(base_url().'systems/database_restore/'); |
|
581 | 581 | } |
582 | 582 | |
583 | - function database_download($id=''){ |
|
583 | + function database_download($id = '') { |
|
584 | 584 | |
585 | 585 | $result = $this->system_model->get_backup_data($id); |
586 | - $result_array=$result->result_array(); |
|
587 | - if($result->num_rows() > 0) |
|
586 | + $result_array = $result->result_array(); |
|
587 | + if ($result->num_rows() > 0) |
|
588 | 588 | { |
589 | - $path=$result_array[0]['path']; |
|
589 | + $path = $result_array[0]['path']; |
|
590 | 590 | $filename = basename($path); |
591 | 591 | $len = filesize($path); |
592 | 592 | |
593 | 593 | header("Content-Encoding: binary"); |
594 | 594 | header("Content-Type: application/octet-stream"); |
595 | - header( "content-length: " . $len ); |
|
596 | - header( "content-disposition: attachment; filename=" . $filename ); |
|
595 | + header("content-length: ".$len); |
|
596 | + header("content-disposition: attachment; filename=".$filename); |
|
597 | 597 | header("Expires: 0"); |
598 | 598 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
599 | 599 | header("Cache-Control: private"); |
600 | 600 | header("Pragma: public"); |
601 | 601 | ob_clean(); |
602 | - $fp=fopen( $path, "r" ); |
|
603 | - fpassthru( $fp ); |
|
602 | + $fp = fopen($path, "r"); |
|
603 | + fpassthru($fp); |
|
604 | 604 | exit; |
605 | 605 | } |
606 | 606 | } |
@@ -614,17 +614,17 @@ discard block |
||
614 | 614 | function database_import_file() |
615 | 615 | { |
616 | 616 | $filename = $_POST['fname']; |
617 | - $upload_greeting_file= $_FILES['userfile']['name']; |
|
618 | - $db_file = explode(".",$upload_greeting_file); |
|
619 | - if( $db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql'){ |
|
620 | - $target_path = basename( $_FILES['userfile']['name']); |
|
621 | - move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path ); |
|
617 | + $upload_greeting_file = $_FILES['userfile']['name']; |
|
618 | + $db_file = explode(".", $upload_greeting_file); |
|
619 | + if ($db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql') { |
|
620 | + $target_path = basename($_FILES['userfile']['name']); |
|
621 | + move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path); |
|
622 | 622 | |
623 | - $query = $this->system_model->import_database($filename,$_FILES['userfile']['name']); |
|
624 | - $this->session->set_flashdata('astpp_errormsg',"The file ". basename( $_FILES['userfile']['name'])." has been uploaded"); |
|
623 | + $query = $this->system_model->import_database($filename, $_FILES['userfile']['name']); |
|
624 | + $this->session->set_flashdata('astpp_errormsg', "The file ".basename($_FILES['userfile']['name'])." has been uploaded"); |
|
625 | 625 | redirect(base_url()."systems/database_restore/"); |
626 | - }else{ |
|
627 | - $this->session->set_flashdata('astpp_notification',"There is a some issue or invalid file format."); |
|
626 | + } else { |
|
627 | + $this->session->set_flashdata('astpp_notification', "There is a some issue or invalid file format."); |
|
628 | 628 | redirect(base_url()."systems/database_restore/"); |
629 | 629 | } |
630 | 630 | } |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | $this->db->where($where); |
635 | 635 | $this->db->delete("backup_database"); |
636 | 636 | $this->session->set_flashdata('astpp_errormsg', 'Database backup deleted successfully.'); |
637 | - redirect(base_url() . 'systems/database_restore/'); |
|
637 | + redirect(base_url().'systems/database_restore/'); |
|
638 | 638 | return true; |
639 | 639 | } |
640 | 640 | function database_backup_delete_multiple() { |
@@ -33,8 +33,9 @@ discard block |
||
33 | 33 | $this->load->model('system_model'); |
34 | 34 | $this->load->dbutil(); |
35 | 35 | |
36 | - if ($this->session->userdata('user_login') == FALSE) |
|
37 | - redirect(base_url() . '/astpp/login'); |
|
36 | + if ($this->session->userdata('user_login') == FALSE) { |
|
37 | + redirect(base_url() . '/astpp/login'); |
|
38 | + } |
|
38 | 39 | } |
39 | 40 | |
40 | 41 | function configuration_edit($edit_id = '') { |
@@ -106,7 +107,7 @@ discard block |
||
106 | 107 | } |
107 | 108 | $this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!'); |
108 | 109 | redirect(base_url() . 'systems/configuration/'.$group_title); |
109 | - }else{ |
|
110 | + } else{ |
|
110 | 111 | $this->load->view('view_systemconf', $data); |
111 | 112 | } |
112 | 113 | } |
@@ -167,8 +168,7 @@ discard block |
||
167 | 168 | $account_data = $this->session->userdata("accountinfo"); |
168 | 169 | $reseller = $account_data['id']; |
169 | 170 | $this->resellertemplate_save($add_array,$reseller); |
170 | - } |
|
171 | - else |
|
171 | + } else |
|
172 | 172 | { |
173 | 173 | $this->admintemplate_save($add_array); |
174 | 174 | } |
@@ -494,12 +494,12 @@ discard block |
||
494 | 494 | $data['page_title'] = 'Database Backup'; |
495 | 495 | if($add_array['id'] != ''){ |
496 | 496 | |
497 | - }else{ |
|
497 | + } else{ |
|
498 | 498 | if($this->form_validation->run() == FALSE) { |
499 | 499 | $data['validation_errors'] = validation_errors(); |
500 | 500 | echo $data['validation_errors']; |
501 | 501 | exit; |
502 | - }else{ |
|
502 | + } else{ |
|
503 | 503 | $db_name = $this->db->database; |
504 | 504 | $db_username = $this->db->username; |
505 | 505 | $db_password = $this->db->password; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | $this->system_model->backup_insert($add_array); |
525 | 525 | echo json_encode(array("SUCCESS"=> $add_array['backup_name']." backup exported successfully!")); |
526 | 526 | exit; |
527 | - }else{ |
|
527 | + } else{ |
|
528 | 528 | echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section'; |
529 | 529 | exit; |
530 | 530 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | exec($run_restore); |
573 | 573 | $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.'); |
574 | 574 | redirect(base_url() . 'systems/database_restore/'); |
575 | - }else{ |
|
575 | + } else{ |
|
576 | 576 | $this->session->set_flashdata('astpp_notification', 'File not exists!'); |
577 | 577 | redirect(base_url() . 'systems/database_restore/'); |
578 | 578 | } |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | $query = $this->system_model->import_database($filename,$_FILES['userfile']['name']); |
624 | 624 | $this->session->set_flashdata('astpp_errormsg',"The file ". basename( $_FILES['userfile']['name'])." has been uploaded"); |
625 | 625 | redirect(base_url()."systems/database_restore/"); |
626 | - }else{ |
|
626 | + } else{ |
|
627 | 627 | $this->session->set_flashdata('astpp_notification',"There is a some issue or invalid file format."); |
628 | 628 | redirect(base_url()."systems/database_restore/"); |
629 | 629 | } |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if ( ! defined('BASEPATH')) |
|
25 | 25 | exit('No direct script access allowed'); |
26 | 26 | |
27 | 27 | class System_form { |
28 | 28 | |
29 | 29 | function get_template_form_fields() { |
30 | 30 | |
31 | - $form['forms'] = array(base_url() . 'systems/template_save/', array("template_form", "name" => "template_form")); |
|
31 | + $form['forms'] = array(base_url().'systems/template_save/', array("template_form", "name" => "template_form")); |
|
32 | 32 | $form['Email Template'] = array( |
33 | 33 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
34 | - array(' Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
35 | - array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | - array('Body', 'TEXTAREA', array('name' => 'template', 'id' => 'template', 'size' => '20', 'class' => "textarea medium"), 'trim|required', 'tOOL TIP', ''), |
|
34 | + array(' Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
35 | + array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | + array('Body', 'TEXTAREA', array('name' => 'template', 'id' => 'template', 'size' => '20', 'class' => "textarea medium"), 'trim|required', 'tOOL TIP', ''), |
|
37 | 37 | ); |
38 | 38 | $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'systems/template/\')'); |
39 | 39 | $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $form['Search'] = array( |
47 | 47 | |
48 | 48 | array(' Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
49 | - array('Subject', 'INPUT', array('name' => 'subject[subject]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'subject[subject-string]', '', '', '', 'search_string_type', ''),array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
49 | + array('Subject', 'INPUT', array('name' => 'subject[subject]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'subject[subject-string]', '', '', '', 'search_string_type', ''), array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
50 | 50 | array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
51 | 51 | ); |
52 | 52 | $form['button_search'] = array('name' => 'action', 'id' => "template_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | |
57 | 57 | function get_configuration_form_fields() { |
58 | 58 | |
59 | - $form['forms'] = array(base_url() . 'systems/configuration_save/', array("id" => "config_form", "name" => "config_form")); |
|
59 | + $form['forms'] = array(base_url().'systems/configuration_save/', array("id" => "config_form", "name" => "config_form")); |
|
60 | 60 | $form['Edit Settings '] = array( |
61 | 61 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
62 | - array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
62 | + array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
63 | 63 | array('Value', 'INPUT', array('name' => 'value', 'size' => '20', 'class' => "text field medium"), 'trim|required', 'tOOL TIP', ''), |
64 | - array('Comment', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
64 | + array('Comment', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
65 | 65 | ); |
66 | 66 | |
67 | 67 | $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
78 | 78 | array('Value', 'INPUT', array('name' => 'value[value]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'value[value-string]', '', '', '', 'search_string_type', ''), |
79 | 79 | array('Description', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''), |
80 | - array('Group', 'group_title', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'group_title', 'group_title', 'system', 'build_dropdown','where_arr',"group_title NOT IN ('asterisk','osc','freepbx')", 'group_by', 'group_title'), |
|
80 | + array('Group', 'group_title', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'group_title', 'group_title', 'system', 'build_dropdown', 'where_arr', "group_title NOT IN ('asterisk','osc','freepbx')", 'group_by', 'group_title'), |
|
81 | 81 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
82 | 82 | array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
83 | 83 | ); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | array("Value", "190", "value", "", "", ""), |
93 | 93 | array("Description", "320", "comment", "", "", ""), |
94 | 94 | array("Group", "120", "group_title", "", "", ""), |
95 | - array("Action", "442", "", "", "",array("EDIT" => array("url" => "systems/configuration_edit/", "mode" => "popup"), |
|
95 | + array("Action", "442", "", "", "", array("EDIT" => array("url" => "systems/configuration_edit/", "mode" => "popup"), |
|
96 | 96 | )) |
97 | 97 | )); |
98 | 98 | return $grid_field_arr; |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | function build_template_list_for_admin() { |
108 | - $grid_field_arr = json_encode(array(array("Name", "425", "name", "", "", "","","true","center"), |
|
109 | - array("Subject", "650", "subject", "", "", "","","true","center"), |
|
110 | - array("Action", "200", "", "", "",array("EDIT" => array("url" => "systems/template_edit/", "mode" => "single"), |
|
108 | + $grid_field_arr = json_encode(array(array("Name", "425", "name", "", "", "", "", "true", "center"), |
|
109 | + array("Subject", "650", "subject", "", "", "", "", "true", "center"), |
|
110 | + array("Action", "200", "", "", "", array("EDIT" => array("url" => "systems/template_edit/", "mode" => "single"), |
|
111 | 111 | )) |
112 | 112 | )); |
113 | 113 | return $grid_field_arr; |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | function build_country_list_for_admin() { |
117 | 117 | $action = 'systems/country_list_edit/'; |
118 | 118 | $action_remove = 'systems/country_remove/'; |
119 | - $mode="popup"; |
|
119 | + $mode = "popup"; |
|
120 | 120 | $grid_field_arr = json_encode(array( |
121 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "","","false","center"), |
|
122 | - array("Name", "705", "country", "", "", "","","true","center"), |
|
121 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "", "", "false", "center"), |
|
122 | + array("Name", "705", "country", "", "", "", "", "true", "center"), |
|
123 | 123 | array("Action", "100", "", "", "", array("EDIT" => array("url" => "$action", "mode" => "$mode"), |
124 | 124 | "DELETE" => array("url" => "$action_remove", "mode" => "single") |
125 | 125 | )) |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | function build_admin_grid_buttons() { |
131 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/country_add/", "popup"), |
|
132 | - array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "systems/country_delete_multiple"), |
|
131 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "systems/country_add/", "popup"), |
|
132 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "systems/country_delete_multiple"), |
|
133 | 133 | )); |
134 | 134 | return $buttons_json; |
135 | 135 | } |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | function get_country_form_fields() { |
154 | 154 | |
155 | 155 | |
156 | - $form['forms'] = array(base_url() . 'systems/country_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
156 | + $form['forms'] = array(base_url().'systems/country_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
157 | 157 | $form['Country List'] = array( |
158 | 158 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
159 | - array('Name', 'INPUT', array('name' => 'country', 'size' => '20', 'class' => "text field medium"), 'trim|required|char|min_length[2]|max_length[20]|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
159 | + array('Name', 'INPUT', array('name' => 'country', 'size' => '20', 'class' => "text field medium"), 'trim|required|char|min_length[2]|max_length[20]|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
160 | 160 | |
161 | 161 | ); |
162 | 162 | $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | function build_currency_list_for_admin() { |
168 | 168 | $action = 'systems/currency_list_edit/'; |
169 | 169 | $action_remove = 'systems/currency_remove/'; |
170 | - $mode="popup"; |
|
170 | + $mode = "popup"; |
|
171 | 171 | |
172 | 172 | $grid_field_arr = json_encode(array( |
173 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "70", "", "", "", "","","false","center"), |
|
174 | - array("Name", "320", "currencyname", "", "", "","","true","center"), |
|
175 | - array("Code", "290", "currency", "", "", "","","true","center"), |
|
176 | - array(" Rate", "330", "currencyrate", "", "", "","","true","right"), |
|
173 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "70", "", "", "", "", "", "false", "center"), |
|
174 | + array("Name", "320", "currencyname", "", "", "", "", "true", "center"), |
|
175 | + array("Code", "290", "currency", "", "", "", "", "true", "center"), |
|
176 | + array(" Rate", "330", "currencyrate", "", "", "", "", "true", "right"), |
|
177 | 177 | array("Action", "265", "", "", "", array("EDIT" => array("url" => "$action", "mode" => "$mode"), |
178 | 178 | "DELETE" => array("url" => "$action_remove", "mode" => "single") |
179 | 179 | )) |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | function get_currency_form_fields() { |
202 | 202 | |
203 | 203 | |
204 | - $form['forms'] = array(base_url() . 'systems/currency_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
204 | + $form['forms'] = array(base_url().'systems/currency_save/', array('id' => 'system_form', 'method' => 'POST', 'name' => 'system_form')); |
|
205 | 205 | $form['Currency List'] = array( |
206 | 206 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
207 | - array('Name', 'INPUT', array('name' => 'currencyname', 'size' => '20','maxlength' => '40', 'class' => "text field medium"), 'trim|required|char|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
208 | - array('Code', 'INPUT', array('name' => 'currency', 'size' => '20','maxlength' => '3', 'class' => "text field medium"), 'trim|required|char|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
209 | - array('Rate', 'INPUT', array('name' => 'currencyrate', 'size' => '20','maxlength' => '7', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
207 | + array('Name', 'INPUT', array('name' => 'currencyname', 'size' => '20', 'maxlength' => '40', 'class' => "text field medium"), 'trim|required|char|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
208 | + array('Code', 'INPUT', array('name' => 'currency', 'size' => '20', 'maxlength' => '3', 'class' => "text field medium"), 'trim|required|char|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
209 | + array('Rate', 'INPUT', array('name' => 'currencyrate', 'size' => '20', 'maxlength' => '7', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter country'), |
|
210 | 210 | |
211 | 211 | ); |
212 | 212 | $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
@@ -215,21 +215,21 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | function build_admin_currency_grid_buttons() { |
218 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/currency_add/", "popup"), |
|
219 | - array("Update Currencies","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "currencyupdate/update_currency/", 'single'), |
|
220 | - array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "systems/currency_delete_multiple"), |
|
218 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "systems/currency_add/", "popup"), |
|
219 | + array("Update Currencies", "btn btn-line-blue", "fa fa-upload fa-lg", "button_action", "currencyupdate/update_currency/", 'single'), |
|
220 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "systems/currency_delete_multiple"), |
|
221 | 221 | )); |
222 | 222 | return $buttons_json; |
223 | 223 | } |
224 | 224 | |
225 | 225 | |
226 | - function get_backup_database_form_fields($file_name,$id='') { |
|
226 | + function get_backup_database_form_fields($file_name, $id = '') { |
|
227 | 227 | $val = $id > 0 ? "backup_database.path.$id" : 'backup_database.path'; |
228 | - $form['forms'] = array(base_url() . 'systems/database_backup_save/',array('id' => 'backup_form', 'method' => 'POST', 'name' => 'backup_form')); |
|
228 | + $form['forms'] = array(base_url().'systems/database_backup_save/', array('id' => 'backup_form', 'method' => 'POST', 'name' => 'backup_form')); |
|
229 | 229 | $form['Database Information'] = array( |
230 | 230 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
231 | 231 | array('Name', 'INPUT', array('name' => 'backup_name', 'size' => '20', 'class' => "text field medium"), 'required', 'tOOL TIP', ''), |
232 | - array('File Name', 'INPUT', array('name' => 'path', 'size' => '20', 'value'=>$file_name,'class' => "text field medium"), 'trim|required|is_unique[' . $val . ']', 'tOOL TIP', ''), |
|
232 | + array('File Name', 'INPUT', array('name' => 'path', 'size' => '20', 'value'=>$file_name, 'class' => "text field medium"), 'trim|required|is_unique['.$val.']', 'tOOL TIP', ''), |
|
233 | 233 | ); |
234 | 234 | $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
235 | 235 | $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | } |
238 | 238 | function build_backupdastabase_list() { |
239 | 239 | $grid_field_arr = json_encode(array( |
240 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "","","false","center"), |
|
241 | - array("Date", "260", "date", "date", "date", "convert_GMT_to","","true","center"), |
|
242 | - array("Name", "295", "backup_name", "", "", "","","true","center"), |
|
243 | - array("File Name", "480", "path", "", "", "","","true","center"), |
|
240 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "", "", "false", "center"), |
|
241 | + array("Date", "260", "date", "date", "date", "convert_GMT_to", "", "true", "center"), |
|
242 | + array("Name", "295", "backup_name", "", "", "", "", "true", "center"), |
|
243 | + array("File Name", "480", "path", "", "", "", "", "true", "center"), |
|
244 | 244 | array("Action", "185", "", "", "", |
245 | 245 | array("EDIT_RESTORE" => array("url" => "systems/database_restore_one/", "mode" => ""), |
246 | 246 | "DOWNLOAD_DATABASE" => array("url" => "systems/database_download/", "mode" => ""), |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | return $grid_field_arr; |
250 | 250 | } |
251 | 251 | function build_backupdastabase_buttons() { |
252 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "systems/database_backup/", "popup"), |
|
253 | - array("import","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "systems/database_import/", "popup"), |
|
254 | - array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "systems/database_backup_delete_multiple") |
|
252 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "systems/database_backup/", "popup"), |
|
253 | + array("import", "btn btn-line-blue", "fa fa-upload fa-lg", "button_action", "systems/database_import/", "popup"), |
|
254 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "systems/database_backup_delete_multiple") |
|
255 | 255 | )); |
256 | 256 | return $buttons_json; |
257 | 257 | } |
@@ -22,8 +22,9 @@ |
||
22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ############################################################################### |
24 | 24 | |
25 | -if (!defined('BASEPATH')) |
|
26 | - exit('No direct script access allowed'); |
|
25 | +if (!defined('BASEPATH')) { |
|
26 | + exit('No direct script access allowed'); |
|
27 | +} |
|
27 | 28 | |
28 | 29 | class Package_form { |
29 | 30 |
@@ -176,35 +176,35 @@ |
||
176 | 176 | <fieldset> |
177 | 177 | <legend> <?=ucfirst($group_title)?></legend> |
178 | 178 | <div style="width:50%;float:left;"> |
179 | - <?php $currency = Common_model::$global_config['system_config']['base_currency'];?> |
|
180 | - <?php $count=ceil(sizeof($details)/2); $i=0; $class="tleft";?> |
|
181 | - <?php foreach($details as$key=>$val){ ?> |
|
182 | - <?php if($count==$i){ |
|
179 | + <?php $currency = Common_model::$global_config['system_config']['base_currency']; ?> |
|
180 | + <?php $count = ceil(sizeof($details) / 2); $i = 0; $class = "tleft"; ?> |
|
181 | + <?php foreach ($details as$key=>$val) { ?> |
|
182 | + <?php if ($count == $i) { |
|
183 | 183 | echo '</div><div style="width:50%;float:left;">'; |
184 | - $class="tright"; |
|
184 | + $class = "tright"; |
|
185 | 185 | } ?> |
186 | 186 | <div class="col-md-12"> |
187 | 187 | <div class="<?=$class?>" href='#'> |
188 | - <label class="col-md-5 no-padding"><?php echo $val['display_name'];?> * </label> |
|
189 | - <?php if(method_exists($this->common,$val['field_type'])){ |
|
190 | - $option_array = $this->common->$val['field_type'](); |
|
188 | + <label class="col-md-5 no-padding"><?php echo $val['display_name']; ?> * </label> |
|
189 | + <?php if (method_exists($this->common, $val['field_type'])) { |
|
190 | + $option_array = $this->common->$val['field_type'](); |
|
191 | 191 | $drpstr = '<select name="'.$val['name'].'" class="col-md-5 form-control selectpicker" data-live-search="true">'; |
192 | - foreach($option_array as $option_key=>$option_val){ |
|
193 | - $selected = ($val['value'] == $option_key)? "selected='selected'":""; |
|
192 | + foreach ($option_array as $option_key=>$option_val) { |
|
193 | + $selected = ($val['value'] == $option_key) ? "selected='selected'" : ""; |
|
194 | 194 | $drpstr .= '<option value="'.$option_key.'"'.$selected.'>'.$option_val.'</option>'; |
195 | 195 | } |
196 | 196 | $drpstr .= '</select>'; |
197 | 197 | echo $drpstr; |
198 | 198 | unset($drpstr); |
199 | - } else{ |
|
199 | + } else { |
|
200 | 200 | echo '<input name="'.$val["name"].'" value="'.$val['value'].'" size="20" maxlength="100" class="col-md-5 form-control" type="text">'; |
201 | 201 | }?> |
202 | - <span class="demo"><?php echo str_replace('smtp',"SMTP",$val['comment']);?></span> |
|
202 | + <span class="demo"><?php echo str_replace('smtp', "SMTP", $val['comment']); ?></span> |
|
203 | 203 | |
204 | 204 | </div> |
205 | 205 | </div> |
206 | 206 | |
207 | - <?php $i++;?> |
|
207 | + <?php $i++; ?> |
|
208 | 208 | <?php }?> |
209 | 209 | </div> |
210 | 210 | </fieldset> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | /* |
50 | 50 | ASTPP 3.0 Add Rategroup add creation date. |
51 | 51 | */ |
52 | - $add_array['creation_date']=gmdate("Y-m-d H:i:s"); |
|
52 | + $add_array['creation_date'] = gmdate("Y-m-d H:i:s"); |
|
53 | 53 | /************************************/ |
54 | 54 | if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
55 | 55 | $account_data = $this->session->userdata("accountinfo"); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /* |
68 | 68 | ASTPP 3.0 Edit Rategroup time update last mofied date. |
69 | 69 | */ |
70 | - $data['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
70 | + $data['last_modified_date'] = gmdate("Y-m-d H:i:s"); |
|
71 | 71 | /*********************************************************/ |
72 | 72 | $this->db->where("id", $id); |
73 | 73 | $this->db->update("pricelists", $data); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->load->model('pricing_model'); |
34 | 34 | |
35 | 35 | if ($this->session->userdata('user_login') == FALSE) |
36 | - redirect(base_url() . '/astpp/login'); |
|
36 | + redirect(base_url().'/astpp/login'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | function price_add($type = "") { |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | foreach ($account->result_array() as $key => $value) { |
53 | 53 | $edit_data = $value; |
54 | 54 | } |
55 | - $routing_data = $this->db_model->getSelect("trunk_id", "routing",array("pricelist_id"=>$edit_id)); |
|
56 | - if($routing_data->num_rows > 0){ |
|
57 | - foreach($routing_data->result_array() as $trunkid){ |
|
55 | + $routing_data = $this->db_model->getSelect("trunk_id", "routing", array("pricelist_id"=>$edit_id)); |
|
56 | + if ($routing_data->num_rows > 0) { |
|
57 | + foreach ($routing_data->result_array() as $trunkid) { |
|
58 | 58 | $edit_data["trunk_id"][] = $trunkid["trunk_id"]; |
59 | 59 | } |
60 | 60 | } |
@@ -84,30 +84,30 @@ discard block |
||
84 | 84 | exit; |
85 | 85 | } |
86 | 86 | $this->load->view('view_price_add_edit', $data); |
87 | - }else { |
|
87 | + } else { |
|
88 | 88 | $data['page_title'] = 'Create Price Details'; |
89 | 89 | if ($this->form_validation->run() == FALSE) { |
90 | 90 | $data['validation_errors'] = validation_errors(); |
91 | 91 | echo $data['validation_errors']; |
92 | 92 | exit; |
93 | 93 | } else { |
94 | - if(isset($add_array['trunk_id']) && !empty($add_array['trunk_id'])) |
|
95 | - $trunk_id=$add_array['trunk_id']; |
|
94 | + if (isset($add_array['trunk_id']) && ! empty($add_array['trunk_id'])) |
|
95 | + $trunk_id = $add_array['trunk_id']; |
|
96 | 96 | unset($add_array['trunk_id']); |
97 | - $priceid=$this->pricing_model->add_price($add_array); |
|
98 | - if(isset($trunk_id) && $trunk_id != ''){ |
|
99 | - $this->set_force_routing($priceid,$trunk_id); |
|
97 | + $priceid = $this->pricing_model->add_price($add_array); |
|
98 | + if (isset($trunk_id) && $trunk_id != '') { |
|
99 | + $this->set_force_routing($priceid, $trunk_id); |
|
100 | 100 | } |
101 | 101 | echo json_encode(array("SUCCESS"=> $add_array["name"]." rate group added successfully!")); |
102 | 102 | exit; |
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
106 | - function set_force_routing($priceid,$trunkid){ |
|
106 | + function set_force_routing($priceid, $trunkid) { |
|
107 | 107 | // echo "<pre>".$priceid; print_r($trunkid); |
108 | - foreach($trunkid as $id){ |
|
108 | + foreach ($trunkid as $id) { |
|
109 | 109 | $routing_arr = array("trunk_id" => $id, "pricelist_id"=>$priceid); |
110 | - $this->db->insert("routing",$routing_arr); |
|
110 | + $this->db->insert("routing", $routing_arr); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | function price_list_search() { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $this->session->set_userdata('price_list_search', $action); |
122 | 122 | } |
123 | 123 | if (@$ajax_search != 1) { |
124 | - redirect(base_url() . 'accounts/customer_list/'); |
|
124 | + redirect(base_url().'accounts/customer_list/'); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | function price_delete($pricelist_id) { |
162 | 162 | $where = array("id" => $pricelist_id); |
163 | 163 | $this->db_model->update("pricelists", array("status" => "2"), $where); |
164 | - $this->db->delete("routing",array("pricelist_id"=>$pricelist_id)); |
|
164 | + $this->db->delete("routing", array("pricelist_id"=>$pricelist_id)); |
|
165 | 165 | $this->session->set_flashdata('astpp_notification', 'Rate group removed successfully!'); |
166 | - redirect(base_url() . 'pricing/price_list/'); |
|
166 | + redirect(base_url().'pricing/price_list/'); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | function price_delete_multiple() { |
@@ -173,59 +173,59 @@ discard block |
||
173 | 173 | $update_data = array('status' => '2'); |
174 | 174 | $this->db->where('pricelist_id '.$where); |
175 | 175 | $this->db->delete('routes'); |
176 | - $this->db->delete("routing",array("pricelist_id"=>$where)); |
|
176 | + $this->db->delete("routing", array("pricelist_id"=>$where)); |
|
177 | 177 | $this->db->where('id '.$where); |
178 | 178 | echo $this->db->update('pricelists', $update_data); |
179 | 179 | } else { |
180 | - $pricelist_arr=array(); |
|
180 | + $pricelist_arr = array(); |
|
181 | 181 | //Get selected Rategroup Name from database. |
182 | 182 | $this->db->select('id,name'); |
183 | 183 | $this->db->where('id '.$where); |
184 | - $pricelist_res=$this->db->get('pricelists'); |
|
185 | - $pricelist_res=$pricelist_res->result_array(); |
|
186 | - foreach($pricelist_res as $value){ |
|
187 | - $pricelist_arr[$value['id']]['name']=$value['name']; |
|
184 | + $pricelist_res = $this->db->get('pricelists'); |
|
185 | + $pricelist_res = $pricelist_res->result_array(); |
|
186 | + foreach ($pricelist_res as $value) { |
|
187 | + $pricelist_arr[$value['id']]['name'] = $value['name']; |
|
188 | 188 | } |
189 | 189 | //Get count of accounts which are using selected rategroups. |
190 | 190 | $this->db->where('pricelist_id '.$where); |
191 | - $this->db->where('deleted',0); |
|
191 | + $this->db->where('deleted', 0); |
|
192 | 192 | $this->db->select('count(id) as cnt,pricelist_id'); |
193 | 193 | $this->db->group_by('pricelist_id'); |
194 | - $account_res=$this->db->get('accounts'); |
|
195 | - if($account_res->num_rows() > 0){ |
|
196 | - $account_res=$account_res->result_array(); |
|
197 | - foreach($account_res as $key=>$value){ |
|
198 | - $pricelist_arr[$value['pricelist_id']]['account']=$value['cnt']; |
|
194 | + $account_res = $this->db->get('accounts'); |
|
195 | + if ($account_res->num_rows() > 0) { |
|
196 | + $account_res = $account_res->result_array(); |
|
197 | + foreach ($account_res as $key=>$value) { |
|
198 | + $pricelist_arr[$value['pricelist_id']]['account'] = $value['cnt']; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | //Get count of routes which are using selected rategroups. |
202 | 202 | $this->db->where('pricelist_id '.$where); |
203 | 203 | $this->db->select('count(id) as cnt,pricelist_id'); |
204 | 204 | $this->db->group_by('pricelist_id'); |
205 | - $routes_res=$this->db->get('routes'); |
|
206 | - if($routes_res->num_rows() > 0){ |
|
207 | - $routes_res=$routes_res->result_array(); |
|
208 | - foreach($routes_res as $key=>$value){ |
|
209 | - $pricelist_arr[$value['pricelist_id']]['routes']=$value['cnt']; |
|
205 | + $routes_res = $this->db->get('routes'); |
|
206 | + if ($routes_res->num_rows() > 0) { |
|
207 | + $routes_res = $routes_res->result_array(); |
|
208 | + foreach ($routes_res as $key=>$value) { |
|
209 | + $pricelist_arr[$value['pricelist_id']]['routes'] = $value['cnt']; |
|
210 | 210 | } |
211 | 211 | } |
212 | - $str=null; |
|
213 | - foreach($pricelist_arr as $key=>$value){ |
|
214 | - $custom_str=null; |
|
215 | - if(isset($value['account']) || isset($value['routes'])){ |
|
216 | - if(isset($value['account'])){ |
|
217 | - $custom_str.= $value['account']." accounts and "; |
|
212 | + $str = null; |
|
213 | + foreach ($pricelist_arr as $key=>$value) { |
|
214 | + $custom_str = null; |
|
215 | + if (isset($value['account']) || isset($value['routes'])) { |
|
216 | + if (isset($value['account'])) { |
|
217 | + $custom_str .= $value['account']." accounts and "; |
|
218 | 218 | } |
219 | - if(isset($value['routes'])){ |
|
220 | - $custom_str.= $value['routes']." origination rates and "; |
|
219 | + if (isset($value['routes'])) { |
|
220 | + $custom_str .= $value['routes']." origination rates and "; |
|
221 | 221 | } |
222 | - $str.=" Rate group Name : ".$value['name']." using by ".rtrim($custom_str," and ")."\n"; |
|
222 | + $str .= " Rate group Name : ".$value['name']." using by ".rtrim($custom_str, " and ")."\n"; |
|
223 | 223 | } |
224 | 224 | } |
225 | - if(!empty($str)){ |
|
226 | - $data['str']=$str; |
|
225 | + if ( ! empty($str)) { |
|
226 | + $data['str'] = $str; |
|
227 | 227 | } |
228 | - $data['selected_ids']=$add_array['selected_ids']; |
|
228 | + $data['selected_ids'] = $add_array['selected_ids']; |
|
229 | 229 | echo json_encode($data); |
230 | 230 | } |
231 | 231 | } |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | $this->load->library('astpp/form'); |
33 | 33 | $this->load->model('pricing_model'); |
34 | 34 | |
35 | - if ($this->session->userdata('user_login') == FALSE) |
|
36 | - redirect(base_url() . '/astpp/login'); |
|
35 | + if ($this->session->userdata('user_login') == FALSE) { |
|
36 | + redirect(base_url() . '/astpp/login'); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | |
39 | 40 | function price_add($type = "") { |
@@ -84,15 +85,16 @@ discard block |
||
84 | 85 | exit; |
85 | 86 | } |
86 | 87 | $this->load->view('view_price_add_edit', $data); |
87 | - }else { |
|
88 | + } else { |
|
88 | 89 | $data['page_title'] = 'Create Price Details'; |
89 | 90 | if ($this->form_validation->run() == FALSE) { |
90 | 91 | $data['validation_errors'] = validation_errors(); |
91 | 92 | echo $data['validation_errors']; |
92 | 93 | exit; |
93 | 94 | } else { |
94 | - if(isset($add_array['trunk_id']) && !empty($add_array['trunk_id'])) |
|
95 | - $trunk_id=$add_array['trunk_id']; |
|
95 | + if(isset($add_array['trunk_id']) && !empty($add_array['trunk_id'])) { |
|
96 | + $trunk_id=$add_array['trunk_id']; |
|
97 | + } |
|
96 | 98 | unset($add_array['trunk_id']); |
97 | 99 | $priceid=$this->pricing_model->add_price($add_array); |
98 | 100 | if(isset($trunk_id) && $trunk_id != ''){ |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if ( ! defined('BASEPATH')) |
|
25 | 25 | exit('No direct script access allowed'); |
26 | 26 | |
27 | 27 | class pricing_form { |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | $this->CI = & get_instance(); |
30 | 30 | } |
31 | 31 | function get_pricing_form_fields() { |
32 | - $form['forms'] = array(base_url() . 'pricing/price_save/', array('id' => 'pricing_form', 'method' => 'POST', 'name' => 'pricing_form')); |
|
32 | + $form['forms'] = array(base_url().'pricing/price_save/', array('id' => 'pricing_form', 'method' => 'POST', 'name' => 'pricing_form')); |
|
33 | 33 | if ($this->CI->session->userdata('logintype') == 1 || $this->CI->session->userdata('logintype') == 5) { |
34 | 34 | $form['Rate Group Information'] = array( |
35 | 35 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
36 | 36 | array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''), |
37 | - array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
37 | + array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
38 | 38 | array('Routing Type', 'routing_type', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_routetype'), |
39 | 39 | array('Initial Increment', 'INPUT', array('name' => 'initially_increment', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
40 | - array('Default Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
41 | - array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0" , 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
40 | + array('Default Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
41 | + array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0", 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
42 | 42 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
43 | 43 | ); |
44 | 44 | } |
45 | - else{ |
|
45 | + else { |
|
46 | 46 | $form['Rate Group Information'] = array( |
47 | 47 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
48 | 48 | array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''), |
@@ -87,21 +87,21 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function build_pricing_list_for_admin() { |
89 | 89 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
90 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
90 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"), |
|
91 | 91 | /** |
92 | 92 | ASTPP 3.0 |
93 | 93 | For Rategroup edit on Name |
94 | 94 | **/ |
95 | - array(gettext("Name"), "110", "name", "", "", "","EDITABLE","true","center"), |
|
95 | + array(gettext("Name"), "110", "name", "", "", "", "EDITABLE", "true", "center"), |
|
96 | 96 | /***************************************/ |
97 | 97 | array(gettext("Routing Type"), "120", "routing_type", "routing_type", "routing_type", "get_routetype"), |
98 | - array(gettext("Initial Increment"), "140", "initially_increment", "", "", "","","true","center"), |
|
99 | - array("Default Increment", "140", "inc", "", "", "","","true","center"), |
|
100 | - array(gettext("Markup(%)"), "100", "markup", "", "", "","","true","center"), |
|
101 | - array(gettext("Rate Count"), "100", "id", "pricelist_id", "routes", "get_field_count","","true","center"), |
|
102 | - array(gettext("Status"), "110", "status", "id", "pricelists", "get_status","","true","center"), |
|
103 | - array(gettext("Created Date"), "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
104 | - array(gettext("Modified Date"), "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
98 | + array(gettext("Initial Increment"), "140", "initially_increment", "", "", "", "", "true", "center"), |
|
99 | + array("Default Increment", "140", "inc", "", "", "", "", "true", "center"), |
|
100 | + array(gettext("Markup(%)"), "100", "markup", "", "", "", "", "true", "center"), |
|
101 | + array(gettext("Rate Count"), "100", "id", "pricelist_id", "routes", "get_field_count", "", "true", "center"), |
|
102 | + array(gettext("Status"), "110", "status", "id", "pricelists", "get_status", "", "true", "center"), |
|
103 | + array(gettext("Created Date"), "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"), |
|
104 | + array(gettext("Modified Date"), "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"), |
|
105 | 105 | array("Action", "150", "", "", "", array("EDIT" => array("url" => "pricing/price_edit/", "mode" => "popup"), |
106 | 106 | |
107 | 107 | "DELETE" => array("url" => "pricing/price_delete/", "mode" => "single"))) |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | function build_grid_buttons() { |
113 | - $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn" ,"fa fa-plus-circle fa-lg", "button_action", "/pricing/price_add/", "popup"), |
|
114 | - array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/pricing/price_delete_multiple/") |
|
113 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/pricing/price_add/", "popup"), |
|
114 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/pricing/price_delete_multiple/") |
|
115 | 115 | )); |
116 | 116 | return $buttons_json; |
117 | 117 | } |
@@ -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')) |
|
25 | - exit('No direct script access allowed'); |
|
24 | +if (!defined('BASEPATH')) { |
|
25 | + exit('No direct script access allowed'); |
|
26 | +} |
|
26 | 27 | |
27 | 28 | class pricing_form { |
28 | 29 | function __construct($library_name = '') { |
@@ -41,8 +42,7 @@ discard block |
||
41 | 42 | array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0" , 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
42 | 43 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
43 | 44 | ); |
44 | - } |
|
45 | - else{ |
|
45 | + } else{ |
|
46 | 46 | $form['Rate Group Information'] = array( |
47 | 47 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
48 | 48 | array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''), |
@@ -27,80 +27,80 @@ |
||
27 | 27 | function refill_coupon_model() { |
28 | 28 | parent::__construct(); |
29 | 29 | } |
30 | - function get_refill_coupon_list($flag,$start = 0, $limit = 0,$export=false){ |
|
30 | + function get_refill_coupon_list($flag, $start = 0, $limit = 0, $export = false) { |
|
31 | 31 | $this->db_model->build_search('refill_coupon_list_search'); |
32 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
33 | - $reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
|
34 | - $where=array('reseller_id'=>$reseller_id); |
|
32 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
33 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
34 | + $where = array('reseller_id'=>$reseller_id); |
|
35 | 35 | if ($flag) { |
36 | - if($export) |
|
37 | - $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC",'',''); |
|
36 | + if ($export) |
|
37 | + $query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", '', ''); |
|
38 | 38 | else |
39 | - $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC", $limit, $start); |
|
39 | + $query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", $limit, $start); |
|
40 | 40 | } else { |
41 | - $query = $this->db_model->countQuery("*", "refill_coupon",$where); |
|
41 | + $query = $this->db_model->countQuery("*", "refill_coupon", $where); |
|
42 | 42 | } |
43 | 43 | return $query; |
44 | 44 | } |
45 | - function get_customer_refill_coupon_list($flag,$start = 0, $limit = 0,$accountid){ |
|
45 | + function get_customer_refill_coupon_list($flag, $start = 0, $limit = 0, $accountid) { |
|
46 | 46 | $this->db_model->build_search('refill_coupon_list_search'); |
47 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
48 | - $reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : ($accountinfo['type']== 0 ? $accountinfo['reseller_id']: 0 ); |
|
49 | - $where=array('reseller_id'=>$reseller_id,"account_id"=>$accountid); |
|
47 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
48 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : ($accountinfo['type'] == 0 ? $accountinfo['reseller_id'] : 0); |
|
49 | + $where = array('reseller_id'=>$reseller_id, "account_id"=>$accountid); |
|
50 | 50 | if ($flag) { |
51 | - $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC", $limit, $start); |
|
51 | + $query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", $limit, $start); |
|
52 | 52 | } else { |
53 | - $query = $this->db_model->countQuery("*", "refill_coupon",$where); |
|
53 | + $query = $this->db_model->countQuery("*", "refill_coupon", $where); |
|
54 | 54 | } |
55 | 55 | return $query; |
56 | 56 | } |
57 | - function add_refill_coupon($add_array){ |
|
57 | + function add_refill_coupon($add_array) { |
|
58 | 58 | $count = $add_array['count']; |
59 | 59 | unset($add_array['action']); |
60 | 60 | unset($add_array['count']); |
61 | - $prefix=$add_array['prefix']; |
|
61 | + $prefix = $add_array['prefix']; |
|
62 | 62 | unset($add_array['prefix']); |
63 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
64 | - $reseller_id=$accountinfo['type']==1 ? $accountinfo['id']:0; |
|
65 | - $insert_arr=array(); |
|
66 | - $account_length=Common_model::$global_config['system_config']['refill_coupon_length']; |
|
67 | - $length=strlen($prefix); |
|
68 | - if($length !=0){ |
|
69 | - $number_length=$account_length-$length; |
|
70 | - } else{ |
|
71 | - $number_length=$account_length; |
|
63 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
64 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
65 | + $insert_arr = array(); |
|
66 | + $account_length = Common_model::$global_config['system_config']['refill_coupon_length']; |
|
67 | + $length = strlen($prefix); |
|
68 | + if ($length != 0) { |
|
69 | + $number_length = $account_length - $length; |
|
70 | + } else { |
|
71 | + $number_length = $account_length; |
|
72 | 72 | } |
73 | 73 | $add_array['amount'] = $this->common_model->add_calculate_currency($add_array['amount'], '', '', false, false); |
74 | - $number=$this->common->find_uniq_rendno_accno($number_length, 'number', 'refill_coupon',$prefix,$count); |
|
75 | - $date=gmdate('Y-m-d H:i:s'); |
|
74 | + $number = $this->common->find_uniq_rendno_accno($number_length, 'number', 'refill_coupon', $prefix, $count); |
|
75 | + $date = gmdate('Y-m-d H:i:s'); |
|
76 | 76 | for ($i = 0; $i < $count; $i++) { |
77 | 77 | $add_array['number'] = trim($number[$i]); |
78 | - $add_array['currency_id']=$accountinfo['currency_id']; |
|
79 | - $add_array['reseller_id']=$reseller_id; |
|
80 | - $add_array['creation_date']=$date; |
|
81 | - $insert_arr[$i]=$add_array; |
|
78 | + $add_array['currency_id'] = $accountinfo['currency_id']; |
|
79 | + $add_array['reseller_id'] = $reseller_id; |
|
80 | + $add_array['creation_date'] = $date; |
|
81 | + $insert_arr[$i] = $add_array; |
|
82 | 82 | } |
83 | - $this->db->insert_batch("refill_coupon",$insert_arr); |
|
83 | + $this->db->insert_batch("refill_coupon", $insert_arr); |
|
84 | 84 | return true; |
85 | 85 | } |
86 | - function remove_refill_coupon($id){ |
|
86 | + function remove_refill_coupon($id) { |
|
87 | 87 | $this->db->where("id", $id); |
88 | 88 | $this->db->delete("refill_coupon"); |
89 | 89 | return true; |
90 | 90 | } |
91 | - function get_refill_coupon_details($id){ |
|
91 | + function get_refill_coupon_details($id) { |
|
92 | 92 | $this->db->where("id", $id); |
93 | - $result=$this->db->get('refill_coupon'); |
|
93 | + $result = $this->db->get('refill_coupon'); |
|
94 | 94 | return $result; |
95 | 95 | } |
96 | - function refill_coupon_count($add_array){ |
|
97 | - $account_length=Common_model::$global_config['system_config']['refill_coupon_length']; |
|
98 | - $this->db->where("length(number)",$account_length); |
|
99 | - $this->db->like('number',$add_array['prefix'],'after'); |
|
96 | + function refill_coupon_count($add_array) { |
|
97 | + $account_length = Common_model::$global_config['system_config']['refill_coupon_length']; |
|
98 | + $this->db->where("length(number)", $account_length); |
|
99 | + $this->db->like('number', $add_array['prefix'], 'after'); |
|
100 | 100 | $this->db->select("count(id) as count"); |
101 | 101 | $this->db->from('refill_coupon'); |
102 | - $result=$this->db->get(); |
|
103 | - $result=$result->result_array(); |
|
102 | + $result = $this->db->get(); |
|
103 | + $result = $result->result_array(); |
|
104 | 104 | return $result; |
105 | 105 | } |
106 | 106 | } |
@@ -33,10 +33,11 @@ |
||
33 | 33 | $reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
34 | 34 | $where=array('reseller_id'=>$reseller_id); |
35 | 35 | if ($flag) { |
36 | - if($export) |
|
37 | - $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC",'',''); |
|
38 | - else |
|
39 | - $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC", $limit, $start); |
|
36 | + if($export) { |
|
37 | + $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC",'',''); |
|
38 | + } else { |
|
39 | + $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC", $limit, $start); |
|
40 | + } |
|
40 | 41 | } else { |
41 | 42 | $query = $this->db_model->countQuery("*", "refill_coupon",$where); |
42 | 43 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | class Refill_coupon extends MX_Controller { |
26 | 26 | |
27 | - function Refill_coupon(){ |
|
27 | + function Refill_coupon() { |
|
28 | 28 | parent::__construct(); |
29 | 29 | $this->load->helper('template_inheritance'); |
30 | 30 | $this->load->helper('form'); |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | $this->load->library("astpp/form"); |
34 | 34 | $this->load->library("session"); |
35 | 35 | if ($this->session->userdata('user_login') == FALSE) |
36 | - redirect(base_url() . 'login/login'); |
|
36 | + redirect(base_url().'login/login'); |
|
37 | 37 | } |
38 | - function refill_coupon_list(){ |
|
39 | - if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
|
40 | - redirect(base_url() . 'user/user/'); |
|
38 | + function refill_coupon_list() { |
|
39 | + if ($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3) { |
|
40 | + redirect(base_url().'user/user/'); |
|
41 | 41 | } |
42 | 42 | $data['username'] = $this->session->userdata('user_name'); |
43 | 43 | $data['page_title'] = gettext('Refill Coupon'); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $data['form_search'] = $this->form->build_serach_form($this->refill_coupon_form->get_refill_coupon_search_form()); |
50 | 50 | $this->load->view('view_refill_coupon_list', $data); |
51 | 51 | } |
52 | - function refill_coupon_list_json(){ |
|
52 | + function refill_coupon_list_json() { |
|
53 | 53 | $json_data = array(); |
54 | 54 | $count_all = $this->refill_coupon_model->get_refill_coupon_list(false, "", ""); |
55 | 55 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
60 | 60 | echo json_encode($json_data); |
61 | 61 | } |
62 | - function refill_coupon_list_search(){ |
|
62 | + function refill_coupon_list_search() { |
|
63 | 63 | $ajax_search = $this->input->post('ajax_search', 0); |
64 | 64 | if ($this->input->post('advance_search', TRUE) == 1) { |
65 | 65 | $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
@@ -72,21 +72,21 @@ discard block |
||
72 | 72 | $this->session->set_userdata('refill_coupon_list_search', $action); |
73 | 73 | } |
74 | 74 | if (@$ajax_search != 1) { |
75 | - redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
75 | + redirect(base_url().'refill_coupon/refill_coupon_list/'); |
|
76 | 76 | } |
77 | 77 | } |
78 | - function refill_coupon_clearsearchfilter(){ |
|
78 | + function refill_coupon_clearsearchfilter() { |
|
79 | 79 | $this->session->set_userdata('advance_search', 0); |
80 | 80 | $this->session->set_userdata('refill_coupon_list_search', ""); |
81 | 81 | } |
82 | - function refill_coupon_list_view($id){ |
|
82 | + function refill_coupon_list_view($id) { |
|
83 | 83 | $data['username'] = $this->session->userdata('user_name'); |
84 | 84 | $data['page_title'] = 'View Refill Coupon'; |
85 | 85 | if ($cc = $this->refill_coupon_model->get_refill_coupon_details($id)) { |
86 | - $refill_coupon_details=$cc->result_array(); |
|
87 | - $data['refill_coupon_details']=$refill_coupon_details[0]; |
|
88 | - $data['refill_coupon_details']['callingcard']= $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']); |
|
89 | - $data['refill_coupon_details']['currency']= $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']); |
|
86 | + $refill_coupon_details = $cc->result_array(); |
|
87 | + $data['refill_coupon_details'] = $refill_coupon_details[0]; |
|
88 | + $data['refill_coupon_details']['callingcard'] = $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']); |
|
89 | + $data['refill_coupon_details']['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']); |
|
90 | 90 | } else { |
91 | 91 | echo "This card is not available."; |
92 | 92 | return; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | |
96 | 96 | } |
97 | 97 | function refill_coupon_add() { |
98 | - if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
|
99 | - redirect(base_url() . 'user/user/'); |
|
98 | + if ($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3) { |
|
99 | + redirect(base_url().'user/user/'); |
|
100 | 100 | } |
101 | 101 | $data['username'] = $this->session->userdata('user_name'); |
102 | 102 | $data['flag'] = 'create'; |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | $this->load->view('view_refill_coupon_add', $data); |
106 | 106 | } |
107 | 107 | function refill_coupon_save() { |
108 | - $account_length=Common_model::$global_config['system_config']['refill_coupon_length']; |
|
108 | + $account_length = Common_model::$global_config['system_config']['refill_coupon_length']; |
|
109 | 109 | $add_array = $this->input->post(); |
110 | - $add_array['status']=0; |
|
110 | + $add_array['status'] = 0; |
|
111 | 111 | $data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), $add_array); |
112 | - $result=$this->refill_coupon_model->refill_coupon_count($add_array); |
|
113 | - $count=$result[0]['count']; |
|
114 | - $remaining_length =0; |
|
115 | - $remaining_length=$account_length - strlen($add_array['prefix']); |
|
116 | - $currentlength =pow(5,$remaining_length); |
|
117 | - $currentlength=$currentlength-$count; |
|
112 | + $result = $this->refill_coupon_model->refill_coupon_count($add_array); |
|
113 | + $count = $result[0]['count']; |
|
114 | + $remaining_length = 0; |
|
115 | + $remaining_length = $account_length - strlen($add_array['prefix']); |
|
116 | + $currentlength = pow(5, $remaining_length); |
|
117 | + $currentlength = $currentlength - $count; |
|
118 | 118 | $data['page_title'] = 'Add Refill Coupon'; |
119 | 119 | if ($this->form_validation->run() == FALSE) { |
120 | 120 | $data['validation_errors'] = validation_errors(); |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | exit; |
123 | 123 | } |
124 | 124 | else { |
125 | - if($account_length<=strlen($add_array['prefix'])){ |
|
125 | + if ($account_length <= strlen($add_array['prefix'])) { |
|
126 | 126 | echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix.")); |
127 | 127 | exit; |
128 | 128 | } |
129 | - if($currentlength <= 0){ |
|
129 | + if ($currentlength <= 0) { |
|
130 | 130 | echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix")); |
131 | 131 | exit; |
132 | 132 | } |
133 | - if($currentlength > 0 && $add_array['count'] > $currentlength){ |
|
133 | + if ($currentlength > 0 && $add_array['count'] > $currentlength) { |
|
134 | 134 | echo json_encode(array("count_error"=>"You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix")); |
135 | 135 | exit; |
136 | - }else{ |
|
136 | + } else { |
|
137 | 137 | $this->refill_coupon_model->add_refill_coupon($add_array); |
138 | 138 | echo json_encode(array("SUCCESS"=> "Refill coupon created successfully!")); |
139 | 139 | exit; |
@@ -143,26 +143,26 @@ discard block |
||
143 | 143 | function refill_coupon_list_delete($id) { |
144 | 144 | $this->refill_coupon_model->remove_refill_coupon($id); |
145 | 145 | $this->session->set_flashdata('astpp_notification', 'Refill coupon removed successfully!'); |
146 | - redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
146 | + redirect(base_url().'refill_coupon/refill_coupon_list/'); |
|
147 | 147 | } |
148 | - function refill_coupon_export(){ |
|
148 | + function refill_coupon_export() { |
|
149 | 149 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
150 | - $currency_id=$account_info['currency_id']; |
|
151 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
152 | - $query = $this->refill_coupon_model->get_refill_coupon_list(true,'','',true); |
|
150 | + $currency_id = $account_info['currency_id']; |
|
151 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
152 | + $query = $this->refill_coupon_model->get_refill_coupon_list(true, '', '', true); |
|
153 | 153 | $cc_array = array(); |
154 | 154 | ob_clean(); |
155 | - $cc_array[] = array('Coupon No.','Description', 'Account','Amount('.$currency.')','Created Date',"Used?",'Used Date'); |
|
155 | + $cc_array[] = array('Coupon No.', 'Description', 'Account', 'Amount('.$currency.')', 'Created Date', "Used?", 'Used Date'); |
|
156 | 156 | if ($query->num_rows() > 0) { |
157 | 157 | foreach ($query->result_array() as $row) { |
158 | 158 | $row['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $row['currency_id']); |
159 | 159 | $row['acc_name'] = $row['account_id'] > 0 ? $this->common->get_field_name('number', 'accounts', $row['account_id']) : ""; |
160 | - $row['status']=$this->common->get_refill_coupon_status('','',$row['status']); |
|
160 | + $row['status'] = $this->common->get_refill_coupon_status('', '', $row['status']); |
|
161 | 161 | $cc_array[] = array( |
162 | 162 | $row['number'], |
163 | 163 | $row['description'], |
164 | 164 | $row['acc_name'], |
165 | - $this->common->convert_to_currency('','',$row['amount']), |
|
165 | + $this->common->convert_to_currency('', '', $row['amount']), |
|
166 | 166 | $row['creation_date'], |
167 | 167 | $row['status'], |
168 | 168 | $row['firstused'] |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | } |
171 | 171 | } |
172 | 172 | $this->load->helper('csv'); |
173 | - array_to_csv($cc_array, 'refill_coupon_' . date("Y-m-d") . '.csv'); |
|
173 | + array_to_csv($cc_array, 'refill_coupon_'.date("Y-m-d").'.csv'); |
|
174 | 174 | } |
175 | - function refill_coupon_customer_json($accountid){ |
|
175 | + function refill_coupon_customer_json($accountid) { |
|
176 | 176 | $json_data = array(); |
177 | - $count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "",$accountid); |
|
177 | + $count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "", $accountid); |
|
178 | 178 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
179 | 179 | $json_data = $paging_data["json_paging"]; |
180 | - $query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"],$accountid); |
|
180 | + $query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $accountid); |
|
181 | 181 | $grid_fields = json_decode($this->refill_coupon_form->build_user_refill_coupon_grid()); |
182 | 182 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
183 | 183 | echo json_encode($json_data); |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | $this->load->library("refill_coupon_form"); |
33 | 33 | $this->load->library("astpp/form"); |
34 | 34 | $this->load->library("session"); |
35 | - if ($this->session->userdata('user_login') == FALSE) |
|
36 | - redirect(base_url() . 'login/login'); |
|
35 | + if ($this->session->userdata('user_login') == FALSE) { |
|
36 | + redirect(base_url() . 'login/login'); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | function refill_coupon_list(){ |
39 | 40 | if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
@@ -120,8 +121,7 @@ discard block |
||
120 | 121 | $data['validation_errors'] = validation_errors(); |
121 | 122 | echo $data['validation_errors']; |
122 | 123 | exit; |
123 | - } |
|
124 | - else { |
|
124 | + } else { |
|
125 | 125 | if($account_length<=strlen($add_array['prefix'])){ |
126 | 126 | echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix.")); |
127 | 127 | exit; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | if($currentlength > 0 && $add_array['count'] > $currentlength){ |
134 | 134 | echo json_encode(array("count_error"=>"You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix")); |
135 | 135 | exit; |
136 | - }else{ |
|
136 | + } else{ |
|
137 | 137 | $this->refill_coupon_model->add_refill_coupon($add_array); |
138 | 138 | echo json_encode(array("SUCCESS"=> "Refill coupon created successfully!")); |
139 | 139 | exit; |
@@ -48,10 +48,10 @@ |
||
48 | 48 | <th>Length in Seconds</th> |
49 | 49 | <th>Cost(CAD)</th> |
50 | 50 | </tr> |
51 | - <?php foreach($cdrs as $cdr){ |
|
52 | - $debit= ''; |
|
53 | - $debit =($cdr['debit']/10000); |
|
54 | - $debit=$debit+0; |
|
51 | + <?php foreach ($cdrs as $cdr) { |
|
52 | + $debit = ''; |
|
53 | + $debit = ($cdr['debit'] / 10000); |
|
54 | + $debit = $debit + 0; |
|
55 | 55 | ?> |
56 | 56 | <tr> |
57 | 57 | <td><?=$cdr['destination']?></td> |