function doExecute(\Classes\Controller\Controller\Request $request)
 {
     // Получаем переменные
     $folderName = $request->getProperty('timestamp');
     $command = $request->getProperty('command');
     $object = $request->getProperty('object');
     $format = $request->getProperty('format');
     $file = $request->getProperty('file');
     $request->addFeedback((bool) rand(0, 1));
     $request->addFeedback(rand(10, 100));
     include \Classes\Controller\Util\Utils::createViewName('executeCommand');
 }
 function doExecute(\Classes\Controller\Controller\Request $request)
 {
     \Classes\Utils\Timer\Timer::start('LOADS_UPLOAD');
     // Получаем переменные
     $filename = $request->getProperty('filename');
     $uploadFactory = new \Classes\Factory\Import\Instance\InstanceUploaderFromExcel();
     $objectArray = $uploadFactory->upload($filename, new \Classes\Instance\Load\Member\CommonMemberLoad());
     $notFoundObjects = \Classes\Factory\Model\Addition\MemberLoadAddition::add($objectArray);
     $request->addFeedback($notFoundObjects);
     \Classes\Utils\Timer\Timer::stop('LOADS_UPLOAD');
     $request->addFeedback(\Classes\Utils\Timer\Timer::show('LOADS_UPLOAD'));
     include \Classes\Controller\Util\Utils::createViewName('importCommonMemberLoadsFromExcel');
 }
 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)
 {
     \Classes\Utils\Timer\Timer::start('DIVIDE_ALL_MEMBERS');
     \Classes\Utils\Member\DivideMember::divideAllMembersByExistingNodes();
     \Classes\Utils\Timer\Timer::stop('DIVIDE_ALL_MEMBERS');
     $request->addFeedback(\Classes\Utils\Timer\Timer::show('DIVIDE_ALL_MEMBERS'));
     include \Classes\Controller\Util\Utils::createViewName('divideAllMemberByExistingNodes');
 }
 function doExecute(\Classes\Controller\Controller\Request $request)
 {
     \Classes\Utils\Timer\Timer::start('COMBINE_DOUBLE_NODES');
     \Classes\Utils\Node\DoubleNodes::combineAll(array(\Classes\Factory\Model\Model::getHashTable()));
     \Classes\Utils\Timer\Timer::stop('COMBINE_DOUBLE_NODES');
     $request->addFeedback(\Classes\Utils\Timer\Timer::show('COMBINE_DOUBLE_NODES'));
     include \Classes\Controller\Util\Utils::createViewName('combineDoubleNodes');
 }
 function doExecute(\Classes\Controller\Controller\Request $request)
 {
     // get all file names
     $files = glob(\Classes\Controller\Util\Utils::tempPath() . '/*');
     foreach ($files as $file) {
         $request->addFeedback($file);
     }
     include \Classes\Controller\Util\Utils::createViewName('getTempFileNames');
 }
 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');
 }
 function doExecute(\Classes\Controller\Controller\Request $request)
 {
     \Classes\Utils\Timer\Timer::start('PARAMETER_MEMBER_UPLOAD');
     // Получаем переменные
     $filename = $request->getProperty('filename');
     $uploadFactory = new \Classes\Factory\Import\Instance\InstanceUploaderFromExcel();
     $objectArray = $uploadFactory->upload($filename, new \Classes\Instance\Member\ParameterMember());
     foreach ($objectArray as &$object) {
         \Classes\Factory\Model\Addition\ParameterMemberAddition::add($object);
     }
     \Classes\Utils\Timer\Timer::stop('PARAMETER_MEMBER_UPLOAD');
     $request->addFeedback(\Classes\Utils\Timer\Timer::show('PARAMETER_MEMBER_UPLOAD'));
     include \Classes\Controller\Util\Utils::createViewName('importParameterMembersFromExcel');
 }
 /**
  * Search file and class inside the file for command
  * 
  * @param \Classes\Controller\Controller\Request $request Request from user
  * @return ReflectionClass
  */
 function getCommand(\Classes\Controller\Controller\Request $request)
 {
     $cmd = 'cmd' . $request->getProperty('cmd');
     $sep = DIRECTORY_SEPARATOR;
     if (!$cmd) {
         return self::$default_cmd;
     }
     $cmd = str_replace(array('.', $sep), '', $cmd);
     $filepath = "Classes{$sep}Controller{$sep}Command{$sep}{$cmd}.php";
     $classname = "\\Classes\\Controller\\Command\\{$cmd}";
     if (file_exists($filepath)) {
         @(require_once "{$filepath}");
         if (class_exists($classname)) {
             $cmd_class = new \ReflectionClass($classname);
             if ($cmd_class->isSubclassOf(self::$base_cmd)) {
                 return $cmd_class->newInstance();
             } else {
                 $request->addFeedback("Object Command from command '{$cmd}' isn't found'");
             }
         }
     }
     $request->addFeedback("Command '{$cmd}' isn't found");
     return clone self::$default_cmd;
 }
 function doExecute(\Classes\Controller\Controller\Request $request)
 {
     \Classes\Utils\Timer\Timer::start('MODEL_EXPORT');
     // Получаем переменные
     $filename = $request->getProperty('filename');
     $path = \Classes\Controller\Util\Utils::tempPath() . DIRECTORY_SEPARATOR . $filename;
     // NUMERATION
     \Classes\Utils\Member\Numeration::numerateFromOne();
     \Classes\Utils\Node\Numeration::numerateFromOne();
     // EXPORT
     \Classes\Factory\Export\Scad21ExportFactory::export($path);
     \Classes\Utils\Timer\Timer::stop('MODEL_EXPORT');
     $request->addFeedback(\Classes\Utils\Timer\Timer::show('MODEL_EXPORT'));
     include \Classes\Controller\Util\Utils::createViewName('exportModelToScad21');
 }
Ejemplo n.º 11
0
 function doExecute(\Classes\Controller\Controller\Request $request)
 {
     // Delete temp files
     $this->deleteAllFilesFromTempFolder();
     try {
         // Check command file
         $filename = $this->getTempFileName("constructor.xlsx");
         if ($filename !== FALSE) {
             // Upload command file
             $uploadFactory = new \Classes\Factory\Import\Instance\InstanceUploaderFromExcel();
             $objectArray = $uploadFactory->upload($filename, new \Classes\Instance\Command\Command());
             foreach ($objectArray as &$object) {
                 $this->doCommand($object);
             }
         }
     } catch (Exception $e) {
         $request->addFeedback("Exception: " . $e->getMessage() . "</br>");
         include \util\Utils::createViewName('execute');
     }
     $this->servicePrint();
 }
Ejemplo n.º 12
0
 function doExecute(\Classes\Controller\Controller\Request $request)
 {
     $request->addFeedback(\Classes\Controller\Util\Utils::createViewName("body"));
     include \Classes\Controller\Util\Utils::createViewName('index');
 }