Example #1
0
 public function delete($id)
 {
     // Kijken of user ingelogd is en admin is
     $user = $this->authex->getUserInfo();
     if ($user == null) {
         redirect('home/login');
     }
     if ($user->niveauId != 1) {
         redirect('home/login');
     }
     //Controleren of er een id is, anders redirecten. Gebruiker kan nooit hier op komen zonder ID.
     //Als er geen ID is, heeft hij de url zelf zo ingetypd.
     if ($id == null) {
         redirect('manage/hotels');
     } else {
         if (!is_numeric($id)) {
             redirect('manage/hotels');
         }
     }
     //Models laden
     $this->load->model('conferentiedag_model');
     $this->load->model('sessie_model');
     $this->load->model('activiteit_model');
     //Kijken of er geen sessies meer aan gebonden zijn
     $sessies = $this->sessie_model->getSessionsConferenceDay($id);
     $activities = $this->activiteit_model->getAllActivitiesConference($id);
     //Kijken of er sessies/activities aan gebonden zijn
     if (count($sessies) == 0 && count($activities) == 0) {
         $this->conferentiedag_model->delete($id);
     }
     //Redirect terug naar current pagina
     redirect_back();
 }
 public function mark_all($user_reff, $user_reff_id)
 {
     $this->auth->login_scurity();
     $this->model_notification->mark_all($user_reff, $user_reff_id);
     set_flashdata("notif", alert("Success mark as read"));
     redirect_back();
 }
Example #3
0
 function enroll()
 {
     $this->form_validation->set_rules('user_skype', 'Skype ID', 'trim|required');
     $this->form_validation->set_rules('user_contact', 'Contact #', 'trim|required');
     if ($this->form_validation->run() == false) {
         $this->session->set_flashdata('msg', '<div class="alert alert-danger text-center">Error.</div>');
         redirect_back();
     } else {
         $course = $this->input->post('course');
         $id = $this->session->userdata('id');
         $username = $this->session->userdata('username');
         $date = $this->input->post('date');
         $time = $this->input->post('time');
         $hours = $this->input->post('hours');
         $price = $this->input->post('price');
         $user_skype = $this->input->post('user_skype');
         $user_contact = $this->input->post('user_contact');
         $course_no = $this->input->post('course_no');
         $enroll = array('course' => $course, 'username' => $username, 'date' => $date, 'TIME_START' => $time, 'hours' => $hours, 'price' => $price, 'course_no' => $course_no, 'status' => 'Enrolled');
         $prof = array('username' => $username, 'USER_SKYPE' => $user_skype, 'USER_CONTACT' => $user_contact);
         $this->Schedules_model->enroll($enroll, $prof);
         $this->session->set_flashdata('msg', '<div class="alert alert-success text-center">Schedule created. We will send you an email for confirmation. </div>');
         redirect('student/profile');
     }
 }
Example #4
0
 public function _edit($talk_id, $title)
 {
     $this->subtitle($title)->load->library('form')->add_rules('talks', array('title' => $title))->add_submit($this('edit'))->add_back('admin/talks.html');
     if ($this->form->is_valid($post)) {
         $this->model()->edit_talk($talk_id, $post['title']);
         //add_alert('success', $this('edit_success_message'));
         redirect_back('admin/talks.html');
     }
     return new Panel(array('title' => $this('edit_talk'), 'icon' => 'fa-comment-o', 'content' => $this->form->display()));
 }
Example #5
0
 public function _edit($page_id, $name, $published, $title, $subtitle, $content, $tab)
 {
     $this->subtitle($title)->load->library('form')->add_rules('pages', array('title' => $title, 'subtitle' => $subtitle, 'name' => $name, 'content' => $content, 'published' => $published))->add_submit($this('edit'))->add_back('admin/pages.html');
     if ($this->form->is_valid($post)) {
         $this->model()->edit_page($page_id, $post['name'], $post['title'], in_array('on', $post['published']), $post['subtitle'], $post['content'], $this->config->lang);
         //add_alert('success', $this('edit_success_message'));
         redirect_back('admin/pages.html');
     }
     return new Panel(array('title' => $this('edit_page'), 'icon' => 'fa-align-left', 'content' => $this->form->display()));
 }
