Beispiel #1
0
 public function filters($offset = 0)
 {
     $string = '%' . $this->input->post('division') . '%';
     $condiciones = '';
     $valores = array();
     if ($string != '%%') {
         $condiciones .= " division LIKE ?";
         $valores['division'] = $string;
     }
     $conditions = array_merge(array($condiciones), $valores);
     $config['base_url'] = site_url('divisiones/index');
     $config['total_rows'] = Division::count(array('conditions' => $conditions));
     $config['per_page'] = '10';
     $config['num_links'] = '10';
     $config['first_link'] = '← primero';
     $config['last_link'] = 'último →';
     $this->load->library('pagination', $config);
     $divisiones = Division::all(array('conditions' => $conditions, 'limit' => $config['per_page'], 'offset' => $offset));
     $this->table->set_heading('Orden', 'División', 'Acciones');
     foreach ($divisiones as $division) {
         $this->table->add_row($division->id, $division->division, anchor('divisiones/editar/' . $division->id, img('static/img/icon/pencil.png'), 'class="tipwe" title="Editar"') . ' ' . anchor('divisiones/eliminar/' . $division->id, img('static/img/icon/trash.png'), 'class="tipwe eliminar" title="Eliminar"'));
     }
     echo $this->table->generate();
     echo '<div class="pagination">';
     echo $this->pagination->create_links();
     echo '</div>';
 }
Beispiel #2
0
 function divisions($office_id = '')
 {
     $o = new Office_m();
     $o->get_by_office_id($office_id);
     $data['page_name'] = '<b>Divisions of "' . $o->office_name . '"</b>';
     $data['msg'] = '';
     $this->load->library('pagination');
     $divisions = new Division();
     $config['base_url'] = base_url() . 'training_manage/course';
     $config['total_rows'] = $divisions->count();
     $config['per_page'] = '15';
     $config['full_tag_open'] = '<p>';
     $config['full_tag_close'] = '</p>';
     $this->pagination->initialize($config);
     // How many related records we want to limit ourselves to
     $limit = $config['per_page'];
     // Set the offset for our paging
     $offset = $this->uri->segment(4);
     $divisions->where('office_id', $office_id);
     $divisions->order_by('name');
     $data['rows'] = $divisions->get($limit, $offset);
     $data['office_id'] = $office_id;
     $data['page'] = $this->uri->segment(3);
     $data['main_content'] = 'divisions';
     return View::make('includes/template', $data);
 }