Ejemplo n.º 1
0
 public function roomlist()
 {
     $this->load->model('rooms/room_list');
     $this->load->library('pagination');
     $header_data = array();
     $header_data['actions'] = array('Create', 'Edit', 'Delete');
     $header_data['title'] = 'Rooms';
     $config['base_url'] = site_url('admin/rooms/roomlist');
     $config['total_rows'] = $this->room_list->getRoomCount();
     $config['per_page'] = '20';
     $config['uri_segment'] = 4;
     $this->pagination->initialize($config);
     $data = array();
     $data['rooms'] =& $this->room_list->getRooms();
     $levels =& $this->room_list->getLevels();
     $level_list = array('' => 'Filter Level');
     foreach ($levels as $level) {
         $level_list[$level->id] = $level->title;
     }
     $data['levels'] = form_dropdown('level_id', $level_list, getRequestState('rooms.level', 'level_id'));
     $tiles =& $this->room_list->getTiles();
     $tile_list = array('' => 'Filter Tile');
     foreach ($tiles as $tile) {
         $tile_list[$tile->id] = $tile->name;
     }
     $data['tiles'] = form_dropdown('tile_id', $tile_list, getRequestState('rooms.tile', 'tile_id'));
     $this->load->view('header', $header_data);
     $this->load->view('rooms/list', $data);
     $this->load->view('footer');
 }
Ejemplo n.º 2
0
 private function _getWhere()
 {
     $level_id = getRequestState('rooms.level', 'level_id');
     $tile_id = getRequestState('rooms.tile', 'tile_id');
     $row = getRequestState('rooms.row', 'row');
     $column = getRequestState('rooms.column', 'column');
     $where = array();
     if (false === empty($level_id)) {
         $where[] = 'r.level_id = ' . $level_id;
     }
     if (false === empty($tile_id)) {
         $where[] = 'r.tile_id = ' . $tile_id;
     }
     if (false === empty($row)) {
         $where[] = 'r.row = ' . $row;
     }
     if (false === empty($column)) {
         $where[] = 'r.column = ' . $column;
     }
     return 0 < sizeof($where) ? 'WHERE ' . implode(' AND ', $where) : '';
 }