- Timestamp:
- Oct 30, 2014 6:21:10 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php
r345 r354 17 17 if ($admin_info) { 18 18 $data['content'] = $this->getCollaborators(); 19 $this-> parser->parse('collaborator/index',$data);19 $this->load->view('collaborator/index',$data); 20 20 } else { 21 21 $this->load->view('login'); … … 24 24 public function getCollaborators($filters=array()) 25 25 { 26 $this->load->driver("pp");26 27 27 $data['current_page'] = $this->uri->segment(4,1); 28 28 $data['itemsoptions']=array(10,25,50,100); 29 $data['perpage'] = 10; 29 $data['perpage'] = 10; 30 30 31 if ($this->input->post('items')) 31 32 { 32 33 $data['perpage'] = $this->input->post('items'); 33 34 } 34 35 $sql="SELECT * FROM tblcollaborator"; 35 36 $data['keyword']=''; 36 $sql=" FROM Entities\Tblcollaborator c";37 37 38 if ($this->input->post('keyword')) 38 39 { 39 $sql.=" WHERE c.full_name LIKE '%".$this->input->post('keyword')."%'"; 40 $data['keyword']=$this->input->post('keyword'); 40 $sql.=" WHERE (full_name LIKE '%".$this->input->post('keyword')."%' OR login_name LIKE '%".$this->input->post('keyword')."%')"; 41 41 } 42 43 $query = $this->doctrine->em->createQuery('SELECT COUNT(c.id) '.$sql); 44 $data['total'] = $query->getSingleScalarResult(); 45 46 $query = $this->doctrine->em->createQuery('SELECT c '.$sql); 47 $query->setFirstResult(($data['current_page']-1)*$data['perpage']); 48 $query->setMaxResults($data['perpage']); 49 $data['collaborators'] = $query->getArrayResult(); 50 51 42 43 $data['total']=500; 44 $data['start']=($data['current_page']-1)*$data['perpage']; 45 $query = $this->db->query($sql." LIMIT ".$data['start'].", ".$data['perpage'].""); 46 $data['collaborators']=$query->result_array(); 52 47 $this->load->library('pagination'); 53 48 $url = "http://$_SERVER[HTTP_HOST]/admin/cong_tac_vien/trang/"; … … 79 74 80 75 if ($this->input->is_ajax_request()) { 81 return $this-> pp->parse('modules/admin/views/collaborator/listview', $data);76 return $this->load->view('collaborator/listview', $data); 82 77 } 83 return $this-> pp->parse('modules/admin/views/collaborator/listview', $data,true);78 return $this->load->view('collaborator/listview', $data,true); 84 79 } 85 80 public function test() { 81 $data=$this->db->get_where('tblcollaborator'); 82 print_r ($data->result_array()); 83 die(); 86 84 for ($i = 1; $i <= 500; $i++) { 87 85 $collaborator = new Entities\Tblcollaborator();
Note: See TracChangeset
for help on using the changeset viewer.