public function actionBackCall() { $success = null; $model = new SystemBackCall(); $settings = \Yii::$app->getModule('admin')->getSettings($this->module->id); if ($model->load(\Yii::$app->request->post()) && $model->save()) { if ($model->contact($settings['BackCallEmail']['value'], $settings['BackCallSubject']['value'])) { /* $url = 'https://docs.google.com/forms/d/e/1FAIpQLSf0kqkJFjt9booJyMOAVULkIWRUUgiU7nolOOzZaRNMc7RWzQ/formResponse'; $data = array(); // массив для отправки в гугл форм $data['entry.1339533031'] = $model->id; $data['entry.692682431'] = $model->name; $data['entry.2127229280'] = $model->phone; $data['entry.489867667'] = $model->email; $data['entry.715720461'] = $model->comment; $data = http_build_query($data); $options = array( // задаем параметры запроса 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => $data, ), ); $context = stream_context_create($options); // создаем контекст отправки $result = file_get_contents($url, false, $context); */ $success = ['success' => \Yii::t('system', $settings['BackCallSuccessText']['value'])]; } } return $this->formatResponse($success); }
/** * Creates a new SystemBackCall model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new SystemBackCall(); if ($model->load(Yii::$app->request->post()) && $model->save()) { if (Yii::$app->request->post('submit-type') == 'continue') { return $this->redirect(['update', 'id' => $model->id]); } else { return $this->redirect(['index']); } } else { return $this->render('create', ['model' => $model]); } }