Changeset 401 for pro-violet-viettel/sourcecode/application/modules
- Timestamp:
- Nov 4, 2014 4:14:22 PM (11 years ago)
- Location:
- pro-violet-viettel/sourcecode/application/modules/admin
- Files:
-
- 4 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 } -
pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php
r374 r401 12 12 } 13 13 14 function getCollaborator ($data) {14 function getCollaborators($data) { 15 15 $sql = "SELECT * FROM " . $this->table_name; 16 16 if ($data['keyword']) { … … 36 36 37 37 function isExist($data) { 38 $sql = "SELECT COUNT(id) as total FROM " . $this->table_name . " WHERE " . $data['field'] . " = '" . $data['value'] . "' LIMIT 1"; 39 if ($this->db->query($sql)->row_array()['total'] == 1) { 38 $sql = "SELECT COUNT(id) as total FROM " . $this->table_name . " WHERE " . $data['field'] . " = '" . $data['value'] . "'"; 39 if (isset($data['id'])) 40 { 41 $id=$data['id']; 42 $sql.=" AND id <> ".$id." LIMIT 1"; 43 } 44 $result = $this->db->query($sql)->row_array(); 45 if ($result['total'] == 1) { 40 46 return true; 41 47 } else { … … 53 59 } 54 60 } 55 if (isset($this->db->query($sql)->row_array()['total']))56 {57 return $this->db->query($sql)->row_array()['total'];58 }59 else60 {61 return 0;62 }61 $result = $this->db->query($sql)->row_array(); 62 return $result['total']; 63 } 64 function getCollaborator($id) 65 { 66 $sql="SELECT * FROM ".$this->table_name." WHERE id=".$id." LIMIT 1"; 67 $result = $this->db->query($sql)->row_array(); 68 return $result; 63 69 } 64 70 -
pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/index.php
r375 r401 2 2 $base_url = base_url(); 3 3 $this->load->view('layout/admin/header', array('base_url' => $base_url)); 4 $this->load->view('layout/admin/sidebar', array('base_url' => $base_url ));4 $this->load->view('layout/admin/sidebar', array('base_url' => $base_url, 'method'=>$this->router->method, 'class'=>$this->router->class )); 5 5 ?> 6 6 <script type="text/javascript"> … … 35 35 36 36 37 $( '.sorting, .sorting_desc, .sorting_asc' ).click(function( index ) {37 $( '.sorting, .sorting_desc, .sorting_asc' ).click(function( index ) { 38 38 var current_class=$( this ).attr('class'); 39 39 $(".sorting_desc").attr("class","sorting"); … … 62 62 filter(); 63 63 }); 64 $('[data-toggle="ajaxModal"]').on('click', 65 function(e) { 66 $('#ajaxModal').remove(); 67 e.preventDefault(); 68 var $this = $(this) 69 , $remote = $this.data('remote') || $this.attr('href') 70 , $modal = $('<div class="modal" id="ajaxModal"><div class="modal-body"></div></div>'); 71 $('body').append($modal); 72 $modal.modal({backdrop: 'static', keyboard: false}); 73 $modal.load($remote); 74 } 75 ); 64 76 65 77 -
pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/listview.php
r373 r401 83 83 </label> 84 84 </th> 85 86 <th class="<?php if ($sorting_field == 'full_name') {echo $sorting_order;} else {echo "sorting";}?>" id="full_name" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 183px;" aria-label="Há» tên: activate to sort column ascending">Há» tên</th> 85 87 <th class="<?php if ($sorting_field == 'cellphone') {echo $sorting_order;} else {echo "sorting";}?>" id="cellphone" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Sá» Äiá»n thoại: activate to sort column ascending">Sá» Äiá»n thoại</th> 86 <th class="<?php if ($sorting_field == 'full_name') {echo $sorting_order;} else {echo "sorting";}?>" id="full_name" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 183px;" aria-label="Há» tên: activate to sort column ascending">Há» tên</th>87 88 <th class="sorting" id="money" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 122px;" aria-label="Tiá»n: activate to sort column ascending">Tiá»n</th> 88 89 <th class="<?php if ($sorting_field == 'created_time') {echo $sorting_order;} else {echo "sorting";}?>" id="created_time" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 209px;" aria-label="Ngà y ÄÄng kÜ: activate to sort column ascending"> … … 107 108 </td> 108 109 110 111 <td class=" "><?php echo $collaborator['full_name']?></td> 109 112 <td class=" "> 110 113 <a href="#"><?php echo $collaborator['cellphone']?></a> 111 114 </td> 112 <td class=" "><?php echo $collaborator['full_name']?></td>113 115 <td class="hidden-480 ">3,330 VND</td> 114 116 <td class=" "><?php echo $collaborator['created_time']?></td> … … 131 133 <div class="visible-md visible-lg hidden-sm hidden-xs action-buttons"> 132 134 <a href="#" class="blue"> 133 <i class="icon-zoom-in bigger-130"></i>135 <i data-toggle="ajaxModal" href='http://viettel.violet.vn/admin/cong_tac_vien/xem/<?php echo $collaborator['id'];?>' class="icon-zoom-in bigger-130"></i> 134 136 </a> 135 137 136 138 <a href="#" class="green"> 137 <i class="icon-pencil bigger-130"></i>139 <i data-toggle="ajaxModal" href='http://viettel.violet.vn/admin/cong_tac_vien/sua/<?php echo $collaborator['id'];?>' data-toggle="modal" href='#editUser' class="icon-pencil bigger-130"></i> 138 140 </a> 139 141 140 142 <a href="#" class="red"> 141 <i class="icon-trash bigger-130"></i>143 <i data-toggle="ajaxModal" href='http://viettel.violet.vn/admin/cong_tac_vien/xoa/<?php echo $collaborator['id'];?>' data-toggle="modal" href='#deleteUser' class="icon-trash bigger-130"></i> 142 144 </a> 143 145 </div>
Note: See TracChangeset
for help on using the changeset viewer.