public function agregar() { $data = array(); if ($_POST) { $concepto = new Concept(elements(array('concepto', 'pago_parcial', 'ciclo_lectivo'), $_POST)); if ($concepto->is_valid()) { $concepto->save(); $this->session->set_flashdata('msg', '<div class="success">El Concepto se guardó correctamente.</div>'); redirect('conceptos'); } else { $data['errors'] = $concepto->errors; } } $data['titulo'] = "Agregar Concepto"; $data['action'] = "conceptos/agregar"; $this->template->write_view('content', 'conceptos/agregar', $data); $this->template->render(); }