<tr> <th><?php echo $usuario->ID_USUARIO; ?> </th> <th><?php echo $usuario->NOMBRE_USUARIO; ?> </th> <th><?php echo ROL::findOne($usuario->ID_ROL)->ROL; ?> </th> <th><?php if ($usuario->ID_DEPARTAMENTO != "") { echo DepartamentoTabla::findOne($usuario->ID_DEPARTAMENTO)->NOMBRE_DEPARTAMENTO; } else { echo "Sin informar"; } ?> </th> <th><?php echo $usuario->EMAIL; ?> </th> <th> <a href = "<?php echo Url::toRoute(["usuario/update", "id_usuario" => $usuario->ID_USUARIO]); ?> ">Editar</a> | <?php if ($usuario->ID_ROL != 4) { ?>
public function actionUpdatedep() { PermisosController::permisoAdministrador(); $model = new DepartamentoForm(); $msg = null; if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { $tabla = DepartamentoTabla::findOne($_GET["id_departamento"]); if ($tabla) { $tabla->NOMBRE_DEPARTAMENTO = $model->NOMBRE_DEPARTAMENTO; if ($tabla->update()) { $msg = '<div class="alert alert-success" role="alert">Departamento actualizado correctamente.</div>'; } else { $msg = '<div class="alert alert-danger" role="alert">Error al actualizar o no existen cambios</div>'; } } else { $msg = '<div class="alert alert-warning" role="alert">Departamento no encontrado.</div>'; } } } if (Yii::$app->request->get("id_departamento")) { $id_departamento = Html::encode($_GET["id_departamento"]); if ((int) $id_departamento) { $tabla = DepartamentoTabla::findOne($id_departamento); if ($tabla) { $model->NOMBRE_DEPARTAMENTO = $tabla->NOMBRE_DEPARTAMENTO; } else { $msg = "Tabla no encontrada"; return $this->redirect(["usuario/viewdep"]); } } else { $msg = "ID no valido"; return $this->redirect(["usuario/viewdep"]); } } else { return $this->redirect(["usuario/viewdep"]); } return $this->render("Updatedep", ["model" => $model, "msg" => $msg]); }