diff --git a/backend/modules/card/controllers/UserCardController.php b/backend/modules/card/controllers/UserCardController.php index 67e2a88..7c1211c 100755 --- a/backend/modules/card/controllers/UserCardController.php +++ b/backend/modules/card/controllers/UserCardController.php @@ -312,21 +312,24 @@ class UserCardController extends Controller $model = UserCard::findOne($id); $resumeTemplate = ResumeTemplate::findOne($model->resume_template_id); + $imagePath = Yii::getAlias('@frontend') . '/web' . $resumeTemplate->header_image; + if (empty($resumeTemplate->header_text)) { + $headerText = 'Generated by ITGuild.info At: ' . date("d/m/Y"); + } else { + $headerText = $resumeTemplate->header_text; + } + $pw = new \PhpOffice\PhpWord\PhpWord(); - -// $header = $section->createHeader(); -// $header->addImage('/home/dev238/projects/aegis/images/Logo_.jpg',['align'=>'right']); - // (B) ADD HTML CONTENT $section = $pw->addSection(); + $header = $section->addHeader(); + if (pathinfo($resumeTemplate->header_image, PATHINFO_EXTENSION)) { + $header->addImage($imagePath, ['width' => 70, 'height' => 30, 'align' => 'left']); + } + $header->addText($headerText, array('bold' => false), array('space' => array('before' => 0, 'after' => 280))); -// $section->addImage( Yii::getAlias('@frontend') . '/media/upload/guild.png', ['width' => '200', 'height' => '200', 'align' => 'center',]); - - - // $header = $section->addHeader(); -// $header->addImage('frontend/web/media/upload/guild.png', ['align' => 'left']); $resumeText = str_replace(array('
', '
', '
'), ' ', $model->resume_text); \PhpOffice\PhpWord\Shared\Html::addHtml($section, $resumeText, false, false); diff --git a/backend/modules/card/views/resume-template/_form.php b/backend/modules/card/views/resume-template/_form.php index cd43c4e..4c436b9 100644 --- a/backend/modules/card/views/resume-template/_form.php +++ b/backend/modules/card/views/resume-template/_form.php @@ -36,7 +36,7 @@ use yii\widgets\ActiveForm; field($model, 'header_text')->textInput(['maxlength' => true]) ?>
-
+