Ejemplo n.º 1
0
 private function dcms_save()
 {
     $user = User_helper::get_user();
     $data = array();
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $data['suggestion'] = $this->input->post('suggestion');
         $data['date'] = date('Y-m-d');
         $data['uisc_id'] = $user->uisc_id;
         $data['created'] = $user->id;
         $data['user_id'] = $user->id;
         $this->db->trans_start();
         //DB Transaction Handle START
         Query_helper::add($this->config->item('table_suggestion'), $data);
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
             $this->dcms_add();
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 2
0
 public function login()
 {
     $user = User_helper::get_user();
     if ($user) {
         $this->dashboard_page();
     } else {
         if ($this->input->post()) {
             if (User_helper::login($this->input->post("username"), $this->input->post("password"))) {
                 $user = User_helper::get_user();
                 $user_info['user_id'] = $user->id;
                 $user_info['login_time'] = time();
                 $user_info['ip_address'] = $this->input->ip_address();
                 $user_info['request_headers'] = json_encode($this->input->request_headers());
                 Query_helper::add($this->config->item('table_user_login_history'), $user_info);
                 $this->dashboard_page($this->lang->line("MSG_LOGIN_SUCCESS"));
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_USERNAME_PASSWORD_INVALID");
                 $this->jsonReturn($ajax);
             }
         } else {
             $this->login_page();
             //login page view
         }
     }
 }
Ejemplo n.º 3
0
 public function index($service_id)
 {
     $user = User_helper::get_user();
     $time = time();
     $service_info = Query_helper::get_info($this->config->item('table_api_services'), '*', array('status =1', 'id =' . $service_id), 1);
     if ($service_info) {
         $data['auth_token'] = random_string('unique') . $time;
         $data['user_id'] = $user->id;
         $data['service_id'] = $service_id;
         $data['time'] = $time;
         $data['status'] = 1;
         $id = Query_helper::add($this->config->item('table_api_auth_token'), $data);
         if ($id) {
             redirect($service_info['service_url'] . $data['auth_token'], 'refresh');
         } else {
             echo "Unable to save data";
         }
     } else {
         echo "invalid service";
     }
 }
Ejemplo n.º 4
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $user_id = $this->input->post('user_id');
         //$row_id=$this->input->post('row_id');
         $ticket_issue_id = $this->input->post('ticket_issue_id');
         $ticket_priority = $this->input->post('ticket_priority');
         $count = count($this->input->post('row_id'));
         if ($id > 0) {
             //                unset($ticket_detail['id']);
             //
             //                $ticket_detail['update_by']=$user->id;
             //                $ticket_detail['update_date']=time();
             //
             //                $this->db->trans_start();  //DB Transaction Handle START
             //
             //                Query_helper::update($this->config->item('table_ticket_assign'),$ticket_detail,array("id = ".$id));
             //
             //                $this->db->trans_complete();   //DB Transaction Handle END
             //
             //                if ($this->db->trans_status() === TRUE)
             //                {
             //                    $this->message=$this->lang->line("MSG_UPDATE_SUCCESS");
             //                    $save_and_new=$this->input->post('system_save_new_status');
             //                    if($save_and_new==1)
             //                    {
             //                        $this->system_add();
             //                    }
             //                    else
             //                    {
             //                        $this->system_list();
             //                    }
             //                }
             //                else
             //                {
             //                    $ajax['status']=false;
             //                    $ajax['system_message']=$this->lang->line("MSG_UPDATE_FAIL");
             //                    $this->jsonReturn($ajax);
             //                }
         } else {
             $ticket_detail['status'] = $this->config->item('STATUS_ASSIGN');
             $ticket_detail['create_by'] = $user->id;
             $ticket_detail['create_date'] = time();
             $ticket_issue_detail['status'] = $this->config->item('STATUS_ASSIGN');
             $ticket_issue_detail['update_by'] = $user->id;
             $ticket_issue_detail['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             for ($i = 0; $i < $count; $i++) {
                 if (isset($ticket_issue_id[$i])) {
                     $ticket_detail['user_id'] = $user_id;
                     $ticket_detail['ticket_issue_id'] = $ticket_issue_id[$i];
                     $ticket_detail['priority'] = $ticket_priority[$i];
                     Query_helper::add($this->config->item('table_ticket_assign'), $ticket_detail);
                     Query_helper::update($this->config->item('table_ticket_issue'), $ticket_issue_detail, array("id = " . $ticket_issue_id[$i]));
                 }
             }
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 5
0
 private function system_save()
 {
     $user = User_helper::get_user();
     if (!$this->permissions['add']) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
         $this->jsonReturn($ajax);
         die;
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $data = $this->input->post('product_assign');
         $data['create_by'] = $user->id;
         $data['create_date'] = time();
         $data['status'] = 1;
         $data['assign_date'] = strtotime($data['assign_date']);
         $data['return_date'] = strtotime($data['return_date']);
         $this->db->trans_start();
         //DB Transaction Handle START
         $inserted_product = array();
         foreach ($data['product_id'] as $product) {
             $data['product_id'] = $product;
             if (!in_array($product, $inserted_product)) {
                 Query_helper::add($this->config->item('table_product_assign'), $data);
             }
             $inserted_product[] = $product;
         }
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
             $save_and_new = $this->input->post('system_save_new_status');
             if ($save_and_new == 1) {
                 $this->system_add();
             } else {
                 $this->system_list();
             }
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 6
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $supplier_detail = $this->input->post('supplier');
         if ($id > 0) {
             unset($supplier_detail['id']);
             $supplier_detail['update_by'] = $user->id;
             $supplier_detail['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_supplier'), $supplier_detail, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $supplier_detail['status'] = $this->config->item('STATUS_ACTIVE');
             $supplier_detail['create_by'] = $user->id;
             $supplier_detail['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_supplier'), $supplier_detail);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 7
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if (!$this->permissions['edit']) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
         $this->jsonReturn($ajax);
         die;
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $tasks = $this->input->post('tasks');
         $user_group_id = $this->input->post('id');
         $time = time();
         $this->db->trans_start();
         //DB Transaction Handle START
         foreach ($tasks as $task) {
             $data = array();
             if (isset($task['list']) && $task['list'] == 1) {
                 $data['list'] = 1;
             } else {
                 $data['list'] = 0;
             }
             if (isset($task['view']) && $task['view'] == 1) {
                 $data['view'] = 1;
             } else {
                 $data['view'] = 0;
             }
             if (isset($task['add']) && $task['add'] == 1) {
                 $data['add'] = 1;
             } else {
                 $data['add'] = 0;
             }
             if (isset($task['edit']) && $task['edit'] == 1) {
                 $data['edit'] = 1;
             } else {
                 $data['edit'] = 0;
             }
             if (isset($task['delete']) && $task['delete'] == 1) {
                 $data['delete'] = 1;
             } else {
                 $data['delete'] = 0;
             }
             if (isset($task['report']) && $task['report'] == 1) {
                 $data['report'] = 1;
             } else {
                 $data['report'] = 0;
             }
             if (isset($task['print']) && $task['print'] == 1) {
                 $data['print'] = 1;
             } else {
                 $data['print'] = 0;
             }
             if ($data['view'] || $data['add'] || $data['edit'] || $data['delete'] || $data['report'] || $data['print']) {
                 $data['list'] = 1;
             }
             if ($task['ugr_id'] > 0) {
                 $data['update_by'] = $user->id;
                 $data['update_date'] = $time;
                 Query_helper::update($this->config->item('table_user_group_role'), $data, array("id = " . $task['ugr_id']));
             } else {
                 $data['user_group_id'] = $user_group_id;
                 $data['component_id'] = $task['component_id'];
                 $data['module_id'] = $task['module_id'];
                 $data['task_id'] = $task['task_id'];
                 $data['create_by'] = $user->id;
                 $data['create_date'] = $time;
                 Query_helper::add($this->config->item('table_user_group_role'), $data);
             }
         }
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_ROLE_ASSIGN_SUCCESS");
             $this->system_list();
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_ROLE_ASSIGN_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 8
0
Archivo: Module.php Proyecto: mazba/ams
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $data = array('name_en' => $this->input->post('name_en'), 'name_bn' => $this->input->post('name_bn'), 'component_id' => $this->input->post('component_id'), 'icon' => $this->input->post('icon'), 'description' => $this->input->post('description'), 'ordering' => $this->input->post('ordering'), 'status' => $this->input->post('status'));
         if ($id > 0) {
             $data['update_by'] = $user->id;
             $data['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_module'), $data, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $data['create_by'] = $user->id;
             $data['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_module'), $data);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 9
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $data = $this->input->post('product');
         $dir = $this->config->item("file_upload");
         $uploaded = System_helper::upload_file($dir['users'], 1024, 'gif|jpg|png|doc|pdf|xls|xlsx');
         $attachment = '';
         if (array_key_exists('attachment', $uploaded)) {
             if ($uploaded['attachment']['status']) {
                 $attachment = $uploaded['attachment']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->message .= $uploaded['attachment']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         if ($id > 0) {
             unset($data['id']);
             $data['update_by'] = $user->id;
             $data['attachment'] = $attachment;
             $data['status'] = 1;
             $data['warranty_start_date'] = strtotime($data['warranty_start_date']);
             $data['warranty_end_date'] = strtotime($data['warranty_end_date']);
             $data['purchase_date'] = strtotime($data['purchase_date']);
             $data['update_date'] = time();
             $data['product_code'] = $data['product_code'][0];
             $data['serial_number'] = $data['serial_number'][0];
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_product'), $data, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $data['create_by'] = $user->id;
             $data['create_date'] = time();
             $data['status'] = 1;
             $data['attachment'] = $attachment;
             $data['warranty_start_date'] = strtotime($data['warranty_start_date']);
             $data['warranty_end_date'] = strtotime($data['warranty_end_date']);
             $data['purchase_date'] = strtotime($data['purchase_date']);
             $data['quantity'] = 1;
             $product_code = $data['product_code'];
             $serial_number = $data['serial_number'];
             unset($data['product_code']);
             unset($data['serial_number']);
             $this->db->trans_start();
             //DB Transaction Handle START
             foreach ($product_code as $key => $code) {
                 $data['product_code'] = $code;
                 $data['serial_number'] = $serial_number[$key];
                 Query_helper::add($this->config->item('table_product'), $data);
             }
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 10
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $media_info = $this->input->post('media');
         $dir = $this->config->item("dcms_upload");
         if ($media_info['media_type'] == 1) {
             $directory = $dir['media_photo'];
             unset($media_info['video_link']);
             unset($media_info['print_year']);
             unset($media_info['external_link']);
         } elseif ($media_info['media_type'] == 2) {
             $directory = $dir['media_photo'];
             unset($media_info['print_year']);
             unset($media_info['external_link']);
         } elseif ($media_info['media_type'] == 3) {
             $directory = $dir['media_print'];
             unset($media_info['video_link']);
         } elseif ($media_info['media_type'] == 4) {
             $directory = $dir['media_publication'];
             unset($media_info['video_link']);
             unset($media_info['print_year']);
         }
         $uploaded = System_helper::upload_file($directory, 5120, 'gif|jpg|png|pdf|doc|docx');
         if (array_key_exists('file_name', $uploaded)) {
             if ($uploaded['file_name']['status']) {
                 $media_info['file_name'] = $uploaded['file_name']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->message .= $uploaded['file_name']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         if ($id > 0) {
             unset($media_info['id']);
             $media_info['update_by'] = $user->id;
             $media_info['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_media'), $media_info, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $media_info['create_by'] = $user->id;
             $media_info['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_media'), $media_info);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 11
0
 private function system_save()
 {
     //print_r($this->input->post());exit;
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $notice_detail = $this->input->post('notice_detail');
         $notice_detail_general = array();
         $notice_detail_specific = array();
         $dir = $this->config->item("dcms_upload");
         $uploaded = System_helper::upload_file($dir['notice'], 5120, 'gif|jpg|png|pdf');
         if (array_key_exists('upload_file', $uploaded)) {
             if ($uploaded['upload_file']['status']) {
                 $notice_detail['upload_file'] = $uploaded['upload_file']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['desk_message'] = $this->message .= $uploaded['upload_file']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         if ($id > 0) {
             unset($notice_detail['id']);
             $this->db->trans_start();
             //DB Transaction Handle START
             $notice_detail['update_by'] = $user->id;
             $notice_detail['update_date'] = time();
             Query_helper::update($this->config->item('table_notice'), $notice_detail, array("id = " . $id));
             if ($notice_detail['notice_type'] == 1) {
                 $general_user_groups = $this->input->post('general_user_group');
                 // Initial Update
                 $this->notice_create_model->initial_notice_update($id);
                 $existing_general_viewers = $this->notice_create_model->existing_viewer_groups($id);
                 foreach ($general_user_groups as $general_user_group) {
                     if (in_array($general_user_group, $existing_general_viewers)) {
                         $notice_detail_general['status'] = $this->config->item('STATUS_ACTIVE');
                         Query_helper::update($this->config->item('table_notice_view'), $notice_detail_general, array("notice_id = " . $id, "viewer_user_group =" . $general_user_group));
                     } else {
                         $notice_detail_general['viewer_user_group'] = $general_user_group;
                         $notice_detail_general['sender_user_group'] = $user->user_group_id;
                         $notice_detail_general['notice_id'] = $id;
                         $notice_detail_general['status'] = $notice_detail['status'];
                         Query_helper::add($this->config->item('table_notice_view'), $notice_detail_general);
                     }
                 }
             } elseif ($notice_detail['notice_type'] == 2) {
                 $sup_group_post = $this->input->post('sub_group');
                 if (sizeof($sup_group_post) > 0) {
                     // Initial Update
                     $this->notice_create_model->initial_notice_update($id);
                     $existing_specific_viewers = $this->notice_create_model->existing_viewer_groups($id);
                     foreach ($sup_group_post as $sup_group) {
                         if (in_array($sup_group, $existing_specific_viewers)) {
                             $notice_detail_specific['status'] = $this->config->item('STATUS_ACTIVE');
                             Query_helper::update($this->config->item('table_notice_view'), $notice_detail_specific, array("notice_id = " . $id, "viewer_user_group=" . $sup_group));
                         } else {
                             $notice_detail_specific['viewer_user_group'] = $sup_group;
                             $notice_detail_specific['sender_user_group'] = $user->user_group_id;
                             $notice_detail_specific['notice_id'] = $id;
                             $notice_detail_specific['division'] = $this->input->post('division');
                             $notice_detail_specific['zilla'] = $this->input->post('zilla');
                             $notice_detail_specific['upazila'] = $this->input->post('upazila');
                             $notice_detail_specific['unioun'] = $this->input->post('union');
                             $notice_detail_specific['citycorporation'] = $this->input->post('city_corporation');
                             $notice_detail_specific['citycorporationward'] = $this->input->post('city_corporation_ward');
                             $notice_detail_specific['municipal'] = $this->input->post('municipal');
                             $notice_detail_specific['municipalward'] = $this->input->post('municipal_ward');
                             $notice_detail_specific['uisc_id'] = $this->input->post('digital_center');
                             $notice_detail_specific['status'] = $notice_detail['status'];
                             Query_helper::add($this->config->item('table_notice_view'), $notice_detail_specific);
                         }
                     }
                 } else {
                     $notice_detail_specific['viewer_user_group'] = $this->input->post('specific_user_level');
                     $notice_detail_specific['sender_user_group'] = $user->user_group_id;
                     $notice_detail_specific['notice_id'] = $id;
                     $notice_detail_specific['division'] = $this->input->post('division');
                     $notice_detail_specific['zilla'] = $this->input->post('zilla');
                     $notice_detail_specific['upazila'] = $this->input->post('upazila');
                     $notice_detail_specific['unioun'] = $this->input->post('union');
                     $notice_detail_specific['citycorporation'] = $this->input->post('city_corporation');
                     $notice_detail_specific['citycorporationward'] = $this->input->post('city_corporation_ward');
                     $notice_detail_specific['municipal'] = $this->input->post('municipal');
                     $notice_detail_specific['municipalward'] = $this->input->post('municipal_ward');
                     $notice_detail_specific['uisc_id'] = $this->input->post('digital_center');
                     $notice_detail_specific['status'] = $notice_detail['status'];
                     Query_helper::update($this->config->item('table_notice_view'), $notice_detail_specific, array("notice_id = " . $id));
                 }
             }
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $notice_detail['create_by'] = $user->id;
             $notice_detail['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             $notice_id = Query_helper::add($this->config->item('table_notice'), $notice_detail);
             if ($notice_detail['notice_type'] == 1) {
                 $general_user_groups = $this->input->post('general_user_group');
                 foreach ($general_user_groups as $general_user_group) {
                     $notice_detail_general['viewer_user_group'] = $general_user_group;
                     $notice_detail_general['sender_user_group'] = $user->user_group_id;
                     $notice_detail_general['notice_id'] = $notice_id;
                     $notice_detail_general['status'] = $notice_detail['status'];
                     Query_helper::add($this->config->item('table_notice_view'), $notice_detail_general);
                 }
             } elseif ($notice_detail['notice_type'] == 2) {
                 $sup_group_post = $this->input->post('sub_group');
                 if (sizeof($sup_group_post) > 0) {
                     foreach ($sup_group_post as $sup_group) {
                         $notice_detail_specific['viewer_user_group'] = $sup_group;
                         $notice_detail_specific['sender_user_group'] = $user->user_group_id;
                         $notice_detail_specific['notice_id'] = $notice_id;
                         $notice_detail_specific['division'] = $this->input->post('division');
                         $notice_detail_specific['zilla'] = $this->input->post('zilla');
                         $notice_detail_specific['upazila'] = $this->input->post('upazila');
                         $notice_detail_specific['unioun'] = $this->input->post('union');
                         $notice_detail_specific['citycorporation'] = $this->input->post('city_corporation');
                         $notice_detail_specific['citycorporationward'] = $this->input->post('city_corporation_ward');
                         $notice_detail_specific['municipal'] = $this->input->post('municipal');
                         $notice_detail_specific['municipalward'] = $this->input->post('municipal_ward');
                         $notice_detail_specific['uisc_id'] = $this->input->post('digital_center');
                         $notice_detail_specific['status'] = $notice_detail['status'];
                         Query_helper::add($this->config->item('table_notice_view'), $notice_detail_specific);
                     }
                 } else {
                     $notice_detail_specific['viewer_user_group'] = $this->input->post('specific_user_level');
                     $notice_detail_specific['sender_user_group'] = $user->user_group_id;
                     $notice_detail_specific['notice_id'] = $notice_id;
                     $notice_detail_specific['division'] = $this->input->post('division');
                     $notice_detail_specific['zilla'] = $this->input->post('zilla');
                     $notice_detail_specific['upazila'] = $this->input->post('upazila');
                     $notice_detail_specific['unioun'] = $this->input->post('union');
                     $notice_detail_specific['citycorporation'] = $this->input->post('city_corporation');
                     $notice_detail_specific['citycorporationward'] = $this->input->post('city_corporation_ward');
                     $notice_detail_specific['municipal'] = $this->input->post('municipal');
                     $notice_detail_specific['municipalward'] = $this->input->post('municipal_ward');
                     $notice_detail_specific['uisc_id'] = $this->input->post('digital_center');
                     $notice_detail_specific['status'] = $notice_detail['status'];
                     Query_helper::add($this->config->item('table_notice_view'), $notice_detail_specific);
                 }
             }
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 12
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $zilla_detail = $this->input->post('zilla_detail');
         if ($id > 0) {
             //$zilla_detail['update_by']=$user->id;
             //$zilla_detail['update_date']=time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_zillas'), $zilla_detail, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             //$zilla_detail['create_by']=$user->id;
             //$zilla_detail['create_date']=time();
             $divid = $zilla_detail['divid'];
             $zillas = Query_helper::get_info($this->config->item('table_zillas'), array('MAX(zillaid) as max_zilla_id'), array("divid = " . $divid));
             if (strlen($zillas[0]['max_zilla_id'] + 1) == 1) {
                 $zillaid = "0" . ($zillas[0]['max_zilla_id'] + 1);
             } else {
                 $zillaid = $zillas[0]['max_zilla_id'] + 1;
             }
             $zilla_detail['zillaid'] = $zillaid;
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_zillas'), $zilla_detail);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 13
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $comment_detail = $this->input->post('comment');
         if ($id > 0) {
             $this->db->trans_start();
             //DB Transaction Handle START
             if ($user->user_group_level == $this->config->item('SUPPORT_GROUP_ID')) {
                 $comment_detail['type'] = $this->config->item('ticket_comment_support_user');
                 $comment_detail['ticket_assign_id'] = $id;
                 $comment_detail['create_by'] = $user->id;
                 $comment_detail['create_date'] = time();
                 Query_helper::add($this->config->item('table_ticket_resolve_comment'), $comment_detail);
             } elseif ($user->user_group_level == $this->config->item('OFFICER_GROUP_ID')) {
                 $comment_detail['type'] = $this->config->item('ticket_comment_manager');
                 $comment_detail['ticket_assign_id'] = $id;
                 $comment_detail['create_by'] = $user->id;
                 $comment_detail['create_date'] = time();
                 Query_helper::add($this->config->item('table_ticket_resolve_comment'), $comment_detail);
                 $ticket_issue_detail['update_by'] = $user->id;
                 $ticket_issue_detail['create_date'] = time();
                 if (!empty($comment_detail['ticket_status_id'])) {
                     $ticket_issue_detail['status'] = $comment_detail['ticket_status_id'];
                 } else {
                     unset($ticket_issue_detail['status']);
                 }
                 Query_helper::update($this->config->item('table_ticket_issue'), $ticket_issue_detail, array("id = " . $comment_detail['ticket_issue_id']));
                 $ticket_assign_detail['update_by'] = $user->id;
                 $ticket_assign_detail['create_date'] = time();
                 if (!empty($comment_detail['ticket_status_id'])) {
                     $ticket_assign_detail['status'] = $comment_detail['ticket_status_id'];
                 } else {
                     unset($ticket_assign_detail['status']);
                 }
                 Query_helper::update($this->config->item('table_ticket_assign'), $ticket_assign_detail, array("id = " . $id));
             } elseif ($user->user_group_level == $this->config->item('END_GROUP_ID')) {
                 $comment_detail['type'] = $this->config->item('ticket_comment_end_user');
                 $comment_detail['ticket_assign_id'] = $id;
                 $comment_detail['create_by'] = $user->id;
                 $comment_detail['create_date'] = time();
                 Query_helper::add($this->config->item('table_ticket_resolve_comment'), $comment_detail);
             } else {
             }
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             //                $comment_detail['status']=$this->config->item('STATUS_PENDING');
             //                $comment_detail['create_by']=$user->id;
             //                $comment_detail['create_date']=time();
             //
             //                $ticket_issue_detail['status']=$this->config->item('STATUS_ASSIGN');
             //                $ticket_issue_detail['create_by']=$user->id;
             //                $ticket_issue_detail['create_date']=time();
             //
             //                $this->db->trans_start();  //DB Transaction Handle START
             //                for($i=0;$i<$count;$i++)
             //                {
             //                    if(isset($ticket_issue_id[$i]))
             //                    {
             //                        //echo $ticket_issue_id[$i]."<br />";
             //                        $comment_detail['user_id']=$user_id;
             //                        $comment_detail['ticket_issue_id']=$ticket_issue_id[$i];
             //                        Query_helper::add($this->config->item('table_ticket_resolve'),$comment_detail);
             //                        Query_helper::update($this->config->item('table_ticket_issue'),$ticket_issue_detail,array("id = ".$ticket_issue_id[$i]));
             //                    }
             //                }
             //
             //                $this->db->trans_complete();   //DB Transaction Handle END
             //
             //                if ($this->db->trans_status() === TRUE)
             //                {
             //                    $this->message=$this->lang->line("MSG_CREATE_SUCCESS");
             //                    $save_and_new=$this->input->post('system_save_new_status');
             //                    if($save_and_new==1)
             //                    {
             //                        $this->system_add();
             //                    }
             //                    else
             //                    {
             //                        $this->system_list();
             //                    }
             //                }
             //                else
             //                {
             //                    $ajax['status']=false;
             //                    $ajax['system_message']=$this->lang->line("MSG_CREATE_FAIL");
             //                    $this->jsonReturn($ajax);
             //                }
         }
     }
 }
Ejemplo n.º 14
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $userDetail = $this->input->post('user_detail');
         if ($id > 0) {
             if ($userDetail['password'] != "") {
                 $encryptPass = md5(md5($userDetail['password']));
                 unset($userDetail['password']);
                 unset($userDetail['confirm_password']);
                 $userDetail['password'] = $encryptPass;
             } else {
                 unset($userDetail['password']);
                 unset($userDetail['confirm_password']);
             }
         } else {
             $encryptPass = md5(md5($userDetail['password']));
             unset($userDetail['password']);
             unset($userDetail['confirm_password']);
             $userDetail['password'] = $encryptPass;
         }
         $user_group_id_level = explode('-', $this->input->post("user_detail[user_group_id]"));
         $user_group_id = $user_group_id_level[0];
         $user_group_level = $user_group_id_level[1];
         $userDetail['user_group_id'] = $user_group_id;
         if ($user_group_level == $this->config->item('SUPER_ADMIN_GROUP_ID') || $user_group_level == $this->config->item('A_TO_I_GROUP_ID') || $user_group_level == $this->config->item('DONOR_GROUP_ID') || $user_group_level == $this->config->item('MINISTRY_GROUP_ID')) {
             $userDetail['division'] = '';
             $userDetail['zilla'] = '';
             $userDetail['upazila'] = '';
             $userDetail['unioun'] = '';
             $userDetail['citycorporation'] = '';
             $userDetail['citycorporationward'] = '';
             $userDetail['municipal'] = '';
             $userDetail['municipalward'] = '';
             $userDetail['uisc_id'] = 0;
         } else {
             if ($user_group_level == $this->config->item('DIVISION_GROUP_ID')) {
                 $userDetail['zilla'] = '';
                 $userDetail['upazila'] = '';
                 $userDetail['unioun'] = '';
                 $userDetail['citycorporation'] = '';
                 $userDetail['citycorporationward'] = '';
                 $userDetail['municipal'] = '';
                 $userDetail['municipalward'] = '';
                 $userDetail['uisc_id'] = 0;
             } else {
                 if ($user_group_level == $this->config->item('DISTRICT_GROUP_ID')) {
                     $userDetail['upazila'] = '';
                     $userDetail['unioun'] = '';
                     $userDetail['citycorporation'] = '';
                     $userDetail['citycorporationward'] = '';
                     $userDetail['municipal'] = '';
                     $userDetail['municipalward'] = '';
                     $userDetail['uisc_id'] = 0;
                 } else {
                     if ($user_group_level == $this->config->item('UPAZILLA_GROUP_ID')) {
                         $userDetail['unioun'] = '';
                         $userDetail['citycorporation'] = '';
                         $userDetail['citycorporationward'] = '';
                         $userDetail['municipal'] = '';
                         $userDetail['municipalward'] = '';
                         $userDetail['uisc_id'] = 0;
                     } else {
                         if ($user_group_level == $this->config->item('UNION_GROUP_ID')) {
                             $userDetail['citycorporation'] = '';
                             $userDetail['citycorporationward'] = '';
                             $userDetail['municipal'] = '';
                             $userDetail['municipalward'] = '';
                             $userDetail['uisc_id'] = 0;
                         } else {
                             if ($user_group_level == $this->config->item('CITY_CORPORATION_GROUP_ID')) {
                                 $userDetail['citycorporationward'] = '';
                                 $userDetail['municipal'] = '';
                                 $userDetail['municipalward'] = '';
                                 $userDetail['uisc_id'] = 0;
                             } else {
                                 if ($user_group_level == $this->config->item('CITY_CORPORATION_WORD_GROUP_ID')) {
                                     $userDetail['municipal'] = '';
                                     $userDetail['municipalward'] = '';
                                     $userDetail['uisc_id'] = 0;
                                 } else {
                                     if ($user_group_level == $this->config->item('MUNICIPAL_GROUP_ID')) {
                                         $userDetail['municipalward'] = '';
                                         $userDetail['uisc_id'] = 0;
                                     } else {
                                         if ($user_group_level == $this->config->item('MUNICIPAL_WORD_GROUP_ID')) {
                                             $userDetail['uisc_id'] = 0;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //            $dir=$this->config->item("system_upload");
         //            $uploaded_img = System_helper::upload_file($dir['user'],10240,'jpg|jpeg|png');
         //
         //            if(is_array($uploaded_img) && sizeof($uploaded_img)>0)
         //            {
         //                foreach($uploaded_img as $img)
         //                {
         //                    $userDetail['picture_name'] = $img['info']['file_name'];
         //                }
         //            }
         //            else
         //            {
         //                $userDetail['picture_name'] = 'no_image.jpg';
         //            }
         if ($id > 0) {
             $userDetail['update_by'] = $user->id;
             $userDetail['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_users'), $userDetail, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $userDetail['create_by'] = $user->id;
             $userDetail['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_users'), $userDetail);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 15
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $time = time();
         $user_id = $id;
         $uisc_id = $this->input->post('uisc_id');
         if ($id > 0) {
             $this->db->trans_start();
             //DB Transaction Handle START
             $dir = $this->config->item("dcms_upload");
             $uploaded = System_helper::upload_file($dir['entrepreneur'], 10240, 'gif|jpg|png');
             if (array_key_exists('profile_image', $uploaded)) {
                 if ($uploaded['profile_image']['status']) {
                     $user_data['picture_name'] = $uploaded['profile_image']['info']['file_name'];
                     Query_helper::update($this->config->item('table_users'), $user_data, array("id = " . $user_id));
                 } else {
                     $ajax['status'] = false;
                     $ajax['system_message'] = $this->message .= $uploaded['profile_image']['message'] . '<br>';
                     $this->jsonReturn($ajax);
                 }
             }
             // User Table update
             $user_update_data = array();
             $user_update_data['name_bn'] = $this->input->post('entrepreneur_name');
             $user_update_data['name_en'] = $this->input->post('entrepreneur_name');
             Query_helper::update($this->config->item('table_users'), $user_update_data, array("id = " . $id));
             //////// START CHAIRMEN INFO ////////
             $chairmen_info['update_by'] = $user->id;
             $chairmen_info['update_date'] = $time;
             //$chairmen_info['user_id']=$user_id;
             $chairmen_info['uisc_id'] = $uisc_id;
             $chairmen_info['chairmen_name'] = $this->input->post('chairmen_name');
             $chairmen_info['chairmen_mobile'] = $this->input->post('chairmen_mobile');
             $chairmen_info['chairmen_email'] = $this->input->post('chairmen_email');
             $chairmen_info['chairmen_address'] = $this->input->post('chairmen_address');
             if ($this->input->post('chairmen_id') > 0) {
                 Query_helper::update($this->config->item('table_entrepreneur_chairmen_info'), $chairmen_info, array("id = " . $this->input->post('chairmen_id')));
             } else {
                 Query_helper::add($this->config->item('table_entrepreneur_chairmen_info'), $chairmen_info);
             }
             //////// END CHAIRMEN INFO ////////
             //////// START SECRETARY_RELATED_INFO ////////
             $secretary_info['update_by'] = $user->id;
             $secretary_info['update_date'] = $time;
             $secretary_info['user_id'] = $user_id;
             $secretary_info['uisc_id'] = $uisc_id;
             $secretary_info['secretary_name'] = $this->input->post('secretary_name');
             $secretary_info['secretary_mobile'] = $this->input->post('secretary_mobile');
             $secretary_info['secretary_email'] = $this->input->post('secretary_email');
             $secretary_info['secretary_address'] = $this->input->post('secretary_address');
             if ($this->input->post('secretary_id') > 0) {
                 Query_helper::update($this->config->item('table_secretary_infos'), $secretary_info, array("id = " . $this->input->post('secretary_id')));
             } else {
                 Query_helper::add($this->config->item('table_secretary_infos'), $secretary_info);
             }
             //////// END SECRETARY_RELATED_INFO ////////
             //////// START ENTREPRENEUR_RELATED_INFO ////////
             $entrepreneur_info['update_by'] = $user->id;
             $entrepreneur_info['update_date'] = $time;
             $entrepreneur_info['user_id'] = $user_id;
             $entrepreneur_info['uisc_id'] = $uisc_id;
             $entrepreneur_info['entrepreneur_type'] = $this->input->post('entrepreneur_exp_type');
             $entrepreneur_info['entrepreneur_name'] = $this->input->post('entrepreneur_name');
             $entrepreneur_info['entrepreneur_mother_name'] = $this->input->post('entrepreneur_mother_name');
             $entrepreneur_info['entrepreneur_father_name'] = $this->input->post('entrepreneur_father_name');
             $entrepreneur_info['entrepreneur_mobile'] = $this->input->post('entrepreneur_mobile');
             $entrepreneur_info['entrepreneur_email'] = $this->input->post('entrepreneur_email');
             $entrepreneur_info['entrepreneur_sex'] = $this->input->post('entrepreneur_sex');
             $entrepreneur_info['entrepreneur_address'] = $this->input->post('entrepreneur_address');
             $entrepreneur_info['entrepreneur_nid'] = $this->input->post('entrepreneur_nid');
             $entrepreneur_info['entrepreneur_bank_name'] = $this->input->post('entrepreneur_bank_name');
             $entrepreneur_info['entrepreneur_bank_account_no'] = $this->input->post('entrepreneur_bank_account_no');
             $entrepreneur_info['entrepreneur_bank_holder_name'] = $this->input->post('entrepreneur_bank_holder_name');
             $entrepreneur_info['entrepreneur_blog_member'] = $this->input->post('entrepreneur_blog_member');
             $entrepreneur_info['entrepreneur_fb_group_member'] = $this->input->post('entrepreneur_fb_group_member');
             //$entrepreneur_info['ques_id']=$this->input->post('ques_id');
             //$entrepreneur_info['ques_ans']=$this->input->post('ques_ans');
             if ($this->input->post('entrepreneur_id') > 0) {
                 Query_helper::update($this->config->item('table_entrepreneur_infos'), $entrepreneur_info, array("id = " . $this->input->post('entrepreneur_id')));
             } else {
                 Query_helper::add($this->config->item('table_entrepreneur_infos'), $entrepreneur_info);
             }
             //////// END ENTREPRENEUR_RELATED_INFO ////////
             //////// START EDUCATION_RELATED_INFO ////////
             $education_info['update_by'] = $user->id;
             $education_info['update_date'] = $time;
             $education_info['user_id'] = $user_id;
             $education_info['uisc_id'] = $uisc_id;
             $education_info['latest_education'] = $this->input->post('latest_education');
             $education_info['passing_year'] = $this->input->post('passing_year');
             if ($this->input->post('education_id') > 0) {
                 Query_helper::update($this->config->item('table_entrepreneur_education'), $education_info, array("id = " . $this->input->post('education_id')));
             } else {
                 Query_helper::add($this->config->item('table_entrepreneur_education'), $education_info);
             }
             //////// END EDUCATION_RELATED_INFO ////////
             //////// START ENTREPRENEUR_TRAINING_RELATED_INFO ////////
             $training_info['update_by'] = $user->id;
             $training_info['update_date'] = $time;
             $training_info['user_id'] = $user_id;
             $training_info['uisc_id'] = $uisc_id;
             $training_id = $this->input->post('training_id');
             $course_name = $this->input->post('training_course');
             $institute_name = $this->input->post('training_institute');
             $timespan = $this->input->post('training_time');
             for ($noc = 0; $noc < sizeof($training_id); $noc++) {
                 $training_info['course_name'] = $course_name[$noc];
                 $training_info['institute_name'] = $institute_name[$noc];
                 $training_info['timespan'] = $timespan[$noc];
                 if (empty($training_id[$noc])) {
                     Query_helper::add($this->config->item('table_training'), $training_info);
                 } else {
                     Query_helper::update($this->config->item('table_training'), $training_info, array("id = " . $training_id[$noc]));
                 }
             }
             //////// END ENTREPRENEUR_TRAINING_RELATED_INFO ////////
             //////// START INVESTMENT_RELATED_INFO ////////
             $investment_info['update_by'] = $user->id;
             $investment_info['update_date'] = $time;
             $investment_info['user_id'] = $user_id;
             $investment_info['uisc_id'] = $uisc_id;
             $investment_info['self_investment'] = System_helper::Get_Bng_to_Eng(trim($this->input->post('self_investment')));
             $investment_info['invest_debt'] = System_helper::Get_Bng_to_Eng(trim($this->input->post('invest_debt')));
             $investment_info['invested_money'] = System_helper::Get_Bng_to_Eng(trim($this->input->post('self_investment'))) + System_helper::Get_Bng_to_Eng(trim($this->input->post('invest_debt')));
             //System_helper::Get_Bng_to_Eng(trim($this->input->post('invested_money')));
             $investment_info['invest_sector'] = $this->input->post('invest_sector');
             if ($this->input->post('investment_id') > 0) {
                 Query_helper::update($this->config->item('table_investment'), $investment_info, array("id = " . $this->input->post('investment_id')));
             } else {
                 Query_helper::add($this->config->item('table_investment'), $investment_info);
             }
             //////// END INVESTMENT_RELATED_INFO ////////
             //////// START CENTER_LOCATION_RELATED_INFO ////////
             $location_info['update_by'] = $user->id;
             $location_info['update_date'] = $time;
             $location_info['user_id'] = $user_id;
             $location_info['uisc_id'] = $uisc_id;
             $location_info['center_type'] = $this->input->post('center_location');
             if ($this->input->post('location_id') > 0) {
                 Query_helper::update($this->config->item('table_center_location'), $location_info, array("id = " . $this->input->post('location_id')));
             } else {
                 Query_helper::add($this->config->item('table_center_location'), $location_info);
             }
             //////// END CENTER_LOCATION_RELATED_INFO ////////
             //////// START EQUIPMENT ////////
             $resources_info['update_by'] = $user->id;
             $resources_info['update_date'] = $time;
             $resources_info['user_id'] = $user_id;
             $resources_info['uisc_id'] = $uisc_id;
             $resources_id = $this->input->post('resources_id');
             $res_id = $this->input->post('res_id');
             $res_detail = $this->input->post('res_detail');
             $quantity = $this->input->post('quantity');
             $status = $this->input->post('status');
             for ($nor = 0; $nor < sizeof($resources_id); $nor++) {
                 $resources_info['res_id'] = $res_id[$nor];
                 $resources_info['res_detail'] = $res_detail[$nor];
                 $resources_info['quantity'] = $quantity[$nor];
                 $resources_info['status'] = $status[$nor];
                 if (empty($resources_id[$nor])) {
                     Query_helper::add($this->config->item('table_uisc_resources'), $resources_info);
                 } else {
                     Query_helper::update($this->config->item('table_uisc_resources'), $resources_info, array("id = " . $resources_id[$nor]));
                 }
             }
             //////// END EQUIPMENT ////////
             //////// START DEVICE_RELATED_INFO ////////
             $device_info['update_by'] = $user->id;
             $device_info['update_date'] = $time;
             $device_info['user_id'] = $user_id;
             $device_info['uisc_id'] = $uisc_id;
             $device_info['connection_type'] = $this->input->post('connection_type');
             $device_info['modem'] = $this->input->post('modem');
             $device_info['ip_address'] = $this->input->post('ip_address');
             if ($this->input->post('device_id') > 0) {
                 Query_helper::update($this->config->item('table_device_infos'), $device_info, array("id = " . $this->input->post('device_id')));
             } else {
                 Query_helper::add($this->config->item('table_device_infos'), $device_info);
             }
             //////// END DEVICE_RELATED_INFO ////////
             //////// START ELECTRICITY_RELATED_INFO ////////
             $electricity_info['update_by'] = $user->id;
             $electricity_info['update_date'] = $time;
             $electricity_info['user_id'] = $user_id;
             $electricity_info['uisc_id'] = $uisc_id;
             $electricity_info['electricity'] = $this->input->post('electricity');
             $electricity_info['solar'] = $this->input->post('solar');
             $electricity_info['ips'] = $this->input->post('ips');
             if ($this->input->post('electricity_id') > 0) {
                 Query_helper::update($this->config->item('table_electricity'), $electricity_info, array("id = " . $this->input->post('electricity_id')));
             } else {
                 Query_helper::add($this->config->item('table_electricity'), $electricity_info);
             }
             //////// END ELECTRICITY_RELATED_INFO ////////
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $userDetail['create_by'] = $user->id;
             $userDetail['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_users'), $userDetail);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 16
0
 private function system_save()
 {
     $user = User_helper::get_user();
     if (!$this->permissions['add']) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
         $this->jsonReturn($ajax);
         die;
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $data = $this->input->post('requisition');
         $data['create_by'] = $user->id;
         $data['create_date'] = time();
         $data['user_id'] = $user->id;
         $this->load->helper('string');
         $data['requisition_id'] = time() . random_string('alpha', 3);
         $this->db->trans_start();
         //DB Transaction Handle START
         Query_helper::add($this->config->item('table_requisition'), $data);
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
             $save_and_new = $this->input->post('system_save_new_status');
             if ($save_and_new == 1) {
                 $this->system_add();
             } else {
                 $this->system_list();
             }
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 17
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $userDetail = $this->input->post('user_detail');
         if ($id > 0) {
             if ($userDetail['password'] != "") {
                 $encryptPass = md5(md5($userDetail['password']));
                 unset($userDetail['password']);
                 unset($userDetail['confirm_password']);
                 $userDetail['password'] = $encryptPass;
             } else {
                 unset($userDetail['password']);
                 unset($userDetail['confirm_password']);
             }
         } else {
             $encryptPass = md5(md5($userDetail['password']));
             unset($userDetail['password']);
             unset($userDetail['confirm_password']);
             $userDetail['password'] = $encryptPass;
         }
         $user_group_id_level = explode('-', $this->input->post("user_detail[user_group_id]"));
         $user_group_id = $user_group_id_level[0];
         //$user_group_level=$user_group_id_level[1];
         $userDetail['user_group_id'] = $user_group_id;
         $date_of_birth = strtotime($userDetail['dob']);
         $userDetail['dob'] = $date_of_birth;
         $dir = $this->config->item("file_upload");
         $uploaded = System_helper::upload_file($dir['users'], 1024, 'gif|jpg|png');
         if (array_key_exists('picture_name', $uploaded)) {
             if ($uploaded['picture_name']['status']) {
                 $userDetail['picture_name'] = $uploaded['picture_name']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->message .= $uploaded['picture_name']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         if ($id > 0) {
             unset($userDetail['id']);
             $userDetail['update_by'] = $user->id;
             $userDetail['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_users'), $userDetail, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $userDetail['status'] = $this->config->item('STATUS_ACTIVE');
             $userDetail['create_by'] = $user->id;
             $userDetail['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_users'), $userDetail);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 18
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $notice_detail = $this->input->post('notice_detail');
         $dir = $this->config->item("dcms_upload");
         $uploaded = System_helper::upload_file($dir['notice'], 1024, 'gif|jpg|png|pdf');
         if (array_key_exists('upload_file', $uploaded)) {
             if ($uploaded['upload_file']['status']) {
                 $notice_detail['upload_file'] = $uploaded['upload_file']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['desk_message'] = $this->message .= $uploaded['upload_file']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         if ($this->input->post('public_notice') && $this->input->post('public_notice') == 1) {
             $notice_detail['public_status'] = 1;
         } else {
             $notice_detail['public_status'] = 0;
         }
         if ($id > 0) {
             unset($notice_detail['id']);
             $notice_detail['update_by'] = $user->id;
             $notice_detail['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_notice'), $notice_detail, array("id = " . $id));
             $notice_inactive['status'] = $this->config->item('STATUS_INACTIVE');
             Query_helper::update($this->config->item('table_notice_view'), $notice_inactive, array("notice_id = " . $id));
             $user_group_id = $this->input->post('user_group_id');
             $count = sizeof($user_group_id);
             for ($i = 0; $i < $count; $i++) {
                 $check_box_elm = "viewer_group_id_" . $user_group_id[$i];
                 if ($this->input->post($check_box_elm)) {
                     $check_box_id = $this->input->post($check_box_elm);
                     $notice_view_detail['viewer_group_id'] = $check_box_id;
                     $notice_view_detail['create_group_id'] = $user->user_group_id;
                     $notice_view_detail['notice_id'] = $id;
                     $notice_view_detail['status'] = $notice_detail['status'];
                     Query_helper::add($this->config->item('table_notice_view'), $notice_view_detail);
                 }
             }
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $notice_detail['create_by'] = $user->id;
             $notice_detail['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             $notice_id = Query_helper::add($this->config->item('table_notice'), $notice_detail);
             $user_group_id = $this->input->post('user_group_id');
             $count = sizeof($user_group_id);
             for ($i = 0; $i < $count; $i++) {
                 $check_box_elm = "viewer_group_id_" . $user_group_id[$i];
                 if ($this->input->post($check_box_elm)) {
                     $check_box_id = $this->input->post($check_box_elm);
                     $notice_view_detail['viewer_group_id'] = $check_box_id;
                     $notice_view_detail['create_group_id'] = $user->user_group_id;
                     $notice_view_detail['notice_id'] = $notice_id;
                     $notice_view_detail['status'] = $notice_detail['status'];
                     Query_helper::add($this->config->item('table_notice_view'), $notice_view_detail);
                 }
             }
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 19
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         if ($id > 0) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
             $this->jsonReturn($ajax);
         } else {
             $data = array();
             $user_id = $user->id;
             $uisc_id = $user->uisc_id;
             $data['uisc_id'] = $uisc_id;
             $data['user_id'] = $user_id;
             $data['question'] = $this->input->post('question');
             $data['user_type'] = $this->input->post('user_group');
             $data['create_by'] = $user_id;
             $data['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_faqs'), $data);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 20
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $ticket_detail = $this->input->post('ticket');
         $dir = $this->config->item("file_upload");
         $uploaded = System_helper::upload_file($dir['ticket_issue'], 1024, 'gif|jpg|png|xls|xlsx|pdf|doc|docx');
         if (array_key_exists('issue_attachment', $uploaded)) {
             if ($uploaded['issue_attachment']['status']) {
                 $ticket_detail['issue_attachment'] = $uploaded['issue_attachment']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->message .= $uploaded['issue_attachment']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         $comment_detail = $this->input->post('comment');
         if ($id > 0) {
             unset($ticket_detail['id']);
             $ticket_detail['update_by'] = $user->id;
             $ticket_detail['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             //Query_helper::update($this->config->item('table_ticket_issue'),$ticket_detail,array("id = ".$id));
             $comment_detail['type'] = $this->config->item('ticket_comment_end_user');
             $comment_detail['ticket_issue_id'] = $id;
             $comment_detail['create_by'] = $user->id;
             $comment_detail['create_date'] = time();
             Query_helper::add($this->config->item('table_ticket_resolve_comment'), $comment_detail);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $ticket_detail['status'] = $this->config->item('STATUS_INACTIVE');
             $ticket_detail['create_by'] = $user->id;
             $ticket_detail['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_ticket_issue'), $ticket_detail);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 21
0
 public function upload_excel_file()
 {
     $user = User_helper::get_user();
     if ($_FILES["file"]['name'] != "") {
         $arr = explode(".", $_FILES["file"]['name']);
         $ext = $arr[sizeof($arr) - 1];
     }
     $size = $_FILES["file"]['size'];
     $this->load->library('upload');
     $fileName = 'template_' . $user->id . '_' . date('Ymdhis');
     if ($ext == 'xls' || $ext == 'xlsx') {
         System_helper::upload_excel_file($fileName, $save_dir = "uploads/excel", $max_size = 60000, $types = 'xls|xlsx');
         if ($ext == 'xls') {
             $path = "uploads/excel/" . $fileName . '.xls';
         } else {
             $path = "uploads/excel/" . $fileName . '.xlsx';
         }
         if ($size < 60000) {
             $i = 0;
             $totalcount = 0;
             $objPHPExcel = PHPExcel_IOFactory::load($path);
             foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
                 $worksheetTitle = $worksheet->getTitle();
                 $highestRow = $worksheet->getHighestRow();
                 $highestColumn = $worksheet->getHighestColumn();
                 $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
                 $nrColumns = ord($highestColumn) - 64;
                 for ($row = 1; $row <= $highestRow; ++$row) {
                     for ($col = 0; $col < $highestColumnIndex; ++$col) {
                         $cell = $worksheet->getCellByColumnAndRow($col, $row);
                         $val = $cell->getValue();
                         $dataType = PHPExcel_Cell_DataType::dataTypeForValue($val);
                     }
                 }
             }
             $total_men = 0;
             $total_women = 0;
             $total_tribe = 0;
             $total_disability = 0;
             $total_services = 0;
             $total_income = 0;
             $check_income = false;
             for ($row = 3; $row <= $highestRow; ++$row) {
                 $val = array();
                 for ($col = 0; $col < $highestColumnIndex; ++$col) {
                     $cell = $worksheet->getCellByColumnAndRow($col, $row);
                     $val[] = $cell->getValue();
                 }
                 if ($val[3] != "" && $val[3] != null) {
                     $serial[$i] = System_helper::Get_Bng_to_Eng($val[0]);
                     $customer_name[$i] = $val[1];
                     $gender[$i] = $val[2];
                     $service_name[$i] = $val[3];
                     $amount[$i] = System_helper::Get_Bng_to_Eng(abs($val[4]));
                     if (strlen($amount[$i]) > 6) {
                         $check_income = true;
                     }
                     if ($this->Service_template_model->check_uisc_service_existence($service_name[$i])) {
                         $totalcount = $totalcount + $i;
                         $total_services++;
                         $total_income = $total_income + System_helper::Get_Bng_to_Eng($amount[$i]);
                         if ($gender[$i] == $this->lang->line('MALE_VAL')) {
                             $total_men++;
                         } elseif ($gender[$i] == $this->lang->line('FEMALE_VAL')) {
                             $total_women++;
                         } elseif ($gender[$i] == $this->lang->line('TRIBE_VAL')) {
                             $total_tribe++;
                         } elseif ($gender[$i] == $this->lang->line('DISABILITY_VAL')) {
                             $total_disability++;
                         }
                     }
                     ++$i;
                 }
             }
             $DateCell = $worksheet->getCellByColumnAndRow('1', '1');
             $invDateRaw = $DateCell->getValue();
             if (is_float($invDateRaw)) {
                 $newDate = System_helper::ExcelToPHPDate($invDateRaw);
                 $invDate = date('Y-m-d', $newDate);
             } else {
                 $invDate = $invDateRaw;
             }
             if ($this->Service_template_model->chk_existing_uploded_excel_file($invDate) < 2) {
                 $invoice_data = array();
                 $zilla_invoice_data = array();
                 $invoice_details_data = array();
                 $zilla_invoice_details_data = array();
                 $user_zilla = $user->zilla;
                 $zilla_table_invoice = str_pad($user_zilla, 2, "0", STR_PAD_LEFT) . '_invoices';
                 $zilla_table_invoice_details = str_pad($user_zilla, 2, "0", STR_PAD_LEFT) . '_invoice_details';
                 $uisc_id = $user->uisc_id;
                 $user_group_id = $user->user_group_id;
                 $division = $user->division;
                 $zilla = $user->zilla;
                 $upazila = $user->upazila;
                 $unioun = $user->unioun;
                 $citycorporation = $user->citycorporation;
                 //$citycorporationward = $user->citycorporationward;
                 $municipal = $user->municipal;
                 //$municipalward = $user->municipalward;
                 $invoice_date = $invDate;
                 $customerPost = $customer_name;
                 $servicePost = $service_name;
                 $genderPost = $gender;
                 $earningPost = $amount;
                 $count = sizeof($customerPost);
                 $invoice_data['uisc_id'] = $uisc_id;
                 $invoice_data['unionid'] = $unioun;
                 $invoice_data['municipalid'] = $municipal;
                 $invoice_data['citycorporationid'] = $citycorporation;
                 $invoice_data['upazilaid'] = $upazila;
                 $invoice_data['zillaid'] = $zilla;
                 $invoice_data['divid'] = $division;
                 $invoice_data['type'] = $user_group_id;
                 $invoice_data['invoice_date'] = $invoice_date;
                 $invoice_data['total_income'] = $total_income;
                 $invoice_data['total_service'] = $total_services;
                 $invoice_data['total_men'] = $total_men;
                 $invoice_data['total_women'] = $total_women;
                 $invoice_data['total_tribe'] = $total_tribe;
                 $invoice_data['total_disability'] = $total_disability;
                 $zilla_invoice_data['uisc_id'] = $uisc_id;
                 $zilla_invoice_data['unionid'] = $unioun;
                 $zilla_invoice_data['municipalid'] = $municipal;
                 $zilla_invoice_data['citycorporationid'] = $citycorporation;
                 $zilla_invoice_data['upazilaid'] = $upazila;
                 $zilla_invoice_data['zillaid'] = $zilla;
                 $zilla_invoice_data['divid'] = $division;
                 $zilla_invoice_data['type'] = $user_group_id;
                 $zilla_invoice_data['invoice_date'] = $invoice_date;
                 $zilla_invoice_data['total_income'] = $total_income;
                 $zilla_invoice_data['total_service'] = $total_services;
                 $zilla_invoice_data['total_men'] = $total_men;
                 $zilla_invoice_data['total_women'] = $total_women;
                 //                    echo $zilla_table_invoice;
                 //                    print_r($zilla_invoice_data);exit;
                 if (!$check_income) {
                     if ($total_services > 0) {
                         $this->db->trans_start();
                         //DB Transaction Handle START
                         //$delete_invoice_data['invoice_date'] = $invoice_date;
                         //Query_helper::delete('invoices', $delete_invoice_data);
                         if ($this->Service_template_model->delete_invoice_data($invoice_date)) {
                             $invoice_id = Query_helper::add('invoices', $invoice_data);
                             $zilla_invoice_id = Query_helper::add($zilla_table_invoice, $zilla_invoice_data);
                             for ($i = 0; $i < $count; $i++) {
                                 if ($this->Service_template_model->check_uisc_service_existence($servicePost[$i])) {
                                     list($service_id, $service_name) = $this->Service_template_model->check_uisc_service_existence($servicePost[$i]);
                                     $invoice_details_data['invoice_id'] = $invoice_id;
                                     $invoice_details_data['receiver_name'] = $customerPost[$i];
                                     $invoice_details_data['receiver_sex'] = $genderPost[$i];
                                     $invoice_details_data['service_id'] = $service_id;
                                     //$this->Service_template_model->get_service_id($servicePost[$i]);
                                     $invoice_details_data['income'] = System_helper::Get_Bng_to_Eng($earningPost[$i]);
                                     $invoice_details_data['service_name'] = $service_name;
                                     //$this->Service_template_model->get_service_name($servicePost[$i]);
                                     $zilla_invoice_details_data['invoice_id'] = $zilla_invoice_id;
                                     $zilla_invoice_details_data['receiver_name'] = $customerPost[$i];
                                     $zilla_invoice_details_data['receiver_sex'] = $genderPost[$i];
                                     $zilla_invoice_details_data['service_id'] = $service_id;
                                     //$this->Service_template_model->get_service_id($servicePost[$i]);
                                     $zilla_invoice_details_data['income'] = System_helper::Get_Bng_to_Eng($earningPost[$i]);
                                     $zilla_invoice_details_data['service_name'] = $service_name;
                                     //$this->Service_template_model->get_service_name($servicePost[$i]);
                                     Query_helper::add('invoice_details', $invoice_details_data);
                                     Query_helper::add($zilla_table_invoice_details, $zilla_invoice_details_data);
                                 }
                             }
                             $fileInfo = array('user_id' => $user->id, 'uisc_id' => $uisc_id, 'file_name' => $fileName, 'upload_date' => strtotime($invDate), 'create_date' => time());
                             Query_helper::add($this->config->item('table_excel_history'), $fileInfo);
                             $this->db->trans_complete();
                             //DB Transaction Handle END
                             if ($this->db->trans_status() === TRUE) {
                                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                                 $this->dcms_add();
                             } else {
                                 $ajax['status'] = false;
                                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                                 $this->jsonReturn($ajax);
                             }
                         } else {
                             $ajax['status'] = false;
                             $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                             $this->jsonReturn($ajax);
                         }
                     } else {
                         $ajax['status'] = false;
                         $ajax['system_message'] = $this->lang->line("NO_SERVICES_IN_UISC");
                         $this->jsonReturn($ajax);
                     }
                 } else {
                     $ajax['status'] = false;
                     $ajax['system_message'] = $this->lang->line("MSG_INCOME_AMOUNT_INVALID");
                     $this->jsonReturn($ajax);
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_MAXIMUM_NUMBER_OF_FILES");
                 $this->jsonReturn($ajax);
             }
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_MAX_SIZE");
             $this->jsonReturn($ajax);
         }
     } else {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->lang->line("MSG_EXCEL_ONLY");
         $this->jsonReturn($ajax);
     }
 }
Ejemplo n.º 22
0
 private function dcms_save()
 {
     $time = time();
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         if ($id > 0) {
             $data = $this->input->post('service');
             $data['update_by'] = $user->id;
             $data['update_date'] = time();
             $directory = 'images/service_logo';
             $uploaded = System_helper::upload_file($directory, 5120, 'jpg|png');
             if ($uploaded) {
                 $data['service_logo'] = $uploaded['service_logo']['info']['file_name'];
             }
             $id = Query_helper::update($this->config->item('table_api_services'), $data, ['id =' . $id]);
             if ($id) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->dcms_add();
                 } else {
                     $this->dcms_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $data = $this->input->post('service');
             $data['create_by'] = $user->id;
             $data['create_date'] = time();
             $directory = 'images/service_logo';
             $uploaded = System_helper::upload_file($directory, 5120, 'jpg|png');
             if ($uploaded) {
                 $data['service_logo'] = $uploaded['service_logo']['info']['file_name'];
             }
             $id = Query_helper::add($this->config->item('table_api_services'), $data);
             if ($id) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->dcms_add();
                 } else {
                     $this->dcms_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 23
0
 public function system_save()
 {
     $id = $this->input->post("id");
     $data = $this->input->post('task');
     $user = User_helper::get_user();
     if ($id > 0) {
         $this->db->trans_start();
         //DB Transaction Handle START
         $data['modified_by'] = $user->user_id;
         $data['modification_date'] = time();
         Query_helper::update($this->config->item('table_task'), $data, array("id = " . $id));
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
             $this->system_list();
         } else {
             $this->message = $this->lang->line("MSG_NOT_UPDATED_SUCCESS");
         }
     } else {
         $this->db->trans_start();
         //DB Transaction Handle START
         $data['created_by'] = $user->user_id;
         $data['creation_date'] = time();
         Query_helper::add($this->config->item('table_task'), $data);
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
             $this->system_list();
         } else {
             $this->message = $this->lang->line("MSG_NOT_SAVED_SUCCESS");
         }
     }
 }
Ejemplo n.º 24
0
 private function dcms_save()
 {
     $time = time();
     $center_data = array();
     $secretary_data = array();
     $entrepreneur_data = array();
     $device_data = array();
     $resource_data = array();
     $investment_data = array();
     $training_data = array();
     $electricity_data = array();
     $location_data = array();
     $academic_data = array();
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $center_data['uisc_type'] = $this->input->post('entrepreneur_type');
         $center_data['user_group_id'] = $this->config->item('UISC_GROUP_ID');
         $center_data['division'] = $this->input->post('division');
         $center_data['zilla'] = $this->input->post('zilla');
         if ($this->input->post('entrepreneur_type') == $this->config->item('ONLINE_UNION_GROUP_ID')) {
             $center_data['upazilla'] = $this->input->post('upazilla');
             $center_data['union'] = $this->input->post('union');
             $union_name = $this->Entrepreneur_registration_model->get_union_name($this->input->post('zilla'), $this->input->post('upazilla'), $this->input->post('union'));
             $serial = $this->Entrepreneur_registration_model->CountUnionServiceCenter($this->input->post('division'), $this->input->post('zilla'), $this->input->post('upazilla'), $this->input->post('union'));
             $center_data['uisc_name'] = $union_name . ' ' . $this->lang->line('UNION_DIGITAL_CENTER') . ' -' . $serial;
         } elseif ($this->input->post('entrepreneur_type') == $this->config->item('ONLINE_CITY_CORPORATION_WORD_GROUP_ID')) {
             $center_data['citycorporation'] = $this->input->post('citycorporation');
             $center_data['citycorporationward'] = $this->input->post('citycorporationward');
             $cityCorporation = $this->Entrepreneur_registration_model->get_city_name($this->input->post('zilla'), $this->input->post('citycorporation'));
             $cityCorporationWard = $this->Entrepreneur_registration_model->get_city_ward_name($this->input->post('zilla'), $this->input->post('citycorporation'), $this->input->post('citycorporationward'));
             $serial = $this->Entrepreneur_registration_model->countCityServiceCenter($this->input->post('division'), $this->input->post('zilla'), $this->input->post('citycorporation'), $this->input->post('citycorporationward'));
             $center_data['uisc_name'] = $cityCorporation . ' ' . $cityCorporationWard . ' ' . $this->lang->line('DIGITAL_CENTER') . ' -' . $serial;
         } elseif ($this->input->post('entrepreneur_type') == $this->config->item('ONLINE_MUNICIPAL_WORD_GROUP_ID')) {
             $center_data['municipal'] = $this->input->post('municipal');
             $center_data['municipalward'] = $this->input->post('municipalward');
             $municipal = $this->Entrepreneur_registration_model->get_municipal_name($this->input->post('zilla'), $this->input->post('municipal'));
             $municipalWard = $this->Entrepreneur_registration_model->get_municipal_ward_name($this->input->post('zilla'), $this->input->post('municipal'), $this->input->post('municipalward'));
             $serial = $this->Entrepreneur_registration_model->countMunicipalServiceCenter($this->input->post('division'), $this->input->post('zilla'), $this->input->post('municipal'), $this->input->post('municipalward'));
             if ($municipalWard == 'সকল ওয়ার্ড') {
                 $newMunicipalWard = '';
             } else {
                 $newMunicipalWard = $municipalWard . ' ';
             }
             $center_data['uisc_name'] = $municipal . ' ' . $newMunicipalWard . $this->lang->line('DIGITAL_CENTER') . ' -' . $serial;
         }
         $center_data['uisc_email'] = $this->input->post('uisc_email');
         $center_data['uisc_mobile'] = $this->input->post('uisc_mobile_no');
         $center_data['uisc_address'] = $this->input->post('uisc_address');
         $center_data['ques_id'] = $this->input->post('ques_id');
         $center_data['ques_ans'] = $this->input->post('ques_ans');
         $dir = $this->config->item("dcms_upload");
         $uploaded = System_helper::upload_file($dir['entrepreneur'], 1024, 'gif|jpg|png');
         if (array_key_exists('profile_image', $uploaded)) {
             if ($uploaded['profile_image']['status']) {
                 $center_data['image'] = $uploaded['profile_image']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['desk_message'] = $this->message .= $uploaded['profile_image']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         $center_data['create_by'] = '';
         $center_data['create_date'] = $time;
         $secretary_data['secretary_name'] = $this->input->post('secretary_name');
         $secretary_data['secretary_email'] = $this->input->post('secretary_email');
         $secretary_data['secretary_mobile'] = $this->input->post('secretary_mobile');
         $secretary_data['secretary_address'] = $this->input->post('secretary_address');
         $entrepreneur_data['entrepreneur_type'] = $this->input->post('entrepreneur_exp_type');
         $entrepreneur_data['entrepreneur_name'] = $this->input->post('entrepreneur_name');
         $entrepreneur_data['entrepreneur_father_name'] = $this->input->post('entrepreneur_father_name');
         $entrepreneur_data['entrepreneur_mother_name'] = $this->input->post('entrepreneur_mother_name');
         $entrepreneur_data['entrepreneur_mobile'] = $this->input->post('entrepreneur_mobile');
         $entrepreneur_data['entrepreneur_email'] = $this->input->post('entrepreneur_email');
         $entrepreneur_data['entrepreneur_sex'] = $this->input->post('entrepreneur_sex');
         $entrepreneur_data['entrepreneur_address'] = $this->input->post('entrepreneur_address');
         $device_data['connection_type'] = $this->input->post('connection_type');
         $device_data['ip_address'] = $this->input->post('ip_address');
         $device_data['modem'] = $this->input->post('modem');
         $investment_data['invested_money'] = $this->input->post('invested_money');
         $investment_data['self_investment'] = $this->input->post('self_investment');
         $investment_data['invest_debt'] = $this->input->post('invest_debt');
         $investment_data['invest_sector'] = $this->input->post('invest_sector');
         $electricity_data['electricity'] = $this->input->post('electricity');
         $electricity_data['solar'] = $this->input->post('solar');
         $electricity_data['ips'] = $this->input->post('ips');
         $location_data['center_type'] = $this->input->post('center_location');
         $academic_data['latest_education'] = $this->input->post('latest_education');
         $academic_data['passing_year'] = $this->input->post('passing_year');
         $resPost = $this->input->post('res_id');
         $res_detailPost = $this->input->post('res_detail');
         $quantityPost = $this->input->post('quantity');
         $statusPost = $this->input->post('status');
         $coursePost = $this->input->post('training_course');
         $institutePost = $this->input->post('training_institute');
         $timePost = $this->input->post('training_time');
         $this->db->trans_start();
         //DB Transaction Handle START
         $uisc_id = Query_helper::add($this->config->item('table_uisc_infos'), $center_data);
         $secretary_data['uisc_id'] = $uisc_id;
         $secretary_data['create_by'] = '';
         $secretary_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_secretary_infos'), $secretary_data);
         $entrepreneur_data['uisc_id'] = $uisc_id;
         $entrepreneur_data['create_by'] = '';
         $entrepreneur_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_entrepreneur_infos'), $entrepreneur_data);
         $device_data['uisc_id'] = $uisc_id;
         $device_data['create_by'] = '';
         $device_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_device_infos'), $device_data);
         $investment_data['uisc_id'] = $uisc_id;
         $investment_data['create_by'] = '';
         $investment_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_investment'), $investment_data);
         $electricity_data['uisc_id'] = $uisc_id;
         $electricity_data['create_by'] = '';
         $electricity_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_electricity'), $electricity_data);
         $location_data['uisc_id'] = $uisc_id;
         $location_data['create_by'] = '';
         $location_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_center_location'), $location_data);
         $academic_data['uisc_id'] = $uisc_id;
         $academic_data['create_by'] = '';
         $academic_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_entrepreneur_education'), $academic_data);
         if (sizeof($resPost) > 0 && is_array($resPost)) {
             for ($i = 0; $i < sizeof($resPost); $i++) {
                 $resource_data['uisc_id'] = $uisc_id;
                 $resource_data['res_id'] = $resPost[$i];
                 $resource_data['res_detail'] = $res_detailPost[$i];
                 $resource_data['quantity'] = $quantityPost[$i];
                 $resource_data['status'] = $statusPost[$i];
                 $resource_data['create_by'] = '';
                 $resource_data['create_date'] = $time;
                 Query_helper::add($this->config->item('table_uisc_resources'), $resource_data);
             }
         }
         if (sizeof($coursePost) > 0 && is_array($coursePost)) {
             for ($i = 0; $i < sizeof($coursePost); $i++) {
                 $training_data['uisc_id'] = $uisc_id;
                 $training_data['course_name'] = $coursePost[$i];
                 $training_data['institute_name'] = $institutePost[$i];
                 $training_data['timespan'] = $timePost[$i];
                 $training_data['create_by'] = '';
                 $training_data['create_date'] = $time;
                 Query_helper::add($this->config->item('table_training'), $training_data);
             }
         }
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
             $this->dcms_add();
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 25
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $uisc = User_helper::get_uisc_info();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         //$service_detail['createdby']=$user->id;
         $service_detail['created_time'] = time();
         $service_detail['uisc_id'] = $uisc->id;
         $service_detail['user_id'] = $user->id;
         //$service_detail['status']=$this->config->item('SERVICES_STATUS_PROPOSED');
         $this->db->trans_start();
         //DB Transaction Handle START
         $all_update['status'] = $this->config->item('STATUS_INACTIVE');
         Query_helper::update($this->config->item('table_services_uisc'), $all_update, array("user_id = " . $user->id));
         $number_of_service = sizeof($this->input->post("service_id"));
         $service_id = $this->input->post('service_id');
         $uisc_service_id = $this->input->post('uisc_service_id');
         for ($i = 0; $i < $number_of_service; $i++) {
             $check_post = $service_id[$i];
             if ($this->input->post($check_post)) {
                 $uisc_service_post_id = $uisc_service_id[$i];
                 //                    $single_data['remaining']="'remaining'+1";
                 //                    Query_helper::update($this->config->item('table_services_uisc'),$single_data,array("user_id = ".$user->id, "service_id = ".$uisc_service_post_id));
                 $update_sql = "update " . $this->config->item('table_services_uisc') . " set remaining=remaining+1 where user_id='" . $user->id . "' AND service_id='{$uisc_service_post_id}'";
                 $this->db->query($update_sql);
                 $service_detail['service_id'] = $check_post;
                 $service_detail['remaining'] = 1;
                 Query_helper::add($this->config->item('table_services_uisc'), $service_detail);
             }
         }
         /*
                     $number_of_own_service=sizeof($this->input->post("own_service_id"));
                     $service_id=$this->input->post('service_id');
                     $uisc_service_id=$this->input->post('uisc_service_id');
                     for($i=0; $i<$number_of_service; $i++)
                     {
                         $check_post=$service_id[$i];
                         if($this->input->post($check_post))
                         {
                             $uisc_service_post_id=$uisc_service_id[$i];
                             //                    $single_data['remaining']="'remaining'+1";
                             //                    Query_helper::update($this->config->item('table_services_uisc'),$single_data,array("user_id = ".$user->id, "service_id = ".$uisc_service_post_id));
         
                             $update_sql="update ".$this->config->item('table_services_uisc')." set remaining=remaining+1 where user_id='".$user->id."' AND service_id='$uisc_service_post_id'";
                             $this->db->query($update_sql);
         
                             $service_detail['service_id']=$check_post;
                             $service_detail['remaining']=1;
                             Query_helper::add($this->config->item('table_services_uisc'),$service_detail);
                         }
                     }
         */
         //                $service_detail_uisc['uisc_id']=$user->id;
         //                $service_detail_uisc['service_id']=$service_last_id;
         //                $service_detail_uisc['user_id']=$user->id;
         //                $service_detail_uisc['created_time']=time();
         //                Query_helper::add($this->config->item('table_services_uisc'),$service_detail_uisc);
         $this->db->trans_complete();
         //DB Transaction Handle END
         //die();
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
             $this->system_add();
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 26
0
 private function dcms_save()
 {
     $time = time();
     $user_data = array();
     $secretary_data = array();
     $entrepreneur_data = array();
     $device_data = array();
     $resource_data = array();
     $investment_data = array();
     $training_data = array();
     $electricity_data = array();
     $location_data = array();
     $academic_data = array();
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $user_data['uisc_type'] = $this->input->post('entrepreneur_type');
         $user_data['user_group_id'] = $this->config->item('UISC_GROUP_ID');
         $user_data['uisc_id'] = $this->input->post('uisc_name');
         $user_data['division'] = $this->input->post('division');
         $user_data['zilla'] = $this->input->post('zilla');
         $user_data['status'] = 0;
         $user_data['name_bn'] = $this->input->post('entrepreneur_name');
         if ($this->input->post('entrepreneur_type') == $this->config->item('ONLINE_UNION_GROUP_ID')) {
             $user_data['upazila'] = $this->input->post('upazilla');
             $user_data['unioun'] = $this->input->post('union');
             $uisc_serial = $this->User_registration_model->get_uisc_serial($this->input->post('uisc_name'));
             $user_serial = $this->User_registration_model->get_user_serial($this->input->post('uisc_name'));
             $user_data['username'] = $user_data['zilla'] . '-' . $user_data['upazila'] . '-' . $user_data['unioun'] . '-' . str_pad($uisc_serial, 2, "0", STR_PAD_LEFT) . '-' . str_pad($user_serial, 2, "0", STR_PAD_LEFT);
             $user_data['password'] = md5(md5($user_data['username']));
         } elseif ($this->input->post('entrepreneur_type') == $this->config->item('ONLINE_CITY_CORPORATION_WORD_GROUP_ID')) {
             $user_data['citycorporation'] = $this->input->post('citycorporation');
             $user_data['citycorporationward'] = $this->input->post('citycorporationward');
             $uisc_serial = $this->User_registration_model->get_uisc_serial($this->input->post('uisc_name'));
             $user_serial = $this->User_registration_model->get_user_serial($this->input->post('uisc_name'));
             $user_data['username'] = $user_data['zilla'] . '-' . $user_data['citycorporation'] . '-' . $user_data['citycorporationward'] . '-' . str_pad($uisc_serial, 2, "0", STR_PAD_LEFT) . '-' . str_pad($user_serial, 2, "0", STR_PAD_LEFT);
             $user_data['password'] = md5(md5($user_data['username']));
         } elseif ($this->input->post('entrepreneur_type') == $this->config->item('ONLINE_MUNICIPAL_WORD_GROUP_ID')) {
             $user_data['municipal'] = $this->input->post('municipal');
             $user_data['municipalward'] = $this->input->post('municipalward');
             $uisc_serial = $this->User_registration_model->get_uisc_serial($this->input->post('uisc_name'));
             $user_serial = $this->User_registration_model->get_user_serial($this->input->post('uisc_name'));
             $user_data['username'] = $user_data['zilla'] . '-' . $user_data['municipal'] . '-' . $user_data['municipalward'] . '-' . str_pad($uisc_serial, 2, "0", STR_PAD_LEFT) . '-' . str_pad($user_serial, 2, "0", STR_PAD_LEFT);
             $user_data['password'] = md5(md5($user_data['username']));
         }
         $user_data['email'] = $this->input->post('uisc_email');
         $user_data['mobile'] = $this->input->post('uisc_mobile_no');
         $user_data['ques_id'] = $this->input->post('ques_id');
         $user_data['ques_ans'] = $this->input->post('ques_ans');
         $dir = $this->config->item("dcms_upload");
         $uploaded = System_helper::upload_file($dir['entrepreneur'], 10240, 'gif|jpg|png');
         if (array_key_exists('profile_image', $uploaded)) {
             if ($uploaded['profile_image']['status']) {
                 $user_data['picture_name'] = $uploaded['profile_image']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->message .= $uploaded['profile_image']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         $user_data['create_by'] = '000000';
         $user_data['create_date'] = $time;
         $entrepreneur_data['user_id'] = $user_data['username'];
         $entrepreneur_data['entrepreneur_type'] = $this->input->post('entrepreneur_exp_type');
         $entrepreneur_data['entrepreneur_name'] = $this->input->post('entrepreneur_name');
         $entrepreneur_data['entrepreneur_father_name'] = $this->input->post('entrepreneur_father_name');
         $entrepreneur_data['entrepreneur_mother_name'] = $this->input->post('entrepreneur_mother_name');
         $entrepreneur_data['entrepreneur_qualification'] = $this->input->post('entrepreneur_qualification');
         $entrepreneur_data['entrepreneur_mobile'] = $this->input->post('entrepreneur_mobile');
         $entrepreneur_data['entrepreneur_email'] = $this->input->post('entrepreneur_email');
         $entrepreneur_data['entrepreneur_sex'] = $this->input->post('entrepreneur_sex');
         $entrepreneur_data['entrepreneur_address'] = $this->input->post('entrepreneur_address');
         $entrepreneur_data['entrepreneur_nid'] = $this->input->post('entrepreneur_nid');
         $entrepreneur_data['entrepreneur_bank_name'] = $this->input->post('entrepreneur_bank_name');
         $entrepreneur_data['entrepreneur_bank_account_no'] = $this->input->post('entrepreneur_bank_account_no');
         $entrepreneur_data['entrepreneur_bank_holder_name'] = $this->input->post('entrepreneur_bank_holder_name');
         $entrepreneur_data['entrepreneur_blog_member'] = $this->input->post('entrepreneur_blog_member');
         $entrepreneur_data['entrepreneur_fb_group_member'] = $this->input->post('entrepreneur_fb_group_member');
         $device_data['connection_type'] = $this->input->post('connection_type');
         $device_data['ip_address'] = $this->input->post('ip_address');
         $device_data['modem'] = $this->input->post('modem');
         $investment_data['self_investment'] = System_helper::Get_Bng_to_Eng(trim($this->input->post('self_investment')));
         $investment_data['invest_debt'] = System_helper::Get_Bng_to_Eng(trim($this->input->post('invest_debt')));
         $investment_data['invested_money'] = System_helper::Get_Bng_to_Eng(trim($this->input->post('self_investment'))) + trim(System_helper::Get_Bng_to_Eng($this->input->post('invest_debt')));
         //System_helper::Get_Bng_to_Eng($this->input->post('invested_money'));
         $investment_data['invest_sector'] = $this->input->post('invest_sector');
         $electricity_data['electricity'] = $this->input->post('electricity');
         $electricity_data['solar'] = $this->input->post('solar');
         $electricity_data['ips'] = $this->input->post('ips');
         $location_data['center_type'] = $this->input->post('center_location');
         $academic_data['latest_education'] = $this->input->post('latest_education');
         $academic_data['passing_year'] = $this->input->post('passing_year');
         $coursePost = $this->input->post('training_course');
         $institutePost = $this->input->post('training_institute');
         $timePost = $this->input->post('training_time');
         $resPost = $this->input->post('res_id');
         $res_detailPost = $this->input->post('res_detail');
         $quantityPost = $this->input->post('quantity');
         $statusPost = $this->input->post('status');
         $this->db->trans_start();
         //DB Transaction Handle START
         $user_id = Query_helper::add($this->config->item('table_users'), $user_data);
         $entrepreneur_data['uisc_id'] = $this->input->post('uisc_name');
         $entrepreneur_data['user_id'] = $user_id;
         $entrepreneur_data['create_by'] = '000000';
         $entrepreneur_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_entrepreneur_infos'), $entrepreneur_data);
         $device_data['uisc_id'] = $this->input->post('uisc_name');
         $device_data['user_id'] = $user_id;
         $device_data['create_by'] = '000000';
         $device_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_device_infos'), $device_data);
         $investment_data['uisc_id'] = $this->input->post('uisc_name');
         $investment_data['user_id'] = $user_id;
         $investment_data['create_by'] = '000000';
         $investment_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_investment'), $investment_data);
         $electricity_data['uisc_id'] = $this->input->post('uisc_name');
         $electricity_data['user_id'] = $user_id;
         $electricity_data['create_by'] = '000000';
         $electricity_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_electricity'), $electricity_data);
         $location_data['uisc_id'] = $this->input->post('uisc_name');
         $location_data['user_id'] = $user_id;
         $location_data['create_by'] = '000000';
         $location_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_center_location'), $location_data);
         $academic_data['uisc_id'] = $this->input->post('uisc_name');
         $academic_data['user_id'] = $user_id;
         $academic_data['create_by'] = '000000';
         $academic_data['create_date'] = $time;
         Query_helper::add($this->config->item('table_entrepreneur_education'), $academic_data);
         if (sizeof($resPost) > 0 && is_array($resPost)) {
             for ($i = 0; $i < sizeof($resPost); $i++) {
                 $resource_data['uisc_id'] = $this->input->post('uisc_name');
                 $resource_data['user_id'] = $user_id;
                 $resource_data['res_id'] = $resPost[$i];
                 $resource_data['res_detail'] = $res_detailPost[$i];
                 $resource_data['quantity'] = $quantityPost[$i];
                 $resource_data['status'] = $statusPost[$i];
                 $resource_data['create_by'] = '000000';
                 $resource_data['create_date'] = $time;
                 Query_helper::add($this->config->item('table_uisc_resources'), $resource_data);
             }
         }
         if (sizeof($coursePost) > 0 && is_array($coursePost)) {
             for ($i = 0; $i < sizeof($coursePost); $i++) {
                 $training_data['uisc_id'] = $this->input->post('uisc_name');
                 $training_data['user_id'] = $user_id;
                 $training_data['course_name'] = $coursePost[$i];
                 $training_data['institute_name'] = $institutePost[$i];
                 $training_data['timespan'] = $timePost[$i];
                 $training_data['create_by'] = '000000';
                 $training_data['create_date'] = $time;
                 Query_helper::add($this->config->item('table_training'), $training_data);
             }
         }
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
             $this->dcms_add();
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 27
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     $data = $this->input->post('key');
     $keyConfig = $this->config->item('KEY_TYPE');
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         if ($data['parent'] == $keyConfig['CAMPUS'] || $data['parent'] == $keyConfig['SESSION']) {
             $data['description'] = json_encode($this->input->post('description'));
         }
         if ($id > 0) {
             $data['update_by'] = $user->id;
             $data['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_system_keyword'), $data, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $data['create_by'] = $user->id;
             $data['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_system_keyword'), $data);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 28
0
 private function dcms_save()
 {
     $time = time();
     $user = User_helper::get_user();
     $id = $this->input->post("uisc_id");
     $status = $this->input->post("approval_status");
     $uisc_type = $this->input->post("uisc_type");
     $division = $this->input->post("division");
     $zilla = $this->input->post("zilla");
     $image = $this->input->post("user_image");
     $upazilla = 0;
     $union = 0;
     $citycorporation = 0;
     $citycorporationward = 0;
     $municipal = 0;
     $municipalward = 0;
     $union_name = $this->input->post("union_name");
     $city_corporation_name = $this->input->post("city_corporation_name");
     $city_corporation_ward_name = $this->input->post("city_corporation_ward_name");
     $municipal_name = $this->input->post("municipal_name");
     $municipal_ward_name = $this->input->post("municipal_ward_name");
     $entrepreneur_gender = $this->input->post("gender");
     $uisc_center_name = '';
     $ques_id = $this->input->post("ques_id");
     $ques_ans = $this->input->post("ques_ans");
     if ($uisc_type == $this->config->item('ONLINE_UNION_GROUP_ID')) {
         $upazilla = $this->input->post("upazilla");
         $union = $this->input->post("union");
         $serial = $this->Entrepreneur_approval_model->CountUnionServiceCenter($division, $zilla, $upazilla, $union);
         $number_of_user = $this->Entrepreneur_approval_model->Number_of_uisc_user($id);
         $user_id = $zilla . '-' . $upazilla . '-' . $union . '-' . str_pad($serial, 2, "0", STR_PAD_LEFT) . '-' . str_pad($number_of_user, 2, "0", STR_PAD_LEFT);
         //$uisc_center_name=$union_name." ".$this->lang->line('UNION_PARISHAD')." ".$this->lang->line('DIGITAL_CENTER')." - ".$serial;
     } elseif ($uisc_type == $this->config->item('ONLINE_CITY_CORPORATION_WORD_GROUP_ID')) {
         $citycorporation = $this->input->post("citycorporation");
         $citycorporationward = $this->input->post("citycorporationward");
         $serial = $this->Entrepreneur_approval_model->countCityServiceCenter($division, $zilla, $citycorporation, $citycorporationward);
         $number_of_user = $this->Entrepreneur_approval_model->Number_of_uisc_user($id);
         $user_id = $zilla . '-' . $citycorporation . '-' . $citycorporationward . '-' . str_pad($serial, 2, "0", STR_PAD_LEFT) . '-' . str_pad($number_of_user, 2, "0", STR_PAD_LEFT);
         //$uisc_center_name=$city_corporation_name." ".$city_corporation_ward_name." ".$this->lang->line('CITY_CORPORATION')." ".$this->lang->line('DIGITAL_CENTER')." - ".$serial;
     } elseif ($uisc_type == $this->config->item('ONLINE_MUNICIPAL_WORD_GROUP_ID')) {
         $municipal = $this->input->post("municipal");
         $municipalward = $this->input->post("municipalward");
         $serial = $this->Entrepreneur_approval_model->countMunicipalServiceCenter($division, $zilla, $municipal, $municipalward);
         $number_of_user = $this->Entrepreneur_approval_model->Number_of_uisc_user($id);
         $user_id = $zilla . '-' . $municipal . '-' . $municipalward . '-' . str_pad($serial, 2, "0", STR_PAD_LEFT) . '-' . str_pad($number_of_user, 2, "0", STR_PAD_LEFT);
         //$uisc_center_name=$municipal_name." ".$municipal_ward_name." ".$this->lang->line('MUNICIPALITY')." ".$this->lang->line('DIGITAL_CENTER')." - ".$serial;
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $uisc_info_update_data = array('status' => $status);
         //$entrepreneur_info_update_data = Array('user_id'=>$user_id);
         //$secretary_info_update_data = Array('user_id'=>$user_id);
         $user_data = array('username' => $user_id, 'password' => md5(md5($user_id)), 'user_group_id' => $this->config->item('UISC_GROUP_ID'), 'uisc_type' => $uisc_type, 'uisc_id' => $id, 'ques_id' => $ques_id, 'ques_ans' => $ques_ans, 'division' => $division, 'zilla' => $zilla, 'upazila' => $upazilla, 'unioun' => $union, 'citycorporation' => $citycorporation, 'citycorporationward' => $citycorporationward, 'municipal' => $municipal, 'municipalward' => $municipalward, 'gender' => $entrepreneur_gender, 'picture_name' => $image, 'create_by' => $user->id, 'create_date' => $time);
         if ($id > 0) {
             $uisc_info_update_data['update_by'] = $user->id;
             $uisc_info_update_data['update_date'] = $time;
             $this->db->trans_start();
             //DB Transaction Handle START
             if ($status == 1) {
                 $uisc_user_id = Query_helper::add($this->config->item('table_users'), $user_data);
                 //$uisc_info_update_data['uisc_name']=$uisc_center_name;
                 $entrepreneur_info_update_data['user_id'] = $uisc_user_id;
                 $entrepreneur_info_update_data['update_by'] = $user->id;
                 $entrepreneur_info_update_data['update_date'] = $time;
                 $secretary_info_update_data['user_id'] = $uisc_user_id;
                 $secretary_info_update_data['update_by'] = $user->id;
                 $secretary_info_update_data['update_date'] = $time;
                 $resources_info_update_data['user_id'] = $uisc_user_id;
                 $resources_info_update_data['update_by'] = $user->id;
                 $resources_info_update_data['update_date'] = $time;
                 $device_info_update_data['user_id'] = $uisc_user_id;
                 $device_info_update_data['update_by'] = $user->id;
                 $device_info_update_data['update_date'] = $time;
                 $center_location_info_update_data['user_id'] = $uisc_user_id;
                 $center_location_info_update_data['update_by'] = $user->id;
                 $center_location_info_update_data['update_date'] = $time;
                 $education_info_update_data['user_id'] = $uisc_user_id;
                 $education_info_update_data['update_by'] = $user->id;
                 $education_info_update_data['update_date'] = $time;
                 $electricity_info_update_data['user_id'] = $uisc_user_id;
                 $electricity_info_update_data['update_by'] = $user->id;
                 $electricity_info_update_data['update_date'] = $time;
                 $investment_info_update_data['user_id'] = $uisc_user_id;
                 $investment_info_update_data['update_by'] = $user->id;
                 $investment_info_update_data['update_date'] = $time;
                 $training_info_update_data['user_id'] = $uisc_user_id;
                 $training_info_update_data['update_by'] = $user->id;
                 $training_info_update_data['update_date'] = $time;
                 Query_helper::update($this->config->item('table_uisc_infos'), $uisc_info_update_data, array("id = " . $id));
                 Query_helper::update($this->config->item('table_entrepreneur_infos'), $entrepreneur_info_update_data, array("uisc_id = " . $id));
                 Query_helper::update($this->config->item('table_secretary_infos'), $secretary_info_update_data, array("uisc_id = " . $id));
                 Query_helper::update($this->config->item('table_uisc_resources'), $resources_info_update_data, array("uisc_id = " . $id));
                 Query_helper::update($this->config->item('table_device_infos'), $device_info_update_data, array("uisc_id = " . $id));
                 Query_helper::update($this->config->item('table_center_location'), $center_location_info_update_data, array("uisc_id = " . $id));
                 Query_helper::update($this->config->item('table_entrepreneur_education'), $education_info_update_data, array("uisc_id = " . $id));
                 Query_helper::update($this->config->item('table_electricity'), $electricity_info_update_data, array("uisc_id = " . $id));
                 Query_helper::update($this->config->item('table_investment'), $investment_info_update_data, array("uisc_id = " . $id));
                 Query_helper::update($this->config->item('table_training'), $training_info_update_data, array("uisc_id = " . $id));
                 $user_detail_info = $this->Entrepreneur_approval_model->get_user_detail_info_from_entrepreneur($uisc_user_id, $id);
                 $user_update_data['name_bn'] = $user_detail_info['entrepreneur_name'];
                 $user_update_data['mobile'] = $user_detail_info['entrepreneur_mobile'];
                 $user_update_data['email'] = $user_detail_info['entrepreneur_email'];
                 $user_update_data['present_address'] = $user_detail_info['entrepreneur_address'];
                 Query_helper::update($this->config->item('table_users'), $user_update_data, array("id = " . $uisc_user_id));
             } elseif ($status == 2) {
                 Query_helper::update($this->config->item('table_uisc_infos'), $uisc_info_update_data, array("id = " . $id));
             }
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $ajax['status'] = true;
                 if ($status == 1) {
                     $subject = $this->lang->line('ADMIN_ENTREPRENEUR_APPROVED_SUBJECT_TITLE');
                     $msg = "  প্রিয় উদ্যোক্তা আপনার রেজিষ্ট্রেশন অনুমোদন করা হয়েছে।\r\n                            আপনার ব্যবহারকারী  নামঃ " . $user_id . "  এবং  পাসওয়ার্ডঃ  " . $user_id;
                     $from_email = $this->config->item('from_mail_address');
                     $to_email = $user_detail_info['entrepreneur_email'];
                     $cc_email = $this->config->item('cc_mail_address_maraj');
                     User_helper::mail_send($from_email, $to_email, $cc_email, '', $subject, $msg);
                     $ajax['system_message'] = $this->lang->line("MSG_SUCCESSFULLY_APPROVED");
                 } else {
                     $ajax['system_message'] = $this->lang->line("MSG_SUCCESSFULLY_DENIED");
                 }
                 $this->jsonReturn($ajax);
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }