예제 #1
0
 /**
  * Ajax-invoked execution of import process. This is where the import is actually run.
  */
 public function RunImport()
 {
     if (!$this->request->user->canDoAction('can_import_worldcat')) {
         return;
     }
     $pa_worldcat_ids = $this->request->getParameter('WorldCatID', pArray);
     $pn_importer_id = $this->request->getParameter('importer_id', pInteger);
     $ps_job_id = $this->request->getParameter('job_id', pString);
     $pn_log_level = $this->request->getParameter('log_level', pInteger);
     $o_progress = new ProgressBar('WebUI', 0, $ps_job_id);
     $o_progress->setJobID($ps_job_id);
     $o_progress->setMode('WebUI');
     $o_progress->setTotal(sizeof($pa_worldcat_ids));
     $vn_status = ca_data_importers::importDataFromSource(join(",", $pa_worldcat_ids), $pn_importer_id, array('progressBar' => $o_progress, 'format' => 'WorldCat', 'logLevel' => $pn_log_level));
     $this->view->setVar('info', array('status' => $vn_status, 'job_id' => $ps_job_id, 'importer_id' => $pn_importer_id, 'worldcat_ids' => $pa_worldcat_ids));
     $this->render('import_run_json.php');
 }