Beispiel #1
0
 /**
  * render Profile.php with $model as ProfileForm if found profile;
  * render Say.php with array.key = title, message
  * 
  * @return $this->render('JoinGroup', array) or $this->render('Say', array)
  */
 public function actionProfile()
 {
     $id = \Yii::$app->user->getId();
     $user = User::findOne($id);
     //$profile = new ProfileForm();
     $profile = ProfileForm::findOne($user->username);
     if ($profile->load(Yii::$app->request->post()) && $profile->validate()) {
         if ($profile->save()) {
             return $this->render('say', ['title' => 'successfully', 'message' => '<3>You submited your profile successfully!</h3>']);
         }
     }
     return $this->render('profile', ['model' => $profile]);
 }
 /**
  * Finds the ProfileForm model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return ProfileForm the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = ProfileForm::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #3
0
/* @var $form yii\widgets\ActiveForm */
$avatar = Yii::$app->request->baseUrl . Yii::$app->params['avatar'];
?>

<div class="data-request-form">

    <?php 
$form = ActiveForm::begin();
?>
        <div class="ui three column stackable grid">
            <div class="four wide rounded column">
                <div class="ui center aligned stackable cards">
                    <div class="card">
                        <div class="image">
                            <?php 
$userRequest = ProfileForm::findOne($model->user_id);
?>
                            <?php 
if (!empty(DataHelper::profileImage($model->user_id))) {
    ?>
                                <?php 
    echo Html::img(['/file', 'id' => DataHelper::profileImage($model->user_id)]);
    ?>
                            <?php 
} else {
    ?>
                                <?php 
    echo Html::img([Yii::$app->params['avatar'], ['alt' => 'user', 'class' => 'tiny image']]);
    ?>
                            <?php 
}