Example #6
0
 public function _edit($game_id, $parent_id, $image_id, $icon_id, $title)
 {
     $this->title($this('games_maps'))->subtitle($this('edit_game'))->load->library('form')->add_rules('games', array('games' => $this->model()->get_games_list($game_id), 'title' => $title, 'parent_id' => $parent_id, 'image_id' => $image_id, 'icon_id' => $icon_id))->add_submit($this('edit'))->add_back('admin/games.html');
     if ($this->form->is_valid($post)) {
         $this->model()->edit_game($game_id, $post['title'], $post['parent_id'], $post['image'], $post['icon']);
         //add_alert('success', $this('edit_game_message'));
         redirect_back('admin/games.html');
     }
     $game = $this->form->display();
     return new Panel(array('title' => $this('edit_game_title', $title), 'icon' => 'fa-gamepad', 'content' => $game));
 }
Example #7
0
 function add_new_people($p_id = false)
 {
     $this->load->library('form_validation');
     $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
     $this->form_validation->set_rules('first_name', 'Name', 'required|min_length[1]|max_length[100]');
     $this->form_validation->set_rules('last_name', 'Name', 'required|min_length[1]|max_length[100]');
     $this->form_validation->set_rules('company_name', 'company name', 'min_length[1]|max_length[100]');
     $this->form_validation->set_rules('mobile', 'Mobile', 'regex_match[/^[0-9]{10}$/]');
     $this->form_validation->set_rules('email', 'Email', 'valid_email');
     $this->form_validation->set_rules('address1', 'Address', 'required|min_length[1]|max_length[200]');
     $this->form_validation->set_rules('city', 'city', 'required');
     if ($this->form_validation->run() == FALSE) {
         set_message(validation_errors());
         redirect_back();
         return 0;
     } else {
         $first_name = strtoupper($this->input->post('first_name'));
         $last_name = strtoupper($this->input->post('last_name'));
         $company_name = strtoupper($this->input->post('company_name'));
         $email = $this->input->post('email');
         $sec_email = $this->input->post('sec_email');
         $mobile = $this->input->post('mobile');
         $phone = $this->input->post('phone');
         $website = $this->input->post('website');
         $skype = $this->input->post('skype');
         $industry = $this->input->post('industry');
         $address1 = $this->input->post('address1');
         $address2 = $this->input->post('address2');
         $city = $this->input->post('city');
         $state = $this->input->post('state');
         $country = $this->input->post('country');
         $note = $this->input->post('note');
         if ($this->session->userdata('role') != 'admin') {
             $companyid = $this->session->userdata('companyid');
         } else {
             $companyid = $this->input->post('companyid');
         }
         $people_data = array('company_name' => $company_name, 'first_name' => $first_name, 'last_name' => $last_name, 'email' => $email, 'sec_email' => $sec_email, 'mobile' => $mobile, 'phone' => $phone, 'website' => $website, 'skype' => $skype, 'industry' => $industry, 'address1' => $address1, 'address2' => $address2, 'city' => $city, 'state' => $state, 'country' => $country, 'note' => $note);
         if ($p_id) {
             $updated_at = date('Y-m-d H:i:s');
             $people_data['updated_at'] = $updated_at;
             $this->db->where('people_id', $p_id);
             $res = $this->db->update('people', $people_data);
             return $res;
         } else {
             $created_at = date('Y-m-d H:i:s');
             $people_data['created_at'] = $created_at;
             $this->db->insert('people', $people_data);
             $people_id = $this->db->insert_id();
             return $people_id;
         }
     }
 }
Example #8
0
 public function destroy($id)
 {
     $cart_items = $this->session->userdata('cart_items');
     foreach ($cart_items as $key => $item) {
         if ($item == $id) {
             unset($cart_items[$key]);
             break;
         }
     }
     $this->session->set_userdata('cart_items', $cart_items);
     redirect_back();
 }
