From: Alexander Smirnov Date: Tue, 30 Jul 2024 12:09:15 +0000 (+0300) Subject: Убираем старый код X-Git-Tag: 1.4~45^2~5 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=eeae84012e122c097f99efb78d94f693b6cfacf1;p=erp24_rep%2Fyii-erp24%2F.git Убираем старый код --- diff --git a/erp24/actions/motivation/UploadXlsxAction.php b/erp24/actions/motivation/UploadXlsxAction.php deleted file mode 100644 index 1ac5a11e..00000000 --- a/erp24/actions/motivation/UploadXlsxAction.php +++ /dev/null @@ -1,55 +0,0 @@ - false, 'extensions' => 'xlsx'], - ]); - - $sheets = []; - if (Yii::$app->request->isPost) { - $model->myfile = UploadedFile::getInstance($model, 'myfile'); - if ($model->myfile && $model->validate()) { - $path = Yii::getAlias('@uploads') . '/' . date("YmdHis") . rand(1000, 9999) . "." . $model->myfile->extension; - $model->myfile->saveAs($path); - // read xlsx - $reader = ReaderEntityFactory::createXLSXReader(); - $reader->open($path); - foreach ($reader->getSheetIterator() as $sheetData) { - $dataNum = 1; - $sheet = ['rows' => [], 'vars' => []]; - foreach ($sheetData->getRowIterator() as $row) { - $sheetRow = []; - foreach ($row->getCells() as $cell) { - if ($cell->getValue() == '###') { - $dataNum = 2; - break; - } - $sheetRow []= $cell->getValue(); - } - switch ($dataNum) { - case 1: { $sheet['rows'][] = $sheetRow; break;} - case 2: { $sheet['vars'][] = $sheetRow; break;} - } - } - $sheets []= $sheet; - } - $reader->close(); - } - } - - return $this->controller->render('upload-xlsx', - compact('model', 'sheets')); - } -} \ No newline at end of file diff --git a/erp24/controllers/MotivationController.php b/erp24/controllers/MotivationController.php index 1fb1ca18..f81c287b 100644 --- a/erp24/controllers/MotivationController.php +++ b/erp24/controllers/MotivationController.php @@ -12,7 +12,6 @@ class MotivationController extends Controller public function actions() { return [ 'index' => \yii_app\actions\motivation\IndexAction::class, - //'upload-xlsx' => \yii_app\actions\motivation\UploadXlsxAction::class, 'values' => \yii_app\actions\motivation\ValuesAction::class, 'create-value' => \yii_app\actions\motivation\CreateValueAction::class, 'update-value' => \yii_app\actions\motivation\UpdateValueAction::class, diff --git a/erp24/views/motivation/upload-xlsx.php b/erp24/views/motivation/upload-xlsx.php deleted file mode 100644 index f78b8a54..00000000 --- a/erp24/views/motivation/upload-xlsx.php +++ /dev/null @@ -1,57 +0,0 @@ - - -
- - ['enctype' => 'multipart/form-data']]) ?> - -
-
-
-
Excel file:
-
field($model, 'myfile')->fileInput()->label(false) ?>
-
-
-
'btn btn-success btn-sm'])?>
-
-
-
- - - - - - - - - - - - - - - $rows): ?> - - - ###'; continue; } ?> - - - - - - - - - -
NumNamVal
- - -