コード例 #1
0
ファイル: UserController.php プロジェクト: NeroJz/admbackend
 public static function actionSaveupdate()
 {
     $request = Yii::$app->request;
     $userID = $request->post('userID');
     $piID = $request->post('piID');
     $user = User::find()->where(array('id' => $userID))->one();
     $user->username = $request->post("username");
     $user->status = $request->post("userstatus");
     $user->updated_at = time();
     $user->update();
     //$user->auth_key = "vBZS7KGrvXesyOkgQhGYCY5KCZi6st5g";
     // $user->password_hash = "$2y$13$4cRqqw0nmEj5.NJRcJYaE.YUSh9DJaQsSpLM3OCicXckrCPoAgWYC";
     $personalinfo = PersonalInformation::find()->where(array('pi_id' => $piID))->one();
     $personalinfo->pi_name = $request->post("fullname");
     $personalinfo->pi_address_permanent = $request->post("permanentaddress");
     $personalinfo->pi_zipcode_permanent = $request->post("permanentzipcode");
     $personalinfo->pi_address = $request->post("address");
     $personalinfo->pi_zipcode = $request->post("zipcode");
     $personalinfo->pi_ic_or_passport = $request->post("icno");
     $personalinfo->pi_gender = $request->post("gender");
     $personalinfo->pi_phone_home = $request->post("phone");
     $personalinfo->pi_hp = $request->post("handphone");
     $personalinfo->pi_email_1 = $request->post("email_1");
     $personalinfo->pi_email_2 = $request->post("email_2");
     $personalinfo->update();
     // print_r($user->update());
     /*  print_r($personalinfo->getErrors());
         die();*/
 }
コード例 #2
0
ファイル: _form.php プロジェクト: NeroJz/admbackend
use yii\helpers\ArrayHelper;
use backend\models\PersonalInformation;
/* @var $this yii\web\View */
/* @var $model backend\models\User */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="user-form">

    <?php 
$form = ActiveForm::begin();
?>

    
    <?php 
echo $form->field($model, 'pi_id')->dropDownList(ArrayHelper::map(PersonalInformation::find('pi_id', 'pi_name')->all(), 'pi_id', 'pi_name'), ['prompt' => 'Select Name']);
?>

    <?php 
echo $form->field($model, 'username')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'auth_key')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'password_hash')->textInput(['maxlength' => true]);
?>

    <?php