Example #9
0
 public function insert_address()
 {
     $user_id = $this->session->userdata('user_session')['user_id'];
     if ($this->form_validation->run() == FALSE) {
         $this->session->set_flashdata('errors', validation_errors());
         redirect_back();
     } else {
         $this->order->update($user_id, $this->input->post());
         $this->session->set_flashdata('success', 'Payment success!');
         redirect('/products');
     }
 }
Example #10
0
 function do_delete($id)
 {
     if (isPost()) {
         $comment = $this->get('Comment', $id);
         if ($comment && $comment->canEdit($this->currentUser)) {
             $comment->entry->get();
             $comment->delete();
         } else {
             $this->show_error('Permission denied');
         }
         redirect_back(url_to($comment->entry, 'show'));
     }
 }
Example #11
0
 function add_place()
 {
     $data = $this->input->post();
     $time = time();
     /* var_dump(date("Y-m-d",$time));
     		echo "<pre>";
     		//var_dump($data);
     		echo "</pre>"; */
     $data1 = array("plc_id" => $data['gid'], "name" => $data['name'], "proportion" => $data['place_area'] . "平方米", "price" => $data['place_price'] . "元", "content" => $data['content'], "created" => $time);
     /* echo "<pre>";
     		var_dump($data1);
     		echo "</pre>"; */
     /**
      * xingde.wei
      * 获取汉字拼音
      */
     // 		$this->load->library('chinesespell');
     // 		$hanzi = iconv("UTF-8","GBK//IGNORE",$data['name']);
     // 		$hanzi = $this->chinesespell->getFullSpell($hanzi);
     // 		$data1['hanzi'] = $hanzi;
     $this->load->model('place_room_model');
     $pr_id = $this->place_room_model->insert($data1);
     if (!empty($pr_id) && isset($pr_id)) {
         $this->load->library('upload2');
         $filedir = 'place_pic/' . date('Ym', time()) . '/' . date('d', time()) . '/';
         $upload_obj = 'upload/';
         $this->upload2->field = 'image';
         $this->upload2->set_dir($upload_obj, $filedir);
         $fs = $this->upload2->execute();
         //var_dump($fs);
         if (!empty($fs)) {
             foreach ($fs as $item) {
                 $pic_file = $upload_obj . $filedir . $item['name'];
                 $data2 = array("room_id" => $pr_id, "pic" => $pic_file, "time" => $time);
                 $this->load->model('place_image_model');
                 $pi_id = $this->place_image_model->insert($data2);
                 if (!empty($pi_id) && isset($pi_id)) {
                     redirect_back();
                 } else {
                     show_error("添加失败!");
                 }
             }
         }
     }
 }
Example #12
0
 public function create()
 {
     $this->auth->allow(array('member'));
     $this->form_validation->set_rules('base_name', 'Base Name', 'required|min_length[5]');
     if ($this->form_validation->run()) {
         $base_name = $this->input->post('base_name');
         $base_desc = $this->input->post('base_desc');
         $base_town_hall = $this->input->post('base_town_hall');
         $data = array('base_name' => $base_name, 'base_desc' => $base_desc, 'base_town_hall' => $base_town_hall, 'base_created_date' => now(), 'base_created_by' => user_member('iduser'));
         $config['upload_path'] = FCPATH . 'asset/base-image/';
         $config['allowed_types'] = 'gif|jpg|png';
         $config['max_size'] = '999999';
         $config['max_width'] = '999999';
         $config['max_height'] = '999999';
         $config['filename'] = 'tes.jpg';
         $this->load->library('upload', $config);
         if ($_FILES and $_FILES['base_image']['name']) {
             if (!$this->upload->do_upload("base_image")) {
                 $error = $this->upload->display_errors();
                 set_flashdata("notif", $error);
                 redirect_back();
             } else {
                 $data_upload = $this->upload->data();
                 $data['base_image'] = $data_upload['file_name'];
                 set_flashdata("notif", 'Success share base');
             }
         } else {
             set_flashdata("notif", 'Please choose once image.');
             redirect_back();
         }
         $idbase = $this->model_base->store($data);
         redirect('base/detail/' . $idbase);
     }
     $data = array();
     $this->template->render('front/base/create-base', $data);
 }
