当前位置: 首页>>代码示例>>PHP>>正文


PHP Gems_Loader::getTaskRunnerBatch方法代码示例

本文整理汇总了PHP中Gems_Loader::getTaskRunnerBatch方法的典型用法代码示例。如果您正苦于以下问题:PHP Gems_Loader::getTaskRunnerBatch方法的具体用法?PHP Gems_Loader::getTaskRunnerBatch怎么用?PHP Gems_Loader::getTaskRunnerBatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gems_Loader的用法示例。


在下文中一共展示了Gems_Loader::getTaskRunnerBatch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getImportOnlyBatch

 /**
  *
  * @param \MUtil_Task_TaskBatch $batch Optional batch with different source etc..
  * @return \MUtil_Task_TaskBatch
  */
 public function getImportOnlyBatch(\MUtil_Task_TaskBatch $batch = null)
 {
     if (!$this->_importBatch instanceof \MUtil_Task_TaskBatch) {
         $batch = $this->loader->getTaskRunnerBatch(__CLASS__ . '_import_' . basename($this->sourceModel->getName()) . '_' . __FUNCTION__);
         $batch->setVariable('targetModel', $this->getTargetModel());
         $this->_importBatch = $batch;
     } else {
         $batch = $this->_importBatch;
     }
     return parent::getImportOnlyBatch($batch);
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:16,代码来源:Importer.php

示例2: getImportMergeBatch

 /**
  *
  * @return \Gems_Task_TaskRunnerBatch
  */
 protected function getImportMergeBatch()
 {
     $batch = $this->loader->getTaskRunnerBatch('track_import_create_' . $this->formData['importId']);
     $import = $this->loadImportData();
     $batch->setVariable('import', $import);
     $batch->setVariable('trackEngine', $this->trackEngine);
     if ($batch->isFinished()) {
         return $batch;
     }
     if (!$batch->isLoaded()) {
         $batch->addTask('Tracker\\Merge\\MergeTrackImportTask', $this->formData);
         $fieldDef = $this->trackEngine->getFieldsDefinition();
         foreach ($import['fields'] as $lineNr => &$fieldData) {
             $field = $fieldDef->getFieldByOrder($fieldData['gtf_id_order']);
             if ($field instanceof FieldInterface) {
                 $fieldData['gtf_id_field'] = $field->getFieldId();
             }
             $batch->addTask('Tracker\\Import\\CreateTrackFieldImportTask', $lineNr, $fieldData);
         }
         foreach ($import['rounds'] as $lineNr => $roundData) {
             $batch->addTask('Tracker\\Import\\CreateTrackRoundImportTask', $lineNr, $roundData);
         }
         if (isset($import['deactivateRounds'])) {
             foreach ($import['deactivateRounds'] as $roundId => $roundDescription) {
                 $batch->addTask('Tracker\\Merge\\DeactivateTrackFieldTask', $roundId, $roundDescription);
             }
         }
         $batch->addTask('AddTask', 'Tracker\\Import\\FinishTrackImport');
     }
     return $batch;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:35,代码来源:ImportTrackSnippetAbstract.php

示例3: commJob

 /**
  * Perform automatic job mail
  */
 public function commJob()
 {
     $batch = $this->loader->getTaskRunnerBatch('cron');
     $batch->minimalStepDurationMs = 3000;
     // 3 seconds max before sending feedback
     $batch->autoStart = true;
     if (!$batch->isLoaded()) {
         // Check for unprocessed tokens
         $tracker = $this->loader->getTracker();
         $tracker->processCompletedTokens(null, $this->currentUser->getUserId());
         $batch->addTask('Mail\\AddAllMailJobsTask');
     }
     $title = $this->_('Executing cron jobs');
     $this->_helper->BatchRunner($batch, $title, $this->accesslog);
     $this->html->br();
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:19,代码来源:CronAction.php

示例4: getExportBatch

 /**
  *
  * @return \Gems_Task_TaskRunnerBatch
  */
 protected function getExportBatch($load = true)
 {
     if ($this->_batch) {
         return $this->_batch;
     }
     $this->_batch = $this->loader->getTaskRunnerBatch('track_export_' . $this->trackEngine->getTrackId());
     if (!$load || $this->_batch->isFinished()) {
         return $this->_batch;
     }
     if (!$this->_batch->isLoaded()) {
         $filename = \MUtil_File::createTemporaryIn(GEMS_ROOT_DIR . '/var/tmp/export/track');
         $trackId = $this->trackEngine->getTrackId();
         $this->_batch->setSessionVariable('filename', $filename);
         $this->_batch->addTask('Tracker\\Export\\MainTrackExportTask', $this->trackEngine->getTrackId(), $this->formData['orgs']);
         // \MUtil_Echo::track($this->formData['fields']);
         foreach ($this->formData['fields'] as $fieldId) {
             $this->_batch->addTask('Tracker\\Export\\TrackFieldExportTask', $trackId, $fieldId);
         }
         $model = $this->getModel();
         foreach ($model->getCol('surveyId') as $surveyId) {
             $this->_batch->addTask('Tracker\\Export\\TrackSurveyExportTask', $trackId, $surveyId);
         }
         foreach ($this->formData['rounds'] as $roundId) {
             $this->_batch->addTask('Tracker\\Export\\TrackRoundExportTask', $trackId, $roundId);
         }
     } else {
         $filename = $this->_batch->getSessionVariable('filename');
     }
     $this->_batch->setVariable('file', fopen($filename, 'a'));
     return $this->_batch;
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:35,代码来源:ExportTrackSnippetAbstract.php

示例5: executeAction

 /**
  * Executes the upgrades for a certain context
  *
  * optional: give from and to levels
  *
  * usage: execute/context/<context>{/from/int/to/int}
  */
 protected function executeAction($from = null, $to = null)
 {
     $context = $this->getRequest()->getParam('id', 'gems');
     $from = $this->getRequest()->getParam('from', $from);
     $to = $this->getRequest()->getParam('to', $to);
     $batch = $this->loader->getTaskRunnerBatch('upgrade' . $context);
     $batch->minimalStepDurationMs = 3000;
     // 3 seconds max before sending feedback
     if (!$batch->isLoaded()) {
         $this->_upgrades->setBatch($batch);
         $this->_upgrades->execute($context, $to, $from);
     }
     $title = sprintf($this->_('Upgrading %s'), $context);
     $this->_helper->BatchRunner($batch, $title, $this->accesslog);
     $this->html->br();
     $this->compatibilityReportAction();
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:24,代码来源:UpgradeAction.php

示例6: getImportCreateBatch

 /**
  *
  * @return \Gems_Task_TaskRunnerBatch
  */
 protected function getImportCreateBatch()
 {
     $batch = $this->loader->getTaskRunnerBatch('track_import_create_' . $this->formData['import_id']);
     $import = $this->loadImportData();
     $batch->setVariable('import', $import);
     if ($batch->isFinished()) {
         return $batch;
     }
     if (!$batch->isLoaded()) {
         $batch->addTask('Tracker\\Import\\CreateTrackImportTask', $this->formData);
         foreach ($import['fields'] as $lineNr => $fieldData) {
             $batch->addTask('Tracker\\Import\\CreateTrackFieldImportTask', $lineNr, $fieldData);
         }
         foreach ($import['rounds'] as $lineNr => $roundData) {
             $batch->addTask('Tracker\\Import\\CreateTrackRoundImportTask', $lineNr, $roundData);
         }
         $batch->addTask('AddTask', 'Tracker\\Import\\FinishTrackImport');
     }
     return $batch;
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:24,代码来源:ImportTrackSnippetAbstract.php

示例7: synchronizeSources

 /**
  * Recalculates all token dates, timing and results
  * and outputs text messages.
  *
  * Does not reflect changes to tracks or rounds.
  *
  * @param int $sourceId A source identifier
  * @param int $userId Id of the user who takes the action (for logging)
  * @return \Gems_Task_TaskRunnerBatch A batch to process the synchronization
  */
 public function synchronizeSources($sourceId = null, $userId = null)
 {
     $batch_id = 'source_synch' . ($sourceId ? '_' . $sourceId : '');
     $batch = $this->loader->getTaskRunnerBatch($batch_id);
     if (!$batch->isLoaded()) {
         if ($sourceId) {
             $sources = array($sourceId);
         } else {
             $select = $this->db->select();
             $select->from('gems__sources', array('gso_id_source'))->where('gso_active = 1');
             $sources = $this->db->fetchCol($select);
         }
         foreach ($sources as $source) {
             $batch->addTask('Tracker_SourceSyncSurveys', $source, $userId);
             // Reset cache after basic synch
             $batch->addTask('CleanCache');
             // Reset cache after field synch
             $batch->addTask('AddTask', 'CleanCache');
             $batch->addTask('AddTask', 'Tracker\\UpdateSyncDate', $source, $userId);
         }
     }
     return $batch;
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:33,代码来源:Tracker.php

示例8: exportAction

 /**
  * Export model data
  */
 public function exportAction()
 {
     $step = $this->request->getParam('step');
     $post = $this->request->getPost();
     $this->autofilterParameters = $this->autofilterParameters + $this->_autofilterExtraParameters;
     $model = $this->getExportModel();
     if (isset($this->autofilterParameters['sortParamAsc'])) {
         $model->setSortParamAsc($this->autofilterParameters['sortParamAsc']);
     }
     if (isset($this->autofilterParameters['sortParamDesc'])) {
         $model->setSortParamDesc($this->autofilterParameters['sortParamDesc']);
     }
     $model->applyParameters($this->getSearchFilter(false), true);
     // Add any defaults.
     if (isset($this->autofilterParameters['extraFilter'])) {
         $model->addFilter($this->autofilterParameters['extraFilter']);
     }
     if (isset($this->autofilterParameters['extraSort'])) {
         $model->addSort($this->autofilterParameters['extraSort']);
     }
     if (!$step || $post && $step == 'form') {
         $this->addSnippet($this->exportFormSnippets);
         $batch = $this->loader->getTaskRunnerBatch('export_data');
         $batch->reset();
     } elseif ($step == 'batch') {
         $batch = $this->loader->getTaskRunnerBatch('export_data');
         $batch->setVariable('model', $model);
         if (!$batch->count()) {
             $batch->minimalStepDurationMs = 2000;
             $batch->finishUrl = $this->view->url(array('step' => 'download'));
             $batch->setSessionVariable('files', array());
             $batch->addTask('Export_ExportCommand', $post['type'], 'addExport', $post);
             $batch->addTask('addTask', 'Export_ExportCommand', $post['type'], 'finalizeFiles');
             $batch->autoStart = true;
         }
         if ($batch->run($this->request)) {
             exit;
         } else {
             $controller = $this;
             if ($batch->isFinished()) {
                 /*\MUtil_Echo::track('finished');
                   $file = $batch->getSessionVariable('file');
                   if ((!empty($file)) && isset($file['file']) && file_exists($file['file'])) {
                       // Forward to download action
                       $this->_session->exportFile = $file;
                   }*/
             } else {
                 if ($batch->count()) {
                     $controller->html->append($batch->getPanel($controller->view, $batch->getProgressPercentage() . '%'));
                 } else {
                     $controller->html->pInfo($controller->_('Nothing to do.'));
                 }
                 $controller->html->pInfo()->a(\MUtil_Html_UrlArrayAttribute::rerouteUrl($this->getRequest(), array('action' => 'index', 'step' => false)), array('class' => 'actionlink'), $this->_('Back'));
             }
         }
     } elseif ($step == 'download') {
         $this->view->layout()->disableLayout();
         $this->_helper->viewRenderer->setNoRender(true);
         $batch = $this->loader->getTaskRunnerBatch('export_data');
         $file = $batch->getSessionVariable('file');
         print_r($file);
         foreach ($file['headers'] as $header) {
             header($header);
         }
         while (ob_get_level()) {
             ob_end_clean();
         }
         readfile($file['file']);
         // Now clean up the file
         unlink($file['file']);
         exit;
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:76,代码来源:ModelSnippetActionAbstract.php


注:本文中的Gems_Loader::getTaskRunnerBatch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。