Changeset 906 for pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php
- Timestamp:
- Apr 23, 2015 12:00:06 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php
r838 r906 17 17 $admin_info = $this->session->userdata('adminInfo'); 18 18 if ($admin_info) { 19 $data['content'] = $this->getCollaborators(); 19 $roles=array(); 20 foreach ($admin_info['roles'] as $role) 21 { 22 $roles[]=$role['role_name']; 23 } 24 //$data['roles']=$roles; 25 $data['content'] = $this->getCollaborators(array(), $roles); 20 26 $this->load->view('collaborator/index', $data); 21 27 } else { … … 24 30 } 25 31 26 public function getCollaborators($filters = array() ) {32 public function getCollaborators($filters = array(), $roles) { 27 33 $this->load->helper('pagging'); 28 34 $this->load->model('collabolator_model'); … … 76 82 $data['num_links'] = 2; 77 83 $data['paging'] = pagging($data); 78 84 $data['roles'] = $roles; 85 79 86 if ($this->input->is_ajax_request()) { 80 87 return $this->load->view('collaborator/listview', $data); … … 88 95 $input = $this->input->post(); 89 96 $this->load->model('collabolator_model'); 90 if (strlen($input['full_name'])==0) 91 { 92 $result['errors'][]=array("content"=>"Tên cá»ng tác viên khÃŽng ÄÆ°á»£c Äá» trá»ng","field"=>"full_name"); 93 } 94 if (strlen($input['login_name'])==0) 95 { 96 $result['errors'][]=array("content"=>"Tên ÄÄng nháºp khÃŽng ÄÆ°á»£c Äá» trá»ng","field"=>"login_name"); 97 98 if (strlen($input['cellphone'])==0) 99 { 100 $result['errors'][] = array("content"=>lang('_SBG_PHONE_REQUIRED_MSG'),"field"=>"cellphone"); 97 101 } 98 102 else 99 103 { 100 if ($this->collabolator_model->isExist(array('field'=>'login_name','value'=>$input['login_name']))) 101 { 102 $result['errors'][]=array("content"=>"Tên ÄÄng nháºp Äã ÄÆ°á»£c sá» dụng","field"=>"login_name"); 103 } 104 } 105 if (strlen($input['cellphone'])==0) 106 { 107 $result['errors'][]=array("content"=>"Sá» Äiá»n thoại khÃŽng ÄÆ°á»£c Äá» trá»ng","field"=>"cellphone"); 108 } 109 else 110 { 104 if (!preg_match('/^([0-9]{10,11}$)$/', $input['cellphone'])) { 105 $result['errors'][] = array("content"=>lang('_SBG_PHONE_FORMAT_ERROR_MSG'), "field"=>"cellphone"); 106 } 107 111 108 if ($this->collabolator_model->isExist(array('field'=>'cellphone','value'=>$input['cellphone']))) 112 109 { 113 $result['errors'][]=array("content"=>"Sá» Äiá»n thoại Äã ÄÆ°á»£c sá» dụng","field"=>"cellphone"); 114 } 115 } 116 if (strlen($input['passwd'])==0) 117 { 118 $result['errors'][]=array("content"=>"Máºt khẩu khÃŽng ÄÆ°á»£c Äá» trá»ng","field"=>"passwd"); 119 } 120 else 121 { 122 if ($input['passwd'] != $input['passwd2']) 123 { 124 $result['errors'][]=array("content"=>"Máºt khẩu phải trùng nhau","field"=>"passwd"); 125 } 126 } 110 $result['errors'][] = array("content"=>lang("_SBG_PHONE_DUPLICATE_MSG"),"field"=>"cellphone"); 111 } 112 } 113 127 114 if (!isset($result['errors'])) 128 115 { 129 unset($input['passwd2']); 130 $input['passwd']=md5($input['activated']); 131 $input['activated']=1; 132 $input['created_time']=date("Y-m-d H:i:s"); 133 $input['updated_time']=date("Y-m-d H:i:s"); 116 117 $passwd = $this->collabolator_model->createRandomPassword(); 118 $input['passwd'] = md5($input['activated']); 119 $input['login_name'] = $input['cellphone']; 120 $input['author'] = 1; 121 $input['activated'] = 1; 122 $input['created_time'] = date("Y-m-d H:i:s"); 123 $input['updated_time'] = date("Y-m-d H:i:s"); 134 124 $this->load->model('collabolator_model'); 125 135 126 $this->collabolator_model->insert($input); 136 127 $result['success'] = 1;
Note: See TracChangeset
for help on using the changeset viewer.