Example #13
0
 function save_task()
 {
     //dsm($this->input->post()); die;
     $project_task_id = $this->input->post('project_task_id');
     $this->load->model('lead_model');
     $this->load->model('user_model');
     $this->load->model('project_model');
     $this->load->library('form_validation');
     $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
     $this->form_validation->set_rules('project_id', 'Project', 'required');
     $this->form_validation->set_rules('employee_id', 'Employee', 'required');
     $this->form_validation->set_rules('project_task_priority', 'Task Priority', 'required');
     $this->form_validation->set_rules('project_task_label', 'Task Label', 'required');
     $this->form_validation->set_rules('project_status_id', 'project Status', 'required');
     $this->form_validation->set_rules('task_status', 'Task Status', 'required');
     $this->form_validation->set_rules('project_task_title', 'Task Title', 'required');
     $this->form_validation->set_rules('project_task_description', 'Task Description', 'required');
     if ($this->form_validation->run() == FALSE) {
         set_message(validation_errors());
         redirect_back();
         return 0;
     } else {
         $project_id = $this->input->post('project_id');
         $employee_id = $this->input->post('employee_id');
         $project_task_priority = $this->input->post('project_task_priority');
         $project_task_label = $this->input->post('project_task_label');
         $project_status_id = $this->input->post('project_status_id');
         $task_status = $this->input->post('task_status');
         $project_task_title = $this->input->post('project_task_title');
         $project_task_progress = $this->input->post('project_task_progress');
         $project_task_estimate = $this->input->post('project_task_estimate');
         $start_date = $this->input->post('start_date');
         $due_date = $this->input->post('due_date');
         $project_task_description = $this->input->post('project_task_description');
         $task_data = array('project_id' => $project_id, 'employee_id' => $employee_id, 'project_task_priority' => $project_task_priority, 'project_task_label' => $project_task_label, 'project_status_id' => $project_status_id, 'task_status' => $task_status, 'project_task_title' => $project_task_title, 'project_task_progress' => $project_task_progress, 'project_task_estimate' => $project_task_estimate, 'start_date' => $start_date, 'due_date' => $due_date, 'project_task_description' => $project_task_description, 'created_by' => $this->session->userdata('uid'));
         if ($project_task_id) {
             $task_data['updated_at'] = date('Y-m-d H:i:s');
             $res = $this->project_model->update_project_task($task_data, $project_task_id);
             if ($res) {
                 set_message('Task Edited Successfully', 'success');
                 redirect_back();
             } else {
                 set_message('Something went wrong');
                 redirect_back();
             }
         } else {
             $task_data['created_at'] = date('Y-m-d H:i:s');
             $res = $this->project_model->add_project_task($task_data);
             if ($res) {
                 set_message('Task Added Successfully', 'success');
                 redirect_back();
             } else {
                 set_message('Something went wrong');
                 redirect_back();
             }
         }
     }
 }
Example #14
0
 public function _roles_edit($role_id, $title)
 {
     $this->subtitle($this('role_', $title))->load->library('form')->add_rules('roles', array('title' => $title))->add_submit($this('edit'))->add_back('admin/teams.html');
     if ($this->form->is_valid($post)) {
         $this->model('roles')->edit_role($role_id, $post['title']);
         //add_alert('success', $this('edit_role_success_message'));
         redirect_back('admin/teams.html');
     }
     return new Panel(array('title' => $this('edit_role'), 'icon' => 'fa-sitemap', 'content' => $this->form->display()));
 }
Example #15
0
 function do_logout()
 {
     $this->session->sess_destroy();
     redirect_back(url_to());
 }
