function training_type() { $options = array(); $t = new Training_type(); $t->order_by('training_type'); $types = $t->get(); foreach ($types as $type) { $options[$type->id] = $type->training_type; } return $options; }
function type() { $data['page_name'] = '<b>Training Type</b>'; $data['msg'] = ''; $this->load->library('pagination'); $type = new Training_type(); $config['base_url'] = base_url() . 'training_manage/type'; $config['total_rows'] = $type->get()->count(); $config['per_page'] = '15'; $this->config->load('pagination', TRUE); $pagination = $this->config->item('pagination'); // We will merge the config file of pagination $config = array_merge($config, $pagination); $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(3); $type->order_by('training_type'); $data['rows'] = $type->get($limit, $offset); $data['page'] = $this->uri->segment(3); $data['main_content'] = 'type'; return View::make('includes/template', $data); }