Exemplo n.º 1
0
 public function actionEdit()
 {
     $request = Yii::$app->request;
     $user = User::findOne($request->get('id'));
     $model = new UserForm();
     $model->attributes = $user->attributes;
     if ($model->load($request->post()) && $model->validate()) {
         //Overall assignment the attributes of $user must be safe attributes
         $user->attributes = $model->attributes;
         // var_dump($model->attributes);
         // var_dump($user->attributes);exit();
         if ($user->save()) {
             $this->redirect(array('index'));
         } else {
         }
     } else {
         if ($model->hasErrors()) {
             // foreach($model->getErrors() as $error){
             // 	var_dump($error,false);
             // }
         }
     }
     return $this->render('edit', ['model' => $model]);
 }
Exemplo n.º 2
0
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Installation</title>

    <link rel="stylesheet" type="text/css" href="<?php 
echo Bootstrap::getBooster()->getAssetsUrl();
?>
/bootstrap/css/bootstrap.min.css" />
</head>
<body>
    <div class="span6 offset3">
        <h1 class="offset1">Installation</h1>
        <h2 class="offset1"><small>Enter admin credentials</small></h2>
        <?php 
if ($model->hasErrors()) {
    ?>
            <?php 
    echo TbHtml::errorSummary($model);
    ?>
        <?php 
}
?>

        <form method="post" class="form-horizontal">

            <?php 
echo TbHtml::activeTextFieldControlGroup($model, 'username');
?>
            <?php 
echo TbHtml::activePasswordFieldControlGroup($model, 'password');