Example #16
0
 public function set_qc_status()
 {
     $this->auth->is_allowed('qc_transfer');
     $this->form_validation->set_rules("status", "status", "required");
     $this->form_validation->set_rules("iduser", "iduser", "required");
     if ($this->input->post('status') == 'unavailable') {
         $this->form_validation->set_rules("remark", "remark", "required");
     }
     if ($this->form_validation->run()) {
         $status = $this->input->post("status");
         $iduser = $this->input->post('iduser');
         $data['user_status'] = $status;
         $this->model_user->change($iduser, $data);
         if ($status == 'unavailable') {
             $result_task = $this->model_task->get_task_pending_byuserqc($iduser);
             foreach ($result_task as $task) {
                 $qc_protelindo = $this->round_robin->get_next_protel_user();
                 $user = $this->model_user->find($qc_protelindo);
                 $data_log_qc = array('task_type' => 'pm', 'idtask' => $task->idpm_plan_detil, 'log_created_date' => date('Y-m-d H:i:s'), 'idqc_before' => $iduser, 'idqc_after' => $qc_protelindo, 'iduser_admin' => user_admin('iduser'), 'remark' => $this->input->post('remark'));
                 $this->model_log_qc->store($data_log_qc);
                 $data_task = array('pmp_qc_protelindo' => $qc_protelindo, 'om_update_by' => user_admin('iduser'), 'om_update_date' => date('Y-m-d H:i:s'));
                 $result_update_task = $this->model_task->update('pm_plan_detail', $data_task, 'idpm_plan_detil', $task->idpm_plan_detil);
                 if (!$result_update_task) {
                     set_flashdata("notif", alert("Gagal menetapkan task", 'danger'));
                     redirect_back();
                 }
             }
         }
         set_flashdata("notif", alert("Berhasil merubas status ke " . $status));
     } else {
         set_flashdata("notif", alert("Gagal merubah status " . validation_errors(), 'danger'));
     }
     redirect_back();
 }
Example #17
0
 public function _groups_edit($group_id, $name, $title, $color, $icon, $auto)
 {
     $this->title($this('groups'))->subtitle($this('edit'))->load->library('form')->add_rules('groups', array('title' => $title, 'color' => $color, 'icon' => $icon, 'auto' => $auto))->add_back('admin/members.html')->add_submit($this('edit'));
     if ($this->form->is_valid($post)) {
         if ($group_id) {
             $this->model('groups')->edit_group($group_id, $post['title'], $post['color'], $post['icon'], $this->config->lang, $auto);
         } else {
             $this->db->insert('nf_groups', array('name' => $name, 'color' => $post['color'], 'icon' => $post['icon'], 'auto' => TRUE));
         }
         //add_alert('success', $this('group_edited'));
         redirect_back('admin/members.html');
     }
     return new Panel(array('title' => $this('edit_group_title'), 'icon' => 'fa-users', 'content' => $this->form->display(), 'size' => 'col-md-12'));
 }
Example #18
0
 public function forgot_password()
 {
     if ($this->input->post()) {
         $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
         if ($this->form_validation->run() == TRUE) {
             $user = $this->User_model->get_user_by_email($this->input->post('email'));
             if (empty($user)) {
                 $this->session->set_flashdata('error', 'Not registered');
                 redirect_back();
             } else {
                 if ($user->activated == 1) {
                     $reset_code = uniqid();
                     $reset_link = site_url('auth/password_reset/' . $reset_code);
                     $data = array('password_reset_code' => $reset_code);
                     $this->User_model->update($data, $user->id);
                     $to = $user->email;
                     $subject = 'Reset your password';
                     $message = 'Someone has requested to reset your password.If you made this change reset your password by clicking the link ' . $reset_link;
                     $this->send_mail($to, $subject, $message);
                     $this->session->set_flashdata('success', 'please check your email');
                     redirect_back();
                 } else {
                     $this->session->set_flashdata('error', 'Email not verified');
                     redirect_back();
                 }
             }
         }
     }
     $this->load->view('auth/forgot_password');
 }
