|
|
|
@ -6,7 +6,6 @@
|
|
|
|
|
|
|
|
|
|
namespace common\modules\forms\controllers; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use common\modules\forms\entities\Form; |
|
|
|
|
use common\modules\forms\services\FormMessageManageService; |
|
|
|
|
use frontend\components\FrontendController; |
|
|
|
@ -22,7 +21,13 @@ class FormController extends FrontendController
|
|
|
|
|
public $mailer; |
|
|
|
|
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); |
|
|
|
|
$this->mailer = $mailer; |
|
|
|
|
$this->message_service = $message_service; |
|
|
|
@ -45,9 +50,11 @@ class FormController extends FrontendController
|
|
|
|
|
if ($form->complete_page_id) { |
|
|
|
|
return $this->redirect(['/pages/page/view', 'id' => $form->complete_page_id]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//return $form->complete_text; |
|
|
|
|
return $this->render('view', ['text' => $form->complete_text]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $this->redirect(Yii::$app->request->referrer); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -80,16 +87,25 @@ class FormController extends FrontendController
|
|
|
|
|
$items = []; |
|
|
|
|
$json = Json::decode($json_string, true); |
|
|
|
|
foreach ($json as $item) { |
|
|
|
|
if ($item['type'] == 'button') {continue;} |
|
|
|
|
if ($item['type'] == 'paragraph') {continue;} |
|
|
|
|
if ($item['type'] == 'header') {continue;} |
|
|
|
|
if ($item['type'] == 'button') { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if ($item['type'] == 'paragraph') { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if ($item['type'] == 'header') { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$item['name'] = str_replace('-', '_', $item['name']); |
|
|
|
|
$items[] = [ |
|
|
|
|
'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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|