Commit 89758aeb32857644aabfbcd46ac6ee0641ec1727
1 parent
0ae6f109
firs page
Showing
3 changed files
with
11 additions
and
52 deletions
Show diff stats
frontend/controllers/LandingController.php
| @@ -13,7 +13,16 @@ class LandingController { | @@ -13,7 +13,16 @@ class LandingController { | ||
| 13 | 13 | ||
| 14 | public function ViewAction($view) | 14 | public function ViewAction($view) |
| 15 | { | 15 | { |
| 16 | - $this->render(); | 16 | + die($view); |
| 17 | + try{ | ||
| 18 | + | ||
| 19 | + $this->render($view); | ||
| 20 | + | ||
| 21 | + } | ||
| 22 | + catch(\yii\base\InvalidParamException $e){ | ||
| 23 | + $this->render('site/404'); | ||
| 24 | + } | ||
| 25 | + | ||
| 17 | } | 26 | } |
| 18 | 27 | ||
| 19 | } | 28 | } |
| 20 | \ No newline at end of file | 29 | \ No newline at end of file |
frontend/controllers/SiteController.php
| @@ -314,55 +314,4 @@ class SiteController extends Controller | @@ -314,55 +314,4 @@ class SiteController extends Controller | ||
| 314 | ]); | 314 | ]); |
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | - public function actionOptions() { | ||
| 318 | - $option_model = new Options(); | ||
| 319 | - $option_list = $option_model->find()->where(1)->all(); | ||
| 320 | - $option_values = array(); | ||
| 321 | - $post = \Yii::$app->request->post(); | ||
| 322 | - | ||
| 323 | - if(!empty(\Yii::$app->request->post())) { | ||
| 324 | - $options_to_values = array(); | ||
| 325 | - $hasErrors = false; | ||
| 326 | - foreach($post['options'] as $key => $val) { | ||
| 327 | - $options_to_values[$key] = new OptionsToValues(); | ||
| 328 | - $options_to_values[$key]['option_id'] = $val['option_id']; | ||
| 329 | - $options_to_values[$key]->loadDefaultValues(); | ||
| 330 | - if($options_to_values[$key]->save()) { | ||
| 331 | - $option_values[$key] = new OptionValues(); | ||
| 332 | - $option_values[$key]['option_value_id'] = $options_to_values[$key]->getAttribute('option_value_id'); | ||
| 333 | - $option_values[$key]['option_value_text'] = $val['option_value']; | ||
| 334 | - if($options_to_values[$key]->option->getAttribute('option_translatable') == 0 || empty($val['option_language_id'])) { | ||
| 335 | - $option_values[$key]['option_language_id'] = 0; | ||
| 336 | - } else { | ||
| 337 | - $option_values[$key]['option_language_id'] = $val['option_language_id']; | ||
| 338 | - } | ||
| 339 | - if(!$option_values[$key]->save()) { | ||
| 340 | - $options_to_values[$key]->delete(); | ||
| 341 | - $hasErrors = true; | ||
| 342 | - } | ||
| 343 | - } | ||
| 344 | - } | ||
| 345 | - if($hasErrors) { | ||
| 346 | - $data['option_values'] = $option_values; | ||
| 347 | - return $this->render('options', ['options' => $data, 'post' => $post]); | ||
| 348 | - } else { | ||
| 349 | - var_dump($data); | ||
| 350 | - } | ||
| 351 | - } else { | ||
| 352 | - foreach($option_list as $index => $option) { | ||
| 353 | - $option_values[$option->getAttribute('option_id')] = new OptionValues(); | ||
| 354 | - } | ||
| 355 | - $data['option_values'] = $option_values; | ||
| 356 | - return $this->render('options', ['options' => $data, 'post' => $post]); | ||
| 357 | - } | ||
| 358 | - } | ||
| 359 | - | ||
| 360 | - public function actionFeedback() { | ||
| 361 | - $form[0] = Option::create(\Yii::$app->request->post(), 'Feedback', 1, [['name' => 'one_name', 'template' => 'text', 'translate' => false], ['name' => 'phone', 'template' => 'text', 'translate' => false], ['name' => 'message', 'template' => 'text', 'translate' => false]], false); | ||
| 362 | - if($form[0]['success'] == false) { | ||
| 363 | - return $this->render('feedback', ['forms' => $form]); | ||
| 364 | - } else { | ||
| 365 | - return $this->render('index'); | ||
| 366 | - } | ||
| 367 | - } | ||
| 368 | } | 317 | } |