Example #19
0
 function pp_delete()
 {
     $gets = $this->input->get();
     if ($gets['type'] == 6) {
         $this->load->model('news_model');
         $data = $this->news_model->get_p_data("hz_exhibition", $gets['exh_id'])->result_array();
         $sponsor = $data[0]['sponsor'];
         //var_dump($host);
         $p = explode(',', $sponsor);
         foreach ($p as $k => $item) {
             if ($item == trim($gets['name'])) {
                 unset($p[$k]);
             }
         }
         $a = array_values($p);
         //var_dump($a);
         if (count($a) == 1) {
             $p_data = array("id" => $gets['exh_id'], "sponsor" => $a[0]);
             $this->load->model('exhibition_model');
             $p_num = $this->exhibition_model->save($p_data);
             if (!empty($p_num)) {
                 redirect_back();
             } else {
                 show_error("删除失败!");
             }
         } else {
             if (count($a) > 1) {
                 $b = implode(',', $a);
                 $p_data = array("id" => $gets['exh_id'], "sponsor" => $b);
                 $this->load->model('exhibition_model');
                 $p_num = $this->exhibition_model->save($p_data);
                 if (!empty($p_num)) {
                     redirect_back();
                 } else {
                     show_error("删除失败!");
                 }
             } else {
                 if (count($a) < 1) {
                     $p_data = array("id" => $gets['exh_id'], "sponsor" => '');
                     $this->load->model('exhibition_model');
                     $p_num = $this->exhibition_model->save($p_data);
                     if (!empty($p_num)) {
                         redirect_back();
                     } else {
                         show_error("删除失败!");
                     }
                 }
             }
         }
     }
 }
Example #20
0
 public function destroy($id)
 {
     $this->product->destroy($id);
     redirect_back();
 }
Example #21
0
 function signup()
 {
     if ($this->session->userdata('uid')) {
         redirect_back();
     } else {
         //event服务条款 start
         $this->load->model('other_more_model');
         $a_data = array('cat_name' => '服务条款');
         $a_num = $this->other_more_model->get_row_array($a_data);
         if (!empty($a_num)) {
             $data['clause_data'] = $a_num;
         }
         //event服务条款 end
         $this->load->helper('captcha');
         $captcha = create_my_captcha();
         $data['captcha_url'] = $captcha['img_url'];
         $this->session->set_userdata('captcha', $captcha['word']);
         $this->load->view('signup', $data);
     }
 }
Example #22
0
 function save_product()
 {
     //dsm($this->input->post()); die;
     $this->load->model('lead_model');
     $product_id = $this->input->post('product_id');
     $this->load->library('form_validation');
     $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
     $this->form_validation->set_rules('product_title', 'Product', 'required|min_length[1]|max_length[100]');
     $this->form_validation->set_rules('price', 'Product Price', 'regex_match[/^[0-9]$/]');
     if ($this->form_validation->run() == FALSE) {
         set_message(validation_errors());
         redirect_back();
         return 0;
     }
     $product_title = $this->input->post('product_title');
     $price = $this->input->post('price');
     $note = $this->input->post('note');
     $companyid = $this->session->userdata('companyid');
     $product_data = array('companyid' => $companyid, 'product_title' => $product_title, 'price' => $price, 'note' => $note);
     if ($product_id) {
         $res = $this->lead_model->update_product($product_data, $product_id);
         if ($res) {
             set_message('Product edited successfully.', 'success');
             redirect_back();
         } else {
             set_message('Something went wrong.');
             redirect_back();
         }
     } else {
         $product_data['created_at'] = date('Y-m-d H:i:s');
         $res = $this->lead_model->add_product($product_data);
         if ($res) {
             set_message('Product added successfully.', 'success');
             redirect_back();
         } else {
             set_message('Something went wrong.');
             redirect_back();
         }
     }
 }
