Ejemplo n.º 1
0
 /**
  * Signs user up.
  *
  * @return User|null the saved model or null if saving fails
  */
 public function AcceptConsentProcessingPersonalData()
 {
     $id = Yii::$app->getUser()->getId();
     $user = UserFrontend::findIdentity($id);
     if ($this->validate() and !empty($user)) {
         $user->consent_processing_personal_data = $this->consent_processing_personal_data;
         if ($user->save()) {
             return $user;
         } else {
             Yii::$app->getSession()->setFlash('error', 'Error accept agreement');
         }
     }
     return null;
 }
Ejemplo n.º 2
0
 /**
  * Signs user up.
  *
  * @return User|null the saved model or null if saving fails
  */
 public function update()
 {
     $id = Yii::$app->getUser()->getId();
     $user = UserFrontend::findIdentity($id);
     if ($this->validate() and isset($user)) {
         $user->username = $this->username;
         if (!empty($this->password)) {
             $user->setPassword($this->password);
         }
         if ($user->save()) {
             return $user;
         } else {
             Yii::$app->getSession()->setFlash('error', 'not save user settings');
         }
     }
     return null;
 }
Ejemplo n.º 3
0
 /**
  * Abitur application export to pdf.
  *
  * @return mixed
  * @throws BadRequestHttpException
  */
 public function actionProfileToPdf()
 {
     $id = Yii::$app->getUser()->getId();
     $user = UserFrontend::findIdentity($id);
     $profile = Profile::findById($user->id_profile);
     // get your HTML raw content without any layouts or scripts
     //        $content = $this->renderPartial('abiturApplicationToPdf', ['model'=>$profile]);
     $content = $this->renderPartial('profileToPdf', ['model' => $profile]);
     // setup kartik\mpdf\Pdf component
     $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'mode' => Pdf::MODE_UTF8, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Заявление'], 'methods' => [], 'marginLeft' => 30, 'marginRight' => 15, 'marginTop' => 12, 'marginBottom' => 12]);
     // return the pdf output as per the destination setting
     return $pdf->render();
 }