Пример #1
0
     if ($importFrequency == SQLIScheduledImport::FREQUENCY_MANUAL) {
         $manualFrequency = (int) $Module->actionParameter('ManualScheduledFrequency');
         if ($manualFrequency < 5) {
             throw new SQLIImportBaseException(SQLIImportUtils::translate('extension/sqliimport/error', 'Please choose a frequency greater than 5min'));
         }
         $row['manual_frequency'] = $manualFrequency;
     }
     $scheduledImport = SQLIScheduledImport::fetch($importID);
     if (!$scheduledImport instanceof SQLIScheduledImport) {
         $scheduledImport = new SQLIScheduledImport($row);
     } else {
         $scheduledImport->fromArray($row);
     }
     if ($importOptions) {
         if (is_array($importOptions)) {
             $scheduledImport->setAttribute('options', SQLIImportHandlerOptions::fromHTTPInput($importOptions));
         } else {
             //backwards compatibility mode : options are set in a textarea
             $scheduledImport->setAttribute('options', SQLIImportHandlerOptions::fromText($importOptions));
         }
     }
     $scheduledImport->store();
     $Module->redirectToView('scheduledlist');
 } else {
     if ($Params['ScheduledImportID']) {
         $scheduledImport = SQLIScheduledImport::fetch($Params['ScheduledImportID']);
         $importID = $Params['ScheduledImportID'];
         $currentImportHandler = $scheduledImport->attribute('handler');
         // Check if user has access to handler alteration
         $aLimitation = array('SQLIImport_Type' => $currentImportHandler);
         $hasAccess = SQLIImportUtils::hasAccessToLimitation($Module->currentModule(), 'manageimports', $aLimitation);