Example #23
0
 function save_employee()
 {
     //dsm($this->input->post()); die;
     $emp_id = $this->input->post('emp_id');
     $p_id = $this->input->post('p_id');
     $this->load->model('user_model');
     $this->load->model('people_model');
     if ($p_id) {
         //dsm($this->input->post()); die;
         $res = $this->people_model->add_new_people($p_id);
         if ($res) {
             $updated_at = date('Y-m-d H:i:s');
             $join_date = $this->input->post('join_date');
             $dob = $this->input->post('dob');
             $designation = $this->input->post('designation');
             $emp_data = array('join_date' => $join_date, 'dob' => $dob, 'designation' => $designation, 'updated_at' => $updated_at);
             $res1 = $this->user_model->update_employee($emp_data, $emp_id);
             $this->session->set_flashdata('success', 'Employee edited successfully');
             redirect_back();
         } else {
             $this->session->set_flashdata('error', 'Somthing went wrong');
             redirect_back();
         }
     } else {
         $people_id = $this->people_model->add_new_people();
         if ($people_id) {
             $companyid = $this->session->userdata('companyid');
             $created_at = date('Y-m-d H:i:s');
             $join_date = $this->input->post('join_date');
             $dob = $this->input->post('dob');
             $designation = $this->input->post('designation');
             $emp_data = array('companyid' => $companyid, 'people_id' => $people_id, 'join_date' => $join_date, 'dob' => $dob, 'designation' => $designation, 'created_at' => $created_at);
             $res = $this->user_model->add_employee($emp_data);
             $companyid = $this->session->userdata('companyid');
             $password = $this->input->post('password');
             $email = $this->input->post('email');
             $dob = $this->input->post('dob');
             $role = 'employee';
             $created_at = date('Y-m-d H:i:s');
             $user_data = array('companyid' => $companyid, 'people_id' => $people_id, 'password' => md5($password), 'temp' => $password, 'role' => $role, 'dob' => $dob, 'email' => $email, 'created_at' => $created_at);
             $res1 = $this->user_model->add_user($user_data);
             $this->session->set_flashdata('success', 'New Employee and User added successfully');
             redirect_back();
         } else {
             $this->session->set_flashdata('error', 'Somthing went wrong');
             redirect_back();
         }
     }
 }
Example #24
0
 function past_delete()
 {
     $id = $this->input->get('id');
     $this->load->model('news_model');
     $this->load->model('past_model');
     $this->load->model('exhibition_model');
     $data = $this->news_model->get_exh_id_data("hz_gl_exh", $id)->result_array();
     $gl_id = $data[0]['id'];
     $gl_data = array("id" => $gl_id, 'exh_id' => $id);
     $num = $this->past_model->delete($gl_data);
     if (!empty($num) && isset($num)) {
         $ex_data = array("id" => $id, 'gl_type' => 0);
         $ex_num = $this->exhibition_model->save($ex_data);
         if (!empty($ex_num) && isset($ex_num)) {
             redirect_back();
         } else {
             show_error("有点小错误哦!");
         }
     } else {
         show_error("删除失败");
     }
 }
Example #25
0
 function delete_room()
 {
     $id = $this->input->get('ro_id');
     $this->load->model('room_order_model');
     $data = $this->room_order_model->get_result_array($id);
     $room_id = $data[0]['room_id'];
     $arr_data = array("id" => $room_id, "status" => 0);
     $arr_id = $this->room_order_model->delete($id);
     if (!empty($arr_id) && isset($arr_id)) {
         $this->load->model('place_room_model');
         $arr_num = $this->place_room_model->save($arr_data);
         if (!empty($arr_num) && isset($arr_num)) {
             redirect_back();
         } else {
             show_error('有点小错误哦!');
         }
     } else {
         show_error('删除失败!');
     }
 }
Example #26
0
 public function _lost_password($key_id, $user_id)
 {
     $this->title($this('password_reset'));
     $this->load->library('form')->add_rules(array('password' => array('label' => $this('new_password'), 'icon' => 'fa-lock', 'type' => 'password', 'rules' => 'required'), 'password_confirm' => array('label' => $this('password_confirmation'), 'icon' => 'fa-lock', 'type' => 'password', 'rules' => 'required', 'check' => function ($value, $post) {
         if ($post['password'] != $value) {
             return i18n('password_not_match');
         }
     })))->add_submit($this('save'))->add_back('user.html')->fast_mode();
     if ($this->form->is_valid($post)) {
         $this->load->library('email')->to($this->db->select('email')->from('nf_users')->where('user_id', $user_id)->row())->subject($this('password_reset_confirmation_email'))->message('default', array('content' => $this('password_reset_confirmation_message')))->send();
         $this->user->login($user_id);
         $this->model()->update_password($post['password'])->delete_key($key_id);
         foreach ($this->user->get_sessions() as $session) {
             if ($session['session_id'] != $this->session('session_id')) {
                 //TODO ajouter une alerte pour ces sessions pour expliquer pk ils sont déco
                 $this->session->disconnect($session['session_id']);
             }
         }
         redirect_back('user.html');
     }
     return new Panel(array('title' => $this('password_reset'), 'icon' => 'fa-lock', 'content' => $this->form->display()));
 }
