original_string: protected function exportBatch($data)
      {
          $filter = $this->getSearchFilter();
  
          if ($data) {
              $batch = $this->loader->getTaskRunnerBatch('export_surveys');
  
              $models = $this->getExportModels($data['gto_id_survey'], $filter, $data);
  
              $batch->setVariable('model', $models);
  
              if (!$batch->count()) {
                  $batch->minimalStepDurationMs = 2000;
                  $batch->finishUrl = $this->view->url(array('step' => 'download'));
  
                  $batch->setSessionVariable('files', array());
  
                  foreach ($data['gto_id_survey'] as $surveyId) {
                      $batch->addTask('Export_ExportCommand', $data['type'], 'addExport', $data, $surveyId);
                  }
  
                  $batch->addTask('addTask', 'Export_ExportCommand', $data['type'], 'finalizeFiles');
                  
                  $export = $this->loader->getExport()->getExport($data['type']);
                  if ($snippet = $export->getHelpSnippet()) {
                      $this->addSnippet($snippet);
                  }
  
                  $batch->autoStart = true;
                  $this->accesslog->logChange($this->getRequest(), null, $data + $filter);
              }
  
  
  
              if ($batch->run($this->request)) {
                  exit;
              } else {
                  $controller = $this;
  
                  if ($batch->isFinished()) {
                  } 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')
                              );
                  }
              }
          }
      }
code: protected function exportBatch($data)
      {
          $filter = $this->getSearchFilter();
  
          if ($data) {
              $batch = $this->loader->getTaskRunnerBatch('export_surveys');
  
              $models = $this->getExportModels($data['gto_id_survey'], $filter, $data);
  
              $batch->setVariable('model', $models);
  
              if (!$batch->count()) {
                  $batch->minimalStepDurationMs = 2000;
                  $batch->finishUrl = $this->view->url(array('step' => 'download'));
  
                  $batch->setSessionVariable('files', array());
  
                  foreach ($data['gto_id_survey'] as $surveyId) {
                      $batch->addTask('Export_ExportCommand', $data['type'], 'addExport', $data, $surveyId);
                  }
  
                  $batch->addTask('addTask', 'Export_ExportCommand', $data['type'], 'finalizeFiles');
                  
                  $export = $this->loader->getExport()->getExport($data['type']);
                  if ($snippet = $export->getHelpSnippet()) {
                      $this->addSnippet($snippet);
                  }
  
                  $batch->autoStart = true;
                  $this->accesslog->logChange($this->getRequest(), null, $data + $filter);
              }
  
  
  
              if ($batch->run($this->request)) {
                  exit;
              } else {
                  $controller = $this;
  
                  if ($batch->isFinished()) {
                  } 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')
                              );
                  }
              }
          }
      }
code_tokens: protected function exportBatch ( $ data ) { $ filter = $ this -> getSearchFilter ( ) ; if ( $ data ) { $ batch = $ this -> loader -> getTaskRunnerBatch ( 'export_surveys' ) ; $ models = $ this -> getExportModels ( $ data [ 'gto_id_survey' ] , $ filter , $ data ) ; $ batch -> setVariable ( 'model' , $ models ) ; if ( ! $ batch -> count ( ) ) { $ batch -> minimalStepDurationMs = 2000 ; $ batch -> finishUrl = $ this -> view -> url ( array ( 'step' => 'download' ) ) ; $ batch -> setSessionVariable ( 'files' , array ( ) ) ; foreach ( $ data [ 'gto_id_survey' ] as $ surveyId ) { $ batch -> addTask ( 'Export_ExportCommand' , $ data [ 'type' ] , 'addExport' , $ data , $ surveyId ) ; } $ batch -> addTask ( 'addTask' , 'Export_ExportCommand' , $ data [ 'type' ] , 'finalizeFiles' ) ; $ export = $ this -> loader -> getExport ( ) -> getExport ( $ data [ 'type' ] ) ; if ( $ snippet = $ export -> getHelpSnippet ( ) ) { $ this -> addSnippet ( $ snippet ) ; } $ batch -> autoStart = true ; $ this -> accesslog -> logChange ( $ this -> getRequest ( ) , null , $ data + $ filter ) ; } if ( $ batch -> run ( $ this -> request ) ) { exit ; } else { $ controller = $ this ; if ( $ batch -> isFinished ( ) ) { } 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' ) ) ; } } } }
docstring: Performs the export step
docstring_tokens: Performs the export step