- Timestamp:
- Nov 4, 2014 4:14:22 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php
r373 r401 56 56 $data['start'] = ($data['current_page'] - 1) * $data['perpage']; 57 57 $data['total'] = $this->collabolator_model->countCollaborator($data); 58 $data['collaborators'] = $this->collabolator_model->getCollaborator ($data);58 $data['collaborators'] = $this->collabolator_model->getCollaborators($data); 59 59 60 60 $data['paging_url'] = base_url() . "/admin/cong_tac_vien/trang/"; … … 121 121 echo json_encode($result); 122 122 } 123 123 public function viewUser() 124 { 125 $id=$this->uri->segment(4); 126 $this->load->model('collabolator_model'); 127 $data=$this->collabolator_model->getCollaborator($id); 128 $this->load->view('collaborator/viewUser',$data); 129 } 130 public function editUser() 131 { 132 $id=$this->uri->segment(4); 133 $this->load->model('collabolator_model'); 134 $data=$this->collabolator_model->getCollaborator($id); 135 $this->load->view('collaborator/editUser',$data); 136 } 137 public function updateUser() 138 { 139 $input['activated']=0; 140 $input= array_merge($input,$this->input->post()); 141 $this->load->model('collabolator_model'); 142 if (strlen($input['full_name'])==0) 143 { 144 $result['errors'][]="Tên cá»ng tác viên khÃŽng ÄÆ°á»£c Äá» trá»ng"; 145 } 146 if (strlen($input['login_name'])==0) 147 { 148 $result['errors'][]="Tên ÄÄng nháºp khÃŽng ÄÆ°á»£c Äá» trá»ng"; 149 } 150 else 151 { 152 if ($this->collabolator_model->isExist(array('field'=>'login_name','value'=>$input['login_name'],'id'=>$input['id']))) 153 { 154 $result['errors'][]="Tên ÄÄng nháºp Äã ÄÆ°á»£c sá» dụng"; 155 } 156 } 157 if (strlen($input['cellphone'])==0) 158 { 159 $result['errors'][]="Sá» Äiá»n thoại khÃŽng ÄÆ°á»£c Äá» trá»ng"; 160 } 161 else 162 { 163 if ($this->collabolator_model->isExist(array('field'=>'cellphone','value'=>$input['cellphone'],'id'=>$input['id']))) 164 { 165 $result['errors'][]="Sá» Äiá»n thoại Äã ÄÆ°á»£c sá» dụng"; 166 } 167 } 168 if (strlen($input['passwd'])==0) 169 { 170 //$result['errors'][]="Máºt khẩu khÃŽng ÄÆ°á»£c Äá» trá»ng"; 171 } 172 if ($input['passwd'] != $input['passwd2']) 173 { 174 $result['errors'][]="Máºt khẩu khÃŽng trùng nhau"; 175 } 176 if (!isset($result['errors'])) 177 { 178 unset($input['passwd2']); 179 $input['activated']=1; 180 $input['updated_time']=date("Y-m-d H:i:s"); 181 $this->load->model('collabolator_model'); 182 $this->collabolator_model->update($input['id'],$input); 183 $result['success'] = 1; 184 } 185 echo json_encode($result); 186 } 124 187 public function test() { 125 188 126 $this->load->library('doctrine');189 127 190 for ($i = 1; $i <= 500; $i++) { 128 $collaborator = new Entities\Tblcollaborator(); 129 $collaborator->setActivated(rand(0, 1)); 130 $collaborator->setAuthor(1); 131 $collaborator->setCellphone('0' . (1695061706 + $i)); 132 $collaborator->setCreatedTime(date("Y-m-d H:i:s")); 133 $collaborator->setFullName("Full Name " . $i); 134 $collaborator->setLoginName("loginname" . $i); 135 $collaborator->setPasswd(md5("12345678")); 136 $collaborator->setUpdatedTime(date("Y-m-d H:i:s")); 137 try { 138 $this->doctrine->em->persist($collaborator); 139 $this->doctrine->em->flush(); 140 $result['success'] = 1; 141 } catch (Exception $e) { 142 143 echo $e; 144 } 191 $input['full_name']="Full Name ".$i; 192 $input['login_name']="loginname".$i; 193 $input['passwd']=md5("12345678"); 194 $input['cellphone']="01234567".(100+$i); 195 $input['activated']=rand(0,1); 196 $input['created_time']=date("Y-m-d H:i:s"); 197 $input['updated_time']=date("Y-m-d H:i:s"); 198 $this->load->model('collabolator_model'); 199 $this->collabolator_model->insert($input); 145 200 } 146 201 }
Note: See TracChangeset
for help on using the changeset viewer.