Example #27
0
            show_error_redirect_back("Access denied");
        }
    }
    $pictures_result = try_mysql_query("SELECT * FROM pictures WHERE category_id='{$category_id}'", $db_read);
    while ($row = mysql_fetch_assoc($pictures_result)) {
        try_mysql_query("DELETE FROM comments WHERE picture_id='" . $pictures_result['picture_id'] . "'", $db_write);
    }
    mysql_free_result($pictures_result);
    try_mysql_query("DELETE FROM pictures WHERE category_id='{$category_id}'", $db_write);
    try_mysql_query("DELETE FROM categories WHERE category_id='{$category_id}'", $db_write);
    show_message_redirect("Category deleted", "show_user.php?user_id=" . $assoc['user_id']);
} else {
    # The user is deleting a picture
    $picture_id = $_GET['picture_id'];
    if (is_numeric($picture_id) == false) {
        redirect_back();
    }
    // Get the category
    $result = try_mysql_query("SELECT user_id,pictures.category_id FROM categories,pictures WHERE categories.category_id = pictures.category_id AND picture_id = {$picture_id}", $db_read);
    $assoc = mysql_fetch_assoc($result);
    mysql_free_result($result);
    if ($me['admin'] != 1 && $assoc['user_id'] != $me['user_id']) {
        show_error_redirect_back("Access denied");
    }
    try_mysql_query("DELETE FROM pictures WHERE picture_id = '{$picture_id}'", $db_write);
    try_mysql_query("DELETE FROM comments WHERE picture_id = '{$picture_id}'", $db_write);
    show_message_redirect("Picture deleted", "show_category.php?category_id=" . $assoc['category_id']);
}
?>
	
	
Example #28
0
 public function _categories_edit($category_id, $title, $image_id, $icon_id)
 {
     $this->subtitle($this('category_', $title))->load->library('form')->add_rules('categories', array('title' => $title, 'image' => $image_id, 'icon' => $icon_id))->add_submit($this('edit'))->add_back('admin/news.html');
     if ($this->form->is_valid($post)) {
         $this->model('categories')->edit_category($category_id, $post['title'], $post['image'], $post['icon']);
         //add_alert('success', $this('edit_category_success_message'));
         redirect_back('admin/news.html');
     }
     return new Panel(array('title' => $this('edit_category'), 'icon' => 'fa-align-left', 'content' => $this->form->display()));
 }
Example #29
0
 public function _categories_edit($category_id, $title)
 {
     $this->title($this('edit_category'))->subtitle($title)->load->library('form')->add_rules('categories', array('title' => $title))->add_submit($this('edit'))->add_back('admin/forum.html');
     if ($this->form->is_valid($post)) {
         $this->model()->edit_category($category_id, $post['title']);
         //add_alert('success', $this('edit_category_success'));
         redirect_back('admin/forum.html');
     }
     return new Panel(array('title' => $this('edit_category'), 'icon' => 'fa-comments', 'content' => $this->form->display()));
 }
Example #30
0
 public function delete($id)
 {
     $user_id = $this->session->userdata('user_id');
     $details = $this->Detail_model->get_details($id);
     if ($details->user_id != $user_id && $this->session->userdata('is_admin') != 1) {
         $this->session->set_flashdata('error', 'You are not authorized to do this action');
         redirect('dashboard');
     }
     $this->Detail_model->delete($id);
     $this->session->set_flashdata('success', "Item <b><i>" . $details->name . '</i></b> has been deleted');
     redirect_back();
 }