public function borrar_profesion() { $id = Input::get('idedit'); $profesion = Profesion::find($id); if ($profesion->delete()) { Session::flash('message', 'Eliminado correctamente'); Session::flash('class', 'success'); } else { Session::flash('message', 'Ha ocurrido un error, intentelo nuevamente'); Session::flash('class', 'danger'); } return Redirect::to('profesion'); }
public function editar_persona() { $fk_lugar = Place::lists('lugar_nombre', 'id'); $fk_profesion = Profesion::lists('profesion_nombre', 'id'); $fk_cargo = Cargo::lists('cargo_nombre', 'id'); $inputs = Input::get('idedit'); $persona = Person::find($inputs); $fk_persona_a_quien_autorizo = Person::where('persona_cid', '!=', $persona->persona_cid)->where('persona_es_autorizado', '=', false)->lists('persona_cid', 'id'); if ($persona) { return View::make('persona.createPersona', array('persona' => $persona, 'fk_lugar' => $fk_lugar, 'fk_profesion' => $fk_profesion, 'fk_cargo' => $fk_cargo, 'fk_persona_a_quien_autorizo' => $fk_persona_a_quien_autorizo)); } else { return Redirect::to('persona'); } }
/** * Método para eliminar */ public function eliminar($key) { if (!($id = DwSecurity::isValidKey($key, 'del_profesion', 'int'))) { return DwRedirect::toAction('listar'); } $profesion = new Profesion(); if (!$profesion->getInformacionProfesion($id)) { DwMessage::get('id_no_found'); return DwRedirect::toAction('listar'); } try { if (Profesion::setProfesion('delete', array('id' => $profesion->id))) { DwMessage::valid('La profesion se ha eliminado correctamente!'); } } catch (KumbiaException $e) { DwMessage::error('Esta profesion no se puede eliminar porque se encuentra relacionada con otro registro.'); } return DwRedirect::toAction('listar'); }
/** * Updates a particular model * @param integer $id the ID of the model to be updated * @redirected to'view' page. */ public function actionUpdate($id) { $model = $this->loadModel($id); if (isset($_POST['Fbm3'])) { $model->attributes = $_POST['Fbm3']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $responsables = Responsable::model()->findAll(); $profesiones = Profesion::model()->findAll(); $dps = Dependencia::model()->findAll(); $generos = Sexo::model()->findAll(); $this->render('update', array('model' => $model, 'responsables' => $responsables, 'profesiones' => $profesiones, 'dps' => $dps, 'generos' => $generos)); }
/** * Método para setear * @param string $method Método a ejecutar (create, update, save) * @param array $data Array con la data => Input::post('model') * @param array $otherData Array con datos adicionales * @return Obj */ public static function setProfesion($method, $data, $optData = null) { //Se aplica la autocarga $obj = new Profesion($data); //Se verifica si contiene una data adicional para autocargar if ($optData) { $obj->dump_result_self($optData); } if ($method != 'delete') { //$obj->ciudad_id = Ciudad::setCiudad($obj->ciudad)->id; } $rs = $obj->{$method}(); return $rs ? $obj : FALSE; }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $pdata = PersonaData::model()->findByPk($id); if (isset($_POST['PersonaData'])) { $pdata->attributes = $_POST['PersonaData']; $persona = PersonaData::model()->findByAttributes(array('cedula' => $pdata->cedula)); if ($persona->id == $pdata->id) { if ($pdata->update()) { $this->redirect(array('view', 'pid' => $pdata->id)); } } else { $pdata->id = NULL; if ($pdata->validate()) { } } } $profesiones = Profesion::model()->findAll(array('select' => 'id, descripcion', 'order' => 'descripcion ASC')); $genero = Sexo::model()->findAll(array('select' => 'id, descripcion', 'order' => 'descripcion ASC')); $this->render('update', array('pdata' => $pdata, 'profesiones' => $profesiones, 'genero' => $genero)); }