<?php $form = ActiveForm::begin(['id' => 'form-signup']); ?> <?php echo $form->field($model, 'username'); ?> <?php echo $form->field($model, 'email'); ?> <?php echo $form->field($model, 'password')->passwordInput(); ?> <?php $authItems = arrayHelper::map($authItems, 'name', 'name'); ?> <?php echo $form->field($model, 'permissions')->checkboxList($authItems); ?> <div class="form-group"> <?php echo Html::submitButton('Signup', ['class' => 'btn btn-primary', 'name' => 'signup-button']); ?> </div> <?php ActiveForm::end(); ?> </div> </div> </div>
var_dump($e); } } if (!is_array($haystack)) { return False; } foreach ($haystack as $key => $value) { if (is_array($value)) { if (self::in_array_multi($needle, $value)) { return True; } else { self::in_array_multi($needle, $value); } } else { if (is_string($needle) && trim($value) === trim($needle)) { //visibility fix// var_dump('string check'); error_log("{$value} === {$needle} setting visibility to 1 hidden"); return True; } } } return False; } } // tester $arr1 = array('level1' => array('level2' => array('level3' => 'hello'))); $needle = array('level3' => 'hello'); var_dump(arrayHelper::in_array_multi($needle, $arr1)); var_dump(arrayHelper::in_array_multi('hello', $arr1));
/** * Updates an existing UePartidaEntidad model. * For ajax request will return json object * and for non-ajax request if update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $request = Yii::$app->request; $model = $this->findModel($id); $cuenta = $model->cuenta; $partida = $model->partida; $ue = ArrayHelper::map(UnidadEjecutora::find()->asArray()->all(), 'id', 'nombre'); $tipo_entidad = arrayHelper::map(TipoEntidad::find()->asArray()->all(), 'id', 'nombre'); $verificar = ArrayHelper::map(UePartidaEntidad::find()->where('cuenta= :id', ['id' => $model->cuenta])->andwhere(['partida' => $model->partida])->andwhere(['id_tipo_entidad' => 1])->all(), 'id', 'id_ue'); $verificar_acc = ArrayHelper::map(UePartidaEntidad::find()->where('cuenta= :id', ['id' => $model->cuenta])->andwhere(['partida' => $model->partida])->andwhere(['id_tipo_entidad' => 2])->all(), 'id', 'id_ue'); /* * Process for post resquest */ if ($request->post()) { // $connection = \Yii::$app->db; $transaction = $connection->beginTransaction(); try { //verificando los cambios en los tipos de entidad proyecto y acc $proyecto = $request->post('ue_proyecto'); $acc = $request->post('ue_acc'); if (empty($proyecto) && empty($acc)) { Yii::$app->getSession()->setFlash('danger', 'Error, no puede dejar las partida sin unidad ejecutora'); return $this->render('update', ['model' => $model, 'ue' => $ue, 'tipo_entidad' => $tipo_entidad, 'precarga_proyecto' => $verificar, 'precarga_acc' => $verificar_acc]); } $model->UejEntidad($proyecto, 1); $model->UejEntidad($acc, 2); $transaction->commit(); } catch (Exception $e) { $transaction->rollback(); Yii::$app->getSession()->setFlash('danger', 'Error al actualizar unidades.'); return $this->render('update', ['model' => $model, 'ue' => $ue, 'tipo_entidad' => $tipo_entidad, 'precarga_proyecto' => $verificar, 'precarga_acc' => $verificar_acc]); } return $this->redirect(['view', 'partida' => $partida, 'cuenta' => $cuenta]); } else { return $this->render('update', ['model' => $model, 'ue' => $ue, 'tipo_entidad' => $tipo_entidad, 'precarga_proyecto' => $verificar, 'precarga_acc' => $verificar_acc]); } }