Commit 9e1b54038147b90c83edce3ba50b166353cd4820
Merge remote-tracking branch 'origin/master'
# Conflicts: # frontend/web/css/main.css
Showing
200 changed files
with
2602 additions
and
1540 deletions
Show diff stats
backend/components/base/BaseController.php
| ... | ... | @@ -216,36 +216,5 @@ class BaseController extends Controller { |
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - /** | |
| 220 | - * @param $mode - int: 0 - fetch from cache, - 1 - put in cache, <2 - delete from cache | |
| 221 | - * @param $data - array | |
| 222 | - * @param $configuration - array | |
| 223 | - * @throws \ErrorException | |
| 224 | - */ | |
| 225 | - protected function parserCacheHandler( $mode, &$data = [], &$configuration = [] ){ | |
| 226 | - switch ( $mode ) { | |
| 227 | - case 0: | |
| 228 | - if (Yii::$app->getCache()->get('parser_data') && Yii::$app->getCache()->get('parser_configuration')) { | |
| 229 | - $data = json_decode(Yii::$app->getCache()->get('parser_data'), true); | |
| 230 | - $configuration = unserialize(Yii::$app->getCache()->get('parser_configuration')); | |
| 231 | - } else { | |
| 232 | - throw new \ErrorException('Ошибка кеша'); | |
| 233 | - } | |
| 234 | - break; | |
| 235 | - | |
| 236 | - case 1: | |
| 237 | - Yii::$app->getCache()->set('parser_data', json_encode($data), 1800); | |
| 238 | - // сохраняем в кеш модель - в ней настройки для дальнейшей обработки данных | |
| 239 | - Yii::$app->getCache()->set('parser_configuration', serialize($configuration), 1800); | |
| 240 | - break; | |
| 241 | - | |
| 242 | - default: | |
| 243 | - if( Yii::$app->getCache()->exists('parser_data') ) | |
| 244 | - Yii::$app->getCache()->delete('parser_data'); | |
| 245 | - | |
| 246 | - if( Yii::$app->getCache()->exists('parser_configuration') ) | |
| 247 | - Yii::$app->getCache()->delete('parser_configuration'); | |
| 248 | - } | |
| 249 | 219 | |
| 250 | - } | |
| 251 | 220 | } |
| 252 | 221 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Tsurkanov | |
| 5 | + * Date: 01.12.2015 | |
| 6 | + * Time: 9:42 | |
| 7 | + */ | |
| 8 | +namespace backend\components\traits; | |
| 9 | + | |
| 10 | +use common\components\parsers\DynamicFormHelper; | |
| 11 | +use Yii; | |
| 12 | +use yii\base\ErrorException; | |
| 13 | +use yii\data\ArrayDataProvider; | |
| 14 | + | |
| 15 | +trait ParserTrait | |
| 16 | +{ | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * @param $mode - int: 0 - fetch from cache, - 1 - put in cache, <2 - delete from cache | |
| 20 | + * @param $data - array | |
| 21 | + * @param $configuration - array | |
| 22 | + * @throws \ErrorException | |
| 23 | + */ | |
| 24 | + public function parserCacheHandler($mode, &$data = [], &$configuration = []) | |
| 25 | + { | |
| 26 | + switch ($mode) { | |
| 27 | + case 0: | |
| 28 | + if (Yii::$app->getCache()->get('parser_data') && Yii::$app->getCache()->get('parser_configuration')) { | |
| 29 | + $data = json_decode(Yii::$app->getCache()->get('parser_data'), true); | |
| 30 | + $configuration = unserialize(Yii::$app->getCache()->get('parser_configuration')); | |
| 31 | + } else { | |
| 32 | + throw new \ErrorException('Ошибка кеша'); | |
| 33 | + } | |
| 34 | + break; | |
| 35 | + | |
| 36 | + case 1: | |
| 37 | + Yii::$app->getCache()->set('parser_data', json_encode($data), 1800); | |
| 38 | + // сохраняем в кеш модель - в ней настройки для дальнейшей обработки данных | |
| 39 | + Yii::$app->getCache()->set('parser_configuration', serialize($configuration), 1800); | |
| 40 | + break; | |
| 41 | + | |
| 42 | + default: | |
| 43 | + if (Yii::$app->getCache()->exists('parser_data')) | |
| 44 | + Yii::$app->getCache()->delete('parser_data'); | |
| 45 | + | |
| 46 | + if (Yii::$app->getCache()->exists('parser_configuration')) | |
| 47 | + Yii::$app->getCache()->delete('parser_configuration'); | |
| 48 | + } | |
| 49 | + | |
| 50 | + } | |
| 51 | + | |
| 52 | + public function renderResultView($data) | |
| 53 | + { | |
| 54 | + $provider = new ArrayDataProvider([ | |
| 55 | + 'allModels' => $data, | |
| 56 | + 'pagination' => [ | |
| 57 | + 'pageSize' => 10, | |
| 58 | + ], | |
| 59 | + ]); | |
| 60 | + | |
| 61 | + // создадим модель на столько реквизитов сколько колонок в отпарсенном файле | |
| 62 | + $last_index = end(array_flip($data[0])); | |
| 63 | + $header_counts = $last_index + 1; | |
| 64 | + $header_model = DynamicFormHelper::CreateDynamicModel($header_counts); | |
| 65 | + | |
| 66 | + // соберем массив данных из которых будет пользователь выбирать значения в конструкторе (выпадающий список) | |
| 67 | + $basicColumns = $this->getBasicColumns(); | |
| 68 | + | |
| 69 | + return $this->render('results', | |
| 70 | + ['model' => $data, | |
| 71 | + 'header_model' => $header_model, | |
| 72 | + // список колонок для выбора | |
| 73 | + 'basic_column' => $basicColumns, | |
| 74 | + 'dataProvider' => $provider]); | |
| 75 | + | |
| 76 | + } | |
| 77 | + | |
| 78 | + public function throwStringErrorException( $model , $exception, $errors_str = '' ) | |
| 79 | + { | |
| 80 | + foreach ( $model->getErrors() as $error ) | |
| 81 | + { | |
| 82 | + $errors_str .= ' ' . implode( array_values( $error ) ); | |
| 83 | + } | |
| 84 | + | |
| 85 | + throw new $exception( $errors_str ); | |
| 86 | + } | |
| 87 | + | |
| 88 | + } | |
| 0 | 89 | \ No newline at end of file | ... | ... |
backend/config/main.php
| ... | ... | @@ -16,6 +16,9 @@ return [ |
| 16 | 16 | 'user' => [ |
| 17 | 17 | 'identityClass' => 'common\models\User', |
| 18 | 18 | 'enableAutoLogin' => true, |
| 19 | + 'identityCookie' => [ | |
| 20 | + 'name' => '_backendUser', // unique for backend | |
| 21 | + ] | |
| 19 | 22 | ], |
| 20 | 23 | 'log' => [ |
| 21 | 24 | 'traceLevel' => YII_DEBUG ? 3 : 0, |
| ... | ... | @@ -30,6 +33,8 @@ return [ |
| 30 | 33 | 'errorAction' => 'parser/error', |
| 31 | 34 | ], |
| 32 | 35 | 'request'=>[ |
| 36 | + 'cookieValidationKey' => 'j4iuot9u5894e7tu8reyh78g9y54sy7i', | |
| 37 | + 'csrfParam' => '_backendCSRF', | |
| 33 | 38 | |
| 34 | 39 | 'class' => 'common\components\Request', |
| 35 | 40 | |
| ... | ... | @@ -38,6 +43,10 @@ return [ |
| 38 | 43 | 'adminUrl' => '/admin' |
| 39 | 44 | |
| 40 | 45 | ], |
| 46 | + 'session' => [ | |
| 47 | + 'name' => 'PHPBACKSESSID', | |
| 48 | + 'savePath' => __DIR__ . '/../tmp', | |
| 49 | + ], | |
| 41 | 50 | |
| 42 | 51 | ], |
| 43 | 52 | 'params' => $params, | ... | ... |
backend/controllers/CrossingUploadController.php
| ... | ... | @@ -10,21 +10,24 @@ namespace backend\controllers; |
| 10 | 10 | |
| 11 | 11 | use backend\components\base\BaseController; |
| 12 | 12 | use common\components\CustomArrayHelper; |
| 13 | +use common\components\exceptions\CrossParsingException; | |
| 14 | +use yii\base\Exception; | |
| 13 | 15 | use yii\data\ArrayDataProvider; |
| 14 | 16 | use yii\filters\VerbFilter; |
| 15 | 17 | use yii\filters\AccessControl; |
| 16 | 18 | use backend\models\UploadFileCrossingForm; |
| 17 | 19 | use backend\models\DetailsCrosses; |
| 18 | -use yii\multiparser\DynamicFormHelper; | |
| 20 | +use common\components\parsers\DynamicFormHelper; | |
| 19 | 21 | use yii\web\UploadedFile; |
| 20 | 22 | use common\components\ModelArrayValidator; |
| 21 | 23 | use \Yii; |
| 24 | +use backend\components\traits\ParserTrait; | |
| 22 | 25 | |
| 23 | 26 | class CrossingUploadController extends BaseController |
| 24 | 27 | { |
| 28 | + use ParserTrait; | |
| 25 | 29 | public $layout = "/column"; |
| 26 | 30 | |
| 27 | - | |
| 28 | 31 | /** |
| 29 | 32 | * @inheritdoc |
| 30 | 33 | */ |
| ... | ... | @@ -35,7 +38,7 @@ class CrossingUploadController extends BaseController |
| 35 | 38 | 'class' => AccessControl::className(), |
| 36 | 39 | 'rules' => [ |
| 37 | 40 | [ |
| 38 | - 'actions' => ['result', 'index', 'write'], | |
| 41 | + 'actions' => ['result', 'index', 'write', 'error'], | |
| 39 | 42 | 'allow' => true, |
| 40 | 43 | 'roles' => ['@'], |
| 41 | 44 | ], |
| ... | ... | @@ -50,18 +53,6 @@ class CrossingUploadController extends BaseController |
| 50 | 53 | ]; |
| 51 | 54 | } |
| 52 | 55 | |
| 53 | - /** | |
| 54 | - * @inheritdoc | |
| 55 | - */ | |
| 56 | - public function actions() | |
| 57 | - { | |
| 58 | - return [ | |
| 59 | - 'error' => [ | |
| 60 | - 'class' => 'yii\web\ErrorAction', | |
| 61 | - ], | |
| 62 | - ]; | |
| 63 | - } | |
| 64 | - | |
| 65 | 56 | |
| 66 | 57 | public function actionIndex() |
| 67 | 58 | { |
| ... | ... | @@ -69,60 +60,56 @@ class CrossingUploadController extends BaseController |
| 69 | 60 | return $this->render('index', ['model' => $model]); |
| 70 | 61 | } |
| 71 | 62 | |
| 63 | + | |
| 72 | 64 | public function actionResult() |
| 73 | 65 | { |
| 74 | 66 | $model = new UploadFileCrossingForm(); |
| 75 | 67 | $data = []; |
| 76 | - if ($model->load(Yii::$app->request->post())) { | |
| 68 | + if ( $model->load(Yii::$app->request->post()) ) { | |
| 77 | 69 | $model->file = UploadedFile::getInstance($model, 'file'); |
| 78 | - if ($model->validate()) { | |
| 70 | + | |
| 71 | + if ( $model->validate() ) { | |
| 79 | 72 | $file_name = $model->file->name; |
| 80 | 73 | $model->file_path = Yii::getAlias('@temp_upload') . '/' . $file_name; |
| 81 | 74 | $model->file->saveAs($model->file_path); |
| 82 | 75 | //запускаем парсинг |
| 83 | 76 | $data = $model->readFile(); |
| 84 | 77 | // сохраняем в кеш отпарсенные даные |
| 85 | - $this->parserCacheHandler( 1, $data, $model ); | |
| 86 | - } else if (Yii::$app->getCache()->get('parser_data')) { | |
| 87 | - $data = json_decode(Yii::$app->getCache()->get('parser_data'), true); | |
| 78 | + $this->parserCacheHandler( 1, $data, $model ); | |
| 79 | + } else { | |
| 80 | + // не прошла валидация формы загрузки файлов | |
| 81 | + $errors_str = "Ошибка загрузки файла. "; | |
| 82 | + $this->throwStringErrorException( $model , new CrossParsingException( $errors_str ) ); | |
| 88 | 83 | } |
| 89 | - $provider = new ArrayDataProvider([ | |
| 90 | - 'allModels' => $data, | |
| 91 | - 'pagination' => [ | |
| 92 | - 'pageSize' => 10, | |
| 93 | - ], | |
| 94 | - ]); | |
| 95 | - | |
| 96 | - // создадим модель на столько реквизитов сколько колонок в отпарсенном файле | |
| 97 | - $last_index = end(array_flip($data[0])); | |
| 98 | - $header_counts = $last_index + 1; | |
| 99 | - $header_model = DynamicFormHelper::CreateDynamicModel($header_counts); | |
| 100 | - | |
| 101 | - // соберем массив данных из которых будет пользователь выбирать значения в конструкторе (выпадающий список) | |
| 102 | - $basicColumns = $this->getBasicColumns(); | |
| 103 | - | |
| 104 | - return $this->render('results', | |
| 105 | - ['model' => $data, | |
| 106 | - 'header_model' => $header_model, | |
| 107 | - // список колонок для выбора | |
| 108 | - 'basic_column' => $basicColumns, | |
| 109 | - 'dataProvider' => $provider]); | |
| 84 | + | |
| 85 | + } else if ( Yii::$app->getCache()->get('parser_data') ) { | |
| 86 | + | |
| 87 | + $data = json_decode( Yii::$app->getCache()->get('parser_data'), true ); | |
| 88 | + | |
| 110 | 89 | } |
| 90 | + // сборка динамической модели и её рендеринг | |
| 91 | + return $this->renderResultView( $data ); | |
| 111 | 92 | } |
| 112 | 93 | |
| 113 | 94 | public function actionWrite() |
| 114 | 95 | { |
| 96 | + set_time_limit(600); | |
| 115 | 97 | //получим колонки которые выбрал пользователь |
| 116 | 98 | $arr_attributes = Yii::$app->request->post()['DynamicModel']; |
| 117 | 99 | //соберем модель по полученным данным |
| 118 | 100 | $model = DynamicFormHelper::CreateDynamicModel($arr_attributes); |
| 101 | + $crosses_model = new DetailsCrosses(); | |
| 102 | + $arr_keys = array_keys($this->getBasicColumns()); | |
| 103 | + | |
| 119 | 104 | //добавим правила валидации (колонки должны быть те что в модели) |
| 120 | 105 | foreach ($arr_attributes as $key => $value) { |
| 121 | - $model->addRule($key, 'in', [ 'range' => array_keys( $this->getBasicColumns() ) ]); | |
| 106 | + $model->addRule($key, 'in', ['range' => $arr_keys]); | |
| 122 | 107 | } |
| 123 | - | |
| 108 | + // установим режим проверки обязательных полей | |
| 109 | + $crosses_model->setScenario('form_upload_validation'); | |
| 110 | + $model_validator = new ModelArrayValidator($crosses_model); | |
| 124 | 111 | // провалидируем выбранные колонки |
| 125 | - if ( $model->validate() ) { | |
| 112 | + if ( $model->validate() && $model_validator->validateRow( array_flip( $arr_attributes ) ) ) { | |
| 126 | 113 | |
| 127 | 114 | // валидация успешна у нас есть соответсвие колонок, преобразуем в массив данное соответсвие для дальнейшей работы |
| 128 | 115 | $arr = $model->toArray(); |
| ... | ... | @@ -132,41 +119,42 @@ class CrossingUploadController extends BaseController |
| 132 | 119 | |
| 133 | 120 | // соотнесем отпарсенные данные с соответствием полученным от пользователя |
| 134 | 121 | // для этого преобразуем массив отпарсенных данных - назначим ключи согласно соответствию |
| 135 | - $data = CustomArrayHelper::createAssocArray($data, $arr, 'attr_'); | |
| 122 | + $data = CustomArrayHelper::createAssocArray( $data, $arr, 'attr_' ); | |
| 136 | 123 | |
| 137 | 124 | // запустим конвертер над над данными |
| 138 | 125 | $data = $this->convertDataByConfiguration( $data, $configuration ); |
| 139 | 126 | |
| 140 | 127 | // валидируем отпарсенные данные моделью в которую будем записывать |
| 141 | - $crosses_model = new DetailsCrosses(); | |
| 142 | - $model_validator = new ModelArrayValidator( $crosses_model ); | |
| 128 | + $crosses_model->setScenario('default'); | |
| 143 | 129 | $data = $model_validator->validate( $data ); |
| 144 | 130 | $msg = $model_validator->getMassage(); |
| 145 | - $type_msg = $model_validator->hasError() ? 'warning' : 'success'; | |
| 131 | + $type_msg = $model_validator->hasError() ? 'warning' : 'success'; | |
| 146 | 132 | $model_validator->close(); |
| 147 | 133 | |
| 148 | - $data = $this->reverseCrosses( $data ); | |
| 134 | + $data = $this->reverseCrosses($data); | |
| 135 | + | |
| 136 | + try { | |
| 137 | + if ($crosses_model->ManualInsertWithIgnore( $data )) { | |
| 149 | 138 | |
| 150 | - if ( $crosses_model->ManualInsertWithIgnore( $data ) ) { | |
| 139 | + // очистим кеш | |
| 140 | + $this->parserCacheHandler(2); | |
| 151 | 141 | |
| 152 | - // очистим кеш | |
| 153 | - $this->parserCacheHandler( 2 ); | |
| 142 | + if (file_exists($configuration['file_path'])) | |
| 143 | + unlink($configuration['file_path']); | |
| 154 | 144 | |
| 155 | - if ( file_exists($configuration['file_path']) ) | |
| 156 | - unlink( $configuration['file_path'] ); | |
| 145 | + Yii::$app->session->setFlash($type_msg, $msg); | |
| 146 | + return $this->render('index', ['model' => $configuration]); | |
| 157 | 147 | |
| 158 | - Yii::$app->session->setFlash( $type_msg, $msg ); | |
| 159 | - return $this->render('index', ['model' => $configuration]); | |
| 148 | + } | |
| 149 | + } catch (Exception $e) { | |
| 160 | 150 | |
| 151 | + new CrossParsingException( $e->getMessage() ); | |
| 161 | 152 | } |
| 162 | 153 | |
| 163 | 154 | } else { |
| 164 | 155 | // не прошла валидация формы загрузки файлов |
| 165 | - $errors_str = ''; | |
| 166 | - foreach ($model->getErrors() as $error) { | |
| 167 | - $errors_str .= implode(array_values($error)); | |
| 168 | - } | |
| 169 | - throw new \ErrorException($errors_str); | |
| 156 | + $errors_str = "Ошибка валидации формы загрузки файлов. "; | |
| 157 | + $this->throwStringErrorException( $crosses_model , 'common\components\exceptions\CrossParsingException', $errors_str ); | |
| 170 | 158 | } |
| 171 | 159 | } |
| 172 | 160 | |
| ... | ... | @@ -181,7 +169,8 @@ class CrossingUploadController extends BaseController |
| 181 | 169 | |
| 182 | 170 | } |
| 183 | 171 | |
| 184 | - protected function convertDataByConfiguration( $data, $configuration ){ | |
| 172 | + protected function convertDataByConfiguration($data, $configuration) | |
| 173 | + { | |
| 185 | 174 | |
| 186 | 175 | // доп. опции для парсера - удаление префикса в артикулах |
| 187 | 176 | $options['mode'] = 'crosses'; |
| ... | ... | @@ -193,38 +182,38 @@ class CrossingUploadController extends BaseController |
| 193 | 182 | $fields[] = 'CROSS_ARTICLE'; |
| 194 | 183 | } |
| 195 | 184 | if ($fields) { |
| 196 | - $options ['converter_conf']['configuration'] = ["article" => $fields, | |
| 185 | + $options ['converter_conf']['configuration'] = ["article" => $fields, | |
| 197 | 186 | "string" => ['ARTICLE', 'CROSS_ARTICLE'],]; |
| 198 | 187 | } else { |
| 199 | - $options ['converter_conf']['configuration'] = ["string" => ['ARTICLE', 'CROSS_ARTICLE'],]; | |
| 188 | + $options ['converter_conf']['configuration'] = ["string" => ['ARTICLE', 'CROSS_ARTICLE'],]; | |
| 200 | 189 | } |
| 201 | 190 | |
| 202 | 191 | // получим базовую конфигурацию и объеденим её с той что образовалась после выбора пользователем настроек |
| 203 | - $basic_options = Yii::$app->multiparser->getConfiguration( 'csv', 'crosses' ); | |
| 204 | - $options = array_merge_recursive( $options, $basic_options ); | |
| 192 | + $basic_options = Yii::$app->multiparser->getConfiguration('csv', 'crosses'); | |
| 193 | + $options = array_merge_recursive($options, $basic_options); | |
| 205 | 194 | |
| 206 | - foreach ( $data as &$row ) { | |
| 207 | - $row = Yii::$app->converter->convertByConfiguration( $row, $options['converter_conf'] ); | |
| 195 | + foreach ($data as &$row) { | |
| 196 | + $row = Yii::$app->converter->convertByConfiguration($row, $options['converter_conf']); | |
| 208 | 197 | } |
| 209 | 198 | |
| 210 | 199 | return $data; |
| 211 | 200 | |
| 212 | 201 | } |
| 213 | 202 | |
| 214 | - protected function reverseCrosses ( $data ) | |
| 203 | + protected function reverseCrosses($data) | |
| 215 | 204 | { |
| 216 | 205 | // для доп массива обратных строк |
| 217 | - $i = count( $data ) - 1; | |
| 206 | + $i = count($data) - 1; | |
| 218 | 207 | $reverse_data = []; |
| 219 | - foreach ( $data as &$row ) { | |
| 208 | + foreach ($data as &$row) { | |
| 220 | 209 | // нужно добавить обратную строку по кроссам |
| 221 | - $reverse_data[ $i ]['ARTICLE'] = $row['CROSS_ARTICLE']; | |
| 222 | - $reverse_data[ $i ]['CROSS_ARTICLE'] = $row['ARTICLE']; | |
| 223 | - $reverse_data[ $i ]['BRAND'] = $row['CROSS_BRAND']; | |
| 224 | - $reverse_data[ $i ]['CROSS_BRAND'] = $row['BRAND']; | |
| 210 | + $reverse_data[$i]['ARTICLE'] = $row['CROSS_ARTICLE']; | |
| 211 | + $reverse_data[$i]['CROSS_ARTICLE'] = $row['ARTICLE']; | |
| 212 | + $reverse_data[$i]['BRAND'] = $row['CROSS_BRAND']; | |
| 213 | + $reverse_data[$i]['CROSS_BRAND'] = $row['BRAND']; | |
| 225 | 214 | $i++; |
| 226 | 215 | } |
| 227 | - $data = array_merge( $data, $reverse_data ); | |
| 216 | + $data = array_merge($data, $reverse_data); | |
| 228 | 217 | |
| 229 | 218 | return $data; |
| 230 | 219 | } | ... | ... |
backend/controllers/NewsController.php
| ... | ... | @@ -95,7 +95,7 @@ class NewsController extends BaseController |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | |
| 98 | - if ($model->load(Yii::$app->request->post()) /*&& $model->save()*/ ) { | |
| 98 | + if ($model->load(Yii::$app->request->post()) && $model->save() ) { | |
| 99 | 99 | |
| 100 | 100 | if ($model['mail_send'] == '1') { |
| 101 | 101 | $sEmails = array(); | ... | ... |
backend/controllers/ParserController.php
| 1 | 1 | <?php |
| 2 | 2 | namespace backend\controllers; |
| 3 | 3 | |
| 4 | -use common\components\archives\ArchiveCreator; | |
| 5 | -use common\components\mail\ImapMailReader; | |
| 6 | -use common\components\mail\MailAttachmentsSaver; | |
| 4 | +use backend\models\Details; | |
| 5 | +use common\components\exceptions\CrossParsingException; | |
| 6 | +use common\components\exceptions\PriceParsingException; | |
| 7 | +use common\components\exceptions\RgParsingException; | |
| 8 | +use common\components\ModelArrayValidator; | |
| 7 | 9 | use common\components\parsers\MailParser; |
| 8 | 10 | use Yii; |
| 9 | 11 | use yii\data\ActiveDataProvider; |
| ... | ... | @@ -13,19 +15,20 @@ use yii\filters\VerbFilter; |
| 13 | 15 | use backend\models\UploadFileParsingForm; |
| 14 | 16 | use yii\web\UploadedFile; |
| 15 | 17 | use yii\data\ArrayDataProvider; |
| 16 | -use yii\multiparser\DynamicFormHelper; | |
| 18 | +use common\components\parsers\DynamicFormHelper; | |
| 17 | 19 | use backend\models\ImportersFiles; |
| 18 | 20 | use backend\models\Importers; |
| 19 | 21 | use yii\base\ErrorException; |
| 20 | 22 | use common\components\PriceWriter; |
| 21 | -use common\components\CustomVarDamp; | |
| 22 | 23 | use common\components\CustomArrayHelper; |
| 24 | +use backend\components\traits\ParserTrait; | |
| 23 | 25 | |
| 24 | 26 | /** |
| 25 | 27 | * Parser controller |
| 26 | 28 | */ |
| 27 | 29 | class ParserController extends BaseController |
| 28 | 30 | { |
| 31 | + use ParserTrait; | |
| 29 | 32 | public $layout = "/column"; |
| 30 | 33 | |
| 31 | 34 | /** |
| ... | ... | @@ -53,7 +56,6 @@ class ParserController extends BaseController |
| 53 | 56 | } |
| 54 | 57 | |
| 55 | 58 | |
| 56 | - | |
| 57 | 59 | public function actionIndex($mode = 0) |
| 58 | 60 | { |
| 59 | 61 | $model = new UploadFileParsingForm(); |
| ... | ... | @@ -65,21 +67,31 @@ class ParserController extends BaseController |
| 65 | 67 | public function actionError() |
| 66 | 68 | { |
| 67 | 69 | $exception = Yii::$app->errorHandler->exception; |
| 68 | - if ($exception !== null) { | |
| 69 | - return $this->render('error', ['message' => $exception->getMessage()]); | |
| 70 | + $action_name = ''; | |
| 71 | + | |
| 72 | + if ( $exception instanceof CrossParsingException ) { | |
| 73 | + $action_name = ['crossing-upload/result']; | |
| 74 | + }elseif ( $exception instanceof PriceParsingException ) { | |
| 75 | + $action_name = ['results']; | |
| 76 | + }elseif ( $exception instanceof RgParsingException ) { | |
| 77 | + $action_name = ['rg-grup/results']; | |
| 78 | + } | |
| 79 | + | |
| 80 | + if ( $exception !== null ) { | |
| 81 | + $msg = $exception->getMessage(); | |
| 82 | + return $this->render( 'error', [ 'message' => $msg, 'action_name' => $action_name ] ); | |
| 70 | 83 | } |
| 71 | 84 | } |
| 72 | 85 | |
| 73 | 86 | public function actionResults($mode = 0) |
| 74 | 87 | { |
| 88 | + set_time_limit(600); | |
| 75 | 89 | $model = new UploadFileParsingForm( ['mode' => $mode] ); |
| 76 | 90 | $data = []; |
| 77 | 91 | if ( $model->load(Yii::$app->request->post()) ) { |
| 78 | - $model->file = UploadedFile::getInstance($model, 'file'); | |
| 79 | - // первый проход - валидируем, | |
| 80 | - // сохраняем файл, | |
| 92 | + $model->file = UploadedFile::getInstance( $model, 'file' ); | |
| 93 | + // первый проход - валидируем, сохраняем файл, | |
| 81 | 94 | // ложим в кеш (для ручной загрузки) отпарсенные данные и параметры модели |
| 82 | - // (потом при записи в базу данных они пригодятся) | |
| 83 | 95 | if ( $model->validate() ) { |
| 84 | 96 | // сохраним файл и создадим модель - ImportersFiles |
| 85 | 97 | $files_model = $this->saveParserFile($model); |
| ... | ... | @@ -88,45 +100,19 @@ class ParserController extends BaseController |
| 88 | 100 | $model->success = true; |
| 89 | 101 | return $this->render('index', ['model' => $model]); |
| 90 | 102 | } |
| 91 | - | |
| 92 | 103 | // === ручная загрузка =========== |
| 93 | 104 | //запускаем парсинг |
| 94 | 105 | $data = $this->parseDataFromFile( $files_model, $model ); |
| 95 | 106 | |
| 96 | 107 | } else { |
| 97 | 108 | // не прошла валидация форма загрузки файлов |
| 98 | -// $errors_str = ''; | |
| 99 | -// foreach ($model->getErrors() as $error) { | |
| 100 | -// $errors_str .= implode( array_values($error) ); | |
| 101 | -// } | |
| 102 | -// throw new ErrorException( $errors_str ); | |
| 103 | - $model->throwStringErrorException(); | |
| 109 | + $this->throwStringErrorException( $model , 'common\components\exceptions\PriceParsingException' ); | |
| 104 | 110 | } |
| 105 | 111 | // листаем пагинатором, или повторно вызываем - считываем из кеша отпрасенные данные |
| 106 | 112 | } else if ( Yii::$app->getCache()->get('parser_data') ) { |
| 107 | - | |
| 108 | 113 | $data = json_decode(Yii::$app->getCache()->get('parser_data'), true); |
| 109 | - | |
| 110 | 114 | } |
| 111 | - | |
| 112 | - $provider = new ArrayDataProvider([ | |
| 113 | - 'allModels' => $data, | |
| 114 | - 'pagination' => [ | |
| 115 | - 'pageSize' => 10, | |
| 116 | - ], | |
| 117 | - ]); | |
| 118 | - | |
| 119 | - $last_index = end( array_flip( $data[0] ) ); | |
| 120 | - $header_counts = $last_index + 1; | |
| 121 | - //формируем заголовок для пользователя, где он сможет выбрать соответсвие полей (выпадающий список) | |
| 122 | - $header_model = DynamicFormHelper::CreateDynamicModel( $header_counts ); | |
| 123 | - | |
| 124 | - return $this->render('results', | |
| 125 | - ['model' => $data, | |
| 126 | - 'header_model' => $header_model, | |
| 127 | - // список колонок для выбора | |
| 128 | - 'basic_column' => Yii::$app->multiparser->getConfiguration('csv', 'basic_column'), | |
| 129 | - 'dataProvider' => $provider]); | |
| 115 | + return $this->renderResultView( $data ); | |
| 130 | 116 | } |
| 131 | 117 | |
| 132 | 118 | public function actionWrite() |
| ... | ... | @@ -135,13 +121,17 @@ class ParserController extends BaseController |
| 135 | 121 | $arr_attributes = Yii::$app->request->post()['DynamicModel']; |
| 136 | 122 | //соберем модель по полученным данным |
| 137 | 123 | $model = DynamicFormHelper::CreateDynamicModel($arr_attributes); |
| 124 | + $details_model = new Details(); | |
| 138 | 125 | //добавим правила валидации (колонки должны быть те что указаны в конфиге) |
| 139 | 126 | foreach ($arr_attributes as $key => $value) { |
| 140 | 127 | $model->addRule($key, 'in', ['range' => array_keys(Yii::$app->multiparser->getConfiguration('csv', 'basic_column'))]); |
| 141 | 128 | } |
| 142 | 129 | |
| 130 | + // установим режим проверки обязательных полей | |
| 131 | + $details_model->setScenario('form_upload_validation'); | |
| 132 | + $model_validator = new ModelArrayValidator( $details_model ); | |
| 143 | 133 | // провалидируем выбранные колонки |
| 144 | - if ($model->validate()) { | |
| 134 | + if ( $model->validate() && $model_validator->validateRow( array_flip( $arr_attributes ) ) ) { | |
| 145 | 135 | |
| 146 | 136 | // валидация успешна у нас есть соответсвие колонок, преобразуем в массив данное соответсвие для дальнейшей работы |
| 147 | 137 | $arr = $model->toArray(); |
| ... | ... | @@ -164,12 +154,16 @@ class ParserController extends BaseController |
| 164 | 154 | |
| 165 | 155 | if( file_exists($configuration['file_path']) ) |
| 166 | 156 | unlink($configuration['file_path']); |
| 167 | - | |
| 168 | - Yii::$app->session->setFlash( $writer->getValidatedTypeMsg(), $writer->getValidatedMsg() ); | |
| 169 | - return $this->render('index', ['model' => $configuration]); | |
| 157 | + $validated_type_msg = $writer->hasValidationError() ? 'warning' : 'success'; | |
| 158 | + Yii::$app->session->setFlash( $validated_type_msg, $writer->getValidatedMsg() ); | |
| 159 | + return $this->render('index', ['model' => $configuration]); | |
| 170 | 160 | |
| 171 | 161 | }; |
| 172 | 162 | |
| 163 | + } else { | |
| 164 | + // не прошла валидация формы загрузки файлов | |
| 165 | + $errors_str = "Ошибка валидации формы загрузки файлов. "; | |
| 166 | + $this->throwStringErrorException( $details_model , 'common\components\exceptions\PriceParsingException', $errors_str ); | |
| 173 | 167 | } |
| 174 | 168 | |
| 175 | 169 | } |
| ... | ... | @@ -199,7 +193,7 @@ class ParserController extends BaseController |
| 199 | 193 | $arr_id_files[] = (int) $file_id; |
| 200 | 194 | } |
| 201 | 195 | |
| 202 | - $query = ImportersFiles::find()->where(['in', 'id', $arr_id_files])->orderBy(['upload_time' => SORT_DESC]); | |
| 196 | + $query = ImportersFiles::find()->where(['in', 'id', $arr_id_files])->orderBy( ['upload_time' => SORT_DESC] ); | |
| 203 | 197 | |
| 204 | 198 | $provider = new ActiveDataProvider([ |
| 205 | 199 | 'query' => $query, |
| ... | ... | @@ -300,4 +294,9 @@ class ParserController extends BaseController |
| 300 | 294 | return $data; |
| 301 | 295 | } |
| 302 | 296 | |
| 297 | + protected function getBasicColumns() | |
| 298 | + { | |
| 299 | + return Yii::$app->multiparser->getConfiguration('csv', 'basic_column'); | |
| 300 | + | |
| 301 | + } | |
| 303 | 302 | } | ... | ... |
backend/controllers/RgGrupController.php
| ... | ... | @@ -10,7 +10,8 @@ namespace backend\controllers; |
| 10 | 10 | |
| 11 | 11 | use backend\components\base\BaseController; |
| 12 | 12 | use backend\models\UploadFileRgForm; |
| 13 | -use common\components\CustomVarDamp; | |
| 13 | +use common\components\exceptions\RgParsingException; | |
| 14 | +use common\components\ModelArrayValidator; | |
| 14 | 15 | use common\components\parsers\MailAttachmentsSaver; |
| 15 | 16 | use common\models\Margins; |
| 16 | 17 | use common\models\MarginsGroups; |
| ... | ... | @@ -18,11 +19,13 @@ use yii\filters\AccessControl; |
| 18 | 19 | use Yii; |
| 19 | 20 | use yii\web\UploadedFile; |
| 20 | 21 | use yii\data\ArrayDataProvider; |
| 21 | -use yii\multiparser\DynamicFormHelper; | |
| 22 | +use common\components\parsers\DynamicFormHelper; | |
| 22 | 23 | use common\components\CustomArrayHelper; |
| 24 | +use backend\components\traits\ParserTrait; | |
| 23 | 25 | |
| 24 | 26 | class RgGrupController extends BaseController |
| 25 | 27 | { |
| 28 | + use ParserTrait; | |
| 26 | 29 | public $layout = "/column"; |
| 27 | 30 | |
| 28 | 31 | /** |
| ... | ... | @@ -65,25 +68,15 @@ class RgGrupController extends BaseController |
| 65 | 68 | $model->file = UploadedFile::getInstance($model, 'file'); |
| 66 | 69 | // первый проход - валидируем, сохраняем файл, ложим в кеш отпарсенные данные и параметры модели (потом при записи в базу данных они пригодятся) |
| 67 | 70 | if ($model->validate()) { |
| 68 | - | |
| 69 | 71 | $model->file_path = Yii::getAlias('@manual_upload') . '/' . $model->file->name; |
| 70 | 72 | $model->file->saveAs($model->file_path); |
| 71 | - | |
| 72 | 73 | //запускаем парсинг |
| 73 | 74 | $data = $model->readFile(); |
| 74 | 75 | // сохраняем в кеш отпарсенные даные |
| 75 | - Yii::$app->getCache()->set('parser_data', json_encode($data), 1800); | |
| 76 | - // сохраняем в кеш модель - в ней настройки для дальнейшей обработки данных | |
| 77 | - Yii::$app->getCache()->set('parser_configuration', serialize($model), 1800); | |
| 78 | - | |
| 79 | - | |
| 76 | + $this->parserCacheHandler(1, $data, $model); | |
| 80 | 77 | } else { |
| 81 | 78 | // не прошла валидация форма загрузки файлов |
| 82 | - $errors_str = ''; | |
| 83 | - foreach ($model->getErrors() as $error) { | |
| 84 | - $errors_str .= implode(array_values($error)); | |
| 85 | - } | |
| 86 | - throw new \ErrorException($errors_str); | |
| 79 | + $this->throwStringErrorException($model, 'common\components\exceptions\RgParsingException'); | |
| 87 | 80 | } |
| 88 | 81 | // листаем пагинатором, или повторно вызываем - считываем из кеша отпрасенные данные |
| 89 | 82 | } else if (Yii::$app->getCache()->get('parser_data')) { |
| ... | ... | @@ -91,52 +84,32 @@ class RgGrupController extends BaseController |
| 91 | 84 | $data = json_decode(Yii::$app->getCache()->get('parser_data'), true); |
| 92 | 85 | |
| 93 | 86 | } |
| 94 | - $provider = new ArrayDataProvider([ | |
| 95 | - 'allModels' => $data, | |
| 96 | - 'pagination' => [ | |
| 97 | - 'pageSize' => 10, | |
| 98 | - ], | |
| 99 | - ]); | |
| 100 | - // создадим модель на столько реквизитов сколько колонок в отпарсенном файле | |
| 101 | - $last_index = end(array_flip($data[0])); | |
| 102 | - $header_counts = $last_index + 1; | |
| 103 | - $header_model = DynamicFormHelper::CreateDynamicModel($header_counts); | |
| 104 | - | |
| 105 | - // соберем массив данных из которых будет пользователь выбирать значения в конструкторе (выпадающий список) | |
| 106 | - $header_array = Margins::getHeader(); | |
| 107 | - | |
| 108 | - return $this->render('results', | |
| 109 | - ['model' => $data, | |
| 110 | - 'header_model' => $header_model, | |
| 111 | - // список колонок для выбора | |
| 112 | - 'basic_column' => $header_array, | |
| 113 | - 'dataProvider' => $provider]); | |
| 87 | + // сборка динамической модели и её рендеринг | |
| 88 | + return $this->renderResultView($data); | |
| 114 | 89 | } |
| 115 | 90 | |
| 116 | 91 | public function actionWrite() |
| 117 | 92 | { |
| 118 | 93 | //получим колонки которые выбрал пользователь |
| 119 | 94 | $arr_attributes = Yii::$app->request->post()['DynamicModel']; |
| 95 | + $margin_model = new MarginsGroups(); | |
| 120 | 96 | //соберем модель по полученным данным |
| 121 | 97 | $model = DynamicFormHelper::CreateDynamicModel($arr_attributes); |
| 122 | 98 | //добавим правила валидации (колонки должны быть те что в модели) |
| 123 | 99 | foreach ($arr_attributes as $key => $value) { |
| 124 | 100 | $model->addRule($key, 'in', ['range' => array_keys(Margins::getHeader())]); |
| 125 | 101 | } |
| 126 | - | |
| 102 | + // установим режим проверки обязательных полей | |
| 103 | + $margin_model->setScenario('form_upload_validation'); | |
| 104 | + $model_validator = new ModelArrayValidator($margin_model); | |
| 127 | 105 | // провалидируем выбранные колонки |
| 128 | - if ( $model->validate() ) { | |
| 106 | + if ($model->validate() && $model_validator->validateRow($this->getAttributesForValidate($arr_attributes))) { | |
| 129 | 107 | |
| 130 | 108 | // валидация успешна у нас есть соответсвие колонок, преобразуем в массив данное соответсвие для дальнейшей работы |
| 131 | 109 | $arr = $model->toArray(); |
| 132 | 110 | |
| 133 | 111 | // получим данные из кеша |
| 134 | - if (Yii::$app->getCache()->get('parser_data') && Yii::$app->getCache()->get('parser_configuration')) { | |
| 135 | - $data = json_decode(Yii::$app->getCache()->get('parser_data'), true); | |
| 136 | - $configuration = unserialize(Yii::$app->getCache()->get('parser_configuration')); | |
| 137 | - } else { | |
| 138 | - throw new \ErrorException('Ошибка кеша'); | |
| 139 | - } | |
| 112 | + $this->parserCacheHandler(0, $data, $configuration); | |
| 140 | 113 | |
| 141 | 114 | array_walk($arr, function (&$val) { |
| 142 | 115 | $val = '!' . $val; |
| ... | ... | @@ -147,51 +120,85 @@ class RgGrupController extends BaseController |
| 147 | 120 | $data = CustomArrayHelper::createAssocArray($data, $arr, 'attr_'); |
| 148 | 121 | |
| 149 | 122 | // в первой строке у нас заголовки - уберем |
| 150 | - unset( $data[0] ); | |
| 123 | + unset($data[0]); | |
| 151 | 124 | // подготовим данные для записи в таблицу w_margins_groups |
| 152 | - $arr_values = []; | |
| 153 | - $group = ''; | |
| 154 | - $importer_id = $configuration['importer_id']; | |
| 155 | - foreach ($data as $row_data) { | |
| 156 | - | |
| 157 | - if (isset($row_data['!group'])) { | |
| 158 | - $group = $row_data['!group']; | |
| 159 | - unset($row_data['!group']); | |
| 160 | - } | |
| 161 | - if (isset($row_data['!_null'])) { | |
| 162 | - unset($row_data['!_null']); | |
| 125 | + $data = $this->convertDataByConfiguration($data, $configuration); | |
| 126 | + | |
| 127 | + // валидируем отпарсенные данные моделью в которую будем записывать | |
| 128 | + $margin_model->setScenario('default'); | |
| 129 | + $data = $model_validator->validate($data); | |
| 130 | + $msg = $model_validator->getMassage(); | |
| 131 | + $type_msg = $model_validator->hasError() ? 'warning' : 'success'; | |
| 132 | + $model_validator->close(); | |
| 133 | + // сохраним подготовленные данные | |
| 134 | + if (!empty($data)) { | |
| 135 | + if (MarginsGroups::ManualInsertWithUpdate($data, ['group', 'importer_id', 'margin_id'])) { | |
| 136 | + // все прошло успешно - очищаем кеш | |
| 137 | + $this->parserCacheHandler(2); | |
| 138 | + | |
| 139 | + if (file_exists($configuration['file_path'])) | |
| 140 | + unlink($configuration['file_path']); | |
| 163 | 141 | } |
| 164 | 142 | |
| 165 | - foreach ($row_data as $key => $value) { | |
| 166 | - if ($group) | |
| 167 | - $row['group'] = trim($group); | |
| 143 | + } | |
| 144 | + Yii::$app->session->setFlash($type_msg, $msg); | |
| 145 | + return $this->render('index', ['model' => $configuration]); | |
| 168 | 146 | |
| 169 | - $row['importer_id'] = trim($importer_id); | |
| 170 | - $row['margin_id'] = ltrim($key, '!'); | |
| 171 | - $row['koef'] = \Yii::$app->converter->convertTo('float', $value, ['precision' => 6]); | |
| 147 | + } else { | |
| 148 | + // не прошла валидация формы загрузки файлов | |
| 149 | + $errors_str = "Ошибка валидации формы загрузки файлов. "; | |
| 150 | + $this->throwStringErrorException($margin_model, 'common\components\exceptions\RgParsingException', $errors_str); | |
| 151 | + } | |
| 152 | + } | |
| 172 | 153 | |
| 154 | + protected function convertDataByConfiguration($data, $configuration) | |
| 155 | + { | |
| 156 | + $arr_values = []; | |
| 157 | + $group = ''; | |
| 158 | + $importer_id = $configuration['importer_id']; | |
| 159 | + foreach ($data as $row_data) { | |
| 160 | + | |
| 161 | + if (isset($row_data['!group'])) { | |
| 162 | + $group = $row_data['!group']; | |
| 163 | + unset($row_data['!group']); | |
| 164 | + } | |
| 165 | + if (isset($row_data['!_null'])) { | |
| 166 | + unset($row_data['!_null']); | |
| 167 | + } | |
| 173 | 168 | |
| 174 | - $arr_values[] = $row; | |
| 169 | + foreach ($row_data as $key => $value) { | |
| 170 | + if ($group) | |
| 171 | + $row['group'] = trim($group); | |
| 175 | 172 | |
| 176 | - } | |
| 173 | + $row['importer_id'] = trim($importer_id); | |
| 174 | + $row['margin_id'] = ltrim($key, '!'); | |
| 175 | + $row['koef'] = \Yii::$app->converter->convertTo('float', $value, ['precision' => 6]); | |
| 177 | 176 | |
| 177 | + $arr_values[] = $row; | |
| 178 | 178 | } |
| 179 | - // сохраним подготовленные данные | |
| 180 | - MarginsGroups::ManualInsertWithUpdate( $arr_values, [ 'group','importer_id','margin_id' ] ); | |
| 181 | - | |
| 182 | - | |
| 183 | - Yii::$app->session->setFlash('success', "Файл {$configuration['file']} успешно загружен"); | |
| 184 | - // все прошло успешно - очищаем кеш | |
| 185 | - Yii::$app->getCache()->delete('parser_data'); | |
| 186 | - Yii::$app->getCache()->delete('parser_configuration'); | |
| 179 | + } | |
| 180 | + return $arr_values; | |
| 181 | + } | |
| 187 | 182 | |
| 188 | - if (file_exists($configuration['file_path'])) | |
| 189 | - unlink($configuration['file_path']); | |
| 183 | + protected function getBasicColumns() | |
| 184 | + { | |
| 185 | + return Margins::getHeader(); | |
| 186 | + } | |
| 190 | 187 | |
| 191 | - return $this->render('index', ['model' => $configuration]); | |
| 188 | + // подготавливает массив для валидирования моделью - MarginsGroups | |
| 189 | + // для этого меняем выбранные значения именем поля - margin_id | |
| 190 | + protected function getAttributesForValidate($arr) | |
| 191 | + { | |
| 192 | + $base_columns_arr = Margins::find()->select('id')->asArray()->all(); | |
| 193 | + $base_columns_arr = array_column($base_columns_arr,'id'); | |
| 192 | 194 | |
| 193 | - } | |
| 195 | + array_walk( $arr, function (&$value, $key, $base_columns_arr) { | |
| 196 | + if (in_array( $value, $base_columns_arr )){ | |
| 197 | + $value = 'margin_id'; | |
| 198 | + } | |
| 199 | + }, $base_columns_arr ); | |
| 194 | 200 | |
| 201 | + return array_flip( $arr ); | |
| 195 | 202 | } |
| 196 | 203 | |
| 197 | 204 | // public function actionMail() | ... | ... |
backend/models/Details.php
| ... | ... | @@ -55,13 +55,13 @@ class Details extends BaseActiveRecord |
| 55 | 55 | public function rules() |
| 56 | 56 | { |
| 57 | 57 | return [ |
| 58 | - [['BRAND', 'ARTICLE', 'PRICE', 'DESCR', 'BOX'], 'required'], | |
| 59 | - [['PRICE'], 'number'], | |
| 60 | - [['BOX'], 'integer'], | |
| 61 | - [['timestamp'], 'safe'], | |
| 62 | - [['BRAND', 'ARTICLE'], 'string', 'max' => 100], | |
| 63 | - [['FULL_ARTICLE'], 'string', 'max' => 150], | |
| 64 | - [['DESCR', 'GROUP'], 'string', 'max' => 200] | |
| 58 | + [['BRAND', 'ARTICLE', 'PRICE', 'DESCR', 'BOX'], 'required' , 'on' => ['default','form_upload_validation']], | |
| 59 | + [['PRICE'], 'number', 'on' => 'default'], | |
| 60 | + [['BOX'], 'integer' , 'on' => 'default'], | |
| 61 | + [['timestamp'], 'safe' , 'on' => 'default'], | |
| 62 | + [['BRAND', 'ARTICLE'], 'string', 'max' => 100 , 'on' => 'default'], | |
| 63 | + [['FULL_ARTICLE'], 'string', 'max' => 150 , 'on' => 'default'], | |
| 64 | + [['DESCR', 'GROUP'], 'string', 'max' => 200 , 'on' => 'default'] | |
| 65 | 65 | ]; |
| 66 | 66 | } |
| 67 | 67 | ... | ... |
backend/models/DetailsCrosses.php
| ... | ... | @@ -35,9 +35,9 @@ class DetailsCrosses extends \backend\components\base\BaseActiveRecord |
| 35 | 35 | public function rules() |
| 36 | 36 | { |
| 37 | 37 | return [ |
| 38 | - [['ARTICLE', 'BRAND', 'CROSS_BRAND', 'CROSS_ARTICLE'], 'required'], | |
| 39 | - [['timestamp'], 'safe'], | |
| 40 | - [['ARTICLE', 'BRAND', 'CROSS_BRAND', 'CROSS_ARTICLE'], 'string', 'max' => 100] | |
| 38 | + [['ARTICLE', 'BRAND', 'CROSS_BRAND', 'CROSS_ARTICLE'], 'required', 'on' => ['default','form_upload_validation']], | |
| 39 | + [['timestamp'], 'safe' , 'on' => 'default'], | |
| 40 | + [['ARTICLE', 'BRAND', 'CROSS_BRAND', 'CROSS_ARTICLE'], 'string', 'max' => 100 , 'on' => 'default'] | |
| 41 | 41 | ]; |
| 42 | 42 | } |
| 43 | 43 | ... | ... |
backend/models/Details_old.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Created by PhpStorm. | |
| 4 | - * User: Cibermag | |
| 5 | - * Date: 15.09.2015 | |
| 6 | - * Time: 16:49 | |
| 7 | - */ | |
| 8 | - | |
| 9 | -namespace backend\models; | |
| 10 | - | |
| 11 | -use yii\base\Model; | |
| 12 | -use Yii; | |
| 13 | - | |
| 14 | -class Details_old extends Model{ | |
| 15 | - const KEY_COLUMN = ['IMPORT_ID','BRAND','ARTICLE']; | |
| 16 | - const BATCH = 500; | |
| 17 | - | |
| 18 | - private $mode; | |
| 19 | - | |
| 20 | - // обязательные поля модели | |
| 21 | - public $BRAND; | |
| 22 | - public $ARTICLE; | |
| 23 | - public $PRICE; | |
| 24 | - public $BOX; | |
| 25 | - | |
| 26 | - function __construct($mode) | |
| 27 | - { | |
| 28 | - $this->mode = $mode; | |
| 29 | - } | |
| 30 | - | |
| 31 | - public function rules() | |
| 32 | - { | |
| 33 | - return [ | |
| 34 | - [['BRAND','ARTICLE', 'PRICE', 'BOX'], 'required' ], | |
| 35 | - ]; | |
| 36 | - } | |
| 37 | - | |
| 38 | - public function formName() | |
| 39 | - { | |
| 40 | - return 'Details'; | |
| 41 | - } | |
| 42 | - | |
| 43 | - | |
| 44 | - public static function tableName() | |
| 45 | - { | |
| 46 | - return '{{%details}}'; | |
| 47 | - } | |
| 48 | - | |
| 49 | -// //@todo вероятно этой функции не место здесь | |
| 50 | -// public function prepareData ( $data, $configuration ) | |
| 51 | -// { | |
| 52 | -// if ( isset($configuration['importer_id']) && $configuration['importer_id']) { | |
| 53 | -// $data = \Yii::$app->multiparser->addColumn( $data, 'IMPORT_ID', $configuration['importer_id'] ); | |
| 54 | -// } | |
| 55 | -// // \common\components\CustomVarDamp::dumpAndDie($data); | |
| 56 | -// return $data; | |
| 57 | -// } | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * @param $data - двумерный массив данных для записи в таблицу details | |
| 61 | - * @throws \yii\db\Exception | |
| 62 | - * вставляет записи с апдейтом при дубляже ключей | |
| 63 | - */ | |
| 64 | - public function save ($data) | |
| 65 | - { | |
| 66 | - $table_name = self::tableName(); | |
| 67 | - $keys_arr = array_keys( $data[0] ); | |
| 68 | - // найдем те поля которые не являются ключами. Их нужно будет при дубляже апдейтить | |
| 69 | - $fields_arr_to_update = array_diff( $keys_arr, $this::KEY_COLUMN ); | |
| 70 | - | |
| 71 | - $query_update = ' on duplicate key update '; | |
| 72 | - foreach ($fields_arr_to_update as $field) { | |
| 73 | - $query_update .= "{$field} = values({$field}),"; | |
| 74 | - } | |
| 75 | - // удалим последнюю запятую | |
| 76 | - $query_update = substr($query_update, 0, strlen($query_update) - 1); | |
| 77 | - | |
| 78 | - // запросы будем выполнять пакетами | |
| 79 | - // размер пакета установлен в константе | |
| 80 | - // разобъем массив на пакеты и будем их проходить | |
| 81 | - $data = array_chunk($data, $this::BATCH ); | |
| 82 | - foreach( $data as $current_batch_array ){ | |
| 83 | - | |
| 84 | - //воспользуемся пакетной вставкой от фреймворка, плюс сразу с экранированием и защитой от инъекций | |
| 85 | - $query_insert = Yii::$app->db->createCommand()->batchInsert($table_name, $keys_arr, $current_batch_array)->sql; | |
| 86 | - // добавим фрагмент с апдейтом при дубляже | |
| 87 | - $query = "{$query_insert} {$query_update}"; | |
| 88 | - // \common\components\CustomVarDamp::dumpAndDie($query); | |
| 89 | - $res = Yii::$app->db->createCommand($query)->execute(); | |
| 90 | - | |
| 91 | - } | |
| 92 | - | |
| 93 | - } | |
| 94 | -} | |
| 95 | - | |
| 96 | -// | |
| 97 | - | |
| 98 | -//$q = " INSERT INTO {$table_name} ({$keys_string}) VALUES ("; | |
| 99 | - | |
| 100 | -//$q .= " on duplicate key update `FULL_ARTICLE` = values (`FULL_ARTICLE`), | |
| 101 | -// `PRICE` = values (`PRICE`), | |
| 102 | -// `DESCR` = values(`DESCR`), | |
| 103 | -// `BOX` = values(`BOX`), | |
| 104 | -// `ADD_BOX` = values(`ADD_BOX`), | |
| 105 | -// `GROUP` = values(`GROUP`);"; | |
| 106 | - | |
| 107 | -// INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6) | |
| 108 | -// ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b); | |
| 109 | - | |
| 110 | - | |
| 111 | - | |
| 112 | -//INSERT INTO `books` (`UserId`, `BookId`, `Count`) VALUES (13, 1001, 3) | |
| 113 | -//ON DUPLICATE KEY UPDATE `Count` = `Count` + VALUES(`Count`); | |
| 114 | - | |
| 115 | -//$values_string = ''; | |
| 116 | -//$keys_arr = array_keys( $data[0] ); | |
| 117 | -//$keys_string = implode( ',', $keys_arr); | |
| 118 | -//$table_name = self::tableName(); | |
| 119 | -//$current_batch = 0; | |
| 120 | -//for ($i = $current_batch; $i < $this::BATCH AND $i < count($data); $i++) { | |
| 121 | -// $values_string .= '(' . implode( ',', $data[$i]) . '),'; | |
| 122 | -//} | |
| 123 | -// for ($current_batch = $this::BATCH; $current_batch<count($data); $current_batch + $this::BATCH ) | |
| 124 | -//// удалим последнюю запятую | |
| 125 | -//$values_string = substr($values_string, 0, strlen($values_string) - 1) . ' '; | |
| 126 | -////\common\components\CustomVarDamp::dumpAndDie($values_string); | |
| 127 | -//// $query = "INSERT INTO {$table_name}({$keys_string}) VALUES {$values_string}"; | |
| 128 | -//// on duplicate key update `PRICE` = values (`PRICE`),`DESCR` = values(`DESCR`),`BOX` = values(`BOX`)"; | |
| 129 | -//$query_insert = Yii::$app->db->createCommand()->batchInsert($table_name, $keys_arr, $data)->sql; | |
| 130 | -//$query = "{$query_insert} on duplicate key update `PRICE` = values (`PRICE`),`DESCR` = values(`DESCR`),`BOX` = values(`BOX`)"; | |
| 131 | -//$res = Yii::$app->db->createCommand($query)->execute(); | |
| 132 | - | |
| 133 | - | |
| 134 | - | |
| 135 | -// Yii::$app->db->createCommand()->batchInsert($table_name, $keys_arr, $data)->sql execute(); | |
| 136 | 0 | \ No newline at end of file |
backend/models/Importer.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace backend\models; | |
| 4 | - | |
| 5 | -use Yii; | |
| 6 | -use backend\components\base\BaseActiveRecord; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * This is the model class for table "{{%importer}}". | |
| 10 | - * | |
| 11 | - * @property integer $id | |
| 12 | - * @property string $code | |
| 13 | - * @property string $name | |
| 14 | - * @property string $name_price | |
| 15 | - * @property string $currency_id | |
| 16 | - * @property string $delivery | |
| 17 | - * @property string $email | |
| 18 | - * @property string $info | |
| 19 | - * @property integer $active | |
| 20 | - * @property integer $PARSER_IS_ACTIVE | |
| 21 | - * @property string $PARSER_COLUMN_COUNT | |
| 22 | - * @property string $PARSER_FIELD_BRAND | |
| 23 | - * @property string $PARSER_FIELD_ARTICLE | |
| 24 | - * @property integer $PARSER_FIELD_ARTICLE_PREFIX | |
| 25 | - * @property string $PARSER_FIELD_PRICE | |
| 26 | - * @property string $PARSER_FIELD_DESCR | |
| 27 | - * @property string $PARSER_FIELD_BOX | |
| 28 | - * @property string $PARSER_FIELD_ADD_BOX | |
| 29 | - * @property string $PARSER_FIELD_GROUP_RG | |
| 30 | - * @property string $PARSER_FIELD_SIGN | |
| 31 | - * @property double $PARSER_FIELD_MULTIPLIER | |
| 32 | - * @property string $price_date_update | |
| 33 | - */ | |
| 34 | -class Importer extends BaseActiveRecord | |
| 35 | -{ | |
| 36 | - /** | |
| 37 | - * @inheritdoc | |
| 38 | - */ | |
| 39 | - public static function tableName() | |
| 40 | - { | |
| 41 | - return '{{%importer}}'; | |
| 42 | - } | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * @inheritdoc | |
| 46 | - */ | |
| 47 | - public function rules() | |
| 48 | - { | |
| 49 | - return [ | |
| 50 | - [['code', 'name', 'currency_id', 'delivery', 'price_date_update'], 'required'], | |
| 51 | - [['name_price', 'email', 'PARSER_FIELD_SIGN', 'info'], 'safe'], | |
| 52 | - [['currency_id', 'active', 'PARSER_IS_ACTIVE', 'PARSER_COLUMN_COUNT', 'PARSER_FIELD_BRAND', 'PARSER_FIELD_ARTICLE', 'PARSER_FIELD_ARTICLE_PREFIX', 'PARSER_FIELD_PRICE', 'PARSER_FIELD_DESCR', 'PARSER_FIELD_BOX', 'PARSER_FIELD_ADD_BOX', 'PARSER_FIELD_GROUP_RG'], 'integer'], | |
| 53 | - [['info'], 'string'], | |
| 54 | - [['PARSER_FIELD_MULTIPLIER'], 'number'], | |
| 55 | - [['code', 'name', 'name_price', 'delivery', 'email'], 'string', 'max' => 254], | |
| 56 | - [['PARSER_FIELD_SIGN'], 'string', 'max' => 1], | |
| 57 | - // [['price_date_update'], 'string', 'max' => 15], | |
| 58 | - [['code'], 'unique'], | |
| 59 | - [['name'], 'unique'] | |
| 60 | - ]; | |
| 61 | - } | |
| 62 | - | |
| 63 | - /** | |
| 64 | - * @inheritdoc | |
| 65 | - */ | |
| 66 | - public function attributeLabels() | |
| 67 | - { | |
| 68 | - return [ | |
| 69 | - 'id' => Yii::t('app', 'ID'), | |
| 70 | - 'code' => Yii::t('app', 'Code'), | |
| 71 | - 'name' => Yii::t('app', 'Name'), | |
| 72 | - 'name_price' => Yii::t('app', 'Name Price'), | |
| 73 | - 'currency_id' => Yii::t('app', 'Currency ID'), | |
| 74 | - 'delivery' => Yii::t('app', 'Delivery'), | |
| 75 | - 'email' => Yii::t('app', 'Email'), | |
| 76 | - 'info' => Yii::t('app', 'Info'), | |
| 77 | - 'active' => Yii::t('app', 'Active'), | |
| 78 | - 'PARSER_IS_ACTIVE' => Yii::t('app', 'Parser Is Active'), | |
| 79 | - 'PARSER_COLUMN_COUNT' => Yii::t('app', 'Parser Column Count'), | |
| 80 | - 'PARSER_FIELD_BRAND' => Yii::t('app', 'Parser Field Brand'), | |
| 81 | - 'PARSER_FIELD_ARTICLE' => Yii::t('app', 'Parser Field Article'), | |
| 82 | - 'PARSER_FIELD_ARTICLE_PREFIX' => Yii::t('app', 'Parser Field Article Prefix'), | |
| 83 | - 'PARSER_FIELD_PRICE' => Yii::t('app', 'Parser Field Price'), | |
| 84 | - 'PARSER_FIELD_DESCR' => Yii::t('app', 'Parser Field Descr'), | |
| 85 | - 'PARSER_FIELD_BOX' => Yii::t('app', 'Parser Field Box'), | |
| 86 | - 'PARSER_FIELD_ADD_BOX' => Yii::t('app', 'Parser Field Add Box'), | |
| 87 | - 'PARSER_FIELD_GROUP_RG' => Yii::t('app', 'Parser Field Group Rg'), | |
| 88 | - 'PARSER_FIELD_SIGN' => Yii::t('app', 'Parser Field Sign'), | |
| 89 | - 'PARSER_FIELD_MULTIPLIER' => Yii::t('app', 'Parser Field Multiplier'), | |
| 90 | - 'price_date_update' => Yii::t('app', 'Price Date Update'), | |
| 91 | - ]; | |
| 92 | - } | |
| 93 | - | |
| 94 | - | |
| 95 | - | |
| 96 | -} |
backend/models/Importers.php
| ... | ... | @@ -95,14 +95,14 @@ class Importers extends BaseActiveRecord |
| 95 | 95 | // возьмем только поля описанные в fields() - там как раз наши настройки парсера |
| 96 | 96 | $arr = $this->toArray(); |
| 97 | 97 | |
| 98 | - // отсортируем по ключам с учетом преобразования в число | |
| 99 | - asort($arr, SORT_NUMERIC); | |
| 100 | 98 | // уберем нулевые колонки |
| 101 | 99 | $arr = array_filter($arr, function($val){ |
| 102 | 100 | return $val <> '0'; |
| 103 | 101 | }); |
| 104 | - // нам нужны именно ключи | |
| 105 | - $arr = array_keys($arr); | |
| 102 | + // нам нужны именно массив в виде 'номер колонки в файле'=>'имя колонки в БД' | |
| 103 | + $arr = array_flip( $arr ); | |
| 104 | + // отсортируем по ключам | |
| 105 | + ksort($arr); | |
| 106 | 106 | |
| 107 | 107 | return $arr; |
| 108 | 108 | } |
| ... | ... | @@ -121,13 +121,27 @@ class Importers extends BaseActiveRecord |
| 121 | 121 | public function fields() |
| 122 | 122 | { |
| 123 | 123 | return [ |
| 124 | - 'BRAND' => 'PARSER_FIELD_BRAND', | |
| 125 | - 'ARTICLE' => 'PARSER_FIELD_ARTICLE', | |
| 126 | - 'PRICE' => 'PARSER_FIELD_PRICE', | |
| 127 | - 'DESCR' => 'PARSER_FIELD_DESCR', | |
| 128 | - 'BOX' => 'PARSER_FIELD_BOX', | |
| 129 | - 'ADD_BOX' => 'PARSER_FIELD_ADD_BOX', | |
| 130 | - 'GROUP_RG' => 'PARSER_FIELD_GROUP_RG' | |
| 124 | + 'BRAND' => function () { | |
| 125 | + return $this->PARSER_FIELD_BRAND == '0'? '0' : (int)$this->PARSER_FIELD_BRAND - 1; | |
| 126 | + }, | |
| 127 | + 'ARTICLE' => function () { | |
| 128 | + return $this->PARSER_FIELD_ARTICLE == '0'? '0' : (int)$this->PARSER_FIELD_ARTICLE - 1; | |
| 129 | + }, | |
| 130 | + 'PRICE' => function () { | |
| 131 | + return $this->PARSER_FIELD_PRICE == '0'? '0' : (int)$this->PARSER_FIELD_PRICE - 1; | |
| 132 | + }, | |
| 133 | + 'DESCR' => function () { | |
| 134 | + return $this->PARSER_FIELD_DESCR == '0'? '0' : (int)$this->PARSER_FIELD_DESCR - 1; | |
| 135 | + }, | |
| 136 | + 'BOX' => function () { | |
| 137 | + return $this->PARSER_FIELD_BOX == '0'? '0' : (int)$this->PARSER_FIELD_BOX - 1; | |
| 138 | + }, | |
| 139 | + 'ADD_BOX' => function () { | |
| 140 | + return $this->PARSER_FIELD_ADD_BOX == '0'? '0' : (int)$this->PARSER_FIELD_ADD_BOX - 1; | |
| 141 | + }, | |
| 142 | + 'GROUP_RG' => function () { | |
| 143 | + return $this->PARSER_FIELD_GROUP_RG == '0'? '0' : (int)$this->PARSER_FIELD_GROUP_RG - 1; | |
| 144 | + }, | |
| 131 | 145 | ]; |
| 132 | 146 | |
| 133 | 147 | } | ... | ... |
backend/views/accounts-vin/_form.php
| ... | ... | @@ -29,7 +29,7 @@ use yii\widgets\ActiveForm; |
| 29 | 29 | <?= $form->field($model, 'timestamp')->textInput() ?> |
| 30 | 30 | |
| 31 | 31 | <div class="form-group"> |
| 32 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 32 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 33 | 33 | </div> |
| 34 | 34 | |
| 35 | 35 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/accounts-vin/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\AccountsVin */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Accounts Vin'; | |
| 9 | +$this->title = 'Добавить Accounts Vin'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Accounts Vins', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/accounts-vin/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Accounts Vin', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Accounts Vin', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/accounts/_form.php
| ... | ... | @@ -85,7 +85,7 @@ use kartik\date\DatePicker; |
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | <div class="form-group"> |
| 88 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 88 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 89 | 89 | </div> |
| 90 | 90 | |
| 91 | 91 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/accounts/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\Accounts */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Accounts'; | |
| 9 | +$this->title = 'Добавить Accounts'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Accounts', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/accounts/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Accounts', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Accounts', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/art-history/_form.php
| ... | ... | @@ -19,7 +19,7 @@ use yii\widgets\ActiveForm; |
| 19 | 19 | <?= $form->field($model, 'dt')->textInput(['maxlength' => true]) ?> |
| 20 | 20 | |
| 21 | 21 | <div class="form-group"> |
| 22 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 22 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 23 | 23 | </div> |
| 24 | 24 | |
| 25 | 25 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/art-history/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\ArtHistory */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Art History'; | |
| 9 | +$this->title = 'Добавить Art History'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Art Histories', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/art-history/index.php
| ... | ... | @@ -17,7 +17,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 17 | 17 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 18 | 18 | |
| 19 | 19 | <p> |
| 20 | - <?= Html::a('Create Art History', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | + <?= Html::a('Добавить Art History', ['create'], ['class' => 'btn btn-success']) ?> | |
| 21 | 21 | </p> |
| 22 | 22 | |
| 23 | 23 | <?= GridView::widget([ | ... | ... |
backend/views/brands-replace/_form.php
| ... | ... | @@ -21,7 +21,7 @@ use yii\widgets\ActiveForm; |
| 21 | 21 | <?= $form->field($model, 'timestamp')->textInput() ?> |
| 22 | 22 | |
| 23 | 23 | <div class="form-group"> |
| 24 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 24 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 25 | 25 | </div> |
| 26 | 26 | |
| 27 | 27 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/brands-replace/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\BrandsReplace */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Brands Replace'; | |
| 9 | +$this->title = 'Добавить Brands Replace'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Brands Replaces', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/brands-replace/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Brands Replace', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Brands Replace', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/brands/_form.php
| ... | ... | @@ -29,7 +29,7 @@ use yii\widgets\ActiveForm; |
| 29 | 29 | <?= $form->field($model, 'timestamp')->textInput() ?> |
| 30 | 30 | |
| 31 | 31 | <div class="form-group"> |
| 32 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 32 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 33 | 33 | </div> |
| 34 | 34 | |
| 35 | 35 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/brands/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\Brands */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Brands'; | |
| 9 | +$this->title = 'Добавить Brands'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Brands', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/cat/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\Cat */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Cat'; | |
| 9 | +$this->title = 'Добавить Cat'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Cats', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/cat/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Cat', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Cat', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/crossing-upload/index.php
| ... | ... | @@ -14,9 +14,10 @@ use yii\helpers\ArrayHelper; |
| 14 | 14 | <?= $form->field($model, 'delete_prefix1')->checkbox() ?> |
| 15 | 15 | <?= $form->field($model, 'delete_prefix2')->checkbox() ?> |
| 16 | 16 | <?= $form->field($model, 'file')->fileInput()->label(false) ?> |
| 17 | + <?= Html::tag('p','допустимый формат - csv') ?> | |
| 17 | 18 | |
| 18 | 19 | <div class="form-group"> |
| 19 | - <?= Html::submitButton(Yii::t( 'app', 'Прочитать' ), ['class' => 'btn btn-primary']) ?> | |
| 20 | + <?= Html::submitButton(Yii::t( 'app', 'Выполнить' ), ['class' => 'btn btn-primary']) ?> | |
| 20 | 21 | </div> |
| 21 | 22 | |
| 22 | 23 | <?php ActiveForm::end(); | ... | ... |
backend/views/crossing-upload/results.php
backend/views/deliveries/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Deliveries', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Deliveries', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/details-crosses/_form.php
| ... | ... | @@ -23,7 +23,7 @@ use yii\widgets\ActiveForm; |
| 23 | 23 | <?= $form->field($model, 'timestamp')->textInput() ?> |
| 24 | 24 | |
| 25 | 25 | <div class="form-group"> |
| 26 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 26 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 27 | 27 | </div> |
| 28 | 28 | |
| 29 | 29 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/details-crosses/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\DetailsCrosses */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Details Crosses'; | |
| 9 | +$this->title = 'Добавить Details Crosses'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Details Crosses', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/details/_form.php
| ... | ... | @@ -33,7 +33,7 @@ use yii\widgets\ActiveForm; |
| 33 | 33 | <?= $form->field($model, 'timestamp')->textInput() ?> |
| 34 | 34 | |
| 35 | 35 | <div class="form-group"> |
| 36 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 36 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 37 | 37 | </div> |
| 38 | 38 | |
| 39 | 39 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/details/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\Details */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Details'; | |
| 9 | +$this->title = 'Добавить Details'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Details', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/dic-statuses/_form.php
| ... | ... | @@ -23,7 +23,7 @@ use yii\widgets\ActiveForm; |
| 23 | 23 | <?= $form->field($model, 'if_mail')->textInput() ?> |
| 24 | 24 | |
| 25 | 25 | <div class="form-group"> |
| 26 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 26 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 27 | 27 | </div> |
| 28 | 28 | |
| 29 | 29 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/dic-statuses/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\DicStatuses */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Dic Statuses'; | |
| 9 | +$this->title = 'Добавить Dic Statuses'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Dic Statuses', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/dic-statuses/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Dic Statuses', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Dic Statuses', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/emails/_form.php
| ... | ... | @@ -29,7 +29,7 @@ use yii\widgets\ActiveForm; |
| 29 | 29 | <?= $form->field($model, 'who_comment')->textInput(['maxlength' => true]) ?> |
| 30 | 30 | |
| 31 | 31 | <div class="form-group"> |
| 32 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 32 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 33 | 33 | </div> |
| 34 | 34 | |
| 35 | 35 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/emails/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\Emails */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Emails'; | |
| 9 | +$this->title = 'Добавить Emails'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Emails', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/emails/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Emails', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Emails', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/importers/_form.php
| ... | ... | @@ -63,7 +63,7 @@ use common\models\Currency; |
| 63 | 63 | </div> |
| 64 | 64 | |
| 65 | 65 | <div class="form-group"> |
| 66 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 66 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 67 | 67 | </div> |
| 68 | 68 | |
| 69 | 69 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/importers/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model backend\models\Importers */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Importers'; | |
| 9 | +$this->title = 'Добавить Importers'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Importers', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/importers/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Importers', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Importers', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/layouts/main.php
backend/views/manufacturers/_form.php
| ... | ... | @@ -53,7 +53,7 @@ use yii\widgets\ActiveForm; |
| 53 | 53 | <?= $form->field($model, 'original_url')->textInput(['maxlength' => true]) ?> |
| 54 | 54 | |
| 55 | 55 | <div class="form-group"> |
| 56 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 56 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 57 | 57 | </div> |
| 58 | 58 | |
| 59 | 59 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/manufacturers/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\Manufacturers */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Manufacturers'; | |
| 9 | +$this->title = 'Добавить Manufacturers'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Manufacturers', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/margins-groups/_form.php
| ... | ... | @@ -21,7 +21,7 @@ use yii\helpers\ArrayHelper; |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | <div class="form-group"> |
| 24 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 24 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 25 | 25 | </div> |
| 26 | 26 | |
| 27 | 27 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/margins-groups/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\MarginsGroups */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Margins Groups'; | |
| 9 | +$this->title = 'Добавить Margins Groups'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Margins Groups', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/margins-groups/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Margins Groups', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Margins Groups', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/margins-importers-import/_form.php
| ... | ... | @@ -20,7 +20,7 @@ use \yii\helpers\ArrayHelper; |
| 20 | 20 | |
| 21 | 21 | <?= $form->field($model, 'finish')->checkbox() ?> |
| 22 | 22 | <div class="form-group"> |
| 23 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 23 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 24 | 24 | </div> |
| 25 | 25 | |
| 26 | 26 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/margins-importers-import/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\MarginsImportersImport */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Margins Importers Import'; | |
| 9 | +$this->title = 'Добавить Margins Importers Import'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Margins Importers Imports', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/margins-importers-import/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Margins Importers Import', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Margins Importers Import', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/margins-importers/_form.php
| ... | ... | @@ -19,7 +19,7 @@ use yii\helpers\ArrayHelper; |
| 19 | 19 | <?= $form->field($model, 'koef')->textInput() ?> |
| 20 | 20 | |
| 21 | 21 | <div class="form-group"> |
| 22 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 22 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 23 | 23 | </div> |
| 24 | 24 | |
| 25 | 25 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/margins-importers/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\MarginsImporters */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Margins Importers'; | |
| 9 | +$this->title = 'Добавить Margins Importers'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Margins Importers', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/margins-importers/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Margins Importers', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Margins Importers', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/margins/_form.php
| ... | ... | @@ -17,7 +17,7 @@ use yii\widgets\ActiveForm; |
| 17 | 17 | <?= $form->field($model, 'koef')->textInput() ?> |
| 18 | 18 | |
| 19 | 19 | <div class="form-group"> |
| 20 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 20 | + <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 21 | 21 | </div> |
| 22 | 22 | |
| 23 | 23 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/margins/create.php
| ... | ... | @@ -6,7 +6,7 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\Margins */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Margins'; | |
| 9 | +$this->title = 'Добавить Margins'; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => 'Margins', 'url' => ['index']]; |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> | ... | ... |
backend/views/margins/index.php
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Margins', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить Margins', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/page/_form.php
| ... | ... | @@ -21,6 +21,7 @@ use mihaildev\elfinder\ElFinder; |
| 21 | 21 | 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ |
| 22 | 22 | 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать |
| 23 | 23 | 'inline' => false, //по умолчанию false]), |
| 24 | + 'allowedContent' => true, | |
| 24 | 25 | 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('page/images-upload') |
| 25 | 26 | ] |
| 26 | 27 | ) | ... | ... |
backend/views/page/_search.php
| ... | ... | @@ -34,8 +34,8 @@ use yii\widgets\ActiveForm; |
| 34 | 34 | <?php // echo $form->field($model, 'is_active') ?> |
| 35 | 35 | |
| 36 | 36 | <div class="form-group"> |
| 37 | - <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?> | |
| 38 | - <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?> | |
| 37 | + <?= Html::submitButton('Поиск', ['class' => 'btn btn-primary']) ?> | |
| 38 | + <?= Html::resetButton('Обновить', ['class' => 'btn btn-default']) ?> | |
| 39 | 39 | </div> |
| 40 | 40 | |
| 41 | 41 | <?php ActiveForm::end(); ?> | ... | ... |
backend/views/page/create.php
| ... | ... | @@ -6,8 +6,8 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $this yii\web\View */ |
| 7 | 7 | /* @var $model common\models\Page */ |
| 8 | 8 | |
| 9 | -$this->title = 'Create Page'; | |
| 10 | -$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; | |
| 9 | +$this->title = 'Создать'; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => 'Текстовые страницы', 'url' => ['index']]; | |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> |
| 13 | 13 | <div class="page-create"> | ... | ... |
backend/views/page/index.php
| ... | ... | @@ -7,7 +7,7 @@ use yii\grid\GridView; |
| 7 | 7 | /* @var $searchModel common\models\PageSearch */ |
| 8 | 8 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
| 9 | 9 | |
| 10 | -$this->title = 'Pages'; | |
| 10 | +$this->title = 'Текстовые страницы'; | |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> |
| 13 | 13 | <div class="page-index"> |
| ... | ... | @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 16 | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a('Create Page', ['create'], ['class' => 'btn btn-success']) ?> | |
| 19 | + <?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <?= GridView::widget([ | ... | ... |
backend/views/page/update.php
| ... | ... | @@ -6,9 +6,9 @@ use yii\helpers\Html; |
| 6 | 6 | /* @var $model common\models\Page */ |
| 7 | 7 | |
| 8 | 8 | $this->title = 'Update Page: ' . ' ' . $model->name; |
| 9 | -$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; | |
| 9 | +$this->params['breadcrumbs'][] = ['label' => 'Текстовые страницы', 'url' => ['index']]; | |
| 10 | 10 | $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; |
| 11 | -$this->params['breadcrumbs'][] = 'Update'; | |
| 11 | +$this->params['breadcrumbs'][] = 'Обновить'; | |
| 12 | 12 | ?> |
| 13 | 13 | <div class="page-update"> |
| 14 | 14 | ... | ... |
backend/views/page/view.php
| ... | ... | @@ -7,7 +7,7 @@ use yii\widgets\DetailView; |
| 7 | 7 | /* @var $model common\models\Page */ |
| 8 | 8 | |
| 9 | 9 | $this->title = $model->name; |
| 10 | -$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => 'Текстовые страницы', 'url' => ['index']]; | |
| 11 | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | 12 | ?> |
| 13 | 13 | <div class="page-view"> |
| ... | ... | @@ -15,11 +15,11 @@ $this->params['breadcrumbs'][] = $this->title; |
| 15 | 15 | <h1><?= Html::encode($this->title) ?></h1> |
| 16 | 16 | |
| 17 | 17 | <p> |
| 18 | - <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
| 19 | - <?= Html::a('Delete', ['delete', 'id' => $model->id], [ | |
| 18 | + <?= Html::a('Обновить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
| 19 | + <?= Html::a('Удалить', ['delete', 'id' => $model->id], [ | |
| 20 | 20 | 'class' => 'btn btn-danger', |
| 21 | 21 | 'data' => [ |
| 22 | - 'confirm' => 'Are you sure you want to delete this item?', | |
| 22 | + 'confirm' => 'Вы увереннны что хотите удалить этот элемент?', | |
| 23 | 23 | 'method' => 'post', |
| 24 | 24 | ], |
| 25 | 25 | ]) ?> | ... | ... |
backend/views/parser/error.php
| ... | ... | @@ -7,14 +7,21 @@ |
| 7 | 7 | |
| 8 | 8 | use yii\helpers\Html; |
| 9 | 9 | |
| 10 | -$this->title = $name; | |
| 10 | +$this->title = 'Ошибка'; | |
| 11 | 11 | ?> |
| 12 | 12 | <div class="site-error"> |
| 13 | 13 | |
| 14 | 14 | <h1><?= Html::encode($this->title) ?></h1> |
| 15 | 15 | |
| 16 | 16 | <div class="alert alert-danger"> |
| 17 | - <?= nl2br(Html::encode($message)) ?> | |
| 17 | + <?php | |
| 18 | + echo nl2br(Html::encode($message)); | |
| 19 | + if ( $action_name ) { | |
| 20 | + echo "<br/>"; | |
| 21 | + echo "<br/>"; | |
| 22 | + echo Html::a('Вернуться', $action_name, ['class' => 'btn btn-info', 'name' => 'Return',]); | |
| 23 | + } | |
| 24 | + ?> | |
| 18 | 25 | </div> |
| 19 | 26 | |
| 20 | 27 | <p> | ... | ... |
backend/views/parser/results.php
backend/views/rg-grup/index.php
| ... | ... | @@ -4,17 +4,13 @@ use yii\helpers\Html; |
| 4 | 4 | use backend\models\Importers; |
| 5 | 5 | use yii\helpers\ArrayHelper; |
| 6 | 6 | |
| 7 | -$button_label = 'Прочитать'; | |
| 7 | +$button_label = 'Выполнить'; | |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | ?> |
| 11 | 11 | <div class="row"> |
| 12 | 12 | <div class="col-lg-5"> |
| 13 | 13 | <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data',],'action'=>['rg-grup/results']]); |
| 14 | - | |
| 15 | - if ($msg = \Yii::$app->session->getFlash('success')) { // вернулись после успешной загрузки данного файла | |
| 16 | - echo Html::tag('h3', $msg ,['class'=>'bg-success']); | |
| 17 | - } | |
| 18 | 14 | ?> |
| 19 | 15 | <h3>Загрузка RG групп поставщиков</h3> |
| 20 | 16 | |
| ... | ... | @@ -25,9 +21,13 @@ $button_label = 'Прочитать'; |
| 25 | 21 | <?= $form->field($model, 'file')->fileInput()->label(false) ?> |
| 26 | 22 | <div class="form-group"> |
| 27 | 23 | <?= Html::submitButton(Yii::t( 'app', $button_label ), ['class' => 'btn btn-primary']) ?> |
| 24 | + <?= Html::tag( 'p', 'допустимый формат xlsx') ?> | |
| 25 | + | |
| 28 | 26 | </div> |
| 29 | 27 | |
| 30 | - <?php ActiveForm::end() ?> | |
| 28 | + <?php ActiveForm::end(); | |
| 29 | + // подключим шаблон сообщения | |
| 30 | + echo $this->render('../templates/parser_massage');?> | |
| 31 | 31 | </div> |
| 32 | 32 | </div> |
| 33 | 33 | ... | ... |
backend/views/rg-grup/results.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | use yii\helpers\Html; |
| 4 | -use yii\multiparser\DynamicFormHelper; | |
| 4 | +use common\components\parsers\DynamicFormHelper; | |
| 5 | 5 | use yii\widgets\ActiveForm; |
| 6 | 6 | |
| 7 | 7 | |
| ... | ... | @@ -27,6 +27,6 @@ $this->params['breadcrumbs'][] = $this->title; |
| 27 | 27 | </div> |
| 28 | 28 | |
| 29 | 29 | <?php ActiveForm::end() ?> |
| 30 | - <?= Html::a('Вернуться', ['rg-grup/index'], ['class' => 'btn btn-primary', 'name' => 'Return',]) ?> | |
| 30 | + <?= Html::a('Отмена', ['rg-grup/index'], ['class' => 'btn btn-primary', 'name' => 'Return',]) ?> | |
| 31 | 31 | |
| 32 | 32 | </div> |
| 33 | 33 | \ No newline at end of file | ... | ... |
common/components/ModelArrayValidator.php
| ... | ... | @@ -76,20 +76,33 @@ class ModelArrayValidator |
| 76 | 76 | { |
| 77 | 77 | foreach ( $data as $row ) { |
| 78 | 78 | $this->total_rows++; |
| 79 | - $validate_row[$this->model->formName()] = $row; | |
| 80 | - // clear previous loading | |
| 81 | - $this->clearModelAttributes(); | |
| 82 | - if ( $this->model->load( $validate_row ) && $this->model->validate() ) { | |
| 79 | + | |
| 80 | + if ( $this->validateRow( $row ) ) { | |
| 83 | 81 | // everything OK, registred row to valid data |
| 84 | 82 | $this->valid_data[] = $row; |
| 85 | 83 | } else{ |
| 86 | 84 | // we have errors |
| 87 | 85 | $this->registredError( $this->total_rows ); |
| 88 | 86 | } |
| 87 | + | |
| 89 | 88 | } |
| 90 | 89 | |
| 91 | 90 | return $this->valid_data; |
| 92 | 91 | } |
| 92 | + public function validateRow( $row ) | |
| 93 | + { | |
| 94 | + $validate_row[$this->model->formName()] = $row; | |
| 95 | + // clear previous loading | |
| 96 | + $this->clearModelAttributes(); | |
| 97 | + if ( $this->model->load( $validate_row ) && $this->model->validate() ) { | |
| 98 | + | |
| 99 | + return true; | |
| 100 | + } else{ | |
| 101 | + | |
| 102 | + return false; | |
| 103 | + } | |
| 104 | + | |
| 105 | + } | |
| 93 | 106 | |
| 94 | 107 | protected function registredError ($index) |
| 95 | 108 | { |
| ... | ... | @@ -117,11 +130,17 @@ class ModelArrayValidator |
| 117 | 130 | |
| 118 | 131 | } |
| 119 | 132 | |
| 133 | + public function clearErrors(){ | |
| 134 | + | |
| 135 | + $this->arr_errors = []; | |
| 136 | + | |
| 137 | + } | |
| 138 | + | |
| 120 | 139 | public function close(){ |
| 121 | 140 | |
| 122 | - unset( $this->valid_data ); | |
| 123 | - unset( $this->arr_errors ); | |
| 124 | - unset( $this->model ); | |
| 141 | + $this->valid_data = []; | |
| 142 | + $this->clearErrors(); | |
| 143 | + $this->total_rows = 0; | |
| 125 | 144 | |
| 126 | 145 | } |
| 127 | 146 | } |
| 128 | 147 | \ No newline at end of file | ... | ... |
common/components/PriceWriter.php
| ... | ... | @@ -43,15 +43,15 @@ class PriceWriter |
| 43 | 43 | */ |
| 44 | 44 | protected $validated_msg; |
| 45 | 45 | /** |
| 46 | - * @var - тип сообщения валидатора - success, warning | |
| 46 | + * @var - bool - есть ли ошибки валидации | |
| 47 | 47 | */ |
| 48 | - protected $validated_type_msg; | |
| 48 | + protected $hasValidationError; | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | function __construct() |
| 53 | 53 | { |
| 54 | - set_time_limit(300); | |
| 54 | + set_time_limit(600); | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| ... | ... | @@ -89,9 +89,9 @@ class PriceWriter |
| 89 | 89 | /** |
| 90 | 90 | * @return mixed |
| 91 | 91 | */ |
| 92 | - public function getValidatedTypeMsg() | |
| 92 | + public function hasValidationError() | |
| 93 | 93 | { |
| 94 | - return $this->validated_type_msg; | |
| 94 | + return $this->hasValidationError; | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | |
| ... | ... | @@ -117,12 +117,16 @@ class PriceWriter |
| 117 | 117 | } |
| 118 | 118 | //3. провалидируем полученные данные моделью - Details |
| 119 | 119 | $details_model = $this->validateByDetailsModel(); |
| 120 | + if ( empty($this->data) ) { | |
| 121 | + // после валидации не осталось валидных данных для записи | |
| 122 | + return false; | |
| 123 | + } | |
| 124 | + //4. дополним данные значением импортера и даты обновления цены | |
| 125 | + $this->data = CustomArrayHelper::addColumns($this->data, ['IMPORT_ID' => $this->configuration['importer_id'], 'timestamp' => $update_date]); | |
| 120 | 126 | |
| 121 | - //4. дополним данные значением импортера и даты обновления цены | |
| 122 | - $this->data = CustomArrayHelper::addColumns($this->data, ['IMPORT_ID' => $this->configuration['importer_id'], 'timestamp' => $update_date]); | |
| 127 | + //5. запишем данные в связанные таблицы | |
| 128 | + $this->writePriceInTransaction($details_model, $files_model, $update_date); | |
| 123 | 129 | |
| 124 | - //5. запишем данные в связанные таблицы | |
| 125 | - $this->writePriceInTransaction($details_model, $files_model, $update_date); | |
| 126 | 130 | |
| 127 | 131 | return true; |
| 128 | 132 | } |
| ... | ... | @@ -255,7 +259,7 @@ class PriceWriter |
| 255 | 259 | $model_validator = new ModelArrayValidator( $details_model ); |
| 256 | 260 | $this->data = $model_validator->validate( $this->data ); |
| 257 | 261 | $this->validated_msg = $model_validator->getMassage(); |
| 258 | - $this->validated_type_msg = $model_validator->hasError() ? 'warning' : 'success'; | |
| 262 | + $this->hasValidationError = $model_validator->hasError(); | |
| 259 | 263 | |
| 260 | 264 | $model_validator->close(); |
| 261 | 265 | ... | ... |
common/components/exceptions/CrossParsingException.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Tsurkanov | |
| 5 | + * Date: 30.11.2015 | |
| 6 | + * Time: 17:36 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\exceptions; | |
| 10 | + | |
| 11 | + | |
| 12 | +use yii\base\UserException; | |
| 13 | + | |
| 14 | +class CrossParsingException extends UserException { | |
| 15 | + | |
| 16 | +} | |
| 0 | 17 | \ No newline at end of file | ... | ... |
common/components/exceptions/PriceParsingException.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Tsurkanov | |
| 5 | + * Date: 30.11.2015 | |
| 6 | + * Time: 17:36 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\exceptions; | |
| 10 | + | |
| 11 | + | |
| 12 | +use yii\base\UserException; | |
| 13 | + | |
| 14 | +class PriceParsingException extends UserException { | |
| 15 | + | |
| 16 | +} | |
| 0 | 17 | \ No newline at end of file | ... | ... |
common/components/exceptions/RgParsingException.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Tsurkanov | |
| 5 | + * Date: 30.11.2015 | |
| 6 | + * Time: 17:36 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\exceptions; | |
| 10 | + | |
| 11 | + | |
| 12 | +use yii\base\UserException; | |
| 13 | + | |
| 14 | +class RgParsingException extends UserException { | |
| 15 | + | |
| 16 | +} | |
| 0 | 17 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Cibermag | |
| 5 | + * Date: 31.08.2015 | |
| 6 | + * Time: 12:50 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | +// класс который содержит преобразователи значений (фильтры) используемые при парсинге | |
| 12 | + | |
| 13 | + | |
| 14 | +class Converter implements ConverterInterface | |
| 15 | +{ | |
| 16 | + | |
| 17 | + const METHOD_PREFIX = 'convertTo'; | |
| 18 | + | |
| 19 | + //public $configuration = []; | |
| 20 | + | |
| 21 | + public static function convertToFloat($value) | |
| 22 | + { | |
| 23 | + if ($value == '') { | |
| 24 | + $value = 0; | |
| 25 | + } | |
| 26 | + $value = trim(str_replace(",", ".", $value)); | |
| 27 | + $value = preg_replace("/[^0-9.]+/", "", strtoupper($value)); | |
| 28 | + | |
| 29 | + if ($value == '') { | |
| 30 | + return ''; | |
| 31 | + } | |
| 32 | + $value = round((float)$value, 2); | |
| 33 | + | |
| 34 | + return $value; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public static function convertToInteger($value) | |
| 38 | + { | |
| 39 | + if ($value == '') { | |
| 40 | + $value = 0; | |
| 41 | + } | |
| 42 | + $value = trim(str_replace(",", ".", $value)); | |
| 43 | + $value = preg_replace("/[^0-9.]+/", "", strtoupper($value)); | |
| 44 | + if ($value == '') { | |
| 45 | + return ''; | |
| 46 | + } | |
| 47 | + $value = round((int)$value, 2); | |
| 48 | + | |
| 49 | + return $value; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public static function convertToEncode($value) | |
| 53 | + { | |
| 54 | + $res = $value; | |
| 55 | + if (is_array($value)) { | |
| 56 | + | |
| 57 | + $res = Encoder::encodeArray($value); | |
| 58 | + | |
| 59 | + } elseif (is_string($value)) { | |
| 60 | + | |
| 61 | + $res = Encoder::encodeString($value); | |
| 62 | + | |
| 63 | + } | |
| 64 | + return $res; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public static function convertToString($value) | |
| 68 | + { | |
| 69 | + $convert_func = function ($value_to_convert) { | |
| 70 | + return str_replace(array('!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '~', '`', '"', "'", ' ', '№', '%', ';', ':', '[', ']', '{', '}', '*', '?', '/', '\'', '|', '.', ',', '<', '>', '\\'), '', $value_to_convert); | |
| 71 | + }; | |
| 72 | + | |
| 73 | + if( is_string( $value ) ){ | |
| 74 | + $value = $convert_func( $value ); | |
| 75 | + } | |
| 76 | + | |
| 77 | + if( is_array( $value ) ){ | |
| 78 | + array_walk( $value, $convert_func ); | |
| 79 | + } | |
| 80 | + | |
| 81 | + return $value; | |
| 82 | + } | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * @param $name - имя метода конвертации | |
| 86 | + * @param $value - значение на конвертацию | |
| 87 | + * @return mixed | |
| 88 | + */ | |
| 89 | + public static function __callStatic($name, $value) | |
| 90 | + { | |
| 91 | + $method_name = self::METHOD_PREFIX . $name; | |
| 92 | + if (method_exists(static::class, $method_name)) { | |
| 93 | + return static::$method_name($value[0]); | |
| 94 | + | |
| 95 | + } else { | |
| 96 | + // если такого метода конвертации не предусмотрено, то возвращаем не конвертируя | |
| 97 | + return $value[0]; | |
| 98 | + | |
| 99 | + } | |
| 100 | + } | |
| 101 | + | |
| 102 | + public function __call($name, $params) | |
| 103 | + { | |
| 104 | + return self::__callStatic($name, $params); | |
| 105 | + } | |
| 106 | + | |
| 107 | + | |
| 108 | + /** | |
| 109 | + * @param $arr - массив для конвертирования | |
| 110 | + * @param $configuration - массив конфигурация конвертирования | |
| 111 | + * @return mixed | |
| 112 | + * конвертирует массив по полученным настройкам, вызывая последовательно функции конвертации (указанные в конфигурации) | |
| 113 | + */ | |
| 114 | + public static function convertByConfiguration($arr, $configuration) | |
| 115 | + { | |
| 116 | + if ($hasKey = isset($configuration['hasKey'])) | |
| 117 | + unset($configuration['hasKey']); | |
| 118 | + | |
| 119 | + if (isset($configuration['configuration'])) { | |
| 120 | + $arr_config = $configuration['configuration']; | |
| 121 | + unset($configuration['configuration']); | |
| 122 | + } else { | |
| 123 | + throw new \Exception('Не указан обязательный параметр конфигурационного файла - converter_conf[configuration]'); | |
| 124 | + } | |
| 125 | + | |
| 126 | + // проставим аттрибуты из конфига{}{} | |
| 127 | + self::setAttributes($configuration); | |
| 128 | + | |
| 129 | + foreach ($arr_config as $key => $value) { | |
| 130 | + if ($hasKey) { | |
| 131 | + // у нас ассоциативный массив, и мы можем конвертировать каждое значение в отдельности | |
| 132 | + if (is_array($value)) { | |
| 133 | + //если пустой массив то конвертируем всю строку | |
| 134 | + if (count($value) === 0) { | |
| 135 | + | |
| 136 | + $arr = self::$key($arr); | |
| 137 | + continue; | |
| 138 | + } | |
| 139 | + // иначе конвертируем каждую ячейку в отдельности | |
| 140 | + foreach ($value as $sub_value) { | |
| 141 | + if (isset($arr[$sub_value])) { | |
| 142 | + // конвертируем только те ячейки которые сопоставлены в прочитанном массиве с колонками в конфигурационном файле | |
| 143 | + $arr[$sub_value] = self::$key($arr[$sub_value]); | |
| 144 | + } | |
| 145 | + | |
| 146 | + } | |
| 147 | + } else { | |
| 148 | + | |
| 149 | + if (isset($arr[$value])) { | |
| 150 | + // конвертируем только те ячейки которые сопоставлены в прочитанном массиве с колонками в конфигурационном файле | |
| 151 | + $arr[$value] = self::$key($arr[$value]); | |
| 152 | + // CustomVarDamp::dump($result); | |
| 153 | + } | |
| 154 | + | |
| 155 | + } | |
| 156 | + | |
| 157 | + } else { | |
| 158 | + // нет заголовка - мы можем конвертировать только строку в целом | |
| 159 | + $arr = self::$key($arr); | |
| 160 | + } | |
| 161 | + | |
| 162 | + } | |
| 163 | + | |
| 164 | + return $arr; | |
| 165 | + } | |
| 166 | + | |
| 167 | + public static function setAttributes($configuration) | |
| 168 | + { | |
| 169 | + foreach ($configuration as $key_setting => $setting) { | |
| 170 | + if (property_exists(static::class, $key_setting)) | |
| 171 | + static::$$key_setting = $setting; | |
| 172 | + } | |
| 173 | + | |
| 174 | + } | |
| 175 | + | |
| 176 | + | |
| 177 | +} | |
| 0 | 178 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Tsurkanov | |
| 5 | + * Date: 20.10.2015 | |
| 6 | + * Time: 13:38 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | + | |
| 12 | +interface ConverterInterface { | |
| 13 | + | |
| 14 | + public static function convertByConfiguration( $arr_values_to_convert, $configuration ); | |
| 15 | + | |
| 16 | +} | |
| 0 | 17 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + | |
| 4 | + */ | |
| 5 | +namespace common\components\parsers; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Class CsvParser | |
| 9 | + * @package yii\multiparser | |
| 10 | + * @todo - перевести на анг. яз. | |
| 11 | + */ | |
| 12 | +class CsvParser extends TableParser | |
| 13 | +{ | |
| 14 | + /** @var string - разделитель csv */ | |
| 15 | + public $delimiter = ';'; | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * метод устанвливает нужные настройки объекта SplFileObject, для работы с csv | |
| 21 | + */ | |
| 22 | + public function setup() | |
| 23 | + { | |
| 24 | + parent::setup(); | |
| 25 | + | |
| 26 | + } | |
| 27 | + | |
| 28 | + public function read() | |
| 29 | + { | |
| 30 | + parent::read(); | |
| 31 | + | |
| 32 | + $this->cleanUp(); | |
| 33 | + | |
| 34 | + return $this->result; | |
| 35 | + } | |
| 36 | + | |
| 37 | + | |
| 38 | + protected function readRow( ) | |
| 39 | + { | |
| 40 | + $this->row = fgetcsv( $this->file, 0, $this->delimiter ); | |
| 41 | + } | |
| 42 | + | |
| 43 | + protected function isEmptyRow(){ | |
| 44 | + | |
| 45 | + $is_empty = false; | |
| 46 | + | |
| 47 | + if ($this->row === false || $this->row === NULL ) { | |
| 48 | + return true; | |
| 49 | + } | |
| 50 | + | |
| 51 | + $j = 0; | |
| 52 | + for ($i = 1; $i <= count( $this->row ); $i++) { | |
| 53 | + | |
| 54 | + if ( !isset( $this->row[ $i - 1 ] ) ) { | |
| 55 | + continue; | |
| 56 | + } | |
| 57 | + | |
| 58 | + if ( $this->isEmptyColumn( $this->row[$i - 1] ) ) { | |
| 59 | + $j++; | |
| 60 | + } | |
| 61 | + | |
| 62 | + if ( $j >= $this->min_column_quantity ) { | |
| 63 | + $is_empty = true; | |
| 64 | + break; | |
| 65 | + } | |
| 66 | + } | |
| 67 | + | |
| 68 | + return $is_empty; | |
| 69 | + } | |
| 70 | + | |
| 71 | + protected function isEmptyColumn( $val ){ | |
| 72 | + return $val == ''; | |
| 73 | + } | |
| 74 | + | |
| 75 | + protected function setResult( ){ | |
| 76 | + $this->result[] = $this->row; | |
| 77 | + } | |
| 78 | +} | |
| 0 | 79 | \ No newline at end of file | ... | ... |
common/components/parsers/CustomConverter.php
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | namespace common\components\parsers; |
| 3 | 3 | |
| 4 | 4 | use common\components\CustomVarDamp; |
| 5 | -use yii\multiparser\Converter; | |
| 5 | +use common\components\parsers\Converter; | |
| 6 | 6 | use backend\models\Details; |
| 7 | 7 | use backend\models\DetailsCrosses; |
| 8 | 8 | use backend\models\ImportersPrefix; | ... | ... |
common/components/parsers/CustomCsvParser.php
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Cibermag | |
| 5 | + * Date: 08.09.2015 | |
| 6 | + * Time: 14:50 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | +use yii\base\DynamicModel; | |
| 12 | +use yii\grid\GridView; | |
| 13 | +use yii\grid\SerialColumn; | |
| 14 | +use yii\helpers\ArrayHelper; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * Class DynamicFormHelper | |
| 18 | + * @package backend\components\parsers | |
| 19 | + * Содержит процедуры генерации компонентов с динамическим количеством аттрибутов | |
| 20 | + */ | |
| 21 | +class DynamicFormHelper | |
| 22 | +{ | |
| 23 | + | |
| 24 | + const KEY_PREFIX = 'attr_'; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * @param $source - int or array | |
| 28 | + * если передан массив, то создается модель с атрибутами переданными в массиве, | |
| 29 | + * ключ - имя, значение - значение аттрибута | |
| 30 | + * если передано число, то создается переданное количество аттрибутов с именами - attr_0, attr_1... | |
| 31 | + */ | |
| 32 | + public static function CreateDynamicModel( $source ) | |
| 33 | + { | |
| 34 | + $arr_keys = []; | |
| 35 | + if (is_array($source)) { | |
| 36 | + $arr_keys = $source; | |
| 37 | + } elseif (is_int($source)) { | |
| 38 | + | |
| 39 | + $i = 0; | |
| 40 | + while ($source > $i) { | |
| 41 | + $arr_keys[] = self::KEY_PREFIX . $i; | |
| 42 | + $i++; | |
| 43 | + } | |
| 44 | + array_flip($arr_keys); | |
| 45 | + | |
| 46 | + } | |
| 47 | + | |
| 48 | + $model = new DynamicModel($arr_keys); | |
| 49 | + | |
| 50 | + return $model; | |
| 51 | + } | |
| 52 | + | |
| 53 | + // @todo add comments | |
| 54 | + public static function CreateGridWithDropDownListHeader( $dataProvider, $form, $header_model, $arr_header_values ) | |
| 55 | + { | |
| 56 | + $columns_config = [['class' => SerialColumn::className()]]; | |
| 57 | + $i = 0; | |
| 58 | + foreach( $header_model as $key => $value ) { | |
| 59 | + | |
| 60 | + $columns_config[] = ['header' => $form->field($header_model, $key, ['inputOptions' => ['label' => '']])->dropDownList($arr_header_values), 'attribute' => $i]; | |
| 61 | + $i++; | |
| 62 | + } | |
| 63 | + $dynamic_grid_view = GridView::widget( ['dataProvider' => $dataProvider, | |
| 64 | + 'columns' => $columns_config ] ); | |
| 65 | + | |
| 66 | + return $dynamic_grid_view; | |
| 67 | + | |
| 68 | + } | |
| 69 | + | |
| 70 | +} | |
| 0 | 71 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Cibermag | |
| 5 | + * Date: 27.08.2015 | |
| 6 | + * Time: 13:36 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | +// @todo add comments | |
| 12 | +class Encoder | |
| 13 | +{ | |
| 14 | + /** @var out encoding charset */ | |
| 15 | + public static $out_charset = 'UTF-8'; | |
| 16 | + /** @var out encoding charset */ | |
| 17 | + public static $in_charset = 'windows-1251'; | |
| 18 | + | |
| 19 | + public static function encodeFile($in_charset, $out_charset, $filePath) | |
| 20 | + { | |
| 21 | + | |
| 22 | + $old_content = file_get_contents($filePath); | |
| 23 | + $encode_content = self::encodeString( $old_content, $in_charset, $out_charset ); | |
| 24 | + $file = @fopen($filePath, "w"); | |
| 25 | + fwrite($file, $encode_content); | |
| 26 | + @fclose($file); | |
| 27 | + } | |
| 28 | + | |
| 29 | + public static function encodeArray( $array, $in_charset = '', $out_charset = '') | |
| 30 | + { | |
| 31 | + if ($in_charset) | |
| 32 | + self::$in_charset = $in_charset; | |
| 33 | + | |
| 34 | + if ($out_charset) | |
| 35 | + self::$out_charset = $out_charset; | |
| 36 | + | |
| 37 | + $result = array_map( | |
| 38 | + function ($value) { | |
| 39 | + | |
| 40 | + return self::encodeString( $value, self::$in_charset, self::$out_charset ); | |
| 41 | + | |
| 42 | + }, | |
| 43 | + $array); | |
| 44 | + | |
| 45 | + return $result; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public static function encodeString( $source, $in_charset = '', $out_charset = '' ){ | |
| 49 | + | |
| 50 | + if ($in_charset) | |
| 51 | + self::$in_charset = $in_charset; | |
| 52 | + | |
| 53 | + if ($out_charset) | |
| 54 | + self::$out_charset = $out_charset; | |
| 55 | + | |
| 56 | + return iconv( self::$in_charset, self::$out_charset, $source ); | |
| 57 | + | |
| 58 | + } | |
| 59 | +} | |
| 0 | 60 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Tsurkanov | |
| 5 | + * Date: 20.10.2015 | |
| 6 | + * Time: 16:24 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | + | |
| 12 | +class ObjectCreator { | |
| 13 | + public static function build( array $configuration ){ | |
| 14 | + if ( isset( $configuration['class'] ) ) { | |
| 15 | + $class = trim( $configuration['class'] ); | |
| 16 | + unset( $configuration['class'] ); | |
| 17 | + } else{ | |
| 18 | + throw new \ErrorException('Error configuration - undefined class'); | |
| 19 | + } | |
| 20 | + | |
| 21 | + $object = new $class(); | |
| 22 | + foreach ($configuration as $name => $value) { | |
| 23 | + $object->$name = $value; | |
| 24 | + } | |
| 25 | + | |
| 26 | + return $object; | |
| 27 | + } | |
| 28 | +} | |
| 0 | 29 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Cibermag | |
| 5 | + * Date: 04.09.2015 | |
| 6 | + * Time: 18:25 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | +//@todo - заменить read на parse | |
| 12 | +//@todo - xml - убрать из названий функций xml и array - это и так понятно | |
| 13 | + | |
| 14 | + | |
| 15 | +use common\components\CustomVarDamp; | |
| 16 | + | |
| 17 | +abstract class Parser | |
| 18 | +{ | |
| 19 | + public $converter_conf = []; | |
| 20 | + protected $converter = NULL; | |
| 21 | + | |
| 22 | + /** @var file-resource читаемого файла */ | |
| 23 | + public $file; | |
| 24 | + /** @var string путь читаемого файла */ | |
| 25 | + public $file_path; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * @var array - результирующий массив с отпарсенными значениями | |
| 29 | + */ | |
| 30 | + protected $result = []; | |
| 31 | + | |
| 32 | + /** @var array - массив с заголовком, | |
| 33 | + * */ | |
| 34 | + public $keys = NULL; | |
| 35 | + /** @var bool | |
| 36 | + имеет ли файл заголовок который будет установлен ключами возвращемого массива*/ | |
| 37 | + public $has_header_row = false; | |
| 38 | + /* | |
| 39 | + *если есть ключи, то колонки с пустыми значениями будут пропускаться (из ряда такие значения будут удаляться), | |
| 40 | + * например если в файле вторая колонка пустая то она будет удалена | |
| 41 | + * если есть $has_header_row - то первая значимая строка становится ключами, но пустые колонки не удаляются из ряда | |
| 42 | + * например если в файле вторая колонка пустая то ей будет назначен соответсвующий ключ (второй) из первой строки | |
| 43 | + * все описаное выше реализуется в дочернем семействе классов TableParser в методе filterRow() | |
| 44 | + * для xml происходит просто сопоставление переданных ключей с прочитанными | |
| 45 | + */ | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + public function setup() | |
| 51 | + { | |
| 52 | + $this->setupConverter(); | |
| 53 | + } | |
| 54 | + | |
| 55 | + protected function setupConverter() | |
| 56 | + { | |
| 57 | + if ( $this->has_header_row || $this->keys !== NULL ) { | |
| 58 | + // если у файла есть заголовок, то в результате имеем ассоциативный массив | |
| 59 | + $this->converter_conf['hasKey'] = 1; | |
| 60 | + } | |
| 61 | + | |
| 62 | + if ( $this->converter_conf ) { | |
| 63 | + $converter = ObjectCreator::build( $this->converter_conf ); | |
| 64 | + if ( $converter instanceof ConverterInterface ) { | |
| 65 | + | |
| 66 | + $this->converter = $converter; | |
| 67 | + | |
| 68 | + } | |
| 69 | + } | |
| 70 | + | |
| 71 | + | |
| 72 | + } | |
| 73 | + | |
| 74 | + public abstract function read(); | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * @param $arr | |
| 78 | + * @return mixed | |
| 79 | + * преобразовует значения прочитанного массива в нужные типы, согласно конфигурации конвертера | |
| 80 | + */ | |
| 81 | + protected function convert( $arr ) | |
| 82 | + { | |
| 83 | + | |
| 84 | + if ($this->converter !== NULL) { | |
| 85 | + | |
| 86 | + $arr = $this->converter->convertByConfiguration( $arr, $this->converter_conf ); | |
| 87 | + | |
| 88 | + } | |
| 89 | + | |
| 90 | + | |
| 91 | + return $arr; | |
| 92 | + | |
| 93 | + } | |
| 94 | + | |
| 95 | + protected function cleanUp( ) | |
| 96 | + { | |
| 97 | + | |
| 98 | + unset( $this->file ); | |
| 99 | + unset( $this->converter ); | |
| 100 | + unset( $this->converter_conf ); | |
| 101 | + | |
| 102 | + | |
| 103 | + } | |
| 104 | + | |
| 105 | + | |
| 106 | +} | |
| 0 | 107 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace common\components\parsers; | |
| 4 | + | |
| 5 | + | |
| 6 | +use common\components\CustomVarDamp; | |
| 7 | + | |
| 8 | +class ParserHandler | |
| 9 | +{ | |
| 10 | + //@todo - добавить комменты на анг язе (ошибки выкидывать тоже на англ яз.) | |
| 11 | + //@todo - сделать универсальную обработку ошибок | |
| 12 | + //@todo - возможно отказаться от YiiParserHandler | |
| 13 | + const DEFAULT_MODE = 'web'; | |
| 14 | + | |
| 15 | + | |
| 16 | + /** @var string */ | |
| 17 | + protected $configuration = []; | |
| 18 | + /** @var string */ | |
| 19 | + protected $custom_configuration = []; | |
| 20 | + | |
| 21 | + /** @var file handle */ | |
| 22 | + protected $file; | |
| 23 | + | |
| 24 | + /** @var string - extension of file $file_path */ | |
| 25 | + protected $extension; | |
| 26 | + | |
| 27 | + /** @var string - */ | |
| 28 | + protected $mode; | |
| 29 | + | |
| 30 | + /** @var string - */ | |
| 31 | + protected $options; | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * @param string first line in file for parsing | |
| 35 | + */ | |
| 36 | + public function setup($file_path, $options = []) | |
| 37 | + { | |
| 38 | + //$this->file_path = $file_path; | |
| 39 | + if (isset($options['mode'])) { | |
| 40 | + | |
| 41 | + $this->mode = $options['mode']; | |
| 42 | + unset($options['mode']); | |
| 43 | + | |
| 44 | + } else { | |
| 45 | + | |
| 46 | + $this->mode = self::DEFAULT_MODE; | |
| 47 | + | |
| 48 | + } | |
| 49 | + | |
| 50 | + $this->options = $options; | |
| 51 | + $this->file = fopen($file_path, 'r'); | |
| 52 | + $options['file'] = $this->file; | |
| 53 | + $options['file_path'] = $file_path; | |
| 54 | + $this->extension = pathinfo( $file_path, PATHINFO_EXTENSION ); | |
| 55 | + $this->custom_configuration = $this->getCustomConfiguration($this->extension, $this->mode); | |
| 56 | + $this->custom_configuration = array_merge_recursive($this->custom_configuration, $options); | |
| 57 | + | |
| 58 | + } | |
| 59 | + | |
| 60 | + public function run() | |
| 61 | + { | |
| 62 | + $parser = $this->createObjectByConfiguration( $this->custom_configuration ); | |
| 63 | + | |
| 64 | + $parser->setup(); | |
| 65 | + $result = $parser->read(); | |
| 66 | + | |
| 67 | + unset($parser); | |
| 68 | + fclose( $this->file ); | |
| 69 | + | |
| 70 | + return $result; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public function getCustomConfiguration($extension, $parameter) | |
| 74 | + { | |
| 75 | + if (!count($this->configuration)) { | |
| 76 | + $this->setConfiguration(require(__DIR__ . '/config.php')); | |
| 77 | + } | |
| 78 | + | |
| 79 | + if (!isset($this->configuration[$extension])) { | |
| 80 | + throw new \ErrorException("Parser do not maintain file with extension {$extension}"); | |
| 81 | + } | |
| 82 | + if (!isset($this->configuration[$extension][$parameter])) { | |
| 83 | + throw new \ErrorException("Parser configurator do not have settings for {$parameter} parameter"); | |
| 84 | + } | |
| 85 | + | |
| 86 | + return $this->configuration[$extension][$parameter]; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public function setConfiguration($configuration) | |
| 90 | + { | |
| 91 | + $this->configuration = $configuration; | |
| 92 | + } | |
| 93 | + | |
| 94 | + protected function createObjectByConfiguration($configuration) | |
| 95 | + { | |
| 96 | + return ObjectCreator::build($configuration); | |
| 97 | + } | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | +} | |
| 103 | + | |
| 104 | + | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Tsurkanov | |
| 5 | + * Date: 22.10.2015 | |
| 6 | + * Time: 15:53 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | + | |
| 12 | +use common\components\CustomVarDamp; | |
| 13 | + | |
| 14 | +abstract class TableParser extends Parser | |
| 15 | +{ | |
| 16 | + | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * @var array - текущий отпарсенный ряд | |
| 20 | + */ | |
| 21 | + protected $row = []; | |
| 22 | + | |
| 23 | + /** @var int - первая строка с которой начинать парсить */ | |
| 24 | + public $first_line = 0; | |
| 25 | + | |
| 26 | + /** @var int - последняя строка до которой парсить | |
| 27 | + * если не указана, то парсинг происходит до конца файла*/ | |
| 28 | + public $last_line = 0; | |
| 29 | + | |
| 30 | + /** @var int - первая колонка файла с которой начнется парсинг */ | |
| 31 | + public $first_column = 0; | |
| 32 | + | |
| 33 | + | |
| 34 | + /** @var bool | |
| 35 | + нужно ли искать автоматически первоую значисмую строку (не пустая строка) | |
| 36 | + * иначе первая строка будет взята из аттрибута $first_line */ | |
| 37 | + public $auto_detect_first_line = false; | |
| 38 | + | |
| 39 | + /** @var int - количество значимых колонок, что бы определить первую значимую строку | |
| 40 | + * используется при автоопределении первой строки*/ | |
| 41 | + public $min_column_quantity = 5; | |
| 42 | + /** @var int - количество пустых строк, что бы определить конец файла, | |
| 43 | + * такое количеество подряд пустых строк считается концом файла*/ | |
| 44 | + public $empty_lines_quantity = 3; | |
| 45 | + | |
| 46 | + | |
| 47 | + /** @var int - номер текущей строки парсера */ | |
| 48 | + protected $current_row_number = 0; | |
| 49 | + | |
| 50 | + | |
| 51 | + protected abstract function isEmptyRow(); | |
| 52 | + | |
| 53 | + protected abstract function isEmptyColumn($column_value); | |
| 54 | + | |
| 55 | + protected abstract function readRow(); | |
| 56 | + | |
| 57 | + protected abstract function setResult(); | |
| 58 | + | |
| 59 | + | |
| 60 | + public function read() | |
| 61 | + { | |
| 62 | + if ($this->auto_detect_first_line) { | |
| 63 | + $this->shiftToFirstValuableLine(); | |
| 64 | + } | |
| 65 | + | |
| 66 | + // будем считать количество пустых строк подряд - при достижении $empty_lines_quantity - считаем что это конец файла и выходим | |
| 67 | + $empty_lines = 0; | |
| 68 | + while ($empty_lines < $this->empty_lines_quantity) { | |
| 69 | + // прочтем строку из файла | |
| 70 | + $this->readRow(); | |
| 71 | + | |
| 72 | + if ($this->isEmptyRow()) { | |
| 73 | + //счетчик пустых строк | |
| 74 | + //CustomVarDamp::dump($this->current_row_number); | |
| 75 | + $empty_lines++; | |
| 76 | + continue; | |
| 77 | + } | |
| 78 | + | |
| 79 | + // уберем пустые колонки из ряда | |
| 80 | + if ($this->keys === NULL) { | |
| 81 | + $this->filterRow(); | |
| 82 | + } | |
| 83 | + | |
| 84 | + | |
| 85 | + $this->adjustRowToSettings(); | |
| 86 | + | |
| 87 | + // строка не пустая, имеем прочитанный массив значений | |
| 88 | + $this->current_row_number++; | |
| 89 | + | |
| 90 | + // для первой строки утановим ключи из заголовка | |
| 91 | + if (!$this->setKeysFromHeader()) { | |
| 92 | + $this->setResult(); | |
| 93 | + } | |
| 94 | + | |
| 95 | + | |
| 96 | + // если у нас установлен лимит, при его достижении прекращаем парсинг | |
| 97 | + if ($this->isLastLine()) | |
| 98 | + break; | |
| 99 | + | |
| 100 | + // обнуляем счетчик, так как считаюся пустые строки ПОДРЯД | |
| 101 | + $empty_lines = 0; | |
| 102 | + | |
| 103 | + } | |
| 104 | + | |
| 105 | + } | |
| 106 | + | |
| 107 | + /** | |
| 108 | + * определяет первую значимую строку, | |
| 109 | + * считывается файл пока в нем не встретится строка с непустыми колонками | |
| 110 | + * в количестве указанном в атрибуте min_column_quantity | |
| 111 | + * в результате выполнения $current_row_number будет находится на последней незначимой строке | |
| 112 | + */ | |
| 113 | + protected function shiftToFirstValuableLine() | |
| 114 | + { | |
| 115 | + do { | |
| 116 | + | |
| 117 | + $this->current_row_number++; | |
| 118 | + $this->readRow(); | |
| 119 | + | |
| 120 | + } while ($this->isEmptyRow()); | |
| 121 | + | |
| 122 | + // @todo - сделать опционально | |
| 123 | + // код для того что бы парсить первую строку, закомментировано как предполагается что первая значимая строка это заголовок | |
| 124 | + // $this->current_row_number --; | |
| 125 | +// $this->file->seek( $this->current_row_number ); | |
| 126 | + } | |
| 127 | + | |
| 128 | + /** | |
| 129 | + * @return array - одномерный массив результата парсинга строки | |
| 130 | + */ | |
| 131 | + protected function adjustRowToSettings() | |
| 132 | + { | |
| 133 | + | |
| 134 | + // если есть заголовок, то перед конвертацией его нужно назначить | |
| 135 | + if ($this->keys !== NULL) { | |
| 136 | + // adjust row to keys | |
| 137 | + $this->adjustRowToKeys(); | |
| 138 | + // назначим заголовок | |
| 139 | + $this->row = array_combine($this->keys, $this->row); | |
| 140 | + } | |
| 141 | + | |
| 142 | + // попытаемся конвертировать прочитанные значения согласно конфигурации котнвертера значений | |
| 143 | + $this->row = $this->convert($this->row); | |
| 144 | + | |
| 145 | + // обрежем массив к первой значимой колонке | |
| 146 | + if ($this->first_column) { | |
| 147 | + | |
| 148 | + $this->row = array_slice($this->row, $this->first_column); | |
| 149 | + | |
| 150 | + } | |
| 151 | + | |
| 152 | + } | |
| 153 | + | |
| 154 | + protected function setKeysFromHeader() | |
| 155 | + { | |
| 156 | + if ($this->has_header_row) { | |
| 157 | + // в файле есть заголовок, но он еще не назначен - назначим | |
| 158 | + if ($this->keys === NULL) { | |
| 159 | + $this->keys = array_values($this->row); | |
| 160 | + return true; | |
| 161 | + } | |
| 162 | + } | |
| 163 | + return false; | |
| 164 | + } | |
| 165 | + | |
| 166 | + protected function filterRow() | |
| 167 | + { | |
| 168 | + // если есть заголовок - все значения нужны, не фильтруем | |
| 169 | + if ($this->has_header_row || !is_array($this->row)) { | |
| 170 | + return; | |
| 171 | + } | |
| 172 | + $this->row = array_filter($this->row, function ($val) { | |
| 173 | + return !$this->isEmptyColumn($val); | |
| 174 | + }); | |
| 175 | + } | |
| 176 | + | |
| 177 | + protected function isLastLine() | |
| 178 | + { | |
| 179 | + | |
| 180 | + if (($this->last_line) && ($this->current_row_number > $this->last_line)) { | |
| 181 | + return true; | |
| 182 | + } | |
| 183 | + return false; | |
| 184 | + } | |
| 185 | + | |
| 186 | + protected function adjustRowToKeys() | |
| 187 | + { | |
| 188 | + //уберем из ряда те колонки которых нет в ключах | |
| 189 | + $this->row = array_intersect_key($this->row, $this->keys); | |
| 190 | + | |
| 191 | + $keys_count = count($this->keys); | |
| 192 | + $column_count = count($this->row); | |
| 193 | + if ($keys_count != $column_count) { | |
| 194 | + // найдем колонки которых нет в ряде но есть ключах | |
| 195 | + $arr_diff = array_diff_key($this->keys, $this->row); | |
| 196 | + foreach ($arr_diff as $key => $value) { | |
| 197 | + // колонки которых нет в ряде но есть ключах, добавим их с пустым значением | |
| 198 | + $this->row[$key] = ''; | |
| 199 | + } | |
| 200 | + } | |
| 201 | + } | |
| 202 | + | |
| 203 | +} | |
| 0 | 204 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Tsurkanov | |
| 5 | + * Date: 21.10.2015 | |
| 6 | + * Time: 15:44 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | +use common\components\CustomVarDamp; | |
| 12 | + | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * Class XlsxParser | |
| 16 | + * @package yii\multiparser | |
| 17 | + */ | |
| 18 | +class XlsxParser extends TableParser | |
| 19 | +{ | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * @var string - путь куда будут распаковываться файлы, если не указанно - во временный каталог сервера | |
| 23 | + */ | |
| 24 | + public $path_for_extract_files = ''; | |
| 25 | + | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * @var int - если указано то считывание будет производиться с этого листа, иначе со всех листов | |
| 29 | + * при чтении со всех листов - выходной массив будет иметь номера листов первыми элементами | |
| 30 | + */ | |
| 31 | + public $active_sheet = 0; | |
| 32 | + | |
| 33 | + protected $strings_arr = []; | |
| 34 | + protected $sheets_arr = []; | |
| 35 | + | |
| 36 | + protected $current_node; | |
| 37 | + protected $current_sheet; | |
| 38 | + | |
| 39 | + // глубина округления для флоата | |
| 40 | + // @todo - перенести вродительский класс и применить в дочерних классах | |
| 41 | + protected $float_precision = 6; | |
| 42 | + | |
| 43 | + public function setup() | |
| 44 | + { | |
| 45 | + | |
| 46 | + parent::setup(); | |
| 47 | + | |
| 48 | + if ($this->path_for_extract_files == '') { | |
| 49 | + $this->path_for_extract_files = sys_get_temp_dir(); | |
| 50 | + } | |
| 51 | + } | |
| 52 | + | |
| 53 | + | |
| 54 | + public function read() | |
| 55 | + { | |
| 56 | + $this->extractFiles(); | |
| 57 | + $this->readSheets(); | |
| 58 | + $this->readStrings(); | |
| 59 | + foreach ($this->sheets_arr as $sheet) { | |
| 60 | + //проходим по всем файлам из директории /xl/worksheets/ | |
| 61 | + $this->current_sheet = $sheet; | |
| 62 | + $sheet_path = $this->path_for_extract_files . '/xl/worksheets/' . $sheet . '.xml'; | |
| 63 | + if (file_exists($sheet_path) && is_readable($sheet_path)) { | |
| 64 | + $xml = simplexml_load_file($sheet_path, "SimpleXMLIterator"); | |
| 65 | + $this->current_node = $xml->sheetData->row; | |
| 66 | + $this->current_node->rewind(); | |
| 67 | + if ($this->current_node->valid()) { | |
| 68 | + parent::read(); | |
| 69 | + } | |
| 70 | + } | |
| 71 | + } | |
| 72 | + | |
| 73 | + $this->cleanUp(); | |
| 74 | + | |
| 75 | + if ($this->active_sheet) { | |
| 76 | + // в настройках указан конкретный лист с которого будем производить чтение, поэтому и возвращаем подмассив | |
| 77 | + return $this->result[$this->current_sheet]; | |
| 78 | + } else { | |
| 79 | + return $this->result; | |
| 80 | + } | |
| 81 | + | |
| 82 | + } | |
| 83 | + | |
| 84 | + protected function extractFiles() | |
| 85 | + { | |
| 86 | + $this->path_for_extract_files = $this->path_for_extract_files . session_id(); | |
| 87 | + if (!file_exists($this->path_for_extract_files)) { | |
| 88 | + if (!mkdir($this->path_for_extract_files)) { | |
| 89 | + throw new \Exception('Ошибка создания временного каталога - ' . $this->path_for_extract_files); | |
| 90 | + } | |
| 91 | + } | |
| 92 | + | |
| 93 | + $zip = new \ZipArchive; | |
| 94 | + if ($zip->open($this->file_path) === TRUE) { | |
| 95 | + $zip->extractTo($this->path_for_extract_files . '/'); | |
| 96 | + $zip->close(); | |
| 97 | + } else { | |
| 98 | + | |
| 99 | + throw new \Exception('Ошибка чтения xlsx файла'); | |
| 100 | + } | |
| 101 | + unset($zip); | |
| 102 | + } | |
| 103 | + | |
| 104 | + protected function readSheets() | |
| 105 | + { | |
| 106 | + if ($this->active_sheet) { | |
| 107 | + $this->sheets_arr[] = 'sheet' . $this->active_sheet; | |
| 108 | + return; | |
| 109 | + } | |
| 110 | + | |
| 111 | + $xml = simplexml_load_file($this->path_for_extract_files . '/xl/workbook.xml'); | |
| 112 | + foreach ($xml->sheets->children() as $sheet) { | |
| 113 | + $sheet_name = ''; | |
| 114 | + $sheet_id = 0; | |
| 115 | + $attr = $sheet->attributes(); | |
| 116 | + foreach ($attr as $name => $value) { | |
| 117 | + if ($name == 'name') | |
| 118 | + $sheet_name = (string)$value; | |
| 119 | + | |
| 120 | + if ($name == 'sheetId') | |
| 121 | + $sheet_id = $value; | |
| 122 | + | |
| 123 | + } | |
| 124 | + if ($sheet_name && $sheet_id) { | |
| 125 | + $this->sheets_arr[$sheet_name] = 'Sheet' . $sheet_id; | |
| 126 | + } | |
| 127 | +// | |
| 128 | + } | |
| 129 | + } | |
| 130 | + | |
| 131 | + protected function readStrings() | |
| 132 | + { | |
| 133 | + $xml = simplexml_load_file($this->path_for_extract_files . '/xl/sharedStrings.xml'); | |
| 134 | + foreach ($xml->children() as $item) { | |
| 135 | + $this->strings_arr[] = (string)$item->t; | |
| 136 | + } | |
| 137 | + } | |
| 138 | + | |
| 139 | + | |
| 140 | + protected function readRow() | |
| 141 | + { | |
| 142 | + $this->row = []; | |
| 143 | + $node = $this->current_node->getChildren(); | |
| 144 | + if ($node === NULL) { | |
| 145 | + return; | |
| 146 | + } | |
| 147 | + | |
| 148 | + for ($node->rewind(), $i = 0; $node->valid(); $node->next(), $i++) { | |
| 149 | + $child = $node->current(); | |
| 150 | + $attr = $child->attributes(); | |
| 151 | + | |
| 152 | + // define the index of result array | |
| 153 | + // $attr['r'] - contain the address of cells - A1, B1 ... | |
| 154 | + if (isset($attr['r'])) { | |
| 155 | + // override index | |
| 156 | + $i = $this->convertCellToIndex( $attr['r'] ); | |
| 157 | + | |
| 158 | + if ( $this->keys !== Null ){ | |
| 159 | + if( isset( $this->keys[$i] ) ){ | |
| 160 | + //$i = $this->keys[$i]; | |
| 161 | + } else { | |
| 162 | + // we have a keys, but this one we didn't find, so skip it | |
| 163 | + continue; | |
| 164 | + } | |
| 165 | + } | |
| 166 | + } | |
| 167 | + // define the value of result array | |
| 168 | + if (isset($child->v)) { | |
| 169 | + $value = (string)$child->v; | |
| 170 | + | |
| 171 | + if ( isset($attr['t']) ){ | |
| 172 | + // it's not a value it's a string, so fetch it from string array | |
| 173 | + $value = $this->strings_arr[$value]; | |
| 174 | + } else { | |
| 175 | + $value = (string)round( $value, $this->float_precision ); | |
| 176 | + } | |
| 177 | + | |
| 178 | + | |
| 179 | + } else { | |
| 180 | + $value = ''; | |
| 181 | + } | |
| 182 | + | |
| 183 | + // set | |
| 184 | + $this->row[$i] = $value; | |
| 185 | + | |
| 186 | + } | |
| 187 | +// // fill the row by empty values for keys that we are missed in previous step | |
| 188 | + // only for 'has_header_row = true' mode | |
| 189 | + if ( $this->has_header_row && $this->keys !== Null ) { | |
| 190 | + $extra_column = count( $this->keys ) - count( $this->row ); | |
| 191 | + if ( $extra_column ) { | |
| 192 | + foreach ( $this->keys as $key => $key ) { | |
| 193 | + | |
| 194 | + if ( isset( $this->row[$key] ) ) { | |
| 195 | + continue; | |
| 196 | + } | |
| 197 | + $this->row[$key] = ''; | |
| 198 | + } | |
| 199 | + } | |
| 200 | + | |
| 201 | + } | |
| 202 | + ksort( $this->row ); | |
| 203 | + $this->current_node->next(); | |
| 204 | + } | |
| 205 | + | |
| 206 | + protected function isEmptyRow() | |
| 207 | + { | |
| 208 | + | |
| 209 | + $is_empty = false; | |
| 210 | + | |
| 211 | + if (!count($this->row) || !$this->current_node->valid()) { | |
| 212 | + return true; | |
| 213 | + } | |
| 214 | + | |
| 215 | + $j = 0; | |
| 216 | + for ($i = 1; $i <= count($this->row); $i++) { | |
| 217 | + | |
| 218 | + if (isset($this->row[$i - 1]) && $this->isEmptyColumn($this->row[$i - 1])) { | |
| 219 | + $j++; | |
| 220 | + } | |
| 221 | + | |
| 222 | + if ($j >= $this->min_column_quantity) { | |
| 223 | + $is_empty = true; | |
| 224 | + break; | |
| 225 | + } | |
| 226 | + } | |
| 227 | + | |
| 228 | + return $is_empty; | |
| 229 | + } | |
| 230 | + | |
| 231 | + protected function isEmptyColumn($val) | |
| 232 | + { | |
| 233 | + return $val == ''; | |
| 234 | + } | |
| 235 | + | |
| 236 | + protected function setResult() | |
| 237 | + { | |
| 238 | + $this->result[$this->current_sheet][] = $this->row; | |
| 239 | + } | |
| 240 | + | |
| 241 | + protected function deleteExtractFiles() | |
| 242 | + { | |
| 243 | + $this->removeDir($this->path_for_extract_files); | |
| 244 | + | |
| 245 | + } | |
| 246 | + | |
| 247 | + protected function removeDir($dir) | |
| 248 | + { | |
| 249 | + if (is_dir($dir)) { | |
| 250 | + $objects = scandir($dir); | |
| 251 | + foreach ($objects as $object) { | |
| 252 | + if ($object != "." && $object != "..") { | |
| 253 | + if (filetype($dir . "/" . $object) == "dir") | |
| 254 | + $this->removeDir($dir . "/" . $object); | |
| 255 | + else | |
| 256 | + unlink($dir . "/" . $object); | |
| 257 | + } | |
| 258 | + } | |
| 259 | + reset($objects); | |
| 260 | + rmdir($dir); | |
| 261 | + } | |
| 262 | + } | |
| 263 | + | |
| 264 | + | |
| 265 | + /** | |
| 266 | + * @param $cell_address - string with address like A1, B1 ... | |
| 267 | + * @return int - integer index | |
| 268 | + * this method has a constraint - 'Z' - it's a last column to convert, | |
| 269 | + * column with 'AA..' address and bigger - return index = 0 | |
| 270 | + */ | |
| 271 | + protected function convertCellToIndex($cell_address) | |
| 272 | + { | |
| 273 | + $index = 0; | |
| 274 | + | |
| 275 | + $address_letter = substr($cell_address, 0, 1); | |
| 276 | + $address_arr = range('A', 'Z'); | |
| 277 | + | |
| 278 | + if ( $search_value = array_search( $address_letter, $address_arr ) ) | |
| 279 | + $index = $search_value; | |
| 280 | + | |
| 281 | + return $index; | |
| 282 | + | |
| 283 | + } | |
| 284 | +// @todo - переписать родительский метод в универсальной манере а не переопределять его | |
| 285 | + protected function setKeysFromHeader(){ | |
| 286 | + if ( $this->has_header_row ) { | |
| 287 | + | |
| 288 | + if ($this->keys === NULL) { | |
| 289 | + $this->keys = $this->row; | |
| 290 | + return true; | |
| 291 | + } | |
| 292 | + } | |
| 293 | + return false; | |
| 294 | + } | |
| 295 | + protected function cleanUp() | |
| 296 | + { | |
| 297 | + parent::cleanUp(); | |
| 298 | + unset($this->strings_arr); | |
| 299 | + unset($this->sheets_arr); | |
| 300 | + unset($this->current_node); | |
| 301 | + | |
| 302 | + | |
| 303 | + } | |
| 304 | + | |
| 305 | + function __destruct() | |
| 306 | + { | |
| 307 | + $this->deleteExtractFiles(); | |
| 308 | + } | |
| 309 | + | |
| 310 | + | |
| 311 | +} | |
| 0 | 312 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Cibermag | |
| 5 | + * Date: 10.09.2015 | |
| 6 | + * Time: 17:47 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | + | |
| 12 | +class XmlParser extends Parser{ | |
| 13 | + | |
| 14 | + public $node; | |
| 15 | + | |
| 16 | + public function read() | |
| 17 | + { | |
| 18 | + //$file = $this->file; | |
| 19 | + $result = $this->xmlToArray( ); | |
| 20 | + | |
| 21 | + if ( isset($this->node) ) { | |
| 22 | + | |
| 23 | + $result = $result[ $this->node ]; | |
| 24 | + | |
| 25 | + } | |
| 26 | + | |
| 27 | + $this->cleanUp(); | |
| 28 | + return $result; | |
| 29 | + } | |
| 30 | + | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * Converts an XML string to a PHP array | |
| 34 | + * @param $file_path | |
| 35 | + * @return mixed | |
| 36 | + * @throws Exception | |
| 37 | + * @throws \Exception | |
| 38 | + */ | |
| 39 | + protected function xmlToArray( ) { | |
| 40 | + | |
| 41 | + try { | |
| 42 | + $xml = new \SimpleXMLElement( $this->file_path, 0, true ); | |
| 43 | + //\common\components\CustomVarDamp::dumpAndDie($xml->children()->children()); | |
| 44 | + $result = $this->recursiveXMLToArray( $xml ); | |
| 45 | + } catch(\Exception $ex) { | |
| 46 | + | |
| 47 | + throw $ex; | |
| 48 | + } | |
| 49 | + | |
| 50 | + return $result; | |
| 51 | + } | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * Convert a XML string to a PHP array recursively. Do not | |
| 55 | + * call this function directly | |
| 56 | + * | |
| 57 | + * @param SimpleXMLElement | |
| 58 | + * | |
| 59 | + * @return mixed | |
| 60 | + */ | |
| 61 | + protected function recursiveXMLToArray($xml) { | |
| 62 | + if( $xml instanceof \SimpleXMLElement ) { | |
| 63 | + $attributes = $xml->attributes(); | |
| 64 | + | |
| 65 | + foreach( $attributes as $key => $value ) { | |
| 66 | + if( $value ) { | |
| 67 | + $attribute_array[$key] = (string) $value; | |
| 68 | + } | |
| 69 | + } | |
| 70 | + $previous_xml = $xml; | |
| 71 | + $xml = get_object_vars($xml); | |
| 72 | + } | |
| 73 | + | |
| 74 | + if(is_array($xml)) { | |
| 75 | + | |
| 76 | + if( count($xml) == 0 ) | |
| 77 | + return (string) $previous_xml; // for CDATA | |
| 78 | + | |
| 79 | + foreach($xml as $key => $value) { | |
| 80 | + $row[$key] = $this->recursiveXMLToArray($value); | |
| 81 | + } | |
| 82 | + if ( is_string($value) ) { | |
| 83 | + // дошли до конца рекурсии | |
| 84 | + // преобразуем ряд согласно конфигурации | |
| 85 | + if ( $this->keys !== NULL ) { | |
| 86 | + // назначим ключи из конфигурации, согласно массиву $keys | |
| 87 | + $row = $this->compareArrayWithKeys( $row ); | |
| 88 | + } | |
| 89 | + $row = $this->convert( $row ); | |
| 90 | + | |
| 91 | + } | |
| 92 | + | |
| 93 | + | |
| 94 | + if( isset( $attribute_array ) ) | |
| 95 | + $row['@'] = $attribute_array; // Attributes | |
| 96 | + | |
| 97 | + return $row; | |
| 98 | + } | |
| 99 | + return (string) $xml; | |
| 100 | + } | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * @param array $value_arr - текущий ряд, массив, которому нужно назначить конфигурационные ключи ($keys) | |
| 104 | + * @return array | |
| 105 | + */ | |
| 106 | + protected function compareArrayWithKeys( array $value_arr ){ | |
| 107 | + $res = $this->keys; | |
| 108 | + foreach ( $this->keys as $key => $value ) { | |
| 109 | + if ( array_key_exists( $value, $value_arr ) ) { | |
| 110 | + $res[$key] = $value_arr[$value]; | |
| 111 | + } | |
| 112 | + } | |
| 113 | + return $res; | |
| 114 | + } | |
| 115 | + | |
| 116 | +} | |
| 0 | 117 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Cibermag | |
| 5 | + * Date: 07.09.2015 | |
| 6 | + * Time: 15:56 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | +use yii\base\Component; | |
| 12 | +use yii\base\ErrorException; | |
| 13 | + | |
| 14 | + | |
| 15 | +class YiiConverter extends Component{ | |
| 16 | + | |
| 17 | +public $configuration; | |
| 18 | +public $converter; | |
| 19 | + | |
| 20 | + public function init() | |
| 21 | + { | |
| 22 | + parent::init(); | |
| 23 | + $converter = \Yii::createObject( $this->configuration ); | |
| 24 | + if ( $converter instanceof ConverterInterface ) { | |
| 25 | + | |
| 26 | + $this->converter = $converter; | |
| 27 | + }else{ | |
| 28 | + throw new ErrorException('Wrong type of converter'); | |
| 29 | + } | |
| 30 | + | |
| 31 | + | |
| 32 | + } | |
| 33 | + | |
| 34 | + public function convertTo( $method, $value, $attributes = [] ){ | |
| 35 | + | |
| 36 | + if ( $attributes ) { | |
| 37 | + $this->converter->setAttributes($attributes); | |
| 38 | + } | |
| 39 | + return $this->converter->$method( $value ); | |
| 40 | + | |
| 41 | + } | |
| 42 | + | |
| 43 | + public function convertByConfiguration( $value, $configuration ){ | |
| 44 | + | |
| 45 | + return $this->converter->convertByConfiguration( $value, $configuration ); | |
| 46 | + | |
| 47 | + } | |
| 48 | + | |
| 49 | + | |
| 50 | +} | |
| 0 | 51 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Cibermag | |
| 5 | + * Date: 07.09.2015 | |
| 6 | + * Time: 15:56 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | +use yii\base\Component; | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | +class YiiMultiparser extends Component{ | |
| 17 | + | |
| 18 | +public $configuration; | |
| 19 | +public $parserHandler; | |
| 20 | +//public $file_path; | |
| 21 | + | |
| 22 | + public function init() | |
| 23 | + { | |
| 24 | + parent::init(); | |
| 25 | + $this->parserHandler = new YiiParserHandler( ); | |
| 26 | + $this->parserHandler->setConfiguration( $this->configuration ); | |
| 27 | + | |
| 28 | + } | |
| 29 | + | |
| 30 | + | |
| 31 | + public function parse( $filePath, $options = [] ){ | |
| 32 | + | |
| 33 | + // $this->file_path = $file_path; | |
| 34 | + $this->parserHandler->setup( $filePath, $options ); | |
| 35 | + | |
| 36 | + return $this->parserHandler->run(); | |
| 37 | + | |
| 38 | + } | |
| 39 | + | |
| 40 | + public function getConfiguration( $extension, $parameter ){ | |
| 41 | + | |
| 42 | + return $this->parserHandler->getCustomConfiguration( $extension, $parameter ); | |
| 43 | + | |
| 44 | + } | |
| 45 | + | |
| 46 | +} | |
| 0 | 47 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Cibermag | |
| 5 | + * Date: 07.09.2015 | |
| 6 | + * Time: 15:53 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace common\components\parsers; | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | +class YiiParserHandler extends ParserHandler{ | |
| 14 | + | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * @param $filePath | |
| 18 | + * @param array $options | |
| 19 | + * проверяет читабельность переданного файла, а также наличие настроек парсера в конфигурационном файле для данного типа файла | |
| 20 | + */ | |
| 21 | +// public function setup($file_path, $options = []) | |
| 22 | +// { | |
| 23 | +// $this->file_path = $file_path; | |
| 24 | +// if (isset($options['mode'])) { | |
| 25 | +// | |
| 26 | +// $this->mode = $options['mode']; | |
| 27 | +// unset($options['mode']); | |
| 28 | +// | |
| 29 | +// } else { | |
| 30 | +// | |
| 31 | +// $this->mode = self::DEFAULT_MODE; | |
| 32 | +// | |
| 33 | +// } | |
| 34 | +// | |
| 35 | +// $this->options = $options; | |
| 36 | +// | |
| 37 | +// try { | |
| 38 | +// $this->fileObject = new \SplFileObject($this->file_path, 'r'); | |
| 39 | +// } catch (\ErrorException $e) { | |
| 40 | +// // Yii::warning("Ошибка открытия файла {$this->file_path}"); | |
| 41 | +// echo "Ошибка открытия файла {$this->file_path}"; | |
| 42 | +// return []; | |
| 43 | +// } | |
| 44 | +// | |
| 45 | +// $options['file'] = $this->fileObject; | |
| 46 | +// $this->extension = $this->fileObject->getExtension(); | |
| 47 | +// | |
| 48 | +// try { | |
| 49 | +// | |
| 50 | +// $this->configuration = array_merge_recursive ($this->configuration, $options); | |
| 51 | +// | |
| 52 | +// } catch (\ErrorException $e) { | |
| 53 | +// echo $e->getMessage(); | |
| 54 | +// return []; | |
| 55 | +// } | |
| 56 | +// | |
| 57 | +// } | |
| 58 | +// | |
| 59 | +// public function run() | |
| 60 | +// { | |
| 61 | +// | |
| 62 | +// $result = []; | |
| 63 | +// | |
| 64 | +// // \common\components\CustomVarDamp::dumpAndDie($this); | |
| 65 | +// if (count($this->configuration)) { | |
| 66 | +// $parser = \Yii::createObject($this->configuration); | |
| 67 | +// | |
| 68 | +// try { | |
| 69 | +// | |
| 70 | +// $parser->setup(); | |
| 71 | +// $result = $parser->read(); | |
| 72 | +// | |
| 73 | +// } catch (\ErrorException $e) { | |
| 74 | +// | |
| 75 | +// echo $e->getMessage(); | |
| 76 | +// | |
| 77 | +// } | |
| 78 | +// | |
| 79 | +// } | |
| 80 | +// | |
| 81 | +// return $result; | |
| 82 | +// } | |
| 83 | + protected function createObjectByConfiguration($configuration) | |
| 84 | + { | |
| 85 | + return \Yii::createObject($configuration); | |
| 86 | + } | |
| 87 | + | |
| 88 | + | |
| 89 | +} | |
| 0 | 90 | \ No newline at end of file | ... | ... |
common/components/parsers/config.php
| ... | ... | @@ -6,7 +6,8 @@ |
| 6 | 6 | 'auto_detect_first_line' => true, |
| 7 | 7 | 'converter_conf' => [ |
| 8 | 8 | 'class' => 'common\components\parsers\CustomConverter', |
| 9 | - 'configuration' => ["encode" => 'DESCR'],] | |
| 9 | + 'configuration' => ["encode" => 'DESCR'], | |
| 10 | + ] | |
| 10 | 11 | ], |
| 11 | 12 | 'console' => |
| 12 | 13 | ['class' => 'common\components\parsers\CustomCsvParser', |
| ... | ... | @@ -39,7 +40,6 @@ |
| 39 | 40 | 'crosses' => ['class' => 'common\components\parsers\CustomCsvParser', |
| 40 | 41 | 'auto_detect_first_line' => true, |
| 41 | 42 | 'min_column_quantity' => 4, |
| 42 | - // 'keys' =>['ARTICLE', 'CROSS_ARTICLE', 'BRAND', 'CROSS_BRAND'], | |
| 43 | 43 | 'converter_conf' => [ |
| 44 | 44 | 'class' => ' common\components\parsers\CustomConverter', |
| 45 | 45 | 'hasKey' => 1, |
| ... | ... | @@ -58,7 +58,7 @@ |
| 58 | 58 | ], |
| 59 | 59 | 'xml' => |
| 60 | 60 | ['console' => |
| 61 | - ['class' => 'yii\multiparser\XmlParser', | |
| 61 | + ['class' => 'common\components\parsers\XmlParser', | |
| 62 | 62 | 'node' => 'Товар', |
| 63 | 63 | 'has_header_row' => true, |
| 64 | 64 | 'keys' => [ |
| ... | ... | @@ -78,7 +78,7 @@ |
| 78 | 78 | ], |
| 79 | 79 | 'xlsx' => |
| 80 | 80 | ['web' => |
| 81 | - ['class' => 'yii\multiparser\XlsxParser', | |
| 81 | + ['class' => 'common\components\parsers\XlsxParser', | |
| 82 | 82 | 'path_for_extract_files' => \Yii::getAlias('@temp_upload') . '/xlsx/', |
| 83 | 83 | //'auto_detect_first_line' => true, |
| 84 | 84 | //'has_header_row' => true, | ... | ... |
common/config/main.php
| ... | ... | @@ -15,11 +15,11 @@ return [ |
| 15 | 15 | ] |
| 16 | 16 | ], |
| 17 | 17 | 'multiparser'=>[ |
| 18 | - 'class' => 'yii\multiparser\YiiMultiparser', | |
| 18 | + 'class' => 'common\components\parsers\YiiMultiparser', | |
| 19 | 19 | 'configuration' => $mp_configuration, |
| 20 | 20 | ], |
| 21 | 21 | 'converter'=>[ |
| 22 | - 'class' => 'yii\multiparser\YiiConverter', | |
| 22 | + 'class' => 'common\components\parsers\YiiConverter', | |
| 23 | 23 | 'configuration' => [ |
| 24 | 24 | 'class' => 'common\components\parsers\CustomConverter' |
| 25 | 25 | ], | ... | ... |
common/models/Accounts.php
| ... | ... | @@ -13,6 +13,7 @@ use yii\db\ActiveRecord; |
| 13 | 13 | * @property integer $id |
| 14 | 14 | * @property integer $if_manager |
| 15 | 15 | * @property string $email |
| 16 | + * @property string $auth_key | |
| 16 | 17 | * @property string $pass |
| 17 | 18 | * @property integer $margin_id |
| 18 | 19 | * @property string $name |
| ... | ... | @@ -53,6 +54,11 @@ class Accounts extends ActiveRecord implements IdentityInterface |
| 53 | 54 | public $re_pass; |
| 54 | 55 | public $surname; |
| 55 | 56 | public $country_region; |
| 57 | + public $verifyCode; | |
| 58 | + public $auth_key; | |
| 59 | + public $password_hash; | |
| 60 | + public $password_reset_token; | |
| 61 | + | |
| 56 | 62 | |
| 57 | 63 | /** |
| 58 | 64 | * @inheritdoc |
| ... | ... | @@ -66,6 +72,7 @@ class Accounts extends ActiveRecord implements IdentityInterface |
| 66 | 72 | public function beforeSave() |
| 67 | 73 | { |
| 68 | 74 | $this->dt = time(); |
| 75 | + $this->name = $this->surname.' '.$this->name; | |
| 69 | 76 | return true; |
| 70 | 77 | |
| 71 | 78 | } |
| ... | ... | @@ -89,7 +96,11 @@ class Accounts extends ActiveRecord implements IdentityInterface |
| 89 | 96 | [['email'], 'unique'], |
| 90 | 97 | [['email'], 'email'], |
| 91 | 98 | ['re_pass', 'compare', 'compareAttribute' => 'pass'], |
| 92 | - ['dt', 'date', 'format' => 'Y.m.d'] | |
| 99 | + ['verifyCode', 'captcha'], | |
| 100 | + ['dt', 'date', 'format' => 'Y.m.d'], | |
| 101 | + [['rating','if_manager','set_manager_id','balance'], 'default', 'value' => '0'], | |
| 102 | + [['is_active','margin_id','office_id','is_scribe'], 'default', 'value' => '1'], | |
| 103 | + [['comment'], 'default', 'value' => 'Новый пользователь'], | |
| 93 | 104 | ]; |
| 94 | 105 | } |
| 95 | 106 | |
| ... | ... | @@ -149,56 +160,7 @@ class Accounts extends ActiveRecord implements IdentityInterface |
| 149 | 160 | { |
| 150 | 161 | |
| 151 | 162 | if ($this->validate()) { |
| 152 | - $this->name = $this->surname.' '.$this->name; | |
| 153 | - | |
| 154 | - if( $this->is_firm ){ | |
| 155 | - $this->if_manager = '0'; | |
| 156 | - $this->margin_id = '1'; | |
| 157 | - $this->address = ''; | |
| 158 | - $this->comment = 'Новый пользователь'; | |
| 159 | - $this->rating = '0'; | |
| 160 | - $this->is_active = '1'; | |
| 161 | - $this->last_loginin = ''; | |
| 162 | - $this->firm_inn = ''; | |
| 163 | - $this->firm_bank =''; | |
| 164 | - $this->balance ='0.00'; | |
| 165 | - $this->office_id ='1'; | |
| 166 | - $this->is_scribe ='1'; | |
| 167 | - $this->set_manager_id ='0'; | |
| 168 | - $this->phones2=''; | |
| 169 | - $this->phones3 =''; | |
| 170 | - $this->snumb =''; | |
| 171 | - $this->firm_ur_adr =''; | |
| 172 | - $this->firm_fiz_adr = ''; | |
| 173 | - $this->firm_code_eg = ''; | |
| 174 | - $this->firm_rs = ''; | |
| 175 | - $this->firm_mfo = ''; | |
| 176 | - $this->firm_site = ''; | |
| 177 | - }else{ | |
| 178 | - | |
| 179 | - $this->if_manager = '0'; | |
| 180 | - $this->margin_id = '1'; | |
| 181 | - $this->address = ''; | |
| 182 | - $this->comment = 'Новый пользователь'; | |
| 183 | - $this->rating = '0'; | |
| 184 | - $this->is_active = '1'; | |
| 185 | - $this->last_loginin = ''; | |
| 186 | - $this->firm_inn = ''; | |
| 187 | - $this->firm_bank =''; | |
| 188 | - $this->balance ='0.00'; | |
| 189 | - $this->office_id ='1'; | |
| 190 | - $this->is_scribe ='1'; | |
| 191 | - $this->set_manager_id ='0'; | |
| 192 | - $this->phones2=''; | |
| 193 | - $this->phones3 =''; | |
| 194 | - $this->snumb =''; | |
| 195 | - $this->firm_ur_adr =''; | |
| 196 | - $this->firm_fiz_adr = ''; | |
| 197 | - $this->firm_code_eg = ''; | |
| 198 | - $this->firm_rs = ''; | |
| 199 | - $this->firm_mfo = ''; | |
| 200 | - $this->firm_site = ''; | |
| 201 | - } | |
| 163 | + | |
| 202 | 164 | |
| 203 | 165 | if ($this->save()) { |
| 204 | 166 | return $this; |
| ... | ... | @@ -224,14 +186,14 @@ class Accounts extends ActiveRecord implements IdentityInterface |
| 224 | 186 | } |
| 225 | 187 | |
| 226 | 188 | /** |
| 227 | - * Finds user by username | |
| 189 | + * Finds user by email | |
| 228 | 190 | * |
| 229 | - * @param string $username | |
| 191 | + * @param string $email | |
| 230 | 192 | * @return static|null |
| 231 | 193 | */ |
| 232 | - public static function findByUsername($username) | |
| 194 | + public static function findByEmail($email) | |
| 233 | 195 | { |
| 234 | - return static::findOne(['name' => $username]); | |
| 196 | + return static::findOne(['email' => $email]); | |
| 235 | 197 | } |
| 236 | 198 | |
| 237 | 199 | /** |
| ... | ... | @@ -283,4 +245,27 @@ class Accounts extends ActiveRecord implements IdentityInterface |
| 283 | 245 | { |
| 284 | 246 | $this->password_reset_token = null; |
| 285 | 247 | } |
| 248 | + | |
| 249 | + /** | |
| 250 | + * Finds out if password reset token is valid | |
| 251 | + * | |
| 252 | + * @param string $token password reset token | |
| 253 | + * @return boolean | |
| 254 | + */ | |
| 255 | + public static function isPasswordResetTokenValid($token) | |
| 256 | + { | |
| 257 | + if (empty($token)) { | |
| 258 | + return false; | |
| 259 | + } | |
| 260 | + $expire = Yii::$app->params['user.passwordResetTokenExpire']; | |
| 261 | + $parts = explode('_', $token); | |
| 262 | + $timestamp = (int) end($parts); | |
| 263 | + return $timestamp + $expire >= time(); | |
| 264 | + } | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 286 | 271 | } | ... | ... |
common/models/AccountsForm.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace common\models; | |
| 4 | - | |
| 5 | -use Yii; | |
| 6 | -use yii\web\IdentityInterface; | |
| 7 | -use yii\base\NotSupportedException; | |
| 8 | -use yii\db\ActiveRecord; | |
| 9 | -/** | |
| 10 | - * This is the model class for table "w_accounts". | |
| 11 | - * | |
| 12 | - * | |
| 13 | - * @property integer $id | |
| 14 | - * @property integer $if_manager | |
| 15 | - * @property string $email | |
| 16 | - * @property string $pass | |
| 17 | - * @property integer $margin_id | |
| 18 | - * @property string $name | |
| 19 | - * @property string $phones | |
| 20 | - * @property integer $country | |
| 21 | - * @property integer $city | |
| 22 | - * @property string $address | |
| 23 | - * @property string $comment | |
| 24 | - * @property integer $rating | |
| 25 | - * @property string $dt | |
| 26 | - * @property integer $is_active | |
| 27 | - * @property integer $is_firm | |
| 28 | - * @property string $last_loginin | |
| 29 | - * @property string $firm_inn | |
| 30 | - * @property string $firm_bank | |
| 31 | - * @property double $balance | |
| 32 | - * @property integer $office_id | |
| 33 | - * @property integer $is_scribe | |
| 34 | - * @property integer $set_manager_id | |
| 35 | - * @property string $phones2 | |
| 36 | - * @property string $phones3 | |
| 37 | - * @property integer $car | |
| 38 | - * @property integer $mod | |
| 39 | - * @property string $snumb | |
| 40 | - * @property integer $deliveries | |
| 41 | - * @property integer $scode | |
| 42 | - * @property string $firm_ur_adr | |
| 43 | - * @property string $firm_fiz_adr | |
| 44 | - * @property string $firm_code_eg | |
| 45 | - * @property string $firm_rs | |
| 46 | - * @property string $firm_mfo | |
| 47 | - * @property string $firm_site | |
| 48 | - * @property string $company | |
| 49 | - */ | |
| 50 | -class AccountsForm extends ActiveRecord | |
| 51 | -{ | |
| 52 | - | |
| 53 | - public $re_pass; | |
| 54 | - public $surname; | |
| 55 | - public $verifyCode; | |
| 56 | - public $country_region; | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * @inheritdoc | |
| 60 | - */ | |
| 61 | - public static function tableName() | |
| 62 | - { | |
| 63 | - return 'w_accounts'; | |
| 64 | - } | |
| 65 | - | |
| 66 | - | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * @inheritdoc | |
| 70 | - */ | |
| 71 | - public function rules() | |
| 72 | - { | |
| 73 | - return [ | |
| 74 | - [['if_manager', 'margin_id', 'country', 'city', 'rating', 'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'], | |
| 75 | - [['company','email', 'pass', 'name','surname', 'phones',], 'required'], | |
| 76 | - [['comment'], 'string'], | |
| 77 | - [['balance'], 'number'], | |
| 78 | - [['email', 'name','surname', 'firm_site'], 'string', 'max' => 150], | |
| 79 | - [['pass','re_pass'], 'string', 'max' => 30], | |
| 80 | - [['phones', 'phones2', 'phones3'], 'string', 'max' => 50], | |
| 81 | - [['address', 'firm_inn', 'firm_bank'], 'string', 'max' => 254], | |
| 82 | - [['last_loginin'], 'string', 'max' => 15], | |
| 83 | - [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255], | |
| 84 | - [['email'], 'unique'], | |
| 85 | - [['email'], 'email'], | |
| 86 | - ['re_pass', 'compare', 'compareAttribute' => 'pass'], | |
| 87 | - ['verifyCode', 'captcha'], | |
| 88 | - ['dt', 'date', 'format' => 'Y.m.d'] | |
| 89 | - ]; | |
| 90 | - } | |
| 91 | - | |
| 92 | - /** | |
| 93 | - * @inheritdoc | |
| 94 | - */ | |
| 95 | - public function attributeLabels() | |
| 96 | - { | |
| 97 | - return [ | |
| 98 | - 'id' => 'ID', | |
| 99 | - 'if_manager' => 'Статус менеджера', | |
| 100 | - 'email' => 'E-mail (Логин)', | |
| 101 | - 'pass' => 'Пароль', | |
| 102 | - 'margin_id' => 'Тип цены', | |
| 103 | - 'name' => 'Имя', | |
| 104 | - 'phones' => 'Телефоны', | |
| 105 | - 'country' => Yii::t('app', 'Country'), | |
| 106 | - 'city' =>'Город', | |
| 107 | - 'address' => 'Адрес', | |
| 108 | - 'comment' => 'Комментарий', | |
| 109 | - 'rating' => Yii::t('app', 'Rating'), | |
| 110 | - 'dt' =>'Дата регистрации', | |
| 111 | - 'is_active' => 'Активный', | |
| 112 | - 'is_firm' => 'Юридическое лицо', | |
| 113 | - 'last_loginin' => Yii::t('app', 'Last Loginin'), | |
| 114 | - 'firm_inn' => 'ИНН', | |
| 115 | - 'firm_bank' => 'Банк', | |
| 116 | - 'balance' => Yii::t('app', 'Balance'), | |
| 117 | - 'office_id' => Yii::t('app', 'Office ID'), | |
| 118 | - 'is_scribe' => 'Подписка', | |
| 119 | - 'set_manager_id' => 'Персональный менеджер', | |
| 120 | - 'phones2' => 'Телефоны 2', | |
| 121 | - 'phones3' => 'Телефоны 3', | |
| 122 | - 'car' => Yii::t('app', 'Car'), | |
| 123 | - 'mod' => Yii::t('app', 'Mod'), | |
| 124 | - 'snumb' => 'snumb', | |
| 125 | - 'deliveries' => Yii::t('app', 'Deliveries'), | |
| 126 | - 'scode' => 'Код в 1С', | |
| 127 | - 'firm_ur_adr' => 'Юридический адрес', | |
| 128 | - 'firm_fiz_adr' => 'Физический адрес', | |
| 129 | - 'firm_code_eg' => 'Код ЭГ', | |
| 130 | - 'firm_rs' => 'Расчётный счёт', | |
| 131 | - 'firm_mfo' => 'МФО', | |
| 132 | - 'firm_site' => 'Сайт', | |
| 133 | - 'company' => 'Название фирмы', | |
| 134 | - 'country_region' => 'Регион' | |
| 135 | - ]; | |
| 136 | - } | |
| 137 | - | |
| 138 | - | |
| 139 | -} |
common/models/MarginsGroups.php
| ... | ... | @@ -31,12 +31,13 @@ class MarginsGroups extends \yii\db\ActiveRecord |
| 31 | 31 | public function rules() |
| 32 | 32 | { |
| 33 | 33 | return [ |
| 34 | - [['importer_id', 'margin_id', 'group', 'koef'], 'required'], | |
| 35 | - [['importer_id', 'margin_id'], 'integer'], | |
| 36 | - [['koef'], 'number'], | |
| 37 | - [['timestamp'], 'safe'], | |
| 38 | - [['group'], 'string', 'max' => 200], | |
| 39 | - [['importer_id', 'margin_id', 'group'], 'unique', 'targetAttribute' => ['importer_id', 'margin_id', 'group'], 'message' => 'The combination of Importer ID, Margin ID and Group has already been taken.'] | |
| 34 | + [['group','importer_id', 'margin_id', 'koef'], 'required', 'on' => 'default'], | |
| 35 | + [['margin_id'], 'required', 'on' => 'form_upload_validation', 'message' => 'Должен быть указан хотя бы один тип цен.'], | |
| 36 | + [['group'], 'required', 'on' => 'form_upload_validation', 'message' => 'Группа RG - обязательное поле.'], | |
| 37 | + [['importer_id', 'margin_id'], 'integer' , 'on' => 'default'], | |
| 38 | + [['koef'], 'number' , 'on' => 'default'], | |
| 39 | + [['timestamp'], 'safe' , 'on' => 'default'], | |
| 40 | + [['group'], 'string', 'max' => 200 , 'on' => 'default'], | |
| 40 | 41 | ]; |
| 41 | 42 | } |
| 42 | 43 | |
| ... | ... | @@ -83,7 +84,6 @@ class MarginsGroups extends \yii\db\ActiveRecord |
| 83 | 84 | //@todo - вынести все ручные инсерты в отдельный класс |
| 84 | 85 | public static function ManualInsertWithUpdate($data, $keys) |
| 85 | 86 | { |
| 86 | - // \common\components\CustomVarDamp::dumpAndDie($data); | |
| 87 | 87 | $table_name = self::tableName(); |
| 88 | 88 | $keys_arr = array_keys($data[0]); |
| 89 | 89 | // найдем те поля которые не являются ключами. Их нужно будет при дубляже апдейтить |
| ... | ... | @@ -107,9 +107,9 @@ class MarginsGroups extends \yii\db\ActiveRecord |
| 107 | 107 | |
| 108 | 108 | // добавим фрагмент с апдейтом при дубляже |
| 109 | 109 | $query = "{$query_insert} {$query_update}"; |
| 110 | - // \common\components\CustomVarDamp::dumpAndDie($query); | |
| 111 | 110 | Yii::$app->db->createCommand($query)->execute(); |
| 112 | 111 | |
| 113 | 112 | } |
| 113 | + return true; | |
| 114 | 114 | } |
| 115 | 115 | } | ... | ... |
common/models/News.php
common/models/Page.php
| ... | ... | @@ -33,7 +33,7 @@ class Page extends \yii\db\ActiveRecord |
| 33 | 33 | public function rules() |
| 34 | 34 | { |
| 35 | 35 | return [ |
| 36 | - [['name', 'code', 'content', 'title', 'kwords', 'descr'], 'required'], | |
| 36 | + [['name', 'code', 'content'], 'required'], | |
| 37 | 37 | [['content'], 'string'], |
| 38 | 38 | [['sort', 'is_active'], 'integer'], |
| 39 | 39 | [['name'], 'string', 'max' => 100], | ... | ... |
common/models/User.php
| ... | ... | @@ -130,6 +130,7 @@ class User extends ActiveRecord implements IdentityInterface |
| 130 | 130 | */ |
| 131 | 131 | public function getAuthKey() |
| 132 | 132 | { |
| 133 | + | |
| 133 | 134 | return $this->auth_key; |
| 134 | 135 | } |
| 135 | 136 | |
| ... | ... | @@ -138,6 +139,7 @@ class User extends ActiveRecord implements IdentityInterface |
| 138 | 139 | */ |
| 139 | 140 | public function validateAuthKey($authKey) |
| 140 | 141 | { |
| 142 | + | |
| 141 | 143 | return $this->getAuthKey() === $authKey; |
| 142 | 144 | } |
| 143 | 145 | ... | ... |
| 1 | +<?php | |
| 2 | +namespace common\models; | |
| 3 | + | |
| 4 | +use Yii; | |
| 5 | +use yii\base\Model; | |
| 6 | +use yii\web\IdentityInterface; | |
| 7 | +/** | |
| 8 | + * Login form | |
| 9 | + */ | |
| 10 | +class UserLoginForm extends Model | |
| 11 | +{ | |
| 12 | + public $email; | |
| 13 | + public $pass; | |
| 14 | + public $rememberMe = true; | |
| 15 | + | |
| 16 | + private $_user; | |
| 17 | + | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * @inheritdoc | |
| 21 | + */ | |
| 22 | + public function rules() | |
| 23 | + { | |
| 24 | + return [ | |
| 25 | + // email and password are both required | |
| 26 | + [['email', 'pass'], 'required'], | |
| 27 | + // rememberMe must be a boolean value | |
| 28 | + ['rememberMe', 'boolean'], | |
| 29 | + // password is validated by validatePassword() | |
| 30 | + ['pass', 'validatePassword'], | |
| 31 | + ]; | |
| 32 | + } | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * Validates the password. | |
| 36 | + * This method serves as the inline validation for password. | |
| 37 | + * | |
| 38 | + * @param string $attribute the attribute currently being validated | |
| 39 | + * @param array $params the additional name-value pairs given in the rule | |
| 40 | + */ | |
| 41 | + public function validatePassword($attribute, $params) | |
| 42 | + { | |
| 43 | + if (!$this->hasErrors()) { | |
| 44 | + $user = $this->getUser(); | |
| 45 | + if (!$user || $user->pass != $this->pass) { | |
| 46 | + $this->addError($attribute, 'Неправильный логин или пароль'); | |
| 47 | + } | |
| 48 | + } | |
| 49 | + } | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * Logs in a user using the provided email and password. | |
| 53 | + * | |
| 54 | + * @return boolean whether the user is logged in successfully | |
| 55 | + */ | |
| 56 | + public function login() | |
| 57 | + { | |
| 58 | + | |
| 59 | + if ($this->validate()) { | |
| 60 | + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); | |
| 61 | + } else { | |
| 62 | + return false; | |
| 63 | + } | |
| 64 | + | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * Finds user by [[email]] | |
| 69 | + * | |
| 70 | + * @return User|null | |
| 71 | + */ | |
| 72 | + protected function getUser() | |
| 73 | + { | |
| 74 | + if ($this->_user === null) { | |
| 75 | + $this->_user = Accounts::findByEmail($this->email); | |
| 76 | + } | |
| 77 | + | |
| 78 | + return $this->_user; | |
| 79 | + } | |
| 80 | +} | ... | ... |
composer.json
| ... | ... | @@ -18,7 +18,6 @@ |
| 18 | 18 | "yiisoft/yii2": ">=2.0.6", |
| 19 | 19 | "yiisoft/yii2-bootstrap": "*", |
| 20 | 20 | "yiisoft/yii2-swiftmailer": "*", |
| 21 | - "artweb/yii2-multiparser": "dev-master", | |
| 22 | 21 | "yiisoft/yii2-imagine": "*", |
| 23 | 22 | "kartik-v/yii2-widget-datepicker": "^1.3", |
| 24 | 23 | "kartik-v/yii2-field-range": "^1.3", | ... | ... |
composer.lock
| ... | ... | @@ -4,8 +4,8 @@ |
| 4 | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", |
| 5 | 5 | "This file is @generated automatically" |
| 6 | 6 | ], |
| 7 | - "hash": "ef2a3d61acaf167816352c75435bf866", | |
| 8 | - "content-hash": "564f961bb15ae30084c1aebd1e870b19", | |
| 7 | + "hash": "f6d5550f22108e48d542a099d5e9a3ea", | |
| 8 | + "content-hash": "bc7f313c8871095badc7533a53ff3d53", | |
| 9 | 9 | "packages": [ |
| 10 | 10 | { |
| 11 | 11 | "name": "2amigos/yii2-ckeditor-widget", |
| ... | ... | @@ -67,51 +67,6 @@ |
| 67 | 67 | "time": "2015-04-30 12:22:25" |
| 68 | 68 | }, |
| 69 | 69 | { |
| 70 | - "name": "artweb/yii2-multiparser", | |
| 71 | - "version": "dev-master", | |
| 72 | - "source": { | |
| 73 | - "type": "git", | |
| 74 | - "url": "https://github.com/tsurkanovm/yii-multiparser.git", | |
| 75 | - "reference": "735c416d56e4714656cd8ca37070af692439e770" | |
| 76 | - }, | |
| 77 | - "dist": { | |
| 78 | - "type": "zip", | |
| 79 | - "url": "https://api.github.com/repos/tsurkanovm/yii-multiparser/zipball/58f734e65052303e9fcf7875b089c985a5d2eee7", | |
| 80 | - "reference": "735c416d56e4714656cd8ca37070af692439e770", | |
| 81 | - "shasum": "" | |
| 82 | - }, | |
| 83 | - "require": { | |
| 84 | - "yiisoft/yii2": "*" | |
| 85 | - }, | |
| 86 | - "type": "library", | |
| 87 | - "autoload": { | |
| 88 | - "psr-4": { | |
| 89 | - "yii\\multiparser\\": "lib\\" | |
| 90 | - } | |
| 91 | - }, | |
| 92 | - "notification-url": "https://packagist.org/downloads/", | |
| 93 | - "license": [ | |
| 94 | - "MIT" | |
| 95 | - ], | |
| 96 | - "authors": [ | |
| 97 | - { | |
| 98 | - "name": "Mihail Tsurkanov", | |
| 99 | - "email": "tsurkanovm@gmail.com", | |
| 100 | - "role": "Developer" | |
| 101 | - } | |
| 102 | - ], | |
| 103 | - "description": "This extension provides a Multiparser solution for Yii framework 2.0.", | |
| 104 | - "homepage": "https://github.com/tsurkanovm/yii-multiparser.git", | |
| 105 | - "keywords": [ | |
| 106 | - "csv", | |
| 107 | - "parser", | |
| 108 | - "xlsx", | |
| 109 | - "xml", | |
| 110 | - "yii2" | |
| 111 | - ], | |
| 112 | - "time": "2015-11-10 15:55:00" | |
| 113 | - }, | |
| 114 | - { | |
| 115 | 70 | "name": "bower-asset/bootstrap", |
| 116 | 71 | "version": "v3.3.5", |
| 117 | 72 | "source": { |
| ... | ... | @@ -848,16 +803,16 @@ |
| 848 | 803 | }, |
| 849 | 804 | { |
| 850 | 805 | "name": "kartik-v/bootstrap-fileinput", |
| 851 | - "version": "v4.2.7", | |
| 806 | + "version": "v4.2.8", | |
| 852 | 807 | "source": { |
| 853 | 808 | "type": "git", |
| 854 | 809 | "url": "https://github.com/kartik-v/bootstrap-fileinput.git", |
| 855 | - "reference": "0468bbba9c28c1250aca83eba9b33e32ec135f78" | |
| 810 | + "reference": "6ba4295298ee3abe26171b4e2078c27a2f3b35b0" | |
| 856 | 811 | }, |
| 857 | 812 | "dist": { |
| 858 | 813 | "type": "zip", |
| 859 | - "url": "https://api.github.com/repos/kartik-v/bootstrap-fileinput/zipball/0468bbba9c28c1250aca83eba9b33e32ec135f78", | |
| 860 | - "reference": "0468bbba9c28c1250aca83eba9b33e32ec135f78", | |
| 814 | + "url": "https://api.github.com/repos/kartik-v/bootstrap-fileinput/zipball/6ba4295298ee3abe26171b4e2078c27a2f3b35b0", | |
| 815 | + "reference": "6ba4295298ee3abe26171b4e2078c27a2f3b35b0", | |
| 861 | 816 | "shasum": "" |
| 862 | 817 | }, |
| 863 | 818 | "type": "library", |
| ... | ... | @@ -892,7 +847,7 @@ |
| 892 | 847 | "progress", |
| 893 | 848 | "upload" |
| 894 | 849 | ], |
| 895 | - "time": "2015-09-13 17:39:44" | |
| 850 | + "time": "2015-11-18 17:56:04" | |
| 896 | 851 | }, |
| 897 | 852 | { |
| 898 | 853 | "name": "kartik-v/php-date-formatter", |
| ... | ... | @@ -3299,7 +3254,6 @@ |
| 3299 | 3254 | "aliases": [], |
| 3300 | 3255 | "minimum-stability": "stable", |
| 3301 | 3256 | "stability-flags": { |
| 3302 | - "artweb/yii2-multiparser": 20, | |
| 3303 | 3257 | "kartik-v/yii2-datecontrol": 20, |
| 3304 | 3258 | "kartik-v/yii2-widget-fileinput": 20 |
| 3305 | 3259 | }, | ... | ... |
console/controllers/ParserController.php
| ... | ... | @@ -39,7 +39,7 @@ class ParserController extends Controller |
| 39 | 39 | 'multiplier' => $multiplier], |
| 40 | 40 | 'mode' => 'console'] |
| 41 | 41 | ]; |
| 42 | - if ($this->parseFileConsole($file_path, $config)) { | |
| 42 | + if ( $this->parseFileConsole( $file_path, $config ) ) { | |
| 43 | 43 | unlink(\Yii::getAlias('@temp_upload') . '/' . $file_name . '.csv'); |
| 44 | 44 | \Yii::info("Загрузка файла - $file_path успешно завершена", 'parser'); |
| 45 | 45 | } else { |
| ... | ... | @@ -71,12 +71,16 @@ class ParserController extends Controller |
| 71 | 71 | $writer->setData( $data ); |
| 72 | 72 | $writer->setMode( 1 ); //console-режим |
| 73 | 73 | |
| 74 | - if ( $writer->writePriceToDB() ){ | |
| 74 | + $writer->writePriceToDB(); | |
| 75 | + if ( $writer->hasValidationError() ) { | |
| 76 | + \Yii::error( $writer->getValidatedMsg(), 'parser' ); | |
| 77 | + }else{ | |
| 78 | + \Yii::info( $writer->getValidatedMsg(), 'parser' ); | |
| 79 | + } | |
| 80 | + | |
| 75 | 81 | |
| 76 | 82 | return true; |
| 77 | - } | |
| 78 | 83 | |
| 79 | - return false; | |
| 80 | 84 | } |
| 81 | 85 | |
| 82 | 86 | public function actionParseXml () | ... | ... |
console/migrations/m151201_151524_add_field_auth_key_for_accounts.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\db\Schema; | |
| 4 | +use yii\db\Migration; | |
| 5 | + | |
| 6 | +class m151201_151524_add_field_auth_key_for_accounts extends Migration | |
| 7 | +{ | |
| 8 | + public function up() | |
| 9 | + { | |
| 10 | + $view = <<< MySQL | |
| 11 | + ALTER TABLE `italautocomua`.`w_accounts` | |
| 12 | + ADD COLUMN `auth_key` VARCHAR(255) NULL AFTER `email`; | |
| 13 | +MySQL; | |
| 14 | + $this->execute($view); | |
| 15 | + } | |
| 16 | + | |
| 17 | + public function down() | |
| 18 | + { | |
| 19 | + echo "m151201_151524_add_field_auth_key_for_accounts cannot be reverted.\n"; | |
| 20 | + | |
| 21 | + return false; | |
| 22 | + } | |
| 23 | + | |
| 24 | + /* | |
| 25 | + // Use safeUp/safeDown to run migration code within a transaction | |
| 26 | + public function safeUp() | |
| 27 | + { | |
| 28 | + } | |
| 29 | + | |
| 30 | + public function safeDown() | |
| 31 | + { | |
| 32 | + } | |
| 33 | + */ | |
| 34 | +} | ... | ... |
frontend/config/main.php
| ... | ... | @@ -13,16 +13,25 @@ return [ |
| 13 | 13 | 'controllerNamespace' => 'frontend\controllers', |
| 14 | 14 | 'components' => [ |
| 15 | 15 | 'user' => [ |
| 16 | - 'identityClass' => 'common\models\User', | |
| 16 | + 'identityClass' => 'common\models\Accounts', | |
| 17 | 17 | 'enableAutoLogin' => true, |
| 18 | + 'identityCookie' => [ | |
| 19 | + 'name' => '_frontendUser', // unique for frontend | |
| 20 | + ] | |
| 18 | 21 | ], |
| 19 | 22 | 'request'=>[ |
| 20 | - | |
| 23 | + 'cookieValidationKey' => 'ndahjhjjidasuidrqeswuiuirqw89', | |
| 24 | + 'csrfParam' => '_frontendCSRF', | |
| 21 | 25 | 'class' => 'common\components\Request', |
| 22 | 26 | |
| 23 | 27 | 'web'=> '/frontend/web' |
| 24 | 28 | |
| 25 | 29 | ], |
| 30 | + 'session' => [ | |
| 31 | + 'name' => 'PHPFRONTSESSID', | |
| 32 | + 'savePath' => __DIR__ . '/../tmp', | |
| 33 | + | |
| 34 | + ], | |
| 26 | 35 | 'log' => [ |
| 27 | 36 | 'traceLevel' => YII_DEBUG ? 3 : 0, |
| 28 | 37 | 'targets' => [ |
| ... | ... | @@ -41,9 +50,10 @@ return [ |
| 41 | 50 | 'enablePrettyUrl' => true, |
| 42 | 51 | 'showScriptName' => false, |
| 43 | 52 | 'rules' => [ |
| 44 | - 'news/<translit:\d+>' => 'news/view', | |
| 53 | + 'news/<translit:[\w-]+>' => 'news/view', | |
| 45 | 54 | 'news' => 'news/index', |
| 46 | 55 | 'page/<translit:[\w-]+>'=>'page/view', |
| 56 | + 'company/<translit:[\w-]+>'=>'page/about', | |
| 47 | 57 | 'goods/one-item/<translit:[\w-]+>'=>'goods/one-item', |
| 48 | 58 | 'goods/view/<translit:[\w-]+>'=>'goods/view', |
| 49 | 59 | 'stone/view/<translit:[\w-]+>'=>'stone/view', | ... | ... |
| 1 | +<?php | |
| 2 | +namespace frontend\controllers; | |
| 3 | + | |
| 4 | + | |
| 5 | +use common\models\Accounts; | |
| 6 | +use Yii; | |
| 7 | +use common\models\News; | |
| 8 | +use yii\data\ActiveDataProvider; | |
| 9 | +use yii\filters\AccessControl; | |
| 10 | +use yii\web\Controller; | |
| 11 | +use yii\web\NotFoundHttpException; | |
| 12 | + | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * Site controller | |
| 16 | + */ | |
| 17 | +class AccountsController extends Controller | |
| 18 | +{ | |
| 19 | + public $layout = '/internal'; | |
| 20 | + | |
| 21 | + | |
| 22 | + public function behaviors() | |
| 23 | + { | |
| 24 | + return [ | |
| 25 | + 'access' => [ | |
| 26 | + 'class' => AccessControl::className(), | |
| 27 | + 'rules' => [ | |
| 28 | + [ | |
| 29 | + 'actions' => ['cabinet',], | |
| 30 | + 'allow' => true, | |
| 31 | + 'roles' => ['@'], | |
| 32 | + ], | |
| 33 | + ], | |
| 34 | + ], | |
| 35 | + ]; | |
| 36 | + } | |
| 37 | + | |
| 38 | + | |
| 39 | + public function actionCabinet() | |
| 40 | + { | |
| 41 | + | |
| 42 | + return $this->render('cabinet',[ | |
| 43 | + 'model' => $this->findModel(Yii::$app->user->identity->id) | |
| 44 | + ]); | |
| 45 | + } | |
| 46 | + | |
| 47 | + public function actionIndex() | |
| 48 | + { | |
| 49 | + $dataProvider = new ActiveDataProvider([ | |
| 50 | + 'query' => News::find()->where(['is_active'=>1]), | |
| 51 | + 'pagination' => [ | |
| 52 | + 'pageSize' => 16, | |
| 53 | + ], | |
| 54 | + | |
| 55 | + ]); | |
| 56 | + return $this->render('index',[ | |
| 57 | + 'dataProvider' => $dataProvider | |
| 58 | + ]); | |
| 59 | + } | |
| 60 | + | |
| 61 | + public function actionView($translit) | |
| 62 | + { | |
| 63 | + | |
| 64 | + $activeNews = $this->findModel($translit); | |
| 65 | + $next_news = News::find()->where(['is_active'=>1])->andWhere('id > :id',[':id' => $activeNews->id])->one(); | |
| 66 | + $prev_news = News::find()->where(['is_active'=>1])->andWhere('id < :id',[':id' => $activeNews->id])->one(); | |
| 67 | + | |
| 68 | + return $this->render('view', [ | |
| 69 | + 'model' => $activeNews, | |
| 70 | + 'next_news' => $next_news instanceof News ? $next_news : '', | |
| 71 | + 'prev_news' => $prev_news instanceof News ? $prev_news : '' | |
| 72 | + ]); | |
| 73 | + } | |
| 74 | + | |
| 75 | + protected function findModel($id) | |
| 76 | + { | |
| 77 | + | |
| 78 | + if (($model = Accounts::findOne(["id"=>$id])) !== null) { | |
| 79 | + return $model; | |
| 80 | + } else { | |
| 81 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 82 | + } | |
| 83 | + } | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | +} | ... | ... |
frontend/controllers/NewsController.php
| ... | ... | @@ -32,10 +32,15 @@ class NewsController extends Controller |
| 32 | 32 | |
| 33 | 33 | public function actionView($translit) |
| 34 | 34 | { |
| 35 | - $news_list = News::find()->where(['is_active'=>1])->limit(3)->all(); | |
| 35 | + | |
| 36 | + $activeNews = $this->findModel($translit); | |
| 37 | + $next_news = News::find()->where(['is_active'=>1])->andWhere('id > :id',[':id' => $activeNews->id])->one(); | |
| 38 | + $prev_news = News::find()->where(['is_active'=>1])->andWhere('id < :id',[':id' => $activeNews->id])->one(); | |
| 39 | + | |
| 36 | 40 | return $this->render('view', [ |
| 37 | - 'model' => $this->findModel($translit), | |
| 38 | - 'news_list' => $news_list | |
| 41 | + 'model' => $activeNews, | |
| 42 | + 'next_news' => $next_news instanceof News ? $next_news : '', | |
| 43 | + 'prev_news' => $prev_news instanceof News ? $prev_news : '' | |
| 39 | 44 | ]); |
| 40 | 45 | } |
| 41 | 46 | |
| ... | ... | @@ -79,4 +84,6 @@ class NewsController extends Controller |
| 79 | 84 | "descr"=> "Отказ от рассылки ИталАвто" |
| 80 | 85 | ); |
| 81 | 86 | } |
| 87 | + | |
| 88 | + | |
| 82 | 89 | } | ... | ... |
frontend/controllers/PageController.php
| ... | ... | @@ -38,6 +38,15 @@ class PageController extends Controller |
| 38 | 38 | ]); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | + | |
| 42 | + public function actionAbout($translit) | |
| 43 | + { | |
| 44 | + | |
| 45 | + return $this->render('about_view', [ | |
| 46 | + 'model' => $this->findModel($translit), | |
| 47 | + ]); | |
| 48 | + } | |
| 49 | + | |
| 41 | 50 | protected function findModel($translit) |
| 42 | 51 | { |
| 43 | 52 | ... | ... |
frontend/controllers/SiteController.php
| ... | ... | @@ -2,12 +2,12 @@ |
| 2 | 2 | namespace frontend\controllers; |
| 3 | 3 | |
| 4 | 4 | use common\models\Accounts; |
| 5 | -use common\models\AccountsForm; | |
| 6 | 5 | use common\models\News; |
| 6 | +use common\models\Slider; | |
| 7 | 7 | use common\models\Team; |
| 8 | 8 | use common\models\TeamGroup; |
| 9 | 9 | use Yii; |
| 10 | -use common\models\LoginForm; | |
| 10 | +use common\models\UserLoginForm; | |
| 11 | 11 | use frontend\models\PasswordResetRequestForm; |
| 12 | 12 | use frontend\models\ResetPasswordForm; |
| 13 | 13 | use frontend\models\SignupForm; |
| ... | ... | @@ -50,10 +50,11 @@ class SiteController extends Controller |
| 50 | 50 | */ |
| 51 | 51 | public function actionIndex() |
| 52 | 52 | { |
| 53 | + | |
| 53 | 54 | $this->layout = '/outer'; |
| 54 | 55 | |
| 55 | 56 | $news_list = News::find()->where(['is_active'=>1])->limit(3)->all(); |
| 56 | - | |
| 57 | + $slider_list = Slider::find()->where(['is_active'=>1])->all(); | |
| 57 | 58 | if (Yii::$app->request->post()) { |
| 58 | 59 | |
| 59 | 60 | $post = Yii::$app->request->post(); |
| ... | ... | @@ -68,6 +69,7 @@ class SiteController extends Controller |
| 68 | 69 | |
| 69 | 70 | } |
| 70 | 71 | return $this->render('index',[ |
| 72 | + 'slider_list' => $slider_list, | |
| 71 | 73 | 'news_list' => $news_list |
| 72 | 74 | ]); |
| 73 | 75 | } |
| ... | ... | @@ -84,10 +86,15 @@ class SiteController extends Controller |
| 84 | 86 | } |
| 85 | 87 | |
| 86 | 88 | |
| 87 | - public function actionArticle() | |
| 89 | + public function actionTeam() | |
| 88 | 90 | { |
| 91 | + $teamGroups = TeamGroup::find()->all(); | |
| 92 | + | |
| 89 | 93 | $this->layout = '/internal'; |
| 90 | - return $this->render('article'); | |
| 94 | + return $this->render('team',[ | |
| 95 | + 'teamGroups' => $teamGroups, | |
| 96 | + ]); | |
| 97 | + | |
| 91 | 98 | } |
| 92 | 99 | |
| 93 | 100 | public function actionBc2Catalog() |
| ... | ... | @@ -120,11 +127,6 @@ class SiteController extends Controller |
| 120 | 127 | return $this->render('busket_step2'); |
| 121 | 128 | } |
| 122 | 129 | |
| 123 | - public function actionCabinet() | |
| 124 | - { | |
| 125 | - $this->layout = '/internal'; | |
| 126 | - return $this->render('cabinet'); | |
| 127 | - } | |
| 128 | 130 | |
| 129 | 131 | public function actionCatalogMarokStep2() |
| 130 | 132 | { |
| ... | ... | @@ -265,14 +267,19 @@ class SiteController extends Controller |
| 265 | 267 | */ |
| 266 | 268 | public function actionLogin() |
| 267 | 269 | { |
| 270 | + | |
| 271 | + | |
| 268 | 272 | if (!\Yii::$app->user->isGuest) { |
| 273 | + | |
| 269 | 274 | return $this->goHome(); |
| 270 | 275 | } |
| 271 | 276 | |
| 272 | - $model = new LoginForm(); | |
| 277 | + $model = new UserLoginForm(); | |
| 278 | + | |
| 273 | 279 | if ($model->load(Yii::$app->request->post()) && $model->login()) { |
| 274 | 280 | return $this->goBack(); |
| 275 | 281 | } else { |
| 282 | + $this->layout = '/internal'; | |
| 276 | 283 | return $this->render('login', [ |
| 277 | 284 | 'model' => $model, |
| 278 | 285 | ]); |
| ... | ... | @@ -327,16 +334,23 @@ class SiteController extends Controller |
| 327 | 334 | */ |
| 328 | 335 | public function actionSignup() |
| 329 | 336 | { |
| 337 | + | |
| 338 | + $this->layout = '/internal'; | |
| 339 | + | |
| 330 | 340 | $model = new Accounts(); |
| 331 | 341 | |
| 332 | - if ($model->load(Yii::$app->request->post(),'AccountsForm')) { | |
| 342 | + if ($model->load(Yii::$app->request->post()) ) { | |
| 333 | 343 | |
| 334 | - if ($user = $model->signup()) { | |
| 344 | + $model->generateAuthKey(); | |
| 345 | + | |
| 346 | + $model->save(); | |
| 347 | + | |
| 348 | + if (Yii::$app->getUser()->login($model)) { | |
| 349 | + | |
| 350 | + return $this->goHome(); | |
| 335 | 351 | |
| 336 | - if (Yii::$app->getUser()->login($user)) { | |
| 337 | - return $this->goHome(); | |
| 338 | - } | |
| 339 | 352 | } |
| 353 | + | |
| 340 | 354 | } |
| 341 | 355 | |
| 342 | 356 | return $this->render('signup', [ | ... | ... |
frontend/views/site/cabinet.php renamed to frontend/views/accounts/cabinet.php
| 1 | 1 | <?php |
| 2 | +use \yii\widgets\ActiveForm; | |
| 3 | +use \yii\helpers\ArrayHelper; | |
| 4 | +use \common\models\DicCities; | |
| 5 | +use \common\models\Deliveries; | |
| 2 | 6 | |
| 3 | 7 | $this->registerCssFile('/css/about_company.css'); |
| 4 | 8 | $this->registerCssFile('/css/style/notepad.css'); |
| ... | ... | @@ -6,14 +10,11 @@ $this->registerCssFile('/css/style/my_profile.css'); |
| 6 | 10 | $this->registerCssFile('//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css'); |
| 7 | 11 | $this->registerJsFile('//code.jquery.com/ui/1.11.4/jquery-ui.js'); |
| 8 | 12 | |
| 13 | +$this->title = 'Мой профиль'; | |
| 9 | 14 | $this->params['breadcrumbs'][] = $this->title; |
| 10 | 15 | ?> |
| 11 | 16 | |
| 12 | 17 | <div class="vin"> |
| 13 | - <a href="" class="navigation">Италавто</a> | |
| 14 | - <img src="/images/arrow_dots.png" class='arrow_go'> | |
| 15 | - <span>Мой профиль</span> | |
| 16 | - | |
| 17 | 18 | <p class="vin_article">Мой профиль</p> |
| 18 | 19 | <div class='side_menu'> |
| 19 | 20 | <ul class="side_menu-list" role="tablist"> |
| ... | ... | @@ -30,59 +31,55 @@ $this->params['breadcrumbs'][] = $this->title; |
| 30 | 31 | <div role="tabpanel" class="tab-pane active" id="profile"> |
| 31 | 32 | <p class="tab-content_header">Личные данные</p> |
| 32 | 33 | <div class="myprofile"> |
| 33 | - <button class="purple top">Изменить пароль</button> | |
| 34 | - <form class="my_profile"> | |
| 35 | - | |
| 36 | - | |
| 37 | - <div class="input2"> | |
| 38 | - <label for="login">Мой логин</label> | |
| 39 | - <input type="text" name="login" id="login" placeholder="Логин" minlength="2" required="" | |
| 40 | - </div> | |
| 41 | - <div class="input2"> | |
| 42 | - <label for="name">Имя</label> | |
| 43 | - <input type="text" name="name" id="name" placeholder="Имя" minlength="2" required="" > | |
| 44 | - </div> | |
| 45 | - <div class="input2"> | |
| 46 | - <label for="familyname">Фамилия</label> | |
| 47 | - <input type="text" name="familyname" id="familyname" placeholder="Фамилия" minlength="2" required=""> | |
| 48 | - </div> | |
| 49 | - <div class="input2"> | |
| 50 | - <label for="area_search">Перевозчик:</label> | |
| 51 | - <select class='provider area_search' required=""> | |
| 52 | - <option value="1">Автолюкс до 16.20</option> | |
| 53 | - <option value="2">Выбери меня!</option> | |
| 54 | - <option value="3">Выбери меня!</option> | |
| 55 | - <option value="5">Меня!</option> | |
| 56 | - <option value="4">Меня</option> | |
| 57 | - </select> | |
| 58 | - </div> | |
| 59 | - <div class="input2"> | |
| 60 | - <label for="tel">Телефон</label> | |
| 61 | - <input type="text" name="tel" id="tel" placeholder="Телефон" minlength="7" required=""> | |
| 62 | - </div> | |
| 63 | - <p class="add_telephone2" style="font-size: 14px; | |
| 64 | - margin-right: 12px; | |
| 65 | - margin-top: 10px;">добавить еще 1 телефон</p> | |
| 66 | - <div class="input1"> | |
| 67 | - <input type="telephone" name="telephone" class="telephone_registration_add" placeholder="Телефон" style="display: block;"> | |
| 68 | - </div> | |
| 69 | - <div class="input2"> | |
| 70 | - <label for="cod">Код клиента</label> | |
| 71 | - <input type="text" name="cod" id="cod" class="grey" disabled=""> | |
| 72 | - </div> | |
| 73 | - <div class='input2 '> | |
| 74 | - <label for="consult">Мой консультант</label> | |
| 75 | - <input type="text" name="consult" id="consult" class="grey" disabled="" > | |
| 76 | - </div> | |
| 77 | - | |
| 78 | - | |
| 79 | - </div> | |
| 80 | - <button class="purple_white">Отмена</button> | |
| 81 | - <button class="purple">Изменить</button> | |
| 82 | - </form> | |
| 34 | + <button class="purple top">Изменить пароль</button> | |
| 35 | + | |
| 36 | + <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data','class'=>'my_profile'], 'method'=>'post','action' => '/site/signup',]); ?> | |
| 37 | + | |
| 38 | + <?= $form->field($model, 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?> | |
| 39 | + | |
| 40 | + <?= $form->field($model, 'company')->hiddenInput(['value'=>'Частное лицо']) ?> | |
| 41 | + | |
| 42 | + <?= $form->field($model, 'name',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Имя']) ?> | |
| 43 | + | |
| 44 | + <?= $form->field($model, 'surname',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Фамилия']) ?> | |
| 45 | + | |
| 46 | + <?= $form->field($model, 'phones',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Телефон']) ?> | |
| 47 | + | |
| 48 | + <?= $form->field($model, 'email',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration']) ?> | |
| 49 | + | |
| 50 | + <?= $form->field($model, 'pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?> | |
| 51 | + | |
| 52 | + <?= $form->field($model, 're_pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?> | |
| 53 | + | |
| 54 | + <?= $form->field($model, 'country',['options'=>['class'=>'selectize_item2 input2' ]])->dropDownList( | |
| 55 | + ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'), | |
| 56 | + ['prompt' => 'Выберите область'] | |
| 57 | + ); | |
| 58 | + ?> | |
| 59 | + | |
| 60 | + <?= $form->field($model, 'city',['options'=>['class'=>'selectize_item2 input2' ]])->dropDownList( | |
| 61 | + [], | |
| 62 | + ['prompt' => 'Выберите город'] | |
| 63 | + ); | |
| 64 | + ?> | |
| 65 | + | |
| 66 | + <?= $form->field($model, 'deliveries',['options'=>['class'=>'selectize_item2 input2' ]])->dropDownList( | |
| 67 | + ArrayHelper::map(Deliveries::find()->all(), 'id', 'name'), | |
| 68 | + ['prompt' => 'Выберите тип перевозки'] | |
| 69 | + ); | |
| 70 | + ?> | |
| 71 | + | |
| 72 | + | |
| 73 | + <button class="purple_white">Отмена</button> | |
| 74 | + <button class="purple">Изменить</button> | |
| 75 | + <?php ActiveForm::end(); ?> | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + </div> | |
| 80 | + | |
| 83 | 81 | |
| 84 | 82 | |
| 85 | -</div> | |
| 86 | 83 | </div> |
| 87 | 84 | <div role="tabpanel" class="tab-pane" id="notepad"> |
| 88 | 85 | <p class="tab-content_header">Блокнот</p> |
| ... | ... | @@ -252,85 +249,6 @@ $this->params['breadcrumbs'][] = $this->title; |
| 252 | 249 | </div> |
| 253 | 250 | |
| 254 | 251 | |
| 255 | -<div class="slider_block1"> | |
| 256 | - <div class="tovars"> | |
| 257 | - <p style="display:inline-block">Наши проекты</p> | |
| 258 | - <span><img src="/images/arrow_slider_back.png"></span> | |
| 259 | - <span class="number_of">1/</span> | |
| 260 | - <span class="general_number">5</span> | |
| 261 | - <span><img src="/images/arrow_slider_go.png"></span> | |
| 262 | - <div class="slider_tovars"> | |
| 263 | - | |
| 264 | - <table class="block_project"> | |
| 265 | - <tbody><tr><td> | |
| 266 | - <img src="/images/logo-lr-small.png"> | |
| 267 | - </td></tr> | |
| 268 | - <tr><td> | |
| 269 | - <a href="">lr.italauto.com.ua</a> | |
| 270 | - </td></tr> | |
| 271 | - <tr><td> | |
| 272 | - <ul> | |
| 273 | - <h4>Запчасти на Land Rover<br> и Range Rover</h4> | |
| 274 | - <li>Оригинальные запчасти</li> | |
| 275 | - <li>Сертифицированый продавец</li> | |
| 276 | - <li>Более 300 000 товаров</li> | |
| 277 | - </ul> | |
| 278 | - </td></tr> | |
| 279 | - </tbody></table> | |
| 280 | - <table class="block_project"> | |
| 281 | - <tbody><tr><td> | |
| 282 | - <img src="/images/logo-mersedes-small.png"> | |
| 283 | - </td></tr> | |
| 284 | - <tr><td> | |
| 285 | - <a href="">lr.italauto.com.ua</a> | |
| 286 | - </td></tr> | |
| 287 | - <tr><td> | |
| 288 | - <ul> | |
| 289 | - <h4>Запчасти на<br> Mercedes Benz</h4> | |
| 290 | - <li>Оригинальные запчасти</li> | |
| 291 | - <li>Сертифицированый продавец</li> | |
| 292 | - <li>Более 300 000 товаров</li> | |
| 293 | - </ul> | |
| 294 | - </td></tr> | |
| 295 | - </tbody></table> | |
| 296 | - <table class="block_project"> | |
| 297 | - <tbody><tr><td> | |
| 298 | - <img src="/images/logo-fiat-small.png"> | |
| 299 | - </td></tr> | |
| 300 | - <tr><td> | |
| 301 | - <a href="">lr.italauto.com.ua</a> | |
| 302 | - </td></tr> | |
| 303 | - <tr><td> | |
| 304 | - <ul> | |
| 305 | - <h4>Запчасти на FIAT</h4> | |
| 306 | - <li>Оригинальные запчасти</li> | |
| 307 | - <li>Сертифицированый продавец</li> | |
| 308 | - <li>Более 300 000 товаров</li> | |
| 309 | - </ul> | |
| 310 | - </td></tr> | |
| 311 | - </tbody></table> | |
| 312 | - <table class="block_project"> | |
| 313 | - <tbody><tr><td> | |
| 314 | - <img src="/images/logo-lr-small.png"> | |
| 315 | - </td></tr> | |
| 316 | - <tr><td> | |
| 317 | - <a href="">lr.italauto.com.ua</a> | |
| 318 | - </td></tr> | |
| 319 | - <tr><td> | |
| 320 | - <ul> | |
| 321 | - <h4>Запчасти на Land Rover<br> и Range Rover</h4> | |
| 322 | - <li>Оригинальные запчасти</li> | |
| 323 | - <li>Сертифицированый продавец</li> | |
| 324 | - <li>Более 300 000 товаров</li> | |
| 325 | - </ul> | |
| 326 | - </td></tr> | |
| 327 | - </tbody></table> | |
| 328 | - | |
| 329 | - </div> | |
| 330 | - | |
| 331 | - </div> | |
| 332 | - </div> | |
| 333 | - | |
| 334 | 252 | |
| 335 | 253 | |
| 336 | 254 | <script> | ... | ... |
frontend/views/layouts/main.php
| ... | ... | @@ -5,22 +5,17 @@ |
| 5 | 5 | |
| 6 | 6 | use yii\helpers\Html; |
| 7 | 7 | use yii\widgets\ActiveForm; |
| 8 | -use yii\bootstrap\Nav; | |
| 9 | -use yii\bootstrap\NavBar; | |
| 10 | -use yii\widgets\Breadcrumbs; | |
| 11 | -use frontend\assets\AppAsset; | |
| 12 | -use common\widgets\Alert; | |
| 13 | 8 | use \yii\widgets\Menu; |
| 14 | 9 | use \yii\helpers\Url; |
| 15 | 10 | use common\models\Callback; |
| 16 | 11 | use \common\models\Accounts; |
| 17 | -use \common\models\AccountsForm; | |
| 18 | 12 | use \yii\helpers\ArrayHelper; |
| 19 | 13 | use \common\models\DicCities; |
| 20 | 14 | use \common\models\Deliveries; |
| 21 | 15 | use yii\captcha\Captcha; |
| 22 | - | |
| 16 | +use \common\models\UserLoginForm; | |
| 23 | 17 | ?> |
| 18 | + | |
| 24 | 19 | <?php $this->beginPage() ?> |
| 25 | 20 | <!DOCTYPE html> |
| 26 | 21 | <html lang="<?= Yii::$app->language ?>"> |
| ... | ... | @@ -40,7 +35,7 @@ use yii\captcha\Captcha; |
| 40 | 35 | <?php |
| 41 | 36 | echo Menu::widget([ |
| 42 | 37 | 'items' => [ |
| 43 | - ['label' => 'О компании', 'url'=>Url::toRoute('/site/about')], | |
| 38 | + ['label' => 'О компании', 'url'=>Url::toRoute(['/page/about','translit'=>'about'])], | |
| 44 | 39 | ['label' => 'Каталоги', 'url'=>'#'],//Url::toRoute('/page/FAQ')], |
| 45 | 40 | ['label' => 'Оптовикам','url'=>Url::toRoute(['/page/view','translit'=>'optovikam'])], |
| 46 | 41 | ['label' => 'Поставщикам','url'=>Url::toRoute(['/page/view','translit'=>'suppliers'])], |
| ... | ... | @@ -100,14 +95,8 @@ use yii\captcha\Captcha; |
| 100 | 95 | </div> |
| 101 | 96 | |
| 102 | 97 | <div class="contacts"> |
| 103 | - <img src="/images/logo.png"> | |
| 104 | - <!-- Split button --> | |
| 105 | - | |
| 106 | - <!-- <select class='dropdown_contacts'> | |
| 107 | - <option value="mts" data-image="/images/mts.png"></option> | |
| 108 | - <option value="life"></option> | |
| 109 | - <option value="kyivstar"></option> | |
| 110 | - </select> --> | |
| 98 | + <?= Html::a(Html::img('/images/logo.png'),['/']) ?> | |
| 99 | + | |
| 111 | 100 | <p class="number"><span class="number_space">050 </span>-0400-192</p> |
| 112 | 101 | <div class="phone_select"> |
| 113 | 102 | <img src="/images/mts.png" class="mts"> |
| ... | ... | @@ -178,13 +167,21 @@ use yii\captcha\Captcha; |
| 178 | 167 | </div> |
| 179 | 168 | </div> |
| 180 | 169 | </div> |
| 181 | - | |
| 182 | - | |
| 183 | - | |
| 184 | 170 | <div class="user"> |
| 171 | + | |
| 172 | + <?php if (Yii::$app->user->isGuest):?> | |
| 185 | 173 | <img src="/images/user.png"> |
| 186 | 174 | <p>Войти</p> |
| 187 | 175 | <a href="" class="own_page" id="go">Личный кабинет</a> |
| 176 | + <?php else : ?> | |
| 177 | + | |
| 178 | + <img src="/images/user.png"> | |
| 179 | + <p><?=Yii::$app->user->identity->name?></p> | |
| 180 | + <?= Html::a('Личный кабинет',['accounts/cabinet'],['class'=>'own_page']) ?> | |
| 181 | + <?php endif; ?> | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 188 | 185 | </div> |
| 189 | 186 | |
| 190 | 187 | <div class="box"> |
| ... | ... | @@ -352,25 +349,36 @@ use yii\captcha\Captcha; |
| 352 | 349 | |
| 353 | 350 | <div id="modal_form" style="opacity: 0; top: 45%; display: none;"> |
| 354 | 351 | <span id="modal_close"><img src="/images/close_form.png"></span> |
| 355 | - <form method="get" class="cmxform" action="" id="enter_form"> | |
| 356 | - <fieldset> | |
| 357 | - <h3>Вход в личный кабинет</h3> | |
| 358 | - | |
| 359 | - | |
| 352 | + <?php $form = ActiveForm::begin(['id' => 'enter_form','class'=>'cmxform','action' => '/site/login']); ?> | |
| 353 | + <fieldset> | |
| 354 | + <h3>Вход в личный кабинет</h3> | |
| 355 | + <?= $form->field(new UserLoginForm(), 'email')->label(false) ?> | |
| 356 | + <?= $form->field(new UserLoginForm(), 'pass')->passwordInput()->label(false) ?> | |
| 357 | + <?= $form->field(new UserLoginForm(), 'rememberMe')->checkbox() ?> | |
| 358 | + <?= Html::a('Забыли пароль?', ['site/request-password-reset']) ?> | |
| 359 | + <?= Html::submitButton('Submit', ['class' => 'purple', 'name' => 'login-button']) ?> | |
| 360 | + </fieldset> | |
| 361 | + <?php ActiveForm::end(); ?> | |
| 360 | 362 | |
| 361 | - <input type="email" name="email" id="email" placeholder="email" minlength="" required=""><span class="star">*</span> | |
| 362 | - | |
| 363 | - <input type="password" name="password" id="password" placeholder="Пароль" minlength="5" maxlength="12" required=""><span class="star1">*</span> | |
| 364 | - <input type="checkbox" id="assurance" class="filter-two" name="assurance" value="assurance" > | |
| 365 | - <label for="assurance"><span></span><a href=""></a></label> | |
| 366 | - | |
| 367 | - <a href="" class="own_page1">Запомнить меня</a> | |
| 368 | - <a href="" class="own_page2">Забыли пароль?</a> | |
| 369 | - <button class="purple" type="submit" value="Submit">Войти</button> | |
| 370 | - | |
| 371 | - | |
| 372 | - </fieldset> | |
| 373 | - </form> | |
| 363 | +<!-- <form method="get" class="cmxform" action="" id="enter_form">--> | |
| 364 | +<!-- <fieldset>--> | |
| 365 | +<!----> | |
| 366 | +<!----> | |
| 367 | +<!----> | |
| 368 | +<!----> | |
| 369 | +<!-- <input type="email" name="email" id="email" placeholder="email" minlength="" required=""><span class="star">*</span>--> | |
| 370 | +<!----> | |
| 371 | +<!-- <input type="password" name="password" id="password" placeholder="Пароль" minlength="5" maxlength="12" required=""><span class="star1">*</span>--> | |
| 372 | +<!-- <input type="checkbox" id="assurance" class="filter-two" name="assurance" value="assurance" >--> | |
| 373 | +<!-- <label for="assurance"><span></span><a href=""></a></label>--> | |
| 374 | +<!----> | |
| 375 | +<!-- <a href="" class="own_page1">Запомнить меня</a>--> | |
| 376 | +<!-- <a href="" class="own_page2">Забыли пароль?</a>--> | |
| 377 | +<!-- <button class="purple" type="submit" value="Submit">Войти</button>--> | |
| 378 | +<!----> | |
| 379 | +<!----> | |
| 380 | +<!-- </fieldset>--> | |
| 381 | +<!-- </form>--> | |
| 374 | 382 | |
| 375 | 383 | <a href="" class="own_page3" class="btn btn-lg btn-default" data-toggle="modal" |
| 376 | 384 | data-target="#basicModal" |
| ... | ... | @@ -400,43 +408,43 @@ use yii\captcha\Captcha; |
| 400 | 408 | <div class="registration_holder"> |
| 401 | 409 | |
| 402 | 410 | <div class="registration_for_person"> |
| 403 | - <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data'], 'method'=>'post','action' => 'site/signup']); ?> | |
| 411 | + <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data'], 'method'=>'post','action' => '/site/signup']); ?> | |
| 404 | 412 | |
| 405 | - <?= $form->field(new AccountsForm(), 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?> | |
| 413 | + <?= $form->field(new Accounts(), 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?> | |
| 406 | 414 | |
| 407 | - <?= $form->field(new AccountsForm(), 'company')->hiddenInput(['value'=>'Частное лицо'])->label(false) ?> | |
| 415 | + <?= $form->field(new Accounts(), 'company')->hiddenInput(['value'=>'Частное лицо'])->label(false) ?> | |
| 408 | 416 | |
| 409 | - <?= $form->field(new AccountsForm(), 'name')->textInput(['maxlength' => 45,'placeholder'=>'Имя'])->label(false) ?> | |
| 417 | + <?= $form->field(new Accounts(), 'name')->textInput(['maxlength' => 45,'placeholder'=>'Имя'])->label(false) ?> | |
| 410 | 418 | |
| 411 | - <?= $form->field(new AccountsForm(), 'surname')->textInput(['maxlength' => 45,'placeholder'=>'Фамилия'])->label(false) ?> | |
| 419 | + <?= $form->field(new Accounts(), 'surname')->textInput(['maxlength' => 45,'placeholder'=>'Фамилия'])->label(false) ?> | |
| 412 | 420 | |
| 413 | - <?= $form->field(new AccountsForm(), 'phones')->textInput(['maxlength' => 45,'placeholder'=>'Телефон'])->label(false) ?> | |
| 421 | + <?= $form->field(new Accounts(), 'phones')->textInput(['maxlength' => 45,'placeholder'=>'Телефон'])->label(false) ?> | |
| 414 | 422 | |
| 415 | - <?= $form->field(new AccountsForm(), 'email')->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration'])->label(false) ?> | |
| 423 | + <?= $form->field(new Accounts(), 'email')->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration'])->label(false) ?> | |
| 416 | 424 | |
| 417 | - <?= $form->field(new AccountsForm(), 'pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?> | |
| 425 | + <?= $form->field(new Accounts(), 'pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?> | |
| 418 | 426 | |
| 419 | - <?= $form->field(new AccountsForm(), 're_pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?> | |
| 427 | + <?= $form->field(new Accounts(), 're_pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?> | |
| 420 | 428 | |
| 421 | - <?= $form->field(new AccountsForm(), 'country',['options'=>['class'=>'selectize_item2' ]])->dropDownList( | |
| 429 | + <?= $form->field(new Accounts(), 'country',['options'=>['class'=>'selectize_item2' ]])->dropDownList( | |
| 422 | 430 | ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'), |
| 423 | 431 | ['prompt' => 'Выберите область'] |
| 424 | 432 | )->label(false); |
| 425 | 433 | ?> |
| 426 | 434 | |
| 427 | - <?= $form->field(new AccountsForm(), 'city',['options'=>['class'=>'selectize_item2' ]])->dropDownList( | |
| 435 | + <?= $form->field(new Accounts(), 'city',['options'=>['class'=>'selectize_item2' ]])->dropDownList( | |
| 428 | 436 | [], |
| 429 | 437 | ['prompt' => 'Выберите город'] |
| 430 | 438 | )->label(false); |
| 431 | 439 | ?> |
| 432 | 440 | |
| 433 | - <?= $form->field(new AccountsForm(), 'deliveries',['options'=>['class'=>'selectize_item2' ]])->dropDownList( | |
| 441 | + <?= $form->field(new Accounts(), 'deliveries',['options'=>['class'=>'selectize_item2' ]])->dropDownList( | |
| 434 | 442 | ArrayHelper::map(Deliveries::find()->all(), 'id', 'name'), |
| 435 | 443 | ['prompt' => 'Выберите тип перевозки'] |
| 436 | 444 | )->label(false); |
| 437 | 445 | ?> |
| 438 | 446 | |
| 439 | - <?= $form->field(new AccountsForm(), 'verifyCode')->widget(Captcha::className(), [ | |
| 447 | + <?= $form->field(new Accounts(), 'verifyCode')->widget(Captcha::className(), [ | |
| 440 | 448 | 'options'=>['placeholder'=>'Введите код' ], |
| 441 | 449 | 'template' => '<div>{input}</div><div class="row"><div class="col-lg-3">{image}</div></div>', |
| 442 | 450 | ])->label(false); ?> | ... | ... |
frontend/views/news/one_item.php
| ... | ... | @@ -4,8 +4,8 @@ use \yii\helpers\Html; |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | <div class="news"> |
| 7 | - <?= Html::a(Html::img($model->img),['news/view', 'translit' =>$model->code ]) ?> | |
| 7 | + <?= Html::a(Html::img($model->img),['/news/view', 'translit' =>$model->code ]) ?> | |
| 8 | 8 | <span class='date'><?= $model->date?></span><br> |
| 9 | - <?= Html::a("<p class='article'>".$model->name."</p>",['news/view', 'translit' =>$model->code ]) ?> | |
| 10 | - <?= Html::a("<p class='short_news'>".$model->brief."</p>",['news/view', 'translit' =>$model->code ]) ?> | |
| 9 | + <?= Html::a("<p class='article'>".$model->name."</p>",['/news/view', 'translit' =>$model->code ]) ?> | |
| 10 | + <?= Html::a("<p class='short_news'>".$model->pregStr($model->brief)."</p>",['/news/view', 'translit' =>$model->code ]) ?> | |
| 11 | 11 | </div> |
| 12 | 12 | \ No newline at end of file | ... | ... |
frontend/views/news/view.php
| ... | ... | @@ -19,16 +19,19 @@ $this->params['breadcrumbs'][] = $this->title; |
| 19 | 19 | </div> |
| 20 | 20 | <div class='long_line'></div> |
| 21 | 21 | <div class="go_news"> |
| 22 | - | |
| 22 | + <?php if($next_news):?> | |
| 23 | 23 | <div class="back_news"> |
| 24 | - <?= Html::a("<p class='article'>".$next_news->name."</p>",['news/view', 'translit' =>$next_news->code ]) ?> | |
| 25 | - <?= Html::a("<p class='short_news'>".$next_news->brief."</p>",['news/view', 'translit' =>$next_news->code ]) ?> | |
| 24 | + <?= Html::a("<p class='article'>".$next_news->name."</p>",['/news/view', 'translit' =>$next_news->code ]) ?> | |
| 25 | + <?= Html::a("<p class='short_news'>".$next_news->brief."</p>",['/news/view', 'translit' =>$next_news->code ]) ?> | |
| 26 | 26 | </div> |
| 27 | + <?php endif; ?> | |
| 27 | 28 | |
| 29 | + <?php if($prev_news):?> | |
| 28 | 30 | <div class="back_news"> |
| 29 | - <?= Html::a("<p class='article'>".$prev_news->name."</p>",['news/view', 'translit' =>$prev_news->code ]) ?> | |
| 30 | - <?= Html::a("<p class='short_news'>".$prev_news->brief."</p>",['news/view', 'translit' =>$prev_news->code ]) ?> | |
| 31 | + <?= Html::a("<p class='article'>".$prev_news->name."</p>",['/news/view', 'translit' =>$prev_news->code ]) ?> | |
| 32 | + <?= Html::a("<p class='short_news'>".$prev_news->brief."</p>",['/news/view', 'translit' =>$prev_news->code ]) ?> | |
| 31 | 33 | </div> |
| 34 | + <?php endif; ?> | |
| 32 | 35 | |
| 33 | 36 | </div> |
| 34 | 37 | </div> | ... | ... |
| 1 | +<?php | |
| 2 | +use \yii\helpers\Url; | |
| 3 | +$this->registerCssFile('/css/about_company.css'); | |
| 4 | +$this->registerCssFile('/css/style/optovikam.css'); | |
| 5 | + | |
| 6 | +$this->registerMetaTag(['description' => $model->descr,'keywords'=>$model->kwords]); | |
| 7 | +$this->title = $model->title ? $model->title: $model->name; | |
| 8 | +$this->params['breadcrumbs'][] = $this->title; | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<?php | |
| 12 | + | |
| 13 | + | |
| 14 | +?> | |
| 15 | +<div class="main-vin"> | |
| 16 | + <p class="vin_article"><?=$this->title?></p> | |
| 17 | + <div class='side_menu'> | |
| 18 | + <?php | |
| 19 | + echo \yii\widgets\Menu::widget([ | |
| 20 | + 'options' => ['class' => 'side_menu-list'], | |
| 21 | + 'items' => [ | |
| 22 | + ['label' => 'Миссия', 'url' => Url::toRoute(['/page/about','translit'=>'about'])], | |
| 23 | + ['label' => 'Команда', 'url' => Url::toRoute(['/site/team'])], | |
| 24 | + ], | |
| 25 | + ]); | |
| 26 | + ?> | |
| 27 | + | |
| 28 | + <div class="tab-content"> | |
| 29 | + <?= $model->content;?> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | + <img src="/images/lonh_line.png" class='long_line'> | |
| 33 | +</div> | |
| 0 | 34 | \ No newline at end of file | ... | ... |
frontend/views/page/view.php
| 1 | 1 | <?php |
| 2 | +$this->registerCssFile('/css/about_company.css'); | |
| 3 | +$this->registerCssFile('/css/style/optovikam.css'); | |
| 2 | 4 | $this->registerMetaTag(['description' => $model->descr,'keywords'=>$model->kwords]); |
| 3 | 5 | $this->title = $model->title ? $model->title: $model->name; |
| 4 | 6 | $this->params['breadcrumbs'][] = $this->title; | ... | ... |
frontend/views/site/404.php
frontend/views/site/about.php deleted
| 1 | -<?php | |
| 2 | -$this->registerCssFile('/css/about_company.css'); | |
| 3 | - | |
| 4 | -$this->title = "О компании"; | |
| 5 | -$this->params['breadcrumbs'][] = $this->title; | |
| 6 | -?> | |
| 7 | - | |
| 8 | - | |
| 9 | -<div class="main-vin"> | |
| 10 | - <p class="vin_article">О компании</p> | |
| 11 | -<div class='side_menu'> | |
| 12 | -<ul class="side_menu-list" role="tablist"> | |
| 13 | - <li class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Миссия</a></li> | |
| 14 | - <li><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Команда</a></li> | |
| 15 | - <li><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Контакты</a></li> | |
| 16 | - <li><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Оплата и доставка</a></li> | |
| 17 | -</ul> | |
| 18 | - <div class="tab-content"> | |
| 19 | - <div role="tabpanel" class="tab-pane active" id="home"> | |
| 20 | - <p class="tab-content_header">Преимущества компании "Италавто"</p> | |
| 21 | - <p class="tab-content_article">Наша компания "Италавто" уже много лет занимается поставками автозапчастей для автомобилей итальянского производства. Наиболее распространённые бренды на Украине - различные модели Fiat (Фиат) и Iveco (Ивеко). Лёгкие и тяжёлые грузовые автомобили Ивеко экономичные и адаптированные для работы в Украине. Заслуженной популярностью пользуется микроавтобус Fiat Ducato (Дукато) класса "Газели", Fiat Punto (Пунто) и Fiat Grande Punto (Гранд Пунто) - очень красивые легковые автомобили элегантного дизайна. Fiat Tempra (Темпра) — семейный среднеразмерный автомобиль, выпуск которого компанией Фиат был приостановлен 1998 году, но до сих пор запчасти к Fiat Tempra пользуются повышенным спросом.<br><br><br> | |
| 22 | - | |
| 23 | - В наличии и под заказ на складах Киева и Харькова большой ассортимент оригинальных запчастей к различным маркам и моделям автомобилей итальянского производства. Мы надеемся, что сумеем помочь Вам в подборе необходимых запчастей хорошего качества непосредственно из Европы по оптимальной цене. На нашем сайте Вы можете заказать детали непосредственно из мастерских, где осуществляется разборка, и ремонт Fiat пройдёт намного лучше. Наша компания предоставляет нашим клиентам ряд очевидных преимуществ: максимальное удобство поиска и заказа, не выходя из дома или офиса - используйте для заказа формы интернет-магазина; возможность подбора автозапчастей и деталей он-лайн по коду, по каталогам либо запросом по коду; быструю доставку заказа в течение недели или двух в Киев и в течение дня - из Киева по регионам перевозчиками "Автолюкс", "Гюнсел", "Ин-Тайм", "Новая почта", "Ночной экспресс", "Евроэкспресс". Нашим интернет-магазином предусмотрена возможность просмотра ожидаемых поставок запчастей. Также на нашем сайте регулярно проводятся акции - распродажи запчастей. На запчасти для Iveco (Ивеко) и запчасти для Fiat (Фиат) оптовым покупателей специальные условия. | |
| 24 | - </p> | |
| 25 | -</div> | |
| 26 | - <div role="tabpanel" class="tab-pane" id="profile"> | |
| 27 | - <?php foreach ($teamGroups as $group): ?> | |
| 28 | - <?=$this->render('team_list_layout', [ | |
| 29 | - 'group' => $group | |
| 30 | - ]);?> | |
| 31 | - <?php endforeach; ?> | |
| 32 | - </div> | |
| 33 | - <?=$this->render('contacts_layout', [ | |
| 34 | - ]);?> | |
| 35 | - <?=$this->render('payment_delivery_layout', [ | |
| 36 | - ]);?> | |
| 37 | - </div> | |
| 38 | -</div> | |
| 39 | -<img src="/images/lonh_line.png" class='long_line'> | |
| 40 | -</div> | |
| 41 | 0 | \ No newline at end of file |
frontend/views/site/index.php
| ... | ... | @@ -509,30 +509,13 @@ use \yii\helpers\Html; |
| 509 | 509 | |
| 510 | 510 | <!-- Wrapper for slides --> |
| 511 | 511 | <div class="carousel-inner" role="listbox"> |
| 512 | - <div class="item"> | |
| 513 | - <img src="/images/car_carousel.png" alt="..."> | |
| 514 | - <div class="carousel-caption"> | |
| 515 | - <p>Все для ремонта автомобилей Land Rover | |
| 516 | - <br>lr-parts.com.ua</p> | |
| 517 | - <img src="/images/land_rover.png"> | |
| 518 | - </div> | |
| 519 | - </div> | |
| 520 | - <div class="item"> | |
| 521 | - <img src="/images/car_carousel.png" alt="..."> | |
| 522 | - <div class="carousel-caption"> | |
| 523 | - <p>Все для ремонта автомобилей Land Rover | |
| 524 | - <br>lr-parts.com.ua</p> | |
| 525 | - <img src="/images/land_rover.png"> | |
| 526 | - </div> | |
| 527 | - </div> | |
| 528 | - <div class="item active"> | |
| 529 | - <img src="/images/car_carousel.png" alt="..."> | |
| 530 | - <div class="carousel-caption"> | |
| 531 | - <p>Все для ремонта автомобилей Land Rover | |
| 532 | - <br>lr-parts.com.ua</p> | |
| 533 | - <img src="/images/land_rover.png"> | |
| 512 | + <?php $i = 0; foreach ($slider_list as $one_slid):?> | |
| 513 | + <div class="item <?=!$i++?'active':''?>"> | |
| 514 | + | |
| 515 | + <?= Html::a(Html::img($one_slid->img)) ?> | |
| 516 | + | |
| 534 | 517 | </div> |
| 535 | - </div> | |
| 518 | + <?php endforeach; ?> | |
| 536 | 519 | |
| 537 | 520 | </div> |
| 538 | 521 | |
| ... | ... | @@ -577,46 +560,22 @@ use \yii\helpers\Html; |
| 577 | 560 | </div> |
| 578 | 561 | <div class="news"> |
| 579 | 562 | <?= Html::a( 'Новости', Url::toRoute('news/index'),['class'=>'main_link_news'])?> |
| 580 | -<!-- <span><img src="/images/arrow_slider_back.png"></span>--> | |
| 563 | + | |
| 581 | 564 | <span class="num"></span> |
| 582 | -<!-- <span class="general_number">5</span>--> | |
| 583 | -<!-- <span><img src="/images/arrow_slider_go.png"></span>--> | |
| 584 | -<!-- --><?php //foreach ($news_list as $one_news):?> | |
| 585 | -<!-- <div class="slider_tovars">--> | |
| 586 | -<!-- <div class="tovar">--> | |
| 587 | -<!-- --><?//= Html::img(\yii\helpers\Url::to($one_news->img)); ?> | |
| 588 | -<!-- --><?//= Html::a("<p class='article'>".$one_news->name."</p>",['news/view', 'translit' =>$one_news->code ]) ?> | |
| 589 | -<!-- </div>--> | |
| 590 | -<!-- </div>--> | |
| 591 | -<!-- --><?php //endforeach; ?> | |
| 592 | 565 | <div class="slider_tovars"> |
| 593 | 566 | |
| 594 | 567 | <div id="carousel-example-generic1" class="carousel slide" data-ride="carousel"> |
| 595 | -<!-- Indicators--> | |
| 596 | - <ol class="carousel-indicators"> | |
| 597 | - <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li> | |
| 598 | - <li data-target="#carousel-example-generic" data-slide-to="1"></li> | |
| 599 | - <li data-target="#carousel-example-generic" data-slide-to="2"></li> | |
| 600 | - </ol> | |
| 601 | - | |
| 602 | - <!-- Wrapper for slides --> | |
| 603 | - <div class="carousel-inner" role="listbox"> | |
| 604 | - <div class="item tovar active"> | |
| 605 | - <img src="/images/news.png"> | |
| 606 | - <div class="carousel-caption"> | |
| 607 | - <p>На склад поступила очередная партия товара Metalcaucho. Готов к отгрузке.<br><br> | |
| 608 | 568 | |
| 609 | - Полный список товаров этой группы доступен по <br><a href="">ссылке</a></p> | |
| 610 | - </div> | |
| 611 | - </div> | |
| 612 | - <div class="item tovar"> | |
| 613 | - <img src="/images/news.png"> | |
| 569 | + <div class="carousel-inner" role="listbox"> | |
| 570 | + <?php $i = 0; foreach ($news_list as $one_news):?> | |
| 571 | + <div class="item tovar <?=!$i++?'active':''?>"> | |
| 572 | + <?= Html::a(Html::img($one_news->img),['news/view', 'translit' =>$one_news->code ]) ?> | |
| 614 | 573 | <div class="carousel-caption"> |
| 615 | - <p>На склад поступила очередная партия товара Metalcaucho. Готов к отгрузке.<br><br> | |
| 616 | - | |
| 617 | - Полный список товаров этой группы доступен по <br><a href="">ссылке</a></p> | |
| 574 | + <?= Html::a("<p class='article'>".$one_news->name."</p>",['news/view', 'translit' =>$one_news->code ]) ?> | |
| 575 | + <?= Html::a("<p class='short_news'>".$one_news->pregStr($one_news->brief)."</p>",['news/view', 'translit' =>$one_news->code ]) ?> | |
| 618 | 576 | </div> |
| 619 | 577 | </div> |
| 578 | + <?php endforeach; ?> | |
| 620 | 579 | |
| 621 | 580 | </div> |
| 622 | 581 | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\widgets\ActiveForm; | |
| 4 | +use \yii\helpers\Html; | |
| 5 | +use common\models\UserLoginForm; | |
| 6 | +use \yii\helpers\ArrayHelper; | |
| 7 | +use \common\models\DicCities; | |
| 8 | +use \common\models\Deliveries; | |
| 9 | +use yii\captcha\Captcha; | |
| 10 | + | |
| 11 | + | |
| 12 | +?> | |
| 13 | +<div id="modal_form_registration" > | |
| 14 | + <?php $form = ActiveForm::begin(['id' => 'enter_form','class'=>'cmxform','action' => '/site/login']); ?> | |
| 15 | + <fieldset> | |
| 16 | + <h3>Вход в личный кабинет</h3> | |
| 17 | + <?= $form->field($model, 'email')->label(false) ?> | |
| 18 | + <?= $form->field($model, 'pass')->passwordInput()->label(false) ?> | |
| 19 | + <?= $form->field($model, 'rememberMe')->checkbox() ?> | |
| 20 | + <?= Html::a('Забыли пароль?', ['site/request-password-reset']) ?> | |
| 21 | + <?= Html::submitButton('Submit', ['class' => 'purple', 'name' => 'login-button']) ?> | |
| 22 | + </fieldset> | |
| 23 | + <?php ActiveForm::end(); ?> | |
| 24 | +</div> | |
| 0 | 25 | \ No newline at end of file | ... | ... |
frontend/views/site/provider.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -$this->registerCssFile('/css/style/optovikam.css'); | |
| 4 | -$this->title = "Поставщикам"; | |
| 5 | -$this->params['breadcrumbs'][] = $this->title; | |
| 6 | -?> | |
| 7 | - | |
| 8 | - | |
| 9 | - | |
| 10 | - | |
| 11 | - | |
| 12 | -<div class="main-vin"> | |
| 13 | - | |
| 14 | - <p class="vin_article">Поставщикам</p> | |
| 15 | - | |
| 16 | -<div class="choose_tovar"> | |
| 17 | -<p class="choose_tovar-inviting">Приглашаем к сотрудничеству поставщиков товара.</p> | |
| 18 | - | |
| 19 | -<div class="choose_tovar-list"> | |
| 20 | -<p>Основные положения сотрудничества:</p> | |
| 21 | -<ul> | |
| 22 | - <li>Работа с Поставщиками ведется на основании Договора. Предложение прайсов к загрузке на сайт означает согласие с положениями данного Договора.</li> | |
| 23 | - <li>Загружаются прайсы только прямых поставщиков, т.е. владельцев товара. Данные интернет-магазинов, предлагающих к размещению “чужой” товар, не публикуются.</li> | |
| 24 | - <li>Возможность возврата товара на протяжении 17 дней (14 + 3 дня дорога).</li> | |
| 25 | - <li>Поддержка гарантии на поставляемый товар.</li> | |
| 26 | -</ul> | |
| 27 | -</div> | |
| 28 | - | |
| 29 | -<div class="choose_tovar-list"> | |
| 30 | -<p>Требования к прайсам:</p> | |
| 31 | -<ul> | |
| 32 | - <li>Прайсы-листы принимаются на электронный ящик <a href="">price@italauto.com.ua</a> с указанием в темы письма - Прайс_Название_Поставщика.</li> | |
| 33 | - <li>Обновление ежедневно.</li> | |
| 34 | - <li>Формат представления следующий: (<a href="">Пример_Прайс_Поставщик.</a>)</li> | |
| 35 | - <li>Цена прайса в евро.</li> | |
| 36 | -</ul> | |
| 37 | -</div> | |
| 38 | - | |
| 39 | -<div class="choose_tovar-list"> | |
| 40 | -<p>Требования к товару:</p> | |
| 41 | -<ul> | |
| 42 | - <li>Товар принимается с сопроводительной накладной от Поставщика.</li> | |
| 43 | - <li>Упаковка и содержимое товара должны соответствовать бренду.</li> | |
| 44 | -</ul> | |
| 45 | -</div> | |
| 46 | - | |
| 47 | -<div class="choose_tovar-list"> | |
| 48 | -<table> | |
| 49 | - <tbody><tr> | |
| 50 | - <td class="team_header">Контакты для предложений о сотрудничестве:</td> | |
| 51 | - </tr> | |
| 52 | - <tr> | |
| 53 | - <td class="team_contacts"><a href=""><img src="/images/envelope.png">oleg@italauto.com.ua</a></td> | |
| 54 | - </tr> | |
| 55 | - <tr> | |
| 56 | - <td class="team_contacts"><a href=""><img src="/images/telephone_ico.png">044-593-9051 доб.4201</a></td> | |
| 57 | - </tr> | |
| 58 | - <tr> | |
| 59 | - <td class="team_contacts"><a href=""><img src="/images/skype.png">oleg-italauto</a></td> | |
| 60 | - </tr> | |
| 61 | - | |
| 62 | - </tbody></table> | |
| 63 | -</div> | |
| 64 | -</div> | |
| 65 | -</div> |
frontend/views/site/registration_form.php deleted
| 1 | -<html xmlns="http://www.w3.org/1999/html"><head> | |
| 2 | -<meta charset="utf-8"> | |
| 3 | -<link href="http://fonts.googleapis.com/css?family=Ubuntu:400,300,500,700" rel="stylesheet" type="text/css"> | |
| 4 | -<link rel="stylesheet" type="text/css" href="style.css"> | |
| 5 | -<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css"> | |
| 6 | -<link rel="stylesheet" type="text/css" href="bootstrap1/css/bootstrap.css"> | |
| 7 | - | |
| 8 | -<script type="text/javascript" async="" src="./modal/watch.js"></script> | |
| 9 | -<script src="./modal/jquery.min.js"></script> | |
| 10 | -<script src="./perfect-scrollbar/js/perfect-scrollbar.js"></script> | |
| 11 | -<link rel="stylesheet" href="perfect-scrollbar/css/perfect-scrollbar.css"> | |
| 12 | -<script src="./js/ital_auto.js"></script> | |
| 13 | -<script src="./js/script.js"></script> | |
| 14 | -<link rel="stylesheet" type="text/css" href="css/msdropdown/dd.css"> | |
| 15 | -</head> | |
| 16 | - | |
| 17 | - | |
| 18 | -<body> | |
| 19 | - | |
| 20 | -<div class="modal fade" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
| 21 | - <div class="modal-dialog" role="document"> | |
| 22 | - <div class="modal-content"> | |
| 23 | - <div class="modal-header"> | |
| 24 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
| 25 | - </div> | |
| 26 | - <div class="modal-body"> | |
| 27 | - <div id="modal_form_registration" > | |
| 28 | - <span id="modal_close"><img src="/images/close_form.png"></span> | |
| 29 | - <form action="" method="post" id="registration_form"> | |
| 30 | - <h3>Заявка на регистрацию</h3> | |
| 31 | - <div class="purple_registration active_button" style="margin-left:65px; border-radius:4px 0 0 0 " id="person"><p>Частное лицо</p></div><div id="company" class="purple_registration"><p>Оптовик</p></div> | |
| 32 | - <div class="registration_holder"> | |
| 33 | - | |
| 34 | - <div class="registration_for_person"> | |
| 35 | - | |
| 36 | - | |
| 37 | - <input type="text" name="familyname" id="family_name" placeholder="Фамилия | |
| 38 | - " minlength="2" required=""> | |
| 39 | - | |
| 40 | - <input name="name" id="name" placeholder="Имя" minlength="2" type="text" required=""> | |
| 41 | - <input type="email" name="email" id="email_registration" placeholder="email" minlength="10" required=""> | |
| 42 | - | |
| 43 | - <input type="phone" name="telephone" id="telephone_registration" placeholder="Телефон" minlength="7" required=""> | |
| 44 | - <input type="telephone" name="telephone" id="telephone_registration_add" placeholder="Телефон"> | |
| 45 | - <p class="add_telephone" style="font-size: 14px; | |
| 46 | - margin-right: 12px; | |
| 47 | - margin-top: 10px;">добавить еще 1 телефон</p> | |
| 48 | - <p>Фактический адрес</p> | |
| 49 | - <div class="selectize_item2"> | |
| 50 | - | |
| 51 | - | |
| 52 | - <select class="area"> | |
| 53 | - <option value="" disabled="" selected="">Выберите область</option> | |
| 54 | - <option value="2">Выбери меня!</option> | |
| 55 | - <option value="3">Выбери меня!</option> | |
| 56 | - <option value="5">Меня!</option> | |
| 57 | - <option value="4">Меня</option> | |
| 58 | - </select> | |
| 59 | - | |
| 60 | - </div> | |
| 61 | - <div class="selectize_item2"> | |
| 62 | - | |
| 63 | - | |
| 64 | - <select class="city"> | |
| 65 | - <option value="" disabled="" selected="">Выберите город</option> | |
| 66 | - <option value="2">Выбери меня!</option> | |
| 67 | - <option value="3">Выбери меня!</option> | |
| 68 | - <option value="5">Меня!</option> | |
| 69 | - <option value="4">Меня</option> | |
| 70 | - </select> | |
| 71 | - | |
| 72 | - </div> | |
| 73 | - <div class="selectize_item2"> | |
| 74 | - | |
| 75 | - | |
| 76 | - <select class="steel"> | |
| 77 | - <option value="" disabled="" selected="">Перевозчик</option> | |
| 78 | - <option value="2">Выбери меня!</option> | |
| 79 | - <option value="3">Выбери меня!</option> | |
| 80 | - <option value="5">Меня!</option> | |
| 81 | - <option value="4">Меня</option> | |
| 82 | - </select> | |
| 83 | - | |
| 84 | - </div> | |
| 85 | - | |
| 86 | - <input type="text" placeholder="Введите код" id="code_input" required=""> | |
| 87 | - <div class="code_generate"> | |
| 88 | - <img src="/images/code_generator.png"> | |
| 89 | - </div> | |
| 90 | - <button class="purple" type="submit" value="Submit">Зарегестрироваться</button> | |
| 91 | - | |
| 92 | - | |
| 93 | - </div> | |
| 94 | - <div class="registration_for_company"> | |
| 95 | - | |
| 96 | - <input type="text" name="fullname" id="company_name" placeholder="Компания | |
| 97 | - " minlength="2" required=""> | |
| 98 | - <input type="text" name="fullname" id="family_name" placeholder="Фамилия | |
| 99 | - " minlength="2" required=""> | |
| 100 | - | |
| 101 | - <input type="" name="name" id="name" placeholder="Имя" minlength="2" required=""> | |
| 102 | - <input type="email" name="email" id="email_registration" placeholder="email" minlength="10" required=""> | |
| 103 | - | |
| 104 | - <input type="telephone" name="telephone" id="telephone_registration" placeholder="Телефон" minlength="7" required=""> | |
| 105 | - <input type="telephone" name="telephone" id="telephone_registration_add1" placeholder="Телефон" style="display:none"> | |
| 106 | - <p class="add_telephone1" style="font-size: 14px; | |
| 107 | - margin-right: 12px; | |
| 108 | - margin-top: 10px;">добавить еще 1 телефон</p> | |
| 109 | - <p>Фактический адрес</p> | |
| 110 | - <div class="selectize_item2"> | |
| 111 | - | |
| 112 | - | |
| 113 | - <select class="area"> | |
| 114 | - <option value="" disabled="" selected="">Выберите область</option> | |
| 115 | - <option value="2">Выбери меня!</option> | |
| 116 | - <option value="3">Выбери меня!</option> | |
| 117 | - <option value="5">Меня!</option> | |
| 118 | - <option value="4">Меня</option> | |
| 119 | - </select> | |
| 120 | - | |
| 121 | - </div> | |
| 122 | - <div class="selectize_item2"> | |
| 123 | - | |
| 124 | - | |
| 125 | - <select class="city"> | |
| 126 | - <option value="" disabled="" selected="">Выберите город</option> | |
| 127 | - <option value="2">Выбери меня!</option> | |
| 128 | - <option value="3">Выбери меня!</option> | |
| 129 | - <option value="5">Меня!</option> | |
| 130 | - <option value="4">Меня</option> | |
| 131 | - </select> | |
| 132 | - | |
| 133 | - </div> | |
| 134 | - <div class="selectize_item2"> | |
| 135 | - | |
| 136 | - | |
| 137 | - <select class="steel"> | |
| 138 | - <option value="" disabled="" selected="">Перевозчик</option> | |
| 139 | - <option value="2">Выбери меня!</option> | |
| 140 | - <option value="3">Выбери меня!</option> | |
| 141 | - <option value="5">Меня!</option> | |
| 142 | - <option value="4">Меня</option> | |
| 143 | - </select> | |
| 144 | - | |
| 145 | - </div> | |
| 146 | - | |
| 147 | - <input type="text" placeholder="Введите код" id="code_input"> | |
| 148 | - <div class="code_generate"> | |
| 149 | - <img src="/images/code_generator.png"> | |
| 150 | - </div> | |
| 151 | - <button class="purple" type="submit" value="Submit">Зарегестрироваться</button> | |
| 152 | - | |
| 153 | - | |
| 154 | - </div> | |
| 155 | - </div></form> | |
| 156 | - | |
| 157 | - | |
| 158 | - | |
| 159 | -</div> | |
| 160 | - </div> | |
| 161 | - | |
| 162 | - </div> | |
| 163 | - </div> | |
| 164 | -</div> | |
| 165 | - | |
| 166 | -</body> | |
| 167 | 0 | \ No newline at end of file |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\widgets\ActiveForm; | |
| 4 | +use \yii\helpers\ArrayHelper; | |
| 5 | +use \common\models\DicCities; | |
| 6 | +use \common\models\Deliveries; | |
| 7 | +use yii\captcha\Captcha; | |
| 8 | + | |
| 9 | + | |
| 10 | +?> | |
| 11 | +<div id="modal_form_registration" > | |
| 12 | + <h3>Заявка на регистрацию</h3> | |
| 13 | + <div class="purple_registration active_button" style=" border-radius:12px 0 0 0 " id="person"><p>Частное лицо</p></div><div id="company" class="purple_registration"><p>Оптовик</p></div> | |
| 14 | + <div class="registration_holder"> | |
| 15 | + | |
| 16 | + <div class="registration_for_person"> | |
| 17 | + <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data'], 'method'=>'post','action' => '/site/signup']); ?> | |
| 18 | + | |
| 19 | + <?= $form->field($model, 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?> | |
| 20 | + | |
| 21 | + <?= $form->field($model, 'company')->hiddenInput(['value'=>'Частное лицо'])->label(false) ?> | |
| 22 | + | |
| 23 | + <?= $form->field($model, 'name')->textInput(['maxlength' => 45,'placeholder'=>'Имя'])->label(false) ?> | |
| 24 | + | |
| 25 | + <?= $form->field($model, 'surname')->textInput(['maxlength' => 45,'placeholder'=>'Фамилия'])->label(false) ?> | |
| 26 | + | |
| 27 | + <?= $form->field($model, 'phones')->textInput(['maxlength' => 45,'placeholder'=>'Телефон'])->label(false) ?> | |
| 28 | + | |
| 29 | + <?= $form->field($model, 'email')->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration'])->label(false) ?> | |
| 30 | + | |
| 31 | + <?= $form->field($model, 'pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?> | |
| 32 | + | |
| 33 | + <?= $form->field($model, 're_pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?> | |
| 34 | + | |
| 35 | + <?= $form->field($model, 'country',['options'=>['class'=>'selectize_item2' ]])->dropDownList( | |
| 36 | + ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'), | |
| 37 | + ['prompt' => 'Выберите область'] | |
| 38 | + )->label(false); | |
| 39 | + ?> | |
| 40 | + | |
| 41 | + <?= $form->field($model, 'city',['options'=>['class'=>'selectize_item2' ]])->dropDownList( | |
| 42 | + [], | |
| 43 | + ['prompt' => 'Выберите город'] | |
| 44 | + )->label(false); | |
| 45 | + ?> | |
| 46 | + | |
| 47 | + <?= $form->field($model, 'deliveries',['options'=>['class'=>'selectize_item2' ]])->dropDownList( | |
| 48 | + ArrayHelper::map(Deliveries::find()->all(), 'id', 'name'), | |
| 49 | + ['prompt' => 'Выберите тип перевозки'] | |
| 50 | + )->label(false); | |
| 51 | + ?> | |
| 52 | + | |
| 53 | + <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [ | |
| 54 | + 'options'=>['placeholder'=>'Введите код' ], | |
| 55 | + 'template' => '<div>{input}</div><div class="row"><div class="col-lg-3">{image}</div></div>', | |
| 56 | + ])->label(false); ?> | |
| 57 | + | |
| 58 | + <button class="purple" type="submit" value="Submit">Зарегистрироваться</button> | |
| 59 | + <?php ActiveForm::end(); ?> | |
| 60 | + </div> | |
| 61 | + | |
| 62 | + </div> | |
| 63 | +</div> | |
| 0 | 64 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | +$this->registerCssFile('/css/about_company.css'); | |
| 3 | +use \yii\helpers\Url; | |
| 4 | +$this->params['breadcrumbs'][] = "Команда"; | |
| 5 | +?> | |
| 6 | + | |
| 7 | +<?php | |
| 8 | + | |
| 9 | + | |
| 10 | +?> | |
| 11 | +<div class="main-vin"> | |
| 12 | + <p class="vin_article"><?=$this->title?></p> | |
| 13 | + <div class='side_menu'> | |
| 14 | + <?php | |
| 15 | + echo \yii\widgets\Menu::widget([ | |
| 16 | + 'options' => ['class' => 'side_menu-list'], | |
| 17 | + 'items' => [ | |
| 18 | + ['label' => 'Миссия', 'url' => Url::toRoute(['/page/about','translit'=>'about'])], | |
| 19 | + ['label' => 'Команда', 'url' => Url::toRoute(['/site/team'])], | |
| 20 | + ], | |
| 21 | + ]); | |
| 22 | + ?> | |
| 23 | + <div class="tab-content"> | |
| 24 | + <div id="profile"> | |
| 25 | + <?php foreach ($teamGroups as $group): ?> | |
| 26 | + <?=$this->render('team_list_layout', [ | |
| 27 | + 'group' => $group | |
| 28 | + ]);?> | |
| 29 | + <?php endforeach; ?> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | + </div> | |
| 33 | + <img src="/images/lonh_line.png" class='long_line'> | |
| 34 | +</div> | |
| 0 | 35 | \ No newline at end of file | ... | ... |
frontend/views/site/wholesalers.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -$this->registerCssFile('/css/style/optovikam.css'); | |
| 4 | -$this->title = "Оптовикам"; | |
| 5 | -$this->params['breadcrumbs'][] = $this->title; | |
| 6 | -?> | |
| 7 | - | |
| 8 | -<div class="main-vin"> | |
| 9 | - | |
| 10 | - <p class="vin_article">Оптовикам</p> | |
| 11 | - | |
| 12 | -<div class="choose_tovar"> | |
| 13 | -<p class="choose_tovar-inviting">Приглашаем к сотрудничеству СТО, магазины и торгующие организации</p> | |
| 14 | - | |
| 15 | -<div class="choose_tovar-list"> | |
| 16 | -<p>Общие положения сотрудничества:</p> | |
| 17 | -<ul> | |
| 18 | - <li>Работа с Оптовиками ведется на основании Договора. Регистрация на сайте в качестве Оптовика и заказ товара означают согласие с положениями данного Договора.</li> | |
| 19 | - <li>Уровень цен и скидок определяется руководством на основании договоренностей с Оптовиком.</li> | |
| 20 | - <li>Ответственность за применяемость заказанного товара к автомобилю клиента несет Оптовик. В случае необходимости и возможности мы готовы предоставить консультации по подбору товара.</li> | |
| 21 | -</ul> | |
| 22 | -</div> | |
| 23 | - | |
| 24 | -<div class="choose_tovar-list"> | |
| 25 | -<p>Возврат товара</p> | |
| 26 | -<ul> | |
| 27 | - <li>Возврат “складского” товара возможен на протяжении 14 дней (включая время на пересылку товара). Товар, привезенный “под клиента” возврату не подлежит.</li> | |
| 28 | - <li>Доставка товара осуществляется за счет Оптовика.</li> | |
| 29 | - <li>Товар принимается в неповрежденной упаковке. Надписи, скотч и т.д. должны отсутствовать.</li> | |
| 30 | - <li>Товар со следами установки возврату не подлежит.</li> | |
| 31 | - <li>Cтоимость возвращенного товара учитывается для оплаты следующих заказов.</li> | |
| 32 | -</ul> | |
| 33 | -</div> | |
| 34 | - | |
| 35 | -<div class="choose_tovar-list"> | |
| 36 | -<p>Гарантия</p> | |
| 37 | -<ul> | |
| 38 | - <li>Оригинальные запчасти поставляются без гарантии. Претензии принимаются только по комплектности товара.</li> | |
| 39 | - <li>Гарантия на запчасти производителя Aftermaket (кроме электрических деталей) составляет 14 дней с момента получения товара Оптовиком. Перечень документов, необходимых для предъявления гарантийного случая <a href=''>здесь.</a></li> | |
| 40 | -</ul> | |
| 41 | -</div> | |
| 42 | - | |
| 43 | -<div class="choose_tovar-list"> | |
| 44 | -<p>Доставка товара</p> | |
| 45 | -<ul> | |
| 46 | - <li>Киевляне – самовывоз со склада Поставщика.</li> | |
| 47 | - <li>Регионы – отправка транспортными компаниями (Автолюкс, Гюнсел, Новая Почта).</li> | |
| 48 | -</ul> | |
| 49 | -</div> | |
| 50 | -</div> | |
| 51 | - | |
| 52 | -</div> | |
| 53 | 0 | \ No newline at end of file |
frontend/web/css/main.css
frontend/web/css/style.css
frontend/web/css/style/my_profile.css
| ... | ... | @@ -237,21 +237,6 @@ cursor: pointer; |
| 237 | 237 | outline: none; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | -.orange { | |
| 241 | - height: 28px; | |
| 242 | - width: 32px; | |
| 243 | - border-radius: 7px; | |
| 244 | - border: 1px solid #ffc523; | |
| 245 | - margin-bottom: -1px; | |
| 246 | - font-size: 11px; | |
| 247 | - background-color: #ffc523; | |
| 248 | - box-shadow: 0px 4px 0 0px #efb515; | |
| 249 | - outline: none; | |
| 250 | - cursor: pointer; | |
| 251 | - position: initial; | |
| 252 | - bottom: 0; | |
| 253 | - margin-left: 0; | |
| 254 | -} | |
| 255 | 240 | |
| 256 | 241 | .input_date{ |
| 257 | 242 | width:241px; | ... | ... |
frontend/web/js/main.js
| ... | ... | @@ -2,11 +2,11 @@ |
| 2 | 2 | * Created by vitaliy on 23.11.15. |
| 3 | 3 | */ |
| 4 | 4 | $(document).ready(function(){ |
| 5 | - $('#accountsform-country').change(function(){ | |
| 5 | + $('#accounts-country').change(function(){ | |
| 6 | 6 | var region_id = $(this).val(); |
| 7 | 7 | if(region_id){ |
| 8 | 8 | $.get( "/ajax/get-city", {region_id:region_id}, function( data ) { |
| 9 | - var $input = $('#accountsform-city'); | |
| 9 | + var $input = $('#accounts-city'); | |
| 10 | 10 | $input.empty(); |
| 11 | 11 | $input.append(data); |
| 12 | 12 | }); |
| ... | ... | @@ -18,9 +18,9 @@ $(document).ready(function(){ |
| 18 | 18 | $(this).addClass('active_button'); |
| 19 | 19 | $('#person').removeClass('active_button'); |
| 20 | 20 | |
| 21 | - $('#accountsform-company').attr('type', 'text').attr('placeholder', 'Компания').val(''); | |
| 22 | - $('.field-accountsform-company').css('display','block'); | |
| 23 | - $('#accountsform-is_firm').val('1'); | |
| 21 | + $('#accounts-company').attr('type', 'text').attr('placeholder', 'Компания').val(''); | |
| 22 | + $('.field-accounts-company').css('display','block'); | |
| 23 | + $('#accounts-is_firm').val('1'); | |
| 24 | 24 | |
| 25 | 25 | }); |
| 26 | 26 | |
| ... | ... | @@ -28,9 +28,9 @@ $(document).ready(function(){ |
| 28 | 28 | $('#company').removeClass('active_button'); |
| 29 | 29 | $(this).addClass('active_button'); |
| 30 | 30 | |
| 31 | - $('.field-accountsform-company').css('display','none'); | |
| 32 | - $('#accountsform-company').attr('type', 'hidden').val('Частное лицо'); | |
| 33 | - $('#accountsform-is_firm').val('0'); | |
| 31 | + $('.field-accounts-company').css('display','none'); | |
| 32 | + $('#accounts-company').attr('type', 'hidden').val('Частное лицо'); | |
| 33 | + $('#accounts-is_firm').val('0'); | |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | }); | ... | ... |
frontend/web/js/script.js
| ... | ... | @@ -782,16 +782,6 @@ $('.menu_block_center1').mouseleave(function(){ |
| 782 | 782 | }); |
| 783 | 783 | |
| 784 | 784 | $(document).ready(function(){ |
| 785 | - $(".side_menu-list").on("click","a", function (event) { | |
| 786 | - //отменяем стандартную обработку нажатия по ссылке | |
| 787 | - event.preventDefault(); | |
| 788 | - //забираем идентификатор бока с атрибута href | |
| 789 | - var id = $(this).attr('href'), | |
| 790 | - //узнаем высоту от начала страницы до блока на который ссылается якорь | |
| 791 | - top = $(id).offset().top; | |
| 792 | - //анимируем переход на расстояние - top за 1500 мс | |
| 793 | - $('body,html').animate({scrollTop: top}, 1000); | |
| 794 | - }); | |
| 795 | 785 | |
| 796 | 786 | $('.full_search').click(function(){ |
| 797 | 787 | event.preventDefault(); | ... | ... |
storage/.htaccess deleted
storage/0c66e0fd67756b57b980bbe8d72da37d/200x200.png deleted
7.93 KB
storage/0c66e0fd67756b57b980bbe8d72da37d/original.png deleted
838 Bytes
storage/1d1ddd6734c119028f12799e154b3086/200x200.png deleted
62.3 KB
storage/1d1ddd6734c119028f12799e154b3086/original.png deleted
46.9 KB
storage/1e54f0824124e8e01fe53f6cd24aa278/200x200.png deleted
73.1 KB
storage/1e54f0824124e8e01fe53f6cd24aa278/original.png deleted
88.3 KB
storage/23301a2c6a92e8ec712c3fa8026656f7/original.png deleted
279 Bytes
storage/3182b2b494b1d15298baf57954c80fb0/200x200.jpg deleted
4.33 KB
storage/40303fdd44b5ef0b7e91d160b0685a77/200x200.png deleted
1.64 KB
storage/40303fdd44b5ef0b7e91d160b0685a77/original.png deleted
278 Bytes
storage/4929fc8db8a21618cafbaf3cf97e0558/200x200.jpg deleted
4.27 KB
storage/4929fc8db8a21618cafbaf3cf97e0558/x.jpg deleted
244 KB
storage/4a94428188ea08e7689af186d8bf0c31/200x200.png deleted
59.5 KB
storage/4a94428188ea08e7689af186d8bf0c31/original.png deleted
84.7 KB
storage/5a1dd19f83afba83d262f86a4c65edc5/200x200.png deleted
50.8 KB
storage/5a1dd19f83afba83d262f86a4c65edc5/original.png deleted
109 KB
storage/676b4e1f18a2f68d1bf59850e8cafabc/x.png deleted
31.9 KB
storage/7160cae25ca4674697274dc288200ea1/200x200.png deleted
27.2 KB
storage/7160cae25ca4674697274dc288200ea1/original.png deleted
9.79 KB
storage/75426b23fbcf471ae0f5059f9ab3d824/200x200.png deleted
83.9 KB
storage/75426b23fbcf471ae0f5059f9ab3d824/original.png deleted
86.4 KB
storage/84f933764827939b158a42cbbbbb2170/200x200.png deleted
22.7 KB
storage/84f933764827939b158a42cbbbbb2170/original.png deleted
19.5 KB
storage/9551a85821514b78f863813fcaad085d/original.png deleted
1012 Bytes
storage/96e1f3363613f3fccd55eb5eb228e0ba/200x200.jpg deleted
4.65 KB
storage/96e1f3363613f3fccd55eb5eb228e0ba/original.jpg deleted
1.55 KB
storage/a3a272f7901f29ad1f6cd86e396320d8/original.jpg deleted
1.97 KB
storage/a62948dc31d3269c447bd64fc853ae3a/200x200.jpg deleted
213 KB
storage/a62948dc31d3269c447bd64fc853ae3a/original.jpg deleted
112 KB
storage/a62948dc31d3269c447bd64fc853ae3a/x.jpg deleted
112 KB
storage/a99080da55681122aa044b141e5d8d96/200x200.png deleted
73.3 KB
storage/a99080da55681122aa044b141e5d8d96/original.png deleted
58.9 KB
storage/af5cc0955fcf2bd15a56efa582ece550/200x200.jpg deleted
90.2 KB
storage/af5cc0955fcf2bd15a56efa582ece550/original.jpg deleted
75.5 KB
storage/b6456643a4e6e41ae8aee94327848b12/200x200.png deleted
80.9 KB
storage/b6456643a4e6e41ae8aee94327848b12/original.png deleted
404 KB
storage/bb909ae41e1a3b09c88ea402f74e2caa/200x200.png deleted
61.7 KB
storage/bb909ae41e1a3b09c88ea402f74e2caa/original.png deleted
44.7 KB
storage/c0c5382e254a21fdcfb55d827a557dd9/200x200.png deleted
2.83 KB
storage/c0c5382e254a21fdcfb55d827a557dd9/original.png deleted
3.43 KB
storage/cb32318e7f1ef8e5dea0090346f3e511/200x200.png deleted
95.5 KB
storage/cb32318e7f1ef8e5dea0090346f3e511/original.png deleted
581 KB
storage/d063dccc8763391d7bac467a32a983c4/200x200.png deleted
70.1 KB
storage/d063dccc8763391d7bac467a32a983c4/original.png deleted
321 KB
storage/d732764150f3c6f779d0aed7a35b551e/200x200.jpg deleted
305 KB
storage/d732764150f3c6f779d0aed7a35b551e/original.jpg deleted
161 KB
storage/ef776ce280114fb3a5aeb80da2692813/200x200.png deleted
87.5 KB
storage/ef776ce280114fb3a5aeb80da2692813/original.png deleted
103 KB
storage/index.php deleted
| 1 | -<?php |
storage/parser_data/auto/5648.csv deleted
| 1 | -1;2;3;;;4;5 | |
| 2 | -Sporti TXI 15W40 1L;595405083BD;VARTA;;;1;2173.95 | |
| 3 | -TM 75w80 1L;0 001 108 203;+AE+;;;0;3802.85 | |
| 4 | -TM 80w90 1L;0 001 109 324;TTTT;;;4;3659.05 | |
| 5 | -Tranself NFJ 75W80 1L (ïîëóñèíòåòèêà);0 001 121 408;BOSCH;;;0;3543.06 | |
| 6 | -Tranself NFP 75W80 1L (ñèíòåòèêà);0 001 123 012;BOSCH;;;0;4753.81 | |
| 7 | -Turbo DieseI 10W40 5L;0 001 125 031;BOSCH;;;0;4044.24 | |
| 8 | -Turbo Diesel 10W40 1L;0 001 125 042;BOSCH;;;0;3954.64 | |
| 9 | -WX45;0 001 125 519;BOSCH;;;0;4499.62 | |
| 10 | -Àìîðòèçàòîð áàãàæíèêà Avensis 97->;0 001 138 001;BOSCH;;;0;3400.67 | |
| 11 | -Àìîðòèçàòîð áàãàæíèêà Berlingo/Partner;0 001 152 410;BOSCH;;;0;6139.36 | |
| 12 | -Àìîðòèçàòîð áàãàæíèêà C4/307;0 001 231 033;BOSCH;;;0;12421.31 | |
| 13 | -Àìîðòèçàòîð áàãàæíèêà Kangoo;0 092 M4F 290;BOSCH;;;0;639.38 | |
| 14 | -Àìîðòèçàòîð áàãàæíèêà R19;0 092 M4F 300;BOSCH;;;0;654.83 | |
| 15 | -Tranself NFJ 75W80 1L (ïîëóñèíòåòèêà);0 092 M4F 340;BOSCH;;;0;796.14 | |
| 16 | -Tranself NFP 75W80 1L (ñèíòåòèêà);0 092 M4F 360;BOSCH;;;1;755.40 | |
| 17 | -Turbo DieseI 10W40 5L;0 092 M4F 410;BOSCH;;;1;1087.06 | |
| 18 | -Turbo Diesel 10W40 1L;0 092 M4F 450;BOSCH;;;1;1294.79 | |
| 19 | -WX45;0 092 M4F 510;BOSCH;;;1;1351.54 | |
| 20 | -Sporti TXI 15W40 1L;0 092 M4F 520;BOSCH;;;1;1405.98 | |
| 21 | -TM 75w80 1L;0 092 M60 040;BOSCH;;;1;657.53 |
storage/parser_data/manual/Групы VW.xlsx deleted
No preview for this file type
storage/parser_data/temp/5648.csv deleted
| 1 | -1;2;3;;;4;5 | |
| 2 | -Sporti TXI 15W40 1L;595405083BD;VARTA;;;1;2173.95 | |
| 3 | -TM 75w80 1L;0 001 108 203;+AE+;;;0;3802.85 | |
| 4 | -TM 80w90 1L;0 001 109 324;TTTT;;;4;3659.05 | |
| 5 | -Tranself NFJ 75W80 1L (ïîëóñèíòåòèêà);0 001 121 408;BOSCH;;;0;3543.06 | |
| 6 | -Tranself NFP 75W80 1L (ñèíòåòèêà);0 001 123 012;BOSCH;;;0;4753.81 | |
| 7 | -Turbo DieseI 10W40 5L;0 001 125 031;BOSCH;;;0;4044.24 | |
| 8 | -Turbo Diesel 10W40 1L;0 001 125 042;BOSCH;;;0;3954.64 | |
| 9 | -WX45;0 001 125 519;BOSCH;;;0;4499.62 | |
| 10 | -Àìîðòèçàòîð áàãàæíèêà Avensis 97->;0 001 138 001;BOSCH;;;0;3400.67 | |
| 11 | -Àìîðòèçàòîð áàãàæíèêà Berlingo/Partner;0 001 152 410;BOSCH;;;0;6139.36 | |
| 12 | -Àìîðòèçàòîð áàãàæíèêà C4/307;0 001 231 033;BOSCH;;;0;12421.31 | |
| 13 | -Àìîðòèçàòîð áàãàæíèêà Kangoo;0 092 M4F 290;BOSCH;;;0;639.38 | |
| 14 | -Àìîðòèçàòîð áàãàæíèêà R19;0 092 M4F 300;BOSCH;;;0;654.83 | |
| 15 | -Tranself NFJ 75W80 1L (ïîëóñèíòåòèêà);0 092 M4F 340;BOSCH;;;0;796.14 | |
| 16 | -Tranself NFP 75W80 1L (ñèíòåòèêà);0 092 M4F 360;BOSCH;;;1;755.40 | |
| 17 | -Turbo DieseI 10W40 5L;0 092 M4F 410;BOSCH;;;1;1087.06 | |
| 18 | -Turbo Diesel 10W40 1L;0 092 M4F 450;BOSCH;;;1;1294.79 | |
| 19 | -WX45;0 092 M4F 510;BOSCH;;;1;1351.54 | |
| 20 | -Sporti TXI 15W40 1L;0 092 M4F 520;BOSCH;;;1;1405.98 | |
| 21 | -TM 75w80 1L;0 092 M60 040;BOSCH;;;1;657.53 |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/[Content_Types].xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="bin" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings"/><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/worksheets/sheet2.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/worksheets/sheet3.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/><Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/><Override PartName="/xl/calcChain.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/_rels/.rels deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/docProps/app.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Application>Microsoft Excel</Application><DocSecurity>0</DocSecurity><ScaleCrop>false</ScaleCrop><HeadingPairs><vt:vector size="2" baseType="variant"><vt:variant><vt:lpstr>Листы</vt:lpstr></vt:variant><vt:variant><vt:i4>3</vt:i4></vt:variant></vt:vector></HeadingPairs><TitlesOfParts><vt:vector size="3" baseType="lpstr"><vt:lpstr>Лист1</vt:lpstr><vt:lpstr>Лист2</vt:lpstr><vt:lpstr>Лист3</vt:lpstr></vt:vector></TitlesOfParts><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>15.0300</AppVersion></Properties> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/docProps/core.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:creator></dc:creator><cp:lastModifiedBy></cp:lastModifiedBy><dcterms:created xsi:type="dcterms:W3CDTF">2006-09-16T00:00:00Z</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">2015-11-17T15:57:37Z</dcterms:modified></cp:coreProperties> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/xl/_rels/workbook.xml.rels deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet3.xml"/><Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain" Target="calcChain.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet2.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/><Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/></Relationships> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/xl/calcChain.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<calcChain xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><c r="H3" i="1" l="1"/><c r="H4" i="1"/><c r="H5" i="1"/><c r="H6" i="1"/><c r="H7" i="1"/><c r="H8" i="1"/><c r="H9" i="1"/><c r="H2" i="1"/></calcChain> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/xl/printerSettings/printerSettings1.bin deleted
No preview for this file type
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/xl/sharedStrings.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="7" uniqueCount="7"><si><t>RG</t></si><si><t>ВХ</t></si><si><t xml:space="preserve">М опт </t></si><si><t xml:space="preserve">Опт </t></si><si><t>Дилер</t></si><si><t>Коеф. Розница</t></si><si><t>Розница Результат</t></si></sst> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/xl/styles.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><fonts count="4" x14ac:knownFonts="1"><font><sz val="11"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font><font><b/><sz val="10"/><color rgb="FF000000"/><name val="Arial"/><family val="2"/></font><font><b/><sz val="10"/><color rgb="FF000000"/><name val="Times New Roman"/><family val="1"/></font><font><sz val="10"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="3"><border><left/><right/><top/><bottom/><diagonal/></border><border><left/><right style="thin"><color indexed="64"/></right><top/><bottom style="thin"><color indexed="64"/></bottom><diagonal/></border><border><left style="thin"><color indexed="64"/></left><right style="thin"><color indexed="64"/></right><top/><bottom style="thin"><color indexed="64"/></bottom><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="6"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/><xf numFmtId="0" fontId="1" fillId="0" borderId="1" xfId="0" applyFont="1" applyBorder="1" applyAlignment="1"><alignment horizontal="center" wrapText="1"/></xf><xf numFmtId="0" fontId="2" fillId="0" borderId="2" xfId="0" applyFont="1" applyBorder="1" applyAlignment="1"><alignment horizontal="center" vertical="center" wrapText="1"/></xf><xf numFmtId="0" fontId="3" fillId="0" borderId="0" xfId="0" applyFont="1"/><xf numFmtId="49" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/></cellXfs><cellStyles count="1"><cellStyle name="Обычный" xfId="0" builtinId="0"/></cellStyles><dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium2" defaultPivotStyle="PivotStyleMedium9"/><extLst><ext uri="{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:slicerStyles defaultSlicerStyle="SlicerStyleLight1"/></ext><ext uri="{9260A510-F301-46a8-8635-F512D64BE5F5}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><x15:timelineStyles defaultTimelineStyle="TimeSlicerStyleLight1"/></ext></extLst></styleSheet> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/xl/theme/theme1.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Тема Office"><a:themeElements><a:clrScheme name="Стандартная"><a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="1F497D"/></a:dk2><a:lt2><a:srgbClr val="EEECE1"/></a:lt2><a:accent1><a:srgbClr val="4F81BD"/></a:accent1><a:accent2><a:srgbClr val="C0504D"/></a:accent2><a:accent3><a:srgbClr val="9BBB59"/></a:accent3><a:accent4><a:srgbClr val="8064A2"/></a:accent4><a:accent5><a:srgbClr val="4BACC6"/></a:accent5><a:accent6><a:srgbClr val="F79646"/></a:accent6><a:hlink><a:srgbClr val="0000FF"/></a:hlink><a:folHlink><a:srgbClr val="800080"/></a:folHlink></a:clrScheme><a:fontScheme name="Стандартная"><a:majorFont><a:latin typeface="Cambria" panose="020F0302020204030204"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="MS Pゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="宋体"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Tahoma"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/></a:majorFont><a:minorFont><a:latin typeface="Calibri" panose="020F0502020204030204"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="MS Pゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="宋体"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Tahoma"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/></a:minorFont></a:fontScheme><a:fmtScheme name="Стандартная"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="1"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:shade val="51000"/><a:satMod val="130000"/></a:schemeClr></a:gs><a:gs pos="80000"><a:schemeClr val="phClr"><a:shade val="93000"/><a:satMod val="130000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="94000"/><a:satMod val="135000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln><a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln><a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst><a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0"/></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000"/></a:lightRig></a:scene3d><a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs><a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/></a:theme> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/xl/workbook.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><fileVersion appName="xl" lastEdited="6" lowestEdited="4" rupBuild="14420"/><workbookPr filterPrivacy="1" defaultThemeVersion="124226"/><bookViews><workbookView xWindow="240" yWindow="765" windowWidth="14805" windowHeight="7350"/></bookViews><sheets><sheet name="Лист1" sheetId="1" r:id="rId1"/><sheet name="Лист2" sheetId="2" r:id="rId2"/><sheet name="Лист3" sheetId="3" r:id="rId3"/></sheets><calcPr calcId="152511"/></workbook> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/xl/worksheets/_rels/sheet1.xml.rels deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings" Target="../printerSettings/printerSettings1.bin"/></Relationships> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/xl/worksheets/sheet1.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><dimension ref="A1:H60"/><sheetViews><sheetView tabSelected="1" workbookViewId="0"><selection activeCell="K19" sqref="K19"/></sheetView></sheetViews><sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/><cols><col min="1" max="1" width="16.42578125" style="3" customWidth="1"/><col min="2" max="2" width="13.85546875" style="3" customWidth="1"/><col min="3" max="3" width="16.5703125" customWidth="1"/><col min="4" max="4" width="15.85546875" customWidth="1"/><col min="5" max="5" width="11" customWidth="1"/><col min="6" max="6" width="15.28515625" customWidth="1"/><col min="8" max="8" width="13.28515625" style="4" customWidth="1"/></cols><sheetData><row r="1" spans="1:8" x14ac:dyDescent="0.25"><c r="A1" s="3" t="s"><v>0</v></c><c r="B1" s="3" t="s"><v>1</v></c><c r="C1" t="s"><v>2</v></c><c r="D1" t="s"><v>3</v></c><c r="E1" t="s"><v>4</v></c><c r="F1" t="s"><v>5</v></c><c r="H1" s="4" t="s"><v>6</v></c></row><row r="2" spans="1:8" x14ac:dyDescent="0.25"><c r="A2" s="2"><v>1</v></c><c r="B2" s="1"><v>0.57200000000000006</v></c><c r="F2"><v>1.35</v></c><c r="G2" s="1"/><c r="H2" s="5"><f>B2*F2</f><v>0.77220000000000011</v></c></row><row r="3" spans="1:8" x14ac:dyDescent="0.25"><c r="A3" s="2"><v>2</v></c><c r="B3" s="1"><v>0.66</v></c><c r="F3"><v>1.35</v></c><c r="G3" s="1"/><c r="H3" s="5"><f t="shared" ref="H3:H9" si="0">B3*F3</f><v>0.89100000000000013</v></c></row><row r="4" spans="1:8" x14ac:dyDescent="0.25"><c r="A4" s="2"><v>3</v></c><c r="B4" s="1"><v>0.748</v></c><c r="F4"><v>1.35</v></c><c r="G4" s="1"/><c r="H4" s="5"><f t="shared" si="0"/><v>1.0098</v></c></row><row r="5" spans="1:8" x14ac:dyDescent="0.25"><c r="A5" s="2"><v>4</v></c><c r="B5" s="1"><v>0.82500000000000007</v></c><c r="F5"><v>1.35</v></c><c r="G5" s="1"/><c r="H5" s="5"><f t="shared" si="0"/><v>1.1137500000000002</v></c></row><row r="6" spans="1:8" x14ac:dyDescent="0.25"><c r="A6" s="2"><v>5</v></c><c r="B6" s="1"><v>0.92949999999999999</v></c><c r="F6"><v>1.35</v></c><c r="G6" s="1"/><c r="H6" s="5"><f t="shared" si="0"/><v>1.2548250000000001</v></c></row><row r="7" spans="1:8" x14ac:dyDescent="0.25"><c r="A7" s="2"><v>6</v></c><c r="B7" s="1"><v>0.97350000000000014</v></c><c r="F7"><v>1.35</v></c><c r="G7" s="1"/><c r="H7" s="5"><f t="shared" si="0"/><v>1.3142250000000002</v></c></row><row r="8" spans="1:8" x14ac:dyDescent="0.25"><c r="A8" s="2"><v>7</v></c><c r="B8" s="1"><v>0.97350000000000014</v></c><c r="F8"><v>1.35</v></c><c r="G8" s="1"/><c r="H8" s="5"><f t="shared" si="0"/><v>1.3142250000000002</v></c></row><row r="9" spans="1:8" x14ac:dyDescent="0.25"><c r="A9" s="2"><v>8</v></c><c r="B9" s="1"><v>0.99550000000000016</v></c><c r="F9"><v>1.35</v></c><c r="G9" s="1"/><c r="H9" s="5"><f t="shared" si="0"/><v>1.3439250000000003</v></c></row><row r="10" spans="1:8" x14ac:dyDescent="0.25"><c r="A10" s="2"/><c r="B10" s="1"/><c r="G10" s="1"/><c r="H10" s="5"/></row><row r="11" spans="1:8" x14ac:dyDescent="0.25"><c r="A11" s="2"/><c r="B11" s="1"/><c r="G11" s="1"/><c r="H11" s="5"/></row><row r="12" spans="1:8" x14ac:dyDescent="0.25"><c r="A12" s="2"/><c r="B12" s="1"/><c r="E12" s="3"/><c r="G12" s="1"/><c r="H12" s="5"/></row><row r="13" spans="1:8" x14ac:dyDescent="0.25"><c r="A13" s="2"/><c r="B13" s="1"/><c r="G13" s="1"/><c r="H13" s="5"/></row><row r="14" spans="1:8" x14ac:dyDescent="0.25"><c r="A14" s="2"/><c r="B14" s="1"/><c r="G14" s="1"/><c r="H14" s="5"/></row><row r="15" spans="1:8" x14ac:dyDescent="0.25"><c r="A15" s="2"/><c r="B15" s="1"/><c r="G15" s="1"/><c r="H15" s="5"/></row><row r="16" spans="1:8" x14ac:dyDescent="0.25"><c r="A16" s="2"/><c r="B16" s="1"/><c r="G16" s="1"/><c r="H16" s="5"/></row><row r="17" spans="1:8" x14ac:dyDescent="0.25"><c r="A17" s="2"/><c r="B17" s="1"/><c r="G17" s="1"/><c r="H17" s="5"/></row><row r="18" spans="1:8" x14ac:dyDescent="0.25"><c r="A18" s="2"/><c r="B18" s="1"/><c r="G18" s="1"/><c r="H18" s="5"/></row><row r="19" spans="1:8" x14ac:dyDescent="0.25"><c r="A19" s="2"/><c r="B19" s="1"/><c r="G19" s="1"/><c r="H19" s="5"/></row><row r="20" spans="1:8" x14ac:dyDescent="0.25"><c r="A20" s="2"/><c r="B20" s="1"/><c r="G20" s="1"/><c r="H20" s="5"/></row><row r="21" spans="1:8" x14ac:dyDescent="0.25"><c r="A21" s="2"/><c r="B21" s="1"/><c r="G21" s="1"/><c r="H21" s="5"/></row><row r="22" spans="1:8" x14ac:dyDescent="0.25"><c r="A22" s="2"/><c r="B22" s="1"/><c r="G22" s="1"/><c r="H22" s="5"/></row><row r="23" spans="1:8" x14ac:dyDescent="0.25"><c r="A23" s="2"/><c r="B23" s="1"/><c r="G23" s="1"/><c r="H23" s="5"/></row><row r="24" spans="1:8" x14ac:dyDescent="0.25"><c r="A24" s="2"/><c r="B24" s="1"/><c r="G24" s="1"/><c r="H24" s="5"/></row><row r="25" spans="1:8" x14ac:dyDescent="0.25"><c r="A25" s="2"/><c r="B25" s="1"/><c r="G25" s="1"/><c r="H25" s="5"/></row><row r="26" spans="1:8" x14ac:dyDescent="0.25"><c r="A26" s="2"/><c r="B26" s="1"/><c r="G26" s="1"/><c r="H26" s="5"/></row><row r="27" spans="1:8" x14ac:dyDescent="0.25"><c r="A27" s="2"/><c r="B27" s="1"/><c r="G27" s="1"/><c r="H27" s="5"/></row><row r="28" spans="1:8" x14ac:dyDescent="0.25"><c r="A28" s="2"/><c r="B28" s="1"/><c r="G28" s="1"/><c r="H28" s="5"/></row><row r="29" spans="1:8" x14ac:dyDescent="0.25"><c r="A29" s="2"/><c r="B29" s="1"/><c r="G29" s="1"/><c r="H29" s="5"/></row><row r="30" spans="1:8" x14ac:dyDescent="0.25"><c r="A30" s="2"/><c r="B30" s="1"/></row><row r="31" spans="1:8" x14ac:dyDescent="0.25"><c r="A31" s="2"/><c r="B31" s="1"/></row><row r="32" spans="1:8" x14ac:dyDescent="0.25"><c r="A32" s="2"/><c r="B32" s="1"/></row><row r="33" spans="1:2" x14ac:dyDescent="0.25"><c r="A33" s="2"/><c r="B33" s="1"/></row><row r="34" spans="1:2" x14ac:dyDescent="0.25"><c r="A34" s="2"/><c r="B34" s="1"/></row><row r="35" spans="1:2" x14ac:dyDescent="0.25"><c r="A35" s="2"/><c r="B35" s="1"/></row><row r="36" spans="1:2" x14ac:dyDescent="0.25"><c r="A36" s="2"/><c r="B36" s="1"/></row><row r="37" spans="1:2" x14ac:dyDescent="0.25"><c r="A37" s="2"/><c r="B37" s="1"/></row><row r="38" spans="1:2" x14ac:dyDescent="0.25"><c r="A38" s="2"/><c r="B38" s="1"/></row><row r="39" spans="1:2" x14ac:dyDescent="0.25"><c r="A39" s="2"/><c r="B39" s="1"/></row><row r="40" spans="1:2" x14ac:dyDescent="0.25"><c r="A40" s="2"/><c r="B40" s="1"/></row><row r="41" spans="1:2" x14ac:dyDescent="0.25"><c r="A41" s="2"/><c r="B41" s="1"/></row><row r="42" spans="1:2" x14ac:dyDescent="0.25"><c r="A42" s="2"/><c r="B42" s="1"/></row><row r="43" spans="1:2" x14ac:dyDescent="0.25"><c r="A43" s="2"/><c r="B43" s="1"/></row><row r="44" spans="1:2" x14ac:dyDescent="0.25"><c r="A44" s="2"/><c r="B44" s="1"/></row><row r="45" spans="1:2" x14ac:dyDescent="0.25"><c r="A45" s="2"/><c r="B45" s="1"/></row><row r="46" spans="1:2" x14ac:dyDescent="0.25"><c r="A46" s="2"/><c r="B46" s="1"/></row><row r="47" spans="1:2" x14ac:dyDescent="0.25"><c r="A47" s="2"/><c r="B47" s="1"/></row><row r="48" spans="1:2" x14ac:dyDescent="0.25"><c r="A48" s="2"/><c r="B48" s="1"/></row><row r="49" spans="1:2" x14ac:dyDescent="0.25"><c r="A49" s="2"/><c r="B49" s="1"/></row><row r="50" spans="1:2" x14ac:dyDescent="0.25"><c r="A50" s="2"/><c r="B50" s="1"/></row><row r="51" spans="1:2" x14ac:dyDescent="0.25"><c r="A51" s="2"/><c r="B51" s="1"/></row><row r="52" spans="1:2" x14ac:dyDescent="0.25"><c r="A52" s="2"/><c r="B52" s="1"/></row><row r="53" spans="1:2" x14ac:dyDescent="0.25"><c r="A53" s="2"/><c r="B53" s="1"/></row><row r="54" spans="1:2" x14ac:dyDescent="0.25"><c r="A54" s="2"/><c r="B54" s="1"/></row><row r="55" spans="1:2" x14ac:dyDescent="0.25"><c r="A55" s="2"/><c r="B55" s="1"/></row><row r="56" spans="1:2" x14ac:dyDescent="0.25"><c r="A56" s="2"/><c r="B56" s="1"/></row><row r="57" spans="1:2" x14ac:dyDescent="0.25"><c r="A57" s="2"/><c r="B57" s="1"/></row><row r="58" spans="1:2" x14ac:dyDescent="0.25"><c r="B58" s="1"/></row><row r="59" spans="1:2" x14ac:dyDescent="0.25"><c r="B59" s="1"/></row><row r="60" spans="1:2" x14ac:dyDescent="0.25"><c r="B60" s="1"/></row></sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/><pageSetup paperSize="9" orientation="portrait" verticalDpi="0" r:id="rId1"/></worksheet> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/xl/worksheets/sheet2.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><dimension ref="A1"/><sheetViews><sheetView workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/><sheetData/><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/></worksheet> | |
| 3 | 0 | \ No newline at end of file |
storage/parser_data/temp/xlsx/kud0hb7or3133ull44s061thg2/xl/worksheets/sheet3.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| 2 | -<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><dimension ref="A1"/><sheetViews><sheetView workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/><sheetData/><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/></worksheet> | |
| 3 | 0 | \ No newline at end of file |
| 1 | +yii\web\Cookie Object ( [name] => _frontendUser [value] => [1,"admin",2592000] [domain] => [expire] => 1451578203 [path] => / [secure] => [httpOnly] => 1 ) 1 | |
| 2 | +yii\web\Cookie Object ( [name] => _frontendUser [value] => [4201,"wwww",2592000] [domain] => [expire] => 1451578282 [path] => / [secure] => [httpOnly] => 1 ) 1 | |
| 0 | 3 | \ No newline at end of file | ... | ... |
tests/unit/BaseConverterTest.php
tests/unit/CrossesParsingTest.php
| 1 | 1 | <?php |
| 2 | 2 | namespace tests\unit; |
| 3 | +use common\components\CustomArrayHelper; | |
| 3 | 4 | use common\components\UserStore; |
| 4 | 5 | |
| 5 | 6 | use Yii; |
| ... | ... | @@ -24,16 +25,17 @@ class CrossesParsingTest extends \Codeception\TestCase\Test |
| 24 | 25 | |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | - public function testReadCrosses(){ | |
| 28 | + public function testCrossesConfiguration(){ | |
| 28 | 29 | |
| 29 | 30 | $this->data = Yii::$app->multiparser->parse( $this->file_path, $this->options ); |
| 30 | 31 | $this->assertNotEmpty( $this->data, 'Output array is empty' ); |
| 31 | 32 | $this->assertNotCount( 76, $this->data, 'Output array don`t have 76 rows' ); |
| 33 | + $this->data = CustomArrayHelper::createAssocArray( $this->data, ['ARTICLE','CROSS_ARTICLE','BRAND','CROSS_BRAND'] ); | |
| 32 | 34 | $this->assertArrayHasKey( 'ARTICLE', $this->data[0], 'Output array don`t have key - ARTICLE' ); |
| 33 | 35 | $this->assertArrayHasKey( 'CROSS_ARTICLE', $this->data[0], 'Output array don`t have key - CROSS_ARTICLE' ); |
| 34 | 36 | $this->assertArrayHasKey( 'BRAND', $this->data[0], 'Output array don`t have key - BRAND' ); |
| 35 | 37 | $this->assertArrayHasKey( 'CROSS_BRAND', $this->data[0], 'Output array don`t have key - CROSS_BRAND' ); |
| 36 | - $this->assertEquals( $this->data[0]['BRAND'], strtoupper($this->data[0]['BRAND']),'BRAND not converted to upper case' ); | |
| 38 | + | |
| 37 | 39 | } |
| 38 | 40 | |
| 39 | 41 | ... | ... |