diff --git a/application/controllers/api.php b/application/controllers/api.php index f0fbf17..76ca10f 100644 --- a/application/controllers/api.php +++ b/application/controllers/api.php @@ -920,8 +920,8 @@ public function saverecords() { ///////////////////////// HASSAN ANWAR //////////////////////////// /////////////////////////////////////////////////////////////////////// - $multiChoices = $this->db->query("Select * from form_multiselectFieldLabels where formId='$form_id'"); - foreach($multiChoices->result() as $row) + $multi_choices = $this->db->query("Select * from form_multiselectFieldLabels where formId='$form_id'"); + foreach($multi_choices->result() as $row) { $fd=(array) $dataresultnew1; @@ -958,9 +958,8 @@ public function saverecords() { } - try{ - $ret_ins = $this->db->insert( 'zform_'.$form_id, $final_array ); - + try { + $ret_ins = $this->db->insert('zform_'.$form_id, $final_array); if(!$ret_ins){ $err_msg .= $this->db->_error_message(); $this->form_results_model->update_mobile_activity($activity_inserted_id,array('error'=>$err_msg)); @@ -971,7 +970,7 @@ public function saverecords() { exit(); } $form_result_id_new = $this->db->insert_id(); - }catch (Exception $e) { + } catch (Exception $e) { $this->form_results_model->update_mobile_activity($activity_inserted_id,array('error'=>$e->message())); echo json_encode($jsone_array); exit; @@ -980,9 +979,9 @@ public function saverecords() { if (!empty($sub_table_record)) { - foreach ($sub_table_record as $sb_key => $sb_value) { + foreach ($sub_table_record as $sb_key => $sub_value) { $subtable_name = 'zform_' . $form_id . '_' . $sb_key; - foreach ($sb_value as $sub_array) { + foreach ($sub_value as $sub_array) { $sub_comon_fields = array(); foreach ($sub_array as $fild_key => $filds) { $sub_fild_ary = array( @@ -1029,7 +1028,7 @@ public function saverecords() { $post_url = ''; if (!empty($form_info ['post_url'])) { $post_url = $form_info ['post_url']; - } else if (!empty($form_info ['fv_post_url'])) { + } elseif (!empty($form_info ['fv_post_url'])) { $post_url = $form_info ['fv_post_url']; } @@ -1144,7 +1143,7 @@ public function saverecordscron() { $replacement = '$1-$2-$3 $4:$5:$6'; $activity_datetime = preg_replace($pattern, $replacement, $dateTime_device); $activity_datetime = date('Y-m-d H:i:s', strtotime($activity_datetime)); - } else if (strpos($dateTime_device, '/') < 12) { + } elseif (strpos($dateTime_device, '/') < 12) { $pattern = '#(\d+)/(\d+)/(\d+) (\d+):(\d+):(\d+)#'; $replacement = '$1-$2-$3 $4:$5:$6'; $activity_datetime = preg_replace($pattern, $replacement, $dateTime_device); @@ -1189,7 +1188,7 @@ public function saverecordscron() { } $record[$key] = 'SHOW RECORDS'; } - } else if ($cap_first [0] == 'caption') { + } elseif ($cap_first [0] == 'caption') { $tempary_cap = array( $key => $v ); @@ -1284,8 +1283,10 @@ public function saverecordscron() { } - $this->form_results_model->update_mobile_activity($activity_inserted_id, array('form_data_decoded' => json_encode($dataresultnew1))); - $ret_ins = $this->db->insert('zform_' . $form_id, $dataresultnew1); + $this->form_results_model->update_mobile_activity( + $activity_inserted_id, array('form_data_decoded' => json_encode($dataresultnew1)) + ); + $ret_ins = $this->db->insert('zform_'.$form_id, $dataresultnew1); $form_result_id_new = $this->db->insert_id(); if (!$ret_ins) { $err_msg .= 'Record Not Submitted. ' . $this->db->_error_message() . '. "Please Refresh your application"'; @@ -1324,7 +1325,7 @@ public function saverecordscron() { 'form_id' => $form_id, 'image' => $image_path['image'] ); - if(strpos($image_path ['title'], $form_info['security_key']) !== FALSE){ + if (strpos($image_path ['title'],$form_info['security_key']) !== FALSE) { $add_images ['title'] = urldecode(base64_decode(str_replace($form_info ['security_key'], '', $image_path ['title']))); } else { $add_images ['title'] = urldecode($image_path ['title']); @@ -1343,7 +1344,7 @@ public function saverecordscron() { $post_url = ''; if (!empty($form_info ['post_url'])) { $post_url = $form_info ['post_url']; - } else if (!empty($form_info ['fv_post_url'])) { + } elseif (!empty($form_info ['fv_post_url'])) { $post_url = $form_info ['fv_post_url']; } @@ -1425,7 +1426,7 @@ public function saverecordsharzindagi() { where id ='$form_id'"); $security_key_result = $query->row_array(); $saved_security_key=$security_key_result['security_key']; - if($security_key != $saved_security_key){ + if ($security_key != $saved_security_key) { $jsone_array = array( 'error' => 'Security key does not match' ); @@ -1434,7 +1435,11 @@ public function saverecordsharzindagi() { } //Stop activity saving if already saved - $activity_aready_exist = $this->db->get_where('zform_'.$form_id, array('form_id' => $form_id, 'imei_no' => $imei_no,'activity_datetime' => $activity_datetime))->row_array(); + $activity_aready_exist = $this->db->get_where('zform_'.$form_id, + array( + 'form_id' => $form_id, + 'imei_no' => $imei_no, + 'activity_datetime' => $activity_datetime))->row_array(); if ($activity_aready_exist) { $jsone_array = array( 'success' => 'This activity already submitted.' @@ -1722,7 +1727,7 @@ public function saverecordsweb() { } $record[$key] = 'SHOW RECORDS'; } - } else if ($cap_first [0] == 'caption') { + } elseif ($cap_first [0] == 'caption') { $tempary_cap = array( $key => $v ); @@ -1760,7 +1765,7 @@ public function saverecordsweb() { { $warning_message = 'Your location mismatched. '; } - else{ + else { $warning_message = 'You are on right location' ; } } @@ -1892,8 +1897,8 @@ public function saverecordsweb() { ///////////////////////// HASSAN ANWAR //////////////////////////// /////////////////////////////////////////////////////////////////////// - $multiChoices = $this->db->query("Select * from form_multiselectFieldLabels where formId='$form_id'"); - foreach($multiChoices->result() as $row) + $multi_choices = $this->db->query("Select * from form_multiselectFieldLabels where formId='$form_id'"); + foreach ($multi_choices->result() as $row) { $fd=(array) $dataresultnew1; @@ -1901,7 +1906,7 @@ public function saverecordsweb() { $choicesSent= $dataresultnew1[$label]; $choicesSent=explode(',',$choicesSent); - foreach($choicesSent as $choice) + foreach ($choicesSent as $choice) { $choice=str_replace(' ', '_', $choice); $dataresultnew1[$label.'_'.$choice]='1'; @@ -2101,9 +2106,9 @@ public function getTownName($location = null) { curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //$body = curl_exec($ch); - if( ! $body = curl_exec($ch)) { + if (!$body = curl_exec($ch)) { return false; - }else{ + } else { $townname = json_decode($body, 1); if ($townname != 'null_string') { return $townname; @@ -2128,9 +2133,9 @@ public function getDistrictName($location = null) { curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $body = curl_exec($ch); - if( ! $body = curl_exec($ch)) { + if (!$body = curl_exec($ch)) { return false; - }else{ + } else { $districtname = json_decode($body, 1); if ($districtname [0]) { return $districtname [1]; diff --git a/application/controllers/app.php b/application/controllers/app.php index a16b28f..9adbd2d 100644 --- a/application/controllers/app.php +++ b/application/controllers/app.php @@ -152,12 +152,12 @@ public function ajaxApps(){ //$forms_list[] = array('form_id' => $forms['form_id'], 'form_name' => $forms['form_name']); //$table_exist_bit = $this->form_results_model->check_table_exits('zform_' . $forms['form_id']); //if($table_exist_bit['count(*)']==1){ - if(is_table_exist('zform_' . $forms['form_id'])){ + if (is_table_exist('zform_' . $forms['form_id'])) { //get count of records... $total=$this->form_results_model->find_record_count('zform_' . $forms['form_id']); $results_count+=$total; } - if(!is_table_exist('zform_' . $forms['form_id'])) { + if (!is_table_exist('zform_' . $forms['form_id'])) { updateDataBase($forms['form_id'], $forms['description']); } } @@ -297,7 +297,11 @@ public function deleteasignuser($slug, $app_id) { */ public function appusers() { if (!$this->acl->hasPermission('app_users', 'view')) { - $this->session->set_flashdata('validate', array('message' => "You don't have enough permissions to do this task.", 'type' => 'warning')); + $this->session->set_flashdata('validate', + array( + 'message' => "You don't have enough permissions to do this task.", + 'type' => 'warning') + ); redirect('/'); } $this->load->library('form_validation'); @@ -319,8 +323,7 @@ public function appusers() { $this->form_validation->set_rules('app_id', 'App Id', 'trim|required|xss_clean'); $this->form_validation->set_rules('name', 'First Name', 'trim|required|min_length[1]|xss_clean'); $this->form_validation->set_rules('town', 'district', 'Last Name', 'trim|required|min_length[1]|xss_clean'); - if($this->input->post('login_user') == '') - { + if ($this->input->post('login_user') == '') { $this->form_validation->set_rules('imei_no', 'IMEI #', 'trim|required|callback_appuser_imei_already_exist[' . $app_id . ']'); } else{ @@ -338,8 +341,7 @@ public function appusers() { $view_id = $this->input->post('view_id'); $imei_no = $this->input->post('imei_no'); - if($this->input->post('imei_no')=='') - { + if ($this->input->post('imei_no')=='') { $imei_no = $this->input->post('login_user'); } @@ -374,7 +376,7 @@ public function appusers() { } if ($this->acl->hasSuperAdmin()) { $app_user_list = $this->app_users_model->get_app_user_listing($data['login_department_id']); - }else{ + } else { $app_user_list = $this->app_users_model->get_app_user_listing($data['login_department_id'],null,null,null,null,null,$app_list); } $data['app_user_list'] = $app_user_list; @@ -444,7 +446,7 @@ public function ajaxappusers() { } - if($total_apps_users==0){ + if ($total_apps_users==0) { //echo json_encode(array('aaData'=>'')); echo json_encode(array( //"sEcho" => 0, @@ -452,7 +454,7 @@ public function ajaxappusers() { "iTotalDisplayRecords" => "0", "aaData" => array() )); - }else { + } else { echo json_encode($data2); } @@ -540,14 +542,12 @@ public function appusersimportcsv(){ $this->load->view('templates/footer', $data); } - } - else{ + } else { $this->session->set_flashdata('validate', array('message' => "Select CSV file", 'type' => 'warning')); redirect(base_url() . 'applicatioin-users'); } } - } - else{ + } else { redirect(base_url() . 'applicatioin-users'); } @@ -591,10 +591,10 @@ public function import_app_user_csv() { $myimeidata = $query->result_array(); $already_exist = array(); foreach ($myimeidata as $key => $myimei) { - if(!empty($myimei['imei_no'])){ + if (!empty($myimei['imei_no'])) { $already_exist[] = $myimei['imei_no']; } - else if(!empty($myimei['login_user'])) { + elseif (!empty($myimei['login_user'])) { $already_exist[] = $myimei['login_user']; } } @@ -606,11 +606,11 @@ public function import_app_user_csv() { $row++; } else { - if(!empty($data[$imei_no_index])){ + if (!empty($data[$imei_no_index])) { $unique_identifi = $data[$imei_no_index]; $query = $this->db->query("SELECT * FROM app_users WHERE is_deleted=0 AND app_id = '$app_id' AND imei_no='$unique_identifi'"); } - elseif(!empty($data[$login_user_index])){ + elseif (!empty($data[$login_user_index])) { $unique_identifi = $data[$login_user_index]; $query = $this->db->query("SELECT * FROM app_users WHERE is_deleted=0 AND app_id = '$app_id' AND login_user='$unique_identifi'"); } @@ -1176,11 +1176,11 @@ public function edit($slug) { } } $is_secure = $this->input->post('is_secure'); - if ($this->input->post('is_authorized')) + if ($this->input->post('is_authorized')){ $is_authorized = '1'; - else + } else { $is_authorized = '0'; - + } $change_icon = array( 'name' => $appName, 'icon' => $iconName, @@ -1690,47 +1690,47 @@ public function createapk($slug) { $high_resolution_image = 'YES'; } $persist_images_on_device = 'YES';//If image delete after activity - if(isset($app_general_setting->persist_images_on_device) && $app_general_setting->persist_images_on_device == 1){ + if (isset($app_general_setting->persist_images_on_device) && $app_general_setting->persist_images_on_device == 1) { $persist_images_on_device = 'NO';//if image not delete after activity } $background_update = 'YES';//If image delete after activity - if(isset($app_general_setting->background_update) && $app_general_setting->background_update == 0){ + if (isset($app_general_setting->background_update) && $app_general_setting->background_update == 0) { $background_update = 'NO';//if image not delete after activity } $force_update = 'YES';//If image delete after activity - if(isset($app_general_setting->force_update) && $app_general_setting->force_update == 0){ + if (isset($app_general_setting->force_update) && $app_general_setting->force_update == 0) { $force_update = 'NO';//if image not delete after activity } $enable_auto_time = 'YES'; - if(isset($app_general_setting->enable_auto_time) && $app_general_setting->enable_auto_time == 0){ + if (isset($app_general_setting->enable_auto_time) && $app_general_setting->enable_auto_time == 0) { $enable_auto_time = 'NO'; } $tracking_status = 'YES'; - if(isset($app_general_setting->tracking_status) && $app_general_setting->tracking_status == 0){ + if (isset($app_general_setting->tracking_status) && $app_general_setting->tracking_status == 0) { $tracking_status = 'NO'; } $tracking_interval = 5; - if(isset($app_general_setting->tracking_interval)){ + if (isset($app_general_setting->tracking_interval)) { $tracking_interval = $app_general_setting->tracking_interval; } $tracking_distance = 100; - if(isset($app_general_setting->tracking_distance)){ + if (isset($app_general_setting->tracking_distance)) { $tracking_distance = $app_general_setting->tracking_distance; } $debug_tracking = 'NO'; - if(isset($app_general_setting->debug_tracking) && $app_general_setting->debug_tracking == 1){ + if (isset($app_general_setting->debug_tracking) && $app_general_setting->debug_tracking == 1) { $debug_tracking = 'YES'; } $has_geo_fencing = 'NO'; - if(isset($app_general_setting->has_geo_fencing) && $app_general_setting->has_geo_fencing == 1){ + if (isset($app_general_setting->has_geo_fencing) && $app_general_setting->has_geo_fencing == 1) { $has_geo_fencing = 'YES'; } $debug_geo_fencing = 'NO'; - if(isset($app_general_setting->debug_geo_fencing) && $app_general_setting->debug_geo_fencing == 1){ + if (isset($app_general_setting->debug_geo_fencing) && $app_general_setting->debug_geo_fencing == 1) { $debug_geo_fencing = 'YES'; } @@ -1946,19 +1946,16 @@ function change_string_file($parray) { { $form_submit_url = "http://175.107.16.188:8081/fbrltu/Api/saverecords"; } - else if($parray['app_id'] == '13696') - { + elseif ($parray['app_id'] == '13696') { $form_submit_url = "http://175.107.16.188:8081/dev/Api/saverecords"; } - else if($parray['app_id'] == '13739') - { + elseif ($parray['app_id'] == '13739') { $form_submit_url = "http://202.142.188.174/fbrltu/Api/saverecords"; } - else if($parray['app_id'] == '13747') + elseif($parray['app_id'] == '13747') { $form_submit_url = "http://58.65.205.180/fbrltu/Api/saverecords"; - } - else{ + } else { $form_submit_url = $base_url . "api/saverecords"; } @@ -2180,7 +2177,7 @@ public function newappsettings($slug,$iframe=''){ $exclude_array = array('id', 'form_id','location_source','activity_datetime','created_datetime'); $possible_filters_array=array_diff($all_columns,$exclude_array); - if($i==1) { + if ($i==1) { $first_form_columns = $possible_filters_array; } $possible_and_defaults[$val['id']]['possible_filter_selected']=$possible_filter_selected; @@ -2190,40 +2187,40 @@ public function newappsettings($slug,$iframe=''){ $i++; } - if(!empty($settings_exist)){ + if (!empty($settings_exist)) { $settings_exist_new=array(); - foreach($settings_exist as $key=>$val){ + foreach ($settings_exist as $key=>$val) { $settings_exist_new[$val['setting_type']]=$val; } $result1=array_key_exists("GENERAL_SETTINGS",$settings_exist_new); - if($result1!=''){ + if ($result1!='') { $general_settings_filter=$settings_exist_new['GENERAL_SETTINGS']['filters']; } $result2=array_key_exists("FORM_SETTINGS",$settings_exist_new); - if($result2!=''){ + if ($result2!='') { $form_settings_filter=$settings_exist_new['FORM_SETTINGS']['filters']; } $result3=array_key_exists("RESULT_VIEW_SETTINGS",$settings_exist_new); - if($result3!=''){ + if ($result3!='') { $result_view_settings_filter=$settings_exist_new['RESULT_VIEW_SETTINGS']['filters']; } $result4=array_key_exists("MAP_VIEW_SETTINGS",$settings_exist_new); - if($result4!=''){ + if ($result4!='') { $map_view_settings_filter=$settings_exist_new['MAP_VIEW_SETTINGS']['filters']; } $result5=array_key_exists("GRAPH_VIEW_SETTINGS",$settings_exist_new); - if($result5!=''){ + if ($result5!='') { $graph_view_settings_filter=$settings_exist_new['GRAPH_VIEW_SETTINGS']['filters']; } $result6=array_key_exists("SMS_SETTINGS",$settings_exist_new); - if($result6!=''){ + if ($result6!='') { $sms_settings_filter=$settings_exist_new['SMS_SETTINGS']['filters']; } } - if(!empty($_POST)){ + if (!empty($_POST)) { $setting_type=$_POST['setting_type']; if($setting_type=="sms_settings"){ $selected_app = $this->app_model->get_app($app_id); @@ -2236,7 +2233,7 @@ public function newappsettings($slug,$iframe=''){ } else { $action = "update"; } - if(!isset($_POST['filters'])){ + if (!isset($_POST['filters'])) { $_POST['filters']=array(); } $json_string = json_encode($_POST); @@ -2250,12 +2247,12 @@ public function newappsettings($slug,$iframe=''){ $this->db->where('setting_type', $setting_type); } // Send message - foreach($users as $val){ + foreach ($users as $val) { $result=explode("_",$val); $mobile_number=$result[0]; $name=$result[1]; $message_to_send="Dear $name ,\r \n Application : $application_name\r \n$message\r \n From: ".PLATFORM_NAME." Support Team"; - if($mobile_number!=''){ + if ($mobile_number!='') { //send message send_sms($mobile_number,$message_to_send); } @@ -2265,7 +2262,7 @@ public function newappsettings($slug,$iframe=''){ echo "success"; } - }elseif($setting_type=="form_settings"){ + } elseif ($setting_type=="form_settings") { $form_id=$_POST['form_id']; $post_url=$_POST['post_url']; $row_key=$_POST['row_key']; @@ -2281,17 +2278,17 @@ public function newappsettings($slug,$iframe=''){ $this->db->where('id', $form_id); $this->db->update('form', $form_values); echo "success"; - }elseif($setting_type=="form_column_settings"){ + } elseif ($setting_type=="form_column_settings") { // echo "
";
// print_r($_POST);die;
$app_id=$_POST['app_id'];
$form_id=$_POST['form_id'];
$form_column_settings_exist = $this->app_model->get_form_column_settings($app_id);
- if(!empty($form_column_settings_exist)) {
+ if (!empty($form_column_settings_exist)) {
$form_column_settings_exist_db = (array)json_decode($form_column_settings_exist['columns'],true);
if (array_key_exists($form_id, $form_column_settings_exist_db)) {
unset($form_column_settings_exist[$form_id]);
- }else{
+ } else {
// $form_column_settings_exist=json_decode($form_column_settings_exist['columns'], true);
}
}
@@ -2300,7 +2297,7 @@ public function newappsettings($slug,$iframe=''){
// print_r(json_decode($columns,true));die;
if (empty($form_column_settings_exist)) {
$action = "insert";
- }else{
+ } else {
$action = "update";
}
@@ -2326,7 +2323,7 @@ public function newappsettings($slug,$iframe=''){
echo "success";
}
- }else{
+ } else {
$form_id=(isset($_POST['form'])) ? $_POST['form']:'';
$filters=(isset($_POST['filters'])) ? $_POST['filters']:'';
unset($_POST['filters']);
@@ -2344,7 +2341,7 @@ public function newappsettings($slug,$iframe=''){
$exist_form_filters=$exist_filters['filters'];
if (array_key_exists($form_id,$exist_form_filters)) {
$exist_form_filters[$form_id] = $filters;
- }else{
+ } else {
$exist_form_filters[$form_id] = $filters;
}
@@ -2366,20 +2363,20 @@ public function newappsettings($slug,$iframe=''){
echo "success";
}
}
- }else {
+ } else {
//get froms of this app...
$all_forms=$this->form_model->get_form_by_app($app_id);
//first form...
- foreach($all_forms as $key=>$val){
+ foreach ($all_forms as $key=>$val) {
$form_id=$val['form_id'];
$fields=$this->form_results_model->getTableHeadingsFromSchema("zform_".$form_id);
$exclude_array = array('id', 'form_id', 'is_deleted', 'location_source', 'created_datetime');
$filterd_fileds=array();
$required_fields=array();
$table_name="zform_$form_id";
- foreach($fields as $key1=>$list){
- if(!in_array($list['Field'],$exclude_array)){
+ foreach ($fields as $key1=>$list) {
+ if (!in_array($list['Field'],$exclude_array)) {
$column=$list['Field'];
//get values of this field...
// $column_result=$this->db->query("SELECT $column from $table_name")->result_array();
@@ -2391,8 +2388,8 @@ public function newappsettings($slug,$iframe=''){
$table_result = $this->form_results_model->getTableHeadingsFromSchema($table_name);
$schema_columns=array();
- foreach($table_result as $key=>$val){
- if(!in_array($val['COLUMN_NAME'],$exclude_array)) {
+ foreach ($table_result as $key=>$val) {
+ if (!in_array($val['COLUMN_NAME'],$exclude_array)) {
$schema_columns[$val['COLUMN_NAME']] = $val['COLUMN_NAME'];
}
}
@@ -2403,7 +2400,7 @@ public function newappsettings($slug,$iframe=''){
//get column settings for this app...
$column_settings=$this->form_model->get_column_settings($app_id);
- if(!empty($column_settings)){
+ if (!empty($column_settings)){
$column_settings=json_decode($column_settings['columns'],true);
}
// echo "";
@@ -2446,12 +2443,12 @@ public function newappsettings($slug,$iframe=''){
$data['schema_list'] = $schema_list;
$data['all_forms_columns'] = $all_forms_columns;
$data['column_settings'] = $column_settings;
- if($iframe!=''){
+ if ($iframe!='') {
$data['selected_tab']=$iframe;
}
// echo "";
// print_r($_REQUEST);die;
- if($iframe=='') {
+ if ($iframe=='') {
$this->load->view('templates/header', $data);
}
$this->load->view('app/new_app_settings', $data);
@@ -2490,20 +2487,20 @@ public function newformsettings($slug,$iframe=''){
$graph_view_settings_filter='';
$sms_settings_filter='';
$all_forms_columns=array();
- foreach($app_forms as $key=>$val){
+ foreach ($app_forms as $key=>$val) {
// get table columns name...
$possible_filter_selected=$val['possible_filters'];
$default_filter_selected=$val['filter'];
$table_columns=$this->form_results_model->getTableHeadingsFromSchema("zform_".$val['id']);
$all_columns=array();
- foreach($table_columns as $columns){
+ foreach ($table_columns as $columns) {
$all_columns[]=$columns["Field"];
}
$all_forms_columns[$val['id']]=$all_columns;
$exclude_array = array('id', 'form_id','location_source','activity_datetime','created_datetime');
$possible_filters_array=array_diff($all_columns,$exclude_array);
- if($i==1) {
+ if ($i==1) {
$first_form_columns = $possible_filters_array;
}
$possible_and_defaults[$val['id']]['possible_filter_selected']=$possible_filter_selected;
@@ -2513,34 +2510,34 @@ public function newformsettings($slug,$iframe=''){
$i++;
}
- if(!empty($settings_exist)){
+ if (!empty($settings_exist)) {
$settings_exist_new=array();
foreach($settings_exist as $key=>$val){
$settings_exist_new[$val['setting_type']]=$val;
}
$result1=array_key_exists("GENERAL_SETTINGS",$settings_exist_new);
- if($result1!=''){
+ if ($result1!='') {
$general_settings_filter=$settings_exist_new['GENERAL_SETTINGS']['filters'];
}
$result2=array_key_exists("FORM_SETTINGS",$settings_exist_new);
- if($result2!=''){
+ if ($result2!='') {
$form_settings_filter=$settings_exist_new['FORM_SETTINGS']['filters'];
}
$result3=array_key_exists("RESULT_VIEW_SETTINGS",$settings_exist_new);
- if($result3!=''){
+ if ($result3!='') {
$result_view_settings_filter=$settings_exist_new['RESULT_VIEW_SETTINGS']['filters'];
}
$result4=array_key_exists("MAP_VIEW_SETTINGS",$settings_exist_new);
- if($result4!=''){
+ if ($result4!='') {
$map_view_settings_filter=$settings_exist_new['MAP_VIEW_SETTINGS']['filters'];
}
$result5=array_key_exists("GRAPH_VIEW_SETTINGS",$settings_exist_new);
- if($result5!=''){
+ if ($result5!='') {
$graph_view_settings_filter=$settings_exist_new['GRAPH_VIEW_SETTINGS']['filters'];
}
$result6=array_key_exists("SMS_SETTINGS",$settings_exist_new);
- if($result6!=''){
+ if ($result6!='') {
$sms_settings_filter=$settings_exist_new['SMS_SETTINGS']['filters'];
}
@@ -2554,15 +2551,15 @@ public function newformsettings($slug,$iframe=''){
//get froms of this app...
$all_forms=$this->form_model->get_form_by_app($app_id);
//first form...
- foreach($all_forms as $key=>$val){
+ foreach ($all_forms as $key=>$val) {
$form_id=$val['form_id'];
$fields=$this->form_results_model->getTableHeadingsFromSchema("zform_".$form_id);
$exclude_array = array('id', 'form_id', 'is_deleted', 'location_source', 'created_datetime');
$filterd_fileds=array();
$required_fields=array();
$table_name="zform_$form_id";
- foreach($fields as $key1=>$list){
- if(!in_array($list['Field'],$exclude_array)){
+ foreach ($fields as $key1=>$list) {
+ if (!in_array($list['Field'],$exclude_array)) {
$column=$list['Field'];
//get values of this field...
$col_result_arr=array();
@@ -2573,8 +2570,8 @@ public function newformsettings($slug,$iframe=''){
$table_result = $this->form_results_model->getTableHeadingsFromSchema($table_name);
$schema_columns=array();
- foreach($table_result as $key=>$val){
- if(!in_array($val['COLUMN_NAME'],$exclude_array)) {
+ foreach ($table_result as $key=>$val) {
+ if (!in_array($val['COLUMN_NAME'],$exclude_array)) {
$schema_columns[$val['COLUMN_NAME']] = $val['COLUMN_NAME'];
}
}
@@ -2585,7 +2582,7 @@ public function newformsettings($slug,$iframe=''){
//get column settings for this app...
$column_settings=$this->form_model->get_column_settings($app_id);
- if(!empty($column_settings)){
+ if (!empty($column_settings)) {
$column_settings=json_decode($column_settings['columns'],true);
}
$this->load->library('form_validation');
@@ -2637,13 +2634,13 @@ public function get_field_values(){
$result=$this->db->query("select distinct $column from $table_name where $column LIKE '%$value%'")->result_array();
$i=0;
$options=array();
- foreach($result as $key=>$val){
+ foreach ($result as $key=>$val) {
$field_value = str_replace(" ", "_", $val[$column]);
$options[$i]['value']=$field_value;
$options[$i]['label']=$val[$column];
$i++;
}
- if(empty($options)){
+ if (empty($options)) {
$options[0]['value']="";
$options[0]['label']="No Result Found";
@@ -2665,9 +2662,9 @@ public function get_map_pins(){
}
public function get_name_pin(){
- if($_POST['value']==""){
+ if ($_POST['value']=="") {
- }else {
+ } else {
$value = str_replace("_", " ", $_POST['value']);
$column = $_POST['column'];
$form_id = $_POST['form_id'];
@@ -2711,7 +2708,7 @@ public function get_name_pin(){
public function get_saved_pins($form_id){
$result=$this->db->query("select pins from map_pin_settings where form_id='$form_id'")->result_array();
- if(!empty($result)) {
+ if (!empty($result)) {
return json_decode($result[0]['pins'], true);
}
}
@@ -2719,13 +2716,13 @@ public function get_saved_pins($form_id){
public function get_saved_pins_html(){
$form_id=$_POST['form_id'];
$result=$this->db->query("select pins from map_pin_settings where form_id='$form_id'")->result_array();
- if(!empty($result)) {
+ if (!empty($result)) {
$pins_data=json_decode($result[0]['pins'], true);
$table="";
- foreach($pins_data as $key=>$val){
+ foreach ($pins_data as $key=>$val) {
$key_new=strtoupper(str_replace("_"," ",$key));
$table.="$key_new ";
- foreach($val as $field=>$img){
+ foreach ($val as $field=>$img) {
$field=str_replace("_"," ",$field);
$image_url=base_url()."assets/images/map_pins/$img";
$table.="
@@ -2745,7 +2742,7 @@ public function get_saved_pins_html(){
}
public function save_pin_settings(){
- if(!empty($_POST)) {
+ if (!empty($_POST)) {
$field_name = $_POST['column'];
$form_id = $_POST['form_id'];
$field_value = $_POST['field_value'];
diff --git a/application/controllers/complaint.php b/application/controllers/complaint.php
index ee66033..de5d821 100644
--- a/application/controllers/complaint.php
+++ b/application/controllers/complaint.php
@@ -22,9 +22,6 @@ public function __construct() {
}
public function index() {
-
-
-
if ($this->session->userdata('logged_in')) {
$this->session->unset_userdata('view');
@@ -61,14 +58,12 @@ public function ajaxComplaints(){
// redirect($session_data['login_default_url']);
// }
- if($this->acl->hasPermission('complaint','view all complaints'))
- {
+ if ($this->acl->hasPermission('complaint','view all complaints')) {
$apps = $this->complaint_model->get_complaint(null,$_GET['iDisplayStart'], $_GET['iDisplayLength'], $_GET['sSearch'], $_GET['iSortCol_0'], $_GET['sSortDir_0'], $_GET['sSearch_0'], $_GET['sSearch_1'], $_GET['sSearch_2'], $_GET['sSearch_3'], $_GET['sSearch_4'], $_GET['sSearch_5'], $_GET['sSearch_6'], $_GET['sSearch_7'], $_GET['sSearch_8'], $_GET['sSearch_9']);
$get_all_complaints = $this->complaint_model->get_complaint(null,null, null, $_GET['sSearch'], $_GET['iSortCol_0'], $_GET['sSortDir_0'], $_GET['sSearch_0'], $_GET['sSearch_1'], $_GET['sSearch_2'], $_GET['sSearch_3'], $_GET['sSearch_4'], $_GET['sSearch_5'], $_GET['sSearch_6'], $_GET['sSearch_7'], $_GET['sSearch_8'], $_GET['sSearch_9']);
$total_complaints = count($get_all_complaints);
- }
- else{
+ } else {
$apps = $this->complaint_model->get_complaint($data['login_user_id'],$_GET['iDisplayStart'], $_GET['iDisplayLength'], $_GET['sSearch'], $_GET['iSortCol_0'], $_GET['sSortDir_0'], $_GET['sSearch_0'], $_GET['sSearch_1'], $_GET['sSearch_2'], $_GET['sSearch_3'], $_GET['sSearch_4'], $_GET['sSearch_5'], $_GET['sSearch_6'], $_GET['sSearch_7'], $_GET['sSearch_8'], $_GET['sSearch_9']);
@@ -106,13 +101,13 @@ public function ajaxComplaints(){
}
- if(count($apps)==0){
+ if (count($apps)==0) {
echo json_encode(array(
"iTotalRecords" => "0",
"iTotalDisplayRecords" => "0",
"aaData" => array()
));
- }else {
+ } else {
echo json_encode($data2);
}
@@ -179,7 +174,7 @@ public function add() {
$app_user_detail = $this->app_users_model->get_app_user_by_id($app_user_id);
$app_user_info = '';
- if($app_user_detail)
+ if ($app_user_detail)
$app_user_info = "
Mobile User Info :
User Name : ".$app_user_detail['user_name'].", IMEI# : ".$app_user_detail['imei_no'].", Mobile # : ".$app_user_detail['mobile_number'];
$complaints = $this->input->post('complaints');
@@ -200,20 +195,18 @@ public function add() {
$description = '';
$resolution_time = '';
- if($complaint=='Duplicate SIM'){
+ if ($complaint=='Duplicate SIM') {
$description = 'Address : '.$this->input->post('duplicate_sim_address');
$description .= '
Reason : '.$this->input->post('duplicate_sim_reason');
$complaint_array['duplicate_sim_address']=$this->input->post('duplicate_sim_address');
$complaint_array['duplicate_sim_reason']=$this->input->post('duplicate_sim_reason');
$resolution_time = "1 Working Day";
//$send_email = true;
- }
- elseif($complaint=='SIM blocked'){
+ } elseif ($complaint=='SIM blocked') {
$description = "Sim has been blocked";
$resolution_time = "30 Minutes";
//$send_email = true;
- }
- elseif($complaint=='Internet & Balance Issue'){
+ } elseif ($complaint=='Internet & Balance Issue') {
$description = "Internet and balance issue from ".$this->input->post('internet_issue_from_date');
$description .= ' to'.$this->input->post('internet_issue_to_date');
@@ -222,8 +215,7 @@ public function add() {
$resolution_time = "4 Hours";
//$send_email = true;
- }
- elseif($complaint=='Signal Problem'){
+ } elseif ($complaint=='Signal Problem') {
$description = "Signal problem in following area.
District : ".$this->input->post('signal_problem_district');
$description .= "
Tehsil : ".$this->input->post('signal_problem_tehsil');
$description .= "
Markaz : ".$this->input->post('signal_problem_markaz');
@@ -238,8 +230,7 @@ public function add() {
$resolution_time = "1 Working Day";
//$send_email = true;
- }
- elseif($complaint=='Balance Deduction'){
+ } elseif ($complaint=='Balance Deduction') {
$description = "Balance received on ".$this->input->post('balance_received_date');
$description .= "
Balance deduction on ".$this->input->post('balance_deduction_date');
@@ -247,15 +238,13 @@ public function add() {
$complaint_array['balance_deduction_date']=$this->input->post('balance_deduction_date');
$resolution_time = "4 Hours";
//$send_email = true;
- }
- elseif($complaint=='Sim Mapping/Activation'){
+ } elseif ($complaint=='Sim Mapping/Activation') {
$description = $this->input->post('sim_mapping_activation_comments')."
ICCID will add in change status page after resolve the issue";
$complaint_array['sim_mapping_activation_comments']=$this->input->post('sim_mapping_activation_comments');
$resolution_time = "2 Hours";
//$send_email = true;
- }
- elseif($complaint=='Ownership Change'){
+ } elseif ($complaint=='Ownership Change') {
$description = "New User Name : ".$this->input->post('ownership_user_name');
$description .= "
New User CNIC : ".$this->input->post('ownership_cnic');
$description .= "
User Designation : ".$this->input->post('ownership_designation');
@@ -267,18 +256,15 @@ public function add() {
$complaint_array['ownership_place']=$this->input->post('ownership_place');
$resolution_time = "2 Hours";
- }
- elseif($complaint=='User Status Change'){
+ } elseif ($complaint=='User Status Change') {
$description = "User status change as : ".$this->input->post('user_status_change');
$complaint_array['user_status_change']=$this->input->post('user_status_change');
$resolution_time = "2 Hours";
- }
- elseif($complaint=='IMEI Update'){
+ } elseif ($complaint=='IMEI Update') {
$description = "Change IMEI# as : ".$this->input->post('imei_update');
$complaint_array['imei_update']=$this->input->post('imei_update');
$resolution_time = "2 Hours";
- }
- elseif($complaint=='Mark Leave'){
+ } elseif ($complaint=='Mark Leave') {
$description = "Leave Type : ".$this->input->post('leave_type');
$description .= "
Leave From : ".$this->input->post('leave_from_date');
$description .= " to ".$this->input->post('leave_to_date');
@@ -303,8 +289,7 @@ public function add() {
}
}
- }
- elseif($complaint=='Login Credentials Issues'){
+ } elseif ($complaint=='Login Credentials Issues') {
$description = "User Name : ".$this->input->post('login_user_name');
$description .= "
Old Password : ".$this->input->post('login_old_password');
$description .= "
New Password : ".$this->input->post('login_new_password');
@@ -314,8 +299,7 @@ public function add() {
$complaint_array['login_new_password']=$this->input->post('login_new_password');
$complaint_array['login_issue_reason']=$this->input->post('login_issue_reason');
$resolution_time = "1 Working Day";
- }
- elseif($complaint=='User Transferred'){
+ } elseif ($complaint=='User Transferred') {
$description = "Transfered to following area :
District : ".$this->input->post('transfered_district');
$description .= "
Tehsil : ".$this->input->post('transfered_tehsil');
$description .= "
Markaz : ".$this->input->post('transfered_markaz');
@@ -329,7 +313,7 @@ public function add() {
$complaint_array['transfered_village']=$this->input->post('transfered_village');
$resolution_time = "2 Hours";
}
- elseif($complaint=='Dashboard Not Working'){
+ elseif ($complaint=='Dashboard Not Working') {
//upload image
$description = $this->input->post('dashboard_not_working_comments');
$complaint_array['dashboard_not_working_comments']=$this->input->post('dashboard_not_working_comments');
@@ -353,7 +337,7 @@ public function add() {
}
}
- elseif($complaint=='User Showing Absent on dashboard'){
+ elseif ($complaint=='User Showing Absent on dashboard') {
//upload image
$description = $this->input->post('showing_absent_dashboard_comments');
$complaint_array['showing_absent_dashboard_comments']=$this->input->post('showing_absent_dashboard_comments');
@@ -377,7 +361,7 @@ public function add() {
}
}
- elseif($complaint=='Activities Missing'){
+ elseif ($complaint=='Activities Missing') {
//upload image
$description = $this->input->post('activities_missing_comments');
$complaint_array['activities_missing_comments']=$this->input->post('activities_missing_comments');
@@ -403,7 +387,7 @@ public function add() {
}
- elseif($complaint=='Data Not Showing'){
+ elseif ($complaint=='Data Not Showing') {
$description = "Data not showing from ".$this->input->post('data_missing_from_date');
$description .= " to ".$this->input->post('data_missing_to_date');
$description .= "
Comments : ".$this->input->post('data_missing_comments');
@@ -432,27 +416,27 @@ public function add() {
}
- elseif($complaint=='App not Working'){
+ elseif ($complaint=='App not Working') {
$description = $this->input->post('app_not_working_error');
$complaint_array['app_not_working_error']=$this->input->post('app_not_working_error');
$resolution_time = "1 Working Day";
}
- elseif($complaint=='App Crash/Foreced Stopped'){
+ elseif ($complaint=='App Crash/Foreced Stopped') {
//$description = $this->input->post('name_update_desc');
$description = "Application has been crash or stopped on my device";
$resolution_time = "1 Working Day";
}
- elseif($complaint=='APK Required'){
+ elseif ($complaint=='APK Required') {
$description = $this->input->post('apk_required_email');
$complaint_array['apk_required_email']=$this->input->post('apk_required_email');
$resolution_time = "2 Hours";
}
- elseif($complaint=='Unautherized User'){
+ elseif ($complaint=='Unautherized User') {
$description = "Add IMEI : ".$this->input->post('unautherized_user_imei');
$complaint_array['unautherized_user_imei']=$this->input->post('unautherized_user_imei');
$resolution_time = "2 Hours";
}
- elseif($complaint=='Other'){
+ elseif ($complaint=='Other') {
$description = $this->input->post('other_comments');
$resolution_time = "24 Hours";
}
@@ -467,7 +451,7 @@ public function add() {
$complaint_array['c_description']=$description.$app_user_info;
$complaint_id = $this->complaint_model->add_complaint($complaint_array);
- if(!empty($image_array)){
+ if (!empty($image_array)) {
$image_array['cp_complaint_id_Fk'] = $complaint_id;
$this->db->insert('complaint_photo', $image_array);
unset($image_array);
@@ -520,7 +504,7 @@ public function edit($complaint_id)
$this->load->view('templates/header', $data);
$this->load->view('complaint/edit', $data);
$this->load->view('templates/footer', $data);
- }else {
+ } else {
//If no session, redirect to login page
redirect(base_url());
}
@@ -590,7 +574,7 @@ public function send_email_telco()
$session_data = $this->session->userdata('logged_in');
$changed_by_user = $session_data['login_user_id'];
- foreach($telco_list as $key_t => $telco_value) {
+ foreach ($telco_list as $key_t => $telco_value) {
$this->email->from(SUPPORT_EMAIL, SUPPORT_NAME);
$this->email->to($telco_value['support_email']);
@@ -622,10 +606,10 @@ public function get_app_user_ajax()
$cnic = $_REQUEST['cnic'];
$user_data = $this->app_users_model->get_app_user_by_cnic($app_id,$cnic);
//print_r($user_data);
- if($user_data){
+ if ($user_data) {
$data2 = array('status'=>true,'user_rec'=>$user_data);
}
- else{
+ else {
$data2 = array('status'=>false);
}
echo json_encode($data2);
@@ -637,7 +621,7 @@ public function get_complaints_by(){
$complaint_by_data = $this->complaint_model->get_complaint_by_all();
$string = array();
- foreach($complaint_by_data as $key=>$val) {
+ foreach ($complaint_by_data as $key=>$val) {
$string[] = array('value'=>$val['id'],'label'=>$val['user_name']);
}
echo json_encode($string);
@@ -648,7 +632,7 @@ public function get_application_all(){
$complaint_by_data = $this->complaint_model->get_applications_all();
$string = array();
- foreach($complaint_by_data as $key=>$val) {
+ foreach ($complaint_by_data as $key=>$val) {
$string[] = array('value'=>$val['id'],'label'=>$val['app_name']);
}
echo json_encode($string);
diff --git a/application/controllers/cron.php b/application/controllers/cron.php
index e4bf5cf..7f11a5e 100644
--- a/application/controllers/cron.php
+++ b/application/controllers/cron.php
@@ -92,23 +92,23 @@ public function post_missing_activity_record(){
$query_result = $this->db->query($query);
$results = $query_result->result_array();
- if(count($results)>0){
- if($range_row){
+ if (count($results)>0) {
+ if ($range_row) {
$last_rec_index = $results[count($results) - 1];
$this->db->where('id', $range_row->id);
$this->db->update('cron', array('log_id'=>$last_rec_index['id'] , 'run_datetime' => $run_datetime));
}
- }else{
+ } else {
$min_log = mysql_query( "SELECT min(id) as minid FROM mobile_activity_log where error IS NULL");
$min_log_row = mysql_fetch_object($min_log);
$last_row_id = 0;
- if($min_log_row){
+ if ($min_log_row) {
$last_row_id = $min_log_row->minid;
//$run_datetime = date('Y-m-d H:i:s');
- if($range_row){
+ if ($range_row) {
$this->db->where('id', $range_row->id);
$this->db->update('cron', array('log_id'=>$last_row_id , 'run_datetime' => $run_datetime));
}
@@ -125,7 +125,7 @@ public function post_missing_activity_record(){
$query_result->free_result();
- if(count($results) > 0){
+ if (count($results) > 0) {
foreach ($results as $r_key => $r_value) {
$form_data = json_decode($r_value ['form_data']);
@@ -171,18 +171,18 @@ public function post_missing_activity_record(){
}
$record[$key] = 'SHOW RECORDS';
}
- } else if ($cap_first [0] == 'caption') {
+ } elseif ($cap_first [0] == 'caption') {
$captions_images[$key] = $v;
- } else if ($key == 'caption_sequence') {
+ } elseif ($key == 'caption_sequence') {
$caption_sequence = urldecode($v);
} elseif ($key == 'form_id' || $key == 'row_key' || $key == 'security_key' || $key == "dateTime" || $key == "landing_page" || $key == "is_take_picture" || $key == 'form_icon_name') {
} else {
- if(empty($form_info['security_key'])){
+ if (empty($form_info['security_key'])) {
$vdcode = urldecode(base64_decode($v));
}
- else if(strpos($v, $form_info['security_key']) !== FALSE){
+ elseif (strpos($v, $form_info['security_key']) !== FALSE) {
$vdcode = urldecode(base64_decode(str_replace($form_info['security_key'], '', $v)));
}
else {
@@ -200,23 +200,24 @@ public function post_missing_activity_record(){
$warning_message = '';
$app_map_view_setting = get_map_view_settings($app_id);
- if(isset($app_map_view_setting->map_distance_mapping) && $app_map_view_setting->map_distance_mapping)//if Distance maping on then call this block
- {
+ if (isset($app_map_view_setting->map_distance_mapping) && $app_map_view_setting->map_distance_mapping) { //if Distance maping on then call this block
+
$saved_distance=500;
- if($app_map_view_setting->distance !== ''){//if distance not given then default distance will assign as 500
+ if ($app_map_view_setting->distance !== '') {//if distance not given then default distance will assign as 500
$saved_distance=$app_map_view_setting->distance;
}
$matching_value = $record[$app_map_view_setting->matching_field]; //this field name getting from setting and getting value from received json
- $kml_poligon_rec = $this->db->get_where('kml_poligon', array('app_id' => $app_id, 'type' => 'distence','matching_value' => $matching_value))->row_array();
+ $kml_poligon_rec = $this->db->get_where('kml_poligon', array(
+ 'app_id' => $app_id,
+ 'type' => 'distence',
+ 'matching_value' => $matching_value))->row_array();
- if(!empty($kml_poligon_rec)){
+ if (!empty($kml_poligon_rec)) {
$lat_long = explode(',', $location);//Received location from mobile device
$distance_from_center = lan_lng_distance($kml_poligon_rec['latitude'], $kml_poligon_rec['longitude'],$lat_long[0], $lat_long[1]);
- if($distance_from_center > $saved_distance)
- {
+ if ($distance_from_center > $saved_distance) {
$warning_message = 'Your location mismatched. ';
- }
- else{
+ } else {
$warning_message = 'You are on right location' ;
}
}
@@ -232,21 +233,21 @@ public function post_missing_activity_record(){
$uc = getUcName($location); // Get UC name against location
if ($uc) {
$uc_name = strip_tags($uc);
- }else{
+ } else {
$err_msg.="UC api return null, ";
}
$town = getTownName($location); // Get Town name against location
if ($town) {
$town_name = strip_tags($town);
- }else{
+ } else {
$err_msg.="TOWN api return null, ";
}
$district = getDistrictName($location); // Get Town name against location
if ($district) {
$district_name = strip_tags($district);
- }else{
+ } else {
$err_msg.="District api return null, ";
}
}
@@ -269,8 +270,7 @@ public function post_missing_activity_record(){
//this is for evaccs partition
if (strpos($_SERVER ['SERVER_NAME'], 'monitoring.punjab.gov') !== false) {
- if($form_id == 21 || $form_id == 20)
- {
+ if ($form_id == 21 || $form_id == 20) {
$dataresultnew['created_datetime_partition']=$created_datetime;
}
@@ -291,11 +291,10 @@ public function post_missing_activity_record(){
if (!(in_array(strtolower($element), $fields_list))) {
$fields_count = $this->db->list_fields('zform_' . $form_id);
$fields_count = array_map('strtolower', $fields_count);
- if(count($fields_count) < 90){
+ if (count($fields_count) < 90) {
$field = array($element => array('type' => 'VARCHAR', 'constraint' => 200, 'NULL' => TRUE));
$this->dbforge->add_column('zform_' . $form_id, $field, $after_field);
- }else
- {
+ } else {
$field = array($element => array('type' => 'TEXT', 'NULL' => TRUE));
$this->dbforge->add_column('zform_' . $form_id, $field, $after_field);
}
@@ -309,10 +308,10 @@ public function post_missing_activity_record(){
//print_r($dataresultnew1);
foreach ($dataresultnew1 as $key => $value) {
$key = strtolower($key);
- if(array_key_exists($key, $final_array)){
+ if (array_key_exists($key, $final_array)) {
$final_array[$key] = $final_array[$key].','.$value;
- }else{
+ } else {
$final_array[$key] = $value;
}
@@ -321,11 +320,11 @@ public function post_missing_activity_record(){
// print_r($final_array);
// print "";
//exit;
- try{
+ try {
//echo $r_value['id'];
$ret_ins = $this->db->insert( 'zform_'.$form_id, $final_array );
- if(!$ret_ins){
+ if (!$ret_ins) {
$err_msg .= $this->db->_error_message();
$pos = strpos($err_msg, 'Duplicate Entry');
if ($pos !== false) {
@@ -334,14 +333,13 @@ public function post_missing_activity_record(){
}
$this->form_results_model->update_mobile_activity($r_value['id'],array('error'=>$err_msg));
continue;
- }
- else{
+ } else {
$form_result_id_new = $this->db->insert_id();
echo $r_value['id'].' => Form Id = '.$form_id.'---App Id='.$app_id.' was Inserted Successfully and cleared cache
';
$this->form_results_model->remove_mobile_activity($r_value['id']);
}
- }catch (Exception $e) {
+ } catch (Exception $e) {
//$err_msg .= $this->db->_error_message();
@@ -356,7 +354,7 @@ public function post_missing_activity_record(){
}
- if(!empty($sub_table_record)) {
+ if (!empty($sub_table_record)) {
foreach ($sub_table_record as $sb_key => $sb_value) {
$subtable_name = 'zform_' . $form_id . '_' . $sb_key;
foreach ($sb_value as $sub_array) {
@@ -399,7 +397,7 @@ public function post_missing_activity_record(){
$post_url = '';
if (!empty($form_info ['post_url'])) {
$post_url = $form_info ['post_url'];
- } else if (!empty($form_info ['fv_post_url'])) {
+ } elseif (!empty($form_info ['fv_post_url'])) {
$post_url = $form_info ['fv_post_url'];
}
@@ -453,7 +451,7 @@ public function image_move_in_local_folder(){
$this->db->from('zform_images');
if (strpos($_SERVER ['SERVER_NAME'], 'monitoring.punjab.gov') !== false) {
$this->db->like('image', 'monitoring.punjab.gov.pk/assets');
- }else{
+ } else {
$this->db->like('image', 'dataplug.itu.edu.pk/assets');
//$this->db->like('image', 'godk.itu.edu.pk/assets');
}
@@ -465,7 +463,7 @@ public function image_move_in_local_folder(){
$image_array_post = array();
$count_succ = 0;
$count_fail = 0;
- if(!empty($img_available1)){
+ if (!empty($img_available1)) {
foreach ($img_available1 as $image_data) {
$image_id = $image_data['id'];
$form_id = $image_data['form_id'];
@@ -475,7 +473,7 @@ public function image_move_in_local_folder(){
$app_result = $app_query->row_array();
$app_id = $app_result['app_id'];
- if($app_result['is_deleted'] == 0){
+ if ($app_result['is_deleted'] == 0) {
$url = $image_data['image'];
$url_explode = explode("/", $url);
@@ -483,12 +481,12 @@ public function image_move_in_local_folder(){
$image_name = $url_explode[$image_index];
if (strpos($_SERVER ['SERVER_NAME'], 'monitoring.punjab.gov') !== false) {
$source_path = "/var/www/vhosts/monitoring.punjab.gov.pk/htdoc/assets/images/data/form-data/".$image_name;
- }else{
+ } else {
$source_path = "/var/www/vhosts/dataplug.itu.edu.pk/htdoc/assets/images/data/form-data/".$image_name;
//$source_path = "/var/www/vhosts/godk.itu.edu.pk/htdoc/assets/images/data/form-data/".$image_name;
}
$dest_path = NFS_IMAGE_PATH."/app_id_$app_id/".$image_name;
- if(file_exists($source_path)){
+ if (file_exists($source_path)) {
$count_succ++;
@mkdir(NFS_IMAGE_PATH.'/app_id_'.$app_id);
copy($source_path, $dest_path);
@@ -496,11 +494,10 @@ public function image_move_in_local_folder(){
$this->db->where('id',$image_id);
$this->db->update('zform_images',array('image'=>$dest_path));
unlink($source_path);
- }else{
- if(file_exists($dest_path)){
+ } else {
+ if (file_exists($dest_path)) {
- }
- else{
+ } else {
$this->db->delete('zform_images',array('id'=>$image_id));
$count_fail++;
}
@@ -532,7 +529,7 @@ public function image_move_nfs_to_nfs(){
$this->db->like('image', 'ppmrp-live.s3.amazonaws.com');
$this->db->limit(300000,100000);
- }else{
+ } else {
$this->db->like('image', 'dataplug-live.s3.amazonaws.com');
$this->db->limit(100000);
}
@@ -543,7 +540,7 @@ public function image_move_nfs_to_nfs(){
$image_array_post = array();
$count_succ = 0;
$count_fail = 0;
- if(!empty($img_available1)){
+ if (!empty($img_available1)) {
foreach ($img_available1 as $image_data) {
$image_id = $image_data['id'];
$form_id = $image_data['form_id'];
@@ -553,7 +550,7 @@ public function image_move_nfs_to_nfs(){
$app_result = $app_query->row_array();
$app_id = $app_result['app_id'];
- if($app_result['is_deleted'] == 0){
+ if ($app_result['is_deleted'] == 0) {
$url = $image_data['image'];
$url_explode = explode("/", $url);
@@ -562,11 +559,11 @@ public function image_move_nfs_to_nfs(){
//$source_path = "/var/www/vhosts/monitoring.punjab.gov.pk/htdoc/assets/images/data/form-data/".$image_name;
if (strpos($_SERVER ['SERVER_NAME'], 'monitoring.punjab.gov') !== false) {
$source_path = "/NFS-PPMRP/s3/ppmrp-live/".$image_name;
- }else{
+ } else {
$source_path = "/NFS-Dataplug/s3/dataplug-live/".$image_name;
}
$dest_path = NFS_IMAGE_PATH."/app_id_$app_id/".$image_name;
- if(file_exists($source_path)){
+ if (file_exists($source_path)) {
$count_succ++;
@mkdir(NFS_IMAGE_PATH.'/app_id_'.$app_id);
copy($source_path, $dest_path);
@@ -576,11 +573,10 @@ public function image_move_nfs_to_nfs(){
//unlink($source_path);
//echo "File deleted because Successfully copied = ".$source_path." ==>".$dest_path;
- }else{
- if(file_exists($dest_path)){
+ } else {
+ if (file_exists($dest_path)) {
- }
- else{
+ } else {
//$this->db->delete('zform_images',array('id'=>$image_id));
//echo "Image table record deleted because file not exist = ".$source_path;
$count_fail++;
diff --git a/application/controllers/customreports.php b/application/controllers/customreports.php
index 1e621ba..ef87636 100644
--- a/application/controllers/customreports.php
+++ b/application/controllers/customreports.php
@@ -102,7 +102,7 @@ public function dashboard($slug) {
$from_date = '';
$data['from_date'] = '';
$data['to_date'] = '';
- if(isset($_REQUEST['from_date'])){
+ if (isset($_REQUEST['from_date'])) {
$to_date = $_REQUEST['to_date'];
$from_date = $_REQUEST['from_date'];
$data['from_date'] = $from_date;
@@ -112,7 +112,7 @@ public function dashboard($slug) {
$final_district_wise_array2 = array();
$filter_result = get_graph_view_settings($selected_form['app_id']);
- if($new_category==""){
+ if ($new_category=="") {
$new_category="district_name";
}
foreach ($new_category_list as $cat_listv) {
@@ -193,7 +193,7 @@ public function dashboard($slug) {
$this->load->view('templates/header', $data);
$this->load->view('graph/custom_reports', $data);
$this->load->view('templates/footer', $data);
- }else {
+ } else {
redirect(base_url());
}
}
@@ -256,7 +256,7 @@ public function exportdistrictreport($slug) {
// print "";
// print_r($new_category_list);
// exit;
- if($new_category==""){
+ if ($new_category=="") {
$new_category="district_name";
}
$data['category_list'] = $new_category_list;
@@ -1045,7 +1045,7 @@ public function graph_type($slug) {
$data['graph_text'] = 'Data Records By Users';
$data['graph_type'] = $graph_type;
$this->load->view('graph/dashboard_partial', $data);
- } else if ($graph_type == 'category') {
+ } elseif ($graph_type == 'category') {
$data_array = $this->get_category_list($slug);
$category_list = $data_array['category_list'];
$filter_attribute = $data_array['filter_attribute'];