Browse Source

Project information

master
Egorka 6 years ago
parent
commit
17838b1f23
  1. 28
      common/modules/forms/controllers/FormController.php
  2. 15
      composer.json

28
common/modules/forms/controllers/FormController.php

@ -6,7 +6,6 @@
namespace common\modules\forms\controllers; namespace common\modules\forms\controllers;
use common\modules\forms\entities\Form; use common\modules\forms\entities\Form;
use common\modules\forms\services\FormMessageManageService; use common\modules\forms\services\FormMessageManageService;
use frontend\components\FrontendController; use frontend\components\FrontendController;
@ -22,7 +21,13 @@ class FormController extends FrontendController
public $mailer; public $mailer;
public $message_service; public $message_service;
public function __construct( string $id, $module, MailerInterface $mailer, FormMessageManageService $message_service, array $config = [] ) { public function __construct(
string $id,
$module,
MailerInterface $mailer,
FormMessageManageService $message_service,
array $config = []
) {
parent::__construct($id, $module, $config); parent::__construct($id, $module, $config);
$this->mailer = $mailer; $this->mailer = $mailer;
$this->message_service = $message_service; $this->message_service = $message_service;
@ -45,9 +50,11 @@ class FormController extends FrontendController
if ($form->complete_page_id) { if ($form->complete_page_id) {
return $this->redirect(['/pages/page/view', 'id' => $form->complete_page_id]); return $this->redirect(['/pages/page/view', 'id' => $form->complete_page_id]);
} }
//return $form->complete_text; //return $form->complete_text;
return $this->render('view', ['text' => $form->complete_text]); return $this->render('view', ['text' => $form->complete_text]);
} }
return $this->redirect(Yii::$app->request->referrer); return $this->redirect(Yii::$app->request->referrer);
} }
@ -80,16 +87,25 @@ class FormController extends FrontendController
$items = []; $items = [];
$json = Json::decode($json_string, true); $json = Json::decode($json_string, true);
foreach ($json as $item) { foreach ($json as $item) {
if ($item['type'] == 'button') {continue;} if ($item['type'] == 'button') {
if ($item['type'] == 'paragraph') {continue;} continue;
if ($item['type'] == 'header') {continue;} }
if ($item['type'] == 'paragraph') {
continue;
}
if ($item['type'] == 'header') {
continue;
}
$item['name'] = str_replace('-', '_', $item['name']); $item['name'] = str_replace('-', '_', $item['name']);
$items[] = [ $items[] = [
'key' => isset($item['label']) ? $item['label'] : '', 'key' => isset($item['label']) ? $item['label'] : '',
'value' => is_array($dynaForm->{$item['name']}) ? implode(', ', array_map(function($el){return Html::encode($el);}, $dynaForm->{$item['name']})) : Html::encode($dynaForm->{$item['name']}), 'value' => is_array($dynaForm->{$item['name']}) ? implode(', ', array_map(function ($el) {
return Html::encode($el);
}, $dynaForm->{$item['name']})) : Html::encode($dynaForm->{$item['name']}),
]; ];
} }
return $items; return $items;
} }

15
composer.json

@ -1,16 +1,13 @@
{ {
"name": "yiisoft/yii2-app-advanced", "name": "zertex/zxcms",
"description": "Yii 2 Advanced Project Template", "description": "Zertex CMS",
"keywords": ["yii2", "framework", "advanced", "project template"], "keywords": ["Zertex", "CMS", "yii2", "framework", "advanced"],
"homepage": "http://www.yiiframework.com/", "homepage": "https://cms.zertex.ru/",
"type": "project", "type": "project",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"support": { "support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open", "issues": "https://gitlab.com/zertex/zxcms/issues",
"forum": "http://www.yiiframework.com/forum/", "source": "https://gitlab.com/zertex/zxcms"
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
}, },
"minimum-stability": "stable", "minimum-stability": "stable",
"require": { "require": {

Loading…
Cancel
Save