コード例 #1
0
ファイル: components.php プロジェクト: anggadjava/payroll
 public function index($offset = 0)
 {
     $this->filter_access('Component', 'roled_select', base_url());
     $component = new Component();
     switch ($this->input->get('c')) {
         case "1":
             $data['col'] = "comp_name";
             break;
         case "2":
             $data['col'] = "comp_type";
             break;
         case "3":
             $data['col'] = "comp_id";
             break;
         default:
             $data['col'] = "comp_id";
     }
     if ($this->input->get('d') == "1") {
         $data['dir'] = "DESC";
     } else {
         $data['dir'] = "ASC";
     }
     $data['title'] = "Component";
     $data['btn_add'] = anchor('components/add', 'Add New', array("class" => "btn btn-primary"));
     $data['btn_home'] = anchor(base_url(), 'Home');
     $uri_segment = 3;
     $offset = $this->uri->segment($uri_segment);
     if ($this->input->get('search_by')) {
         $total_rows = $component->like($_GET['search_by'], $_GET['q'])->count();
         $component->like($_GET['search_by'], $_GET['q'])->order_by($data['col'], $data['dir']);
     } else {
         $total_rows = $component->count();
         $component->order_by($data['col'], $data['dir']);
     }
     $data['components'] = $component->get($this->limit, $offset)->all;
     $config['base_url'] = site_url("components/index");
     $config['total_rows'] = $total_rows;
     $config['per_page'] = $this->limit;
     $config['uri_segment'] = $uri_segment;
     $this->pagination->initialize($config);
     $data['pagination'] = $this->pagination->create_links();
     $this->load->view('components/index', $data);
 }
コード例 #2
0
 function testCount()
 {
     $comp = new Component('VCALENDAR');
     $this->assertEquals(1, $comp->count());
 }