Commit 389fc0d1c832b522a2193adb5df9828852589dbf
1 parent
74e69ddf
big commti
Showing
37 changed files
with
25 additions
and
11 deletions
Show diff stats
.htaccess
backend/controllers/EventController.php
... | ... | @@ -80,10 +80,11 @@ class EventController extends Controller |
80 | 80 | { |
81 | 81 | $model = new Event(); |
82 | 82 | |
83 | - if ($model->load(Yii::$app->request->post())) { | |
83 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
84 | 84 | |
85 | 85 | if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) { |
86 | 86 | $model->image = $image->name; |
87 | + $image->saveAs(Yii::getAlias('@imagesDir/event/' . $image->name)); | |
87 | 88 | } |
88 | 89 | |
89 | 90 | if ( ($banner = UploadedFile::getInstance($model, 'banner')) ) { |
... | ... | @@ -91,9 +92,6 @@ class EventController extends Controller |
91 | 92 | $image->saveAs(Yii::getAlias('@imagesDir/event/' . $banner->name)); |
92 | 93 | } |
93 | 94 | |
94 | - if ($model->save() && $image) { | |
95 | - $image->saveAs(Yii::getAlias('@imagesDir/event/' . $image->name)); | |
96 | - } | |
97 | 95 | |
98 | 96 | return $this->redirect(['view', 'id' => $model->event_id]); |
99 | 97 | } else { | ... | ... |
backend/views/layouts/header.php
... | ... | @@ -58,7 +58,7 @@ class SaveImgBehavior extends Behavior |
58 | 58 | foreach($this->fields as $field){ |
59 | 59 | |
60 | 60 | if ( ($image = UploadedFile::getInstance($this->owner, $field['name'])) ) { |
61 | - $this->owner->image = $image->name; | |
61 | + $this->owner->$field['name'] = $image->name; | |
62 | 62 | } |
63 | 63 | |
64 | 64 | ... | ... |
common/modules/product/controllers/ManageController.php
... | ... | @@ -202,8 +202,10 @@ class ManageController extends Controller |
202 | 202 | |
203 | 203 | if ($model->load(Yii::$app->request->post())) { |
204 | 204 | $file = UploadedFile::getInstances($model, 'file'); |
205 | + | |
205 | 206 | $method = 'go'. ucfirst($model->type); |
206 | 207 | $target = Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFile'. ucfirst($model->type)); |
208 | + | |
207 | 209 | if (empty($file)) { |
208 | 210 | $model->errors[] = 'File not upload'; |
209 | 211 | } elseif ($method == 'goPrices' && $file[0]->name != 'file_1.csv') { | ... | ... |
common/modules/product/models/Export.php
... | ... | @@ -12,6 +12,7 @@ class Export extends Model { |
12 | 12 | |
13 | 13 | public function process($dirName, $filename = null, $use_not_enables = false) { |
14 | 14 | set_time_limit(0); |
15 | + ini_set('max_execution_time', 900); | |
15 | 16 | if (is_null($filename)) { |
16 | 17 | $filename = 'products_'. date('d_m_Y_H_i') .'.csv'; |
17 | 18 | } | ... | ... |
common/modules/product/models/Import.php
... | ... | @@ -75,8 +75,14 @@ class Import extends Model { |
75 | 75 | |
76 | 76 | $is_utf = (preg_match('//u', file_get_contents(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFilePrices'), null, null, null, 1000000))); |
77 | 77 | |
78 | - while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE && (empty($limit) || $j++ < $limit)) | |
78 | + while (empty($limit) || $j++ < $limit) | |
79 | 79 | { |
80 | + | |
81 | + | |
82 | + if(!(($data = fgetcsv ($handle, 10000, ";")) !== FALSE)){ | |
83 | + break; | |
84 | + } | |
85 | + | |
80 | 86 | foreach ($data as &$value) |
81 | 87 | { |
82 | 88 | if (!$is_utf) { |
... | ... | @@ -214,10 +220,14 @@ class Import extends Model { |
214 | 220 | |
215 | 221 | $result_items = []; |
216 | 222 | |
217 | - while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE && (empty($limit) || $j++ < $limit)) | |
218 | - { | |
219 | 223 | |
220 | 224 | |
225 | + while ( empty($limit) || $j++ < $limit) | |
226 | + { | |
227 | + if(!(($data = fgetcsv ($handle, 10000, ";")) !== FALSE)){ | |
228 | + break; | |
229 | + } | |
230 | + | |
221 | 231 | foreach ($data as &$value) |
222 | 232 | { |
223 | 233 | if (!$is_utf) { | ... | ... |
console/migrations/m160905_154051_create_table_feedback.php
100644 → 100755
console/migrations/m160907_101042_events_to_products.php
100644 → 100755
console/migrations/m160907_161750_event_add_status.php
100644 → 100755
console/migrations/m160908_162057_add_banner_to_event.php
100644 → 100755
console/migrations/m160912_212751_slider_image_add_end_at.php
100644 → 100755
console/migrations/m160920_193159_add_sale_percent_to_event.php
100644 → 100755
frontend/views/modal/forgot_password_form_model_window.php
100644 → 100755
frontend/views/modal/login_window_model_window.php
100644 → 100755
frontend/views/modal/my_callback_modal_window.php
100644 → 100755
frontend/views/modal/registration_window_model_window.php
100644 → 100755
frontend/widgets/views/slider.php
... | ... | @@ -11,7 +11,7 @@ FlipclockAsset::register($this); |
11 | 11 | |
12 | 12 | |
13 | 13 | <div id="<?=$title?>" class="owl-carousel owl-theme"> |
14 | - <?php foreach($slider->sliderImage as $image): | |
14 | + <?php if($slider instanceof Slider){ foreach($slider->sliderImage as $image): | |
15 | 15 | |
16 | 16 | |
17 | 17 | ?> |
... | ... | @@ -56,7 +56,8 @@ FlipclockAsset::register($this); |
56 | 56 | |
57 | 57 | |
58 | 58 | |
59 | -<?php endforeach; ?> | |
59 | +<?php endforeach; } | |
60 | + ?> | |
60 | 61 | </div> |
61 | 62 | <?php |
62 | 63 | $dur = $slider->duration ? $slider->duration : 5000; | ... | ... |