Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ROL::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['ID_ROL' => $this->ID_ROL]);
     $query->andFilterWhere(['like', 'ROL', $this->ROL]);
     return $dataProvider;
 }
Example #2
0
 /**
  * Finds the ROL model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return ROL the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = ROL::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public static function permisoDocenteDirectorDecano()
 {
     if (Yii::$app->user->isGuest) {
         throw new UnauthorizedHttpException("Debe iniciar sesión para realizar esta operación.");
     }
     $rol = ROL::findOne(Yii::$app->user->identity->ID_ROL)->ROL;
     if ($rol != "Docente" && $rol != "Director" && $rol != "Decano") {
         throw new UnauthorizedHttpException("Su rol de usuario no tiene los privilegios necesarios para realizar esta operación.");
     }
     return $rol;
 }
Example #4
0
</thead>
<tbody>
<?php 
foreach ($model as $usuario) {
    ?>
<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 
Example #5
0
?>

<?php 
echo $form->field($model, "id_usuario")->input("hidden")->label(false);
?>

<?php 
echo $form->field($model, "NOMBRE_USUARIO")->input("text");
?>

<?php 
echo $form->field($model, "id_departamento")->dropDownList(ArrayHelper::Map(DepartamentoTabla::find()->all(), "ID_DEPARTAMENTO", "NOMBRE_DEPARTAMENTO"), ["prompt" => "Sin informar"]);
?>

<?php 
echo $form->field($model, "id_rol")->dropDownList(ArrayHelper::Map(ROL::find()->all(), "ID_ROL", "ROL"));
?>

<?php 
echo $form->field($model, "EMAIL")->input("email");
?>

<?php 
echo $form->field($model, "password")->input("password");
?>

<?php 
echo $form->field($model, "password_repeat")->input("password");
?>

<?php 
Example #6
0
function decano()
{
    return ['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'Inicio', 'url' => ['/site/index']], ['label' => 'Realizar solicitud', 'url' => ['/solicitud/index']], ['label' => 'Gestion sus gastos', 'url' => ['/site/view']], ['label' => 'Ver tipos de viaje', 'url' => ['/site/ver-t-viaje']], ['label' => 'Evaluar solicitudes', 'url' => ['/solicitudes/view']], ['label' => 'Evaluar gastos', 'url' => ['/site/formu']], ['label' => 'Salir (' . Yii::$app->user->identity->NOMBRE_USUARIO . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]];
}
function director()
{
    return ['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'Inicio', 'url' => ['/site/index']], ['label' => 'Realizar solicitud', 'url' => ['/solicitud/index']], ['label' => 'Gestion sus gastos', 'url' => ['/site/view']], ['label' => 'Ver tipos de viaje', 'url' => ['/site/ver-t-viaje']], ['label' => 'Evaluar solicitudes', 'url' => ['/solicitudes/view']], ['label' => 'Evaluar gastos', 'url' => ['/site/formu']], ['label' => 'Salir (' . Yii::$app->user->identity->NOMBRE_USUARIO . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]];
}
function docente()
{
    return ['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'Inicio', 'url' => ['/site/index']], ['label' => 'Realizar solicitud', 'url' => ['/solicitud/index']], ['label' => 'Gestion sus gastos', 'url' => ['/site/view']], ['label' => 'Ver tipos de viaje', 'url' => ['/site/ver-t-viaje']], ['label' => 'Salir (' . Yii::$app->user->identity->NOMBRE_USUARIO . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]];
}
NavBar::begin(['brandLabel' => 'ICINF3', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$rol = "Guest";
if (!Yii::$app->user->isGuest) {
    $rol = ROL::findOne(Yii::$app->user->identity->ID_ROL)->ROL;
}
if ($rol == "Guest") {
    echo Nav::widget(guest());
} else {
    if ($rol == "Administrador") {
        echo Nav::widget(administrador());
    } else {
        if ($rol == "Decano") {
            echo Nav::widget(decano());
        } else {
            if ($rol == "Director") {
                echo Nav::widget(director());
            } else {
                if ($rol == "Docente") {
                    echo Nav::widget(docente());