/**
  * Updates an existing Analista model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $tipoAplicaciones = AplicacionesDb::find()->orderBy(['nombre' => SORT_ASC])->all();
     $model->aplicaciones = \yii\helpers\ArrayHelper::getColumn($model->getAplicacionUsuario()->asArray()->all(), 'id_aplicacion');
     if ($model->load(Yii::$app->request->post())) {
         $model->modificarApp();
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model, 'tipoAplicaciones' => $tipoAplicaciones]);
     }
 }
 /**
  * Updates an existing User model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if (Yii::$app->user->identity->rol_id == '2') {
         $tipoAplicaciones = AplicacionesDb::find()->all();
         $model->aplicaciones = \yii\helpers\ArrayHelper::getColumn($model->getAplicacionUsuario()->asArray()->all(), 'id_aplicacion');
     }
     if ($model->load(Yii::$app->request->post())) {
         $model->setPassword();
         $model->generateAuthKey();
         if (!isset($_POST['User']['aplicaciones']) && Yii::$app->user->identity->rol_id == 2) {
             $model->aplicaciones = [];
         }
         if ($model->save()) {
             return $this->redirect(['view', 'id' => $model->id]);
         }
     } else {
         return $this->render('update', ['model' => $model, 'tipoAplicaciones' => Yii::$app->user->identity->rol_id ? $tipoAplicaciones : '']);
     }
 }
Beispiel #3
0
 public function getAplicaciones()
 {
     $datos = AplicacionesDb::find()->asArray()->all();
     return ArrayHelper::map($datos, 'id', 'nombre');
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdAplicacion()
 {
     return $this->hasOne(AplicacionesDb::className(), ['id' => 'id_aplicacion']);
 }
Beispiel #5
0
 public function getAplicdbid()
 {
     return $this->hasOne(AplicacionesDb::className(), ['id' => 'id_bd']);
 }
Beispiel #6
0
 public function getAplicacionesPermitidas()
 {
     return $this->hasMany(AplicacionesDb::className(), ['id' => 'id_aplicacion'])->viaTable('aplicacion_usuario', ['id_usuario' => 'id']);
 }