Ejemplo n.º 1
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.º 2
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 = array();
         $userDetail['ques_id'] = $this->input->post('ques_id');
         $userDetail['ques_ans'] = $this->input->post('ques_ans');
         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_edit();
                 } else {
                     $this->system_edit();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 3
0
 private function system_batch_delete()
 {
     if ($this->permissions['delete']) {
         $user = User_helper::get_user();
         $selected_ids = $this->input->post('selected_ids');
         $this->db->trans_start();
         //DB Transaction Handle START
         foreach ($selected_ids as $id) {
             Query_helper::update($this->config->item('table_services'), array('status' => 99, 'update_by' => $user->id, 'update_date' => time()), array("id = " . $id));
         }
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_DELETE_SUCCESS");
             $this->system_list();
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_DELETE_FAIL");
             $this->jsonReturn($ajax);
         }
     } else {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
         $this->jsonReturn($ajax);
     }
 }
Ejemplo n.º 4
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.º 5
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.º 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 {
         $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.º 7
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);
             }
         }
     }
 }
Ejemplo n.º 8
0
 public function reject_product()
 {
     $user = User_helper::get_user();
     $id = $this->input->post('assign_id');
     if ($id > 0) {
         $data = array();
         $data['update_by'] = $user->id;
         $data['update_date'] = time();
         $data['status'] = 0;
         Query_helper::update($this->config->item('table_product_assign'), $data, array('product_id =' . $id));
         //        $this->Product_return_model->update_assign_produce($id,$data);
         $s_data = array();
         $s_data['update_by'] = $user->id;
         $s_data['update_date'] = time();
         $s_data['status'] = 99;
         Query_helper::update($this->config->item('table_product'), $s_data, array('id =' . $id));
     }
     return $this->jsonReturn('tes');
 }
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 {
         $userDetail = array();
         $userDetail['password'] = $this->input->post('password');
         $userDetail['confirm_password'] = $this->input->post('confirm_password');
         if ($id > 0) {
             if ($userDetail['password'] != "") {
                 $actual_password = $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;
         }
         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->load->library('email');
                 //                    $this->email->set_mailtype("html");
                 //                    $this->email->from('*****@*****.**');
                 //                    $this->email->to('*****@*****.**');
                 //                    $mail_body = $this->load->view('mail_all_applicant', $data, true);
                 //                    $subject = "ইউজার আইডি ও পাসওয়ার্ড ";
                 //                    $this->email->subject($subject);
                 //                    $this->email->message($mail_body);
                 //                    $email = $this->email->send();
                 //                    if ($email) {
                 //                        $user_info = $this->test_model->email_sent('send', $user_infos['username'], $applicant_email);
                 //                    } else {
                 //                        $user_info = $this->test_model->email_sent('not send', $user_infos['username'], $applicant_email);
                 //                    }
                 //                    $this->email->print_debugger();
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $subject = $this->lang->line('ADMIN_PASSWORD_CHANGE_SUBJECT_TITLE');
                     $msg = "আপনার পাসওয়ার্ড পরিবর্তন করা হয়েছে। আপনার নতুন পাসওয়ার্ডঃ  " . $actual_password;
                     $from_email = $this->config->item('from_mail_address');
                     $to_email = $userDetail['email'];
                     $cc_email = $from_email;
                     User_helper::mail_send($from_email, $to_email, $cc_email, '', $subject, $msg);
                     $this->system_edit();
                 } else {
                     $this->system_edit();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_UPDATE_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 {
         $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.º 11
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.º 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 {
         $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.º 13
0
 private function dcms_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;
         }
     }
     $userDetail = $this->input->post('user_detail');
     if ($id > 0) {
         if ($userDetail['password'] != "") {
             $actual_password = $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']);
         }
         if ($userDetail['ques_id'] == '') {
             unset($userDetail['ques_id']);
             unset($userDetail['ques_ans']);
         }
     }
     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));
         // Mail Function
         $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) {
                 $subject = $this->lang->line('ADMIN_PASSWORD_CHANGE_SUBJECT_TITLE');
                 $msg = "প্রিয় উদ্যোক্তা আপনার পাসওয়ার্ড পরিবর্তন করা হয়েছে। আপনার নতুন পাসওয়ার্ডঃ  " . $actual_password;
                 $from_email = $this->config->item('from_mail_address');
                 $to_email = $userDetail['email'];
                 $cc_email = $from_email;
                 User_helper::mail_send($from_email, $to_email, $cc_email, '', $subject, $msg);
                 $this->dcms_list();
             } else {
                 $this->dcms_list();
             }
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
             $this->jsonReturn($ajax);
         }
     } else {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
         $this->jsonReturn($ajax);
     }
 }
Ejemplo n.º 14
0
 private function dcms_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     $status = $this->input->post("approval_status");
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $user_data = array('status' => $status);
         $user_data['update_by'] = $user->id;
         $user_data['update_date'] = time();
         if ($id > 0) {
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_users'), $user_data, array("id = " . $id));
             $entrepreneur = Query_helper::get_info($this->config->item('table_entrepreneur_infos'), array('entrepreneur_email'), array('user_id = ' . $id), 1);
             $user = Query_helper::get_info($this->config->item('table_users'), array('username'), array('id = ' . $id), 1);
             $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['username'] . "  এবং  পাসওয়ার্ডঃ  " . $user['username'];
                     $from_email = $this->config->item('from_mail_address');
                     $to_email = $entrepreneur['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);
             }
         }
     }
 }
Ejemplo n.º 15
0
 private function dcms_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     $status = $this->input->post("approval_status");
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $user_data = array('status' => $status);
         $user_data['update_by'] = $user->id;
         $user_data['update_date'] = time();
         if ($id > 0) {
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_users'), $user_data, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $ajax['status'] = true;
                 if ($status == 1) {
                     $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);
             }
         }
     }
 }
Ejemplo n.º 16
0
 private function dcms_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;
         }
     }
     $userDetail = $this->input->post('user_detail');
     if ($id > 0) {
         if ($userDetail['password'] != "") {
             $encryptPass = md5($userDetail['password']);
             unset($userDetail['password']);
             unset($userDetail['confirm_password']);
             $userDetail['password'] = $encryptPass;
         } else {
             unset($userDetail['password']);
             unset($userDetail['confirm_password']);
         }
         if ($userDetail['ques_id'] == '') {
             unset($userDetail['ques_id']);
             unset($userDetail['ques_ans']);
         }
     }
     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));
         // Mail Function
         $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->dcms_list();
             } else {
                 $this->dcms_list();
             }
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
             $this->jsonReturn($ajax);
         }
     } else {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
         $this->jsonReturn($ajax);
     }
 }
Ejemplo n.º 17
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.º 18
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);
             }
         }
     }
 }