本文整理汇总了PHP中Division::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Division::all方法的具体用法?PHP Division::all怎么用?PHP Division::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Division
的用法示例。
在下文中一共展示了Division::all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filters
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>';
}
示例2: editar
public function editar($id)
{
if (!$id) {
$this->session->set_flashdata('msg', '<div class="error">La curso solicitada no existe.</div>');
redirect('cursos');
} elseif ($_POST) {
$this->load->helper('date');
$this->load->library('Utils');
$curso = Course::find($id);
$curso->update_attributes(elements(array('course', 'division_id', 'level_id'), $_POST));
if ($curso->is_valid()) {
if ($curso->save()) {
$this->session->set_flashdata('msg', '<div class="success">La curso se guardó correctamente.</div>');
redirect('cursos');
} else {
$this->session->set_flashdata('msg', '<div class="error">Hubo un error al guardar los datos.</div>');
redirect('cursos/editar/' . $id);
}
} else {
$data['errors'] = $curso->errors;
}
} else {
$data['a'] = Course::find($id);
}
$data['niveles'] = Level::all();
$data['divisiones'] = Division::all();
$data['titulo'] = "Editar Curso";
$data['action'] = "cursos/editar/" . $id;
$this->template->write_view('content', 'cursos/agregar', $data);
$this->template->render();
}