Ignore:
Timestamp:
Oct 30, 2014 6:21:10 PM (11 years ago)
Author:
quyenla
Message:

collaborator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php

    r345 r354  
    1717        if ($admin_info) {
    1818            $data['content'] = $this->getCollaborators();
    19             $this->parser->parse('collaborator/index',$data);
     19            $this->load->view('collaborator/index',$data);
    2020        } else {
    2121            $this->load->view('login');
     
    2424    public function getCollaborators($filters=array())
    2525    {
    26         $this->load->driver("pp");
     26 
    2727        $data['current_page'] = $this->uri->segment(4,1);
    2828        $data['itemsoptions']=array(10,25,50,100);
    29         $data['perpage'] = 10;   
     29        $data['perpage'] = 10;   
     30       
    3031        if ($this->input->post('items'))
    3132        {
    3233        $data['perpage'] = $this->input->post('items');   
    3334        }
    34        
     35        $sql="SELECT * FROM tblcollaborator";
    3536        $data['keyword']='';
    36         $sql=" FROM Entities\Tblcollaborator c";
     37       
    3738        if ($this->input->post('keyword'))
    3839        {
    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')."%')";
    4141        }
    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();
    5247        $this->load->library('pagination');
    5348        $url = "http://$_SERVER[HTTP_HOST]/admin/cong_tac_vien/trang/";
     
    7974
    8075        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);   
    8277        }
    83         return $this->pp->parse('modules/admin/views/collaborator/listview', $data,true);   
     78        return $this->load->view('collaborator/listview', $data,true);   
    8479    }
    8580    public function test() {
     81        $data=$this->db->get_where('tblcollaborator');
     82        print_r ($data->result_array());
     83        die();
    8684        for ($i = 1; $i <= 500; $i++) {
    8785            $collaborator = new Entities\Tblcollaborator();
Note: See TracChangeset for help on using the changeset viewer.