Changeset 349 for pro-violet-viettel/sourcecode
- Timestamp:
- Oct 30, 2014 4:57:34 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/admin/controllers/home.php
r342 r349 61 61 } 62 62 63 public function insert() 64 { 65 $admin_info = $this->session->userdata('adminInfo'); 66 if($admin_info) 67 { 68 $login_name = $this->input->post('username'); 69 $password = $this->input->post('password'); 70 $full_name = $this->input->post('fullname'); 71 $email = $this->input->post('email'); 72 $phone = $this->input->post('phone'); 73 $created_time = date('Y-m-d H:i:s', time()); 74 $updated_time = date('Y-m-d H:i:s', time()); 75 $data = array('login_name'=>$login_name, 'full_name'=>$full_name, 'email'=>$email, 'phone'=>$phone, 'created_time'=>$created_time, 'updated_time'=>$updated_time); 76 $this->load->model('admin_model'); 77 $this->admin_model->insert($data); 78 redirect("/admin/home/admin_acc"); 79 80 }else 81 { 82 redirect("/admin/home"); 83 } 84 } 85 86 public function update() 87 { 88 $admin_info = $this->session->userdata('adminInfo'); 89 if($admin_info) 90 { 91 $admin_id = (int)$this->input->post('id'); 92 $login_name = $this->input->post('username'); 93 //$password = $this->input->post('password'); 94 $full_name = $this->input->post('fullname'); 95 $email = $this->input->post('email'); 96 $phone = $this->input->post('phone'); 97 $updated_time = date('Y-m-d H:i:s', time()); 98 $data = array('login_name'=>$login_name, 'full_name'=>$full_name, 'email'=>$email, 'phone'=>$phone, 'updated_time'=>$updated_time); 99 $this->load->model('admin_model'); 100 $this->admin_model->update($admin_id, $data); 101 redirect("/admin/home/admin_acc"); 102 }else 103 { 104 redirect("/admin/home"); 105 } 106 } 107 108 public function delete() 109 { 110 $admin_info = $this->session->userdata('adminInfo'); 111 if($admin_info) 112 { 113 $admin_id = (int)$this->input->post('id'); 114 //echo $admin_id; 115 $this->load->model('admin_model'); 116 $this->admin_model->delete($admin_id); 117 redirect("/admin/home/admin_acc"); 118 }else 119 { 120 redirect("/admin/home"); 121 } 122 123 } 124 63 125 }
Note: See TracChangeset
for help on using the changeset viewer.