function doExecute(\Classes\Controller\Controller\Request $request) { $request->addFeedback('UploadImportFile'); // Получаем переменные $originName = $request->getProperty('filename'); $folderName = $request->getProperty('timestamp'); // Check command file $tempName = NULL; $is_OK = FALSE; if (\Classes\Controller\Util\Utils::getTempFileName($originName, $tempName)) { // Copy file to TEMP file $is_OK = copy($tempName, \Classes\Controller\Util\Utils::tempPath() . '/' . $folderName . '/' . $originName); } // File not found $request->addFeedback($is_OK); include \Classes\Controller\Util\Utils::createViewName('uploadExcelConstructorFile'); }
function doExecute(\Classes\Controller\Controller\Request $request) { $request->addFeedback('UploadExcelConstructorFile'); // Получаем переменные $originName = $request->getProperty('filename'); $folderName = $request->getProperty('timestamp'); // Create new folder in TEMP $this->makeTempFolder($folderName); // Check command file $tempName = NULL; if (\Classes\Controller\Util\Utils::getTempFileName($originName, $tempName)) { // Upload command file $uploadFactory = new \Classes\Factory\Import\Instance\InstanceUploaderFromExcel(); $array = $uploadFactory->upload($tempName, new \Classes\Instance\Command\Command()); foreach ($array as $e) { $command = $e->getProperty('command'); $object = $e->getProperty('object'); $format = $e->getProperty('format'); $file = $e->getProperty('file'); // Prepare empty command row $row = array(); if (!is_null($command)) { $row['command'] = $command->get(); } if (!is_null($object)) { $row['object'] = $object->get(); } if (!is_null($format)) { $row['format'] = $format->get(); } if (!is_null($file)) { $row['file'] = $file->get(); } $request->addFeedback($row); } } include \Classes\Controller\Util\Utils::createViewName('uploadExcelConstructorFile'); }