public function previewAction()
 {
     $id = $this->params->get('id');
     $this->view->addLink = $this->view->qlink($this->translate('Run'), 'director/importsource/run', array('id' => $id));
     $source = ImportSource::load($id, $this->db());
     $this->prepareTabs($id)->activate('preview');
     $this->view->title = sprintf($this->translate('Import source preview: "%s"'), $source->source_name);
     $this->view->table = $this->applyPaginationLimits($this->loadTable('importsourceHook')->setConnection($this->db())->setImportSource($source));
     $this->render('list/table', null, true);
 }
Ejemplo n.º 2
0
 protected function getRowClasses($row)
 {
     if (!$this->revalidate) {
         return array();
     }
     try {
         $import = new Import(ImportSource::load($row->id, $this->connection()));
         if ($import->providesChanges()) {
             $row->source_name = sprintf('%s (%s)', $row->source_name, $this->view()->translate('has changes'));
             return 'pending-changes';
         } else {
             return 'in-sync';
         }
     } catch (Exception $e) {
         $row->source_name = $row->source_name . ' (' . $e->getMessage() . ')';
         return 'failing';
     }
 }
Ejemplo n.º 3
0
 protected function perpareImportSources($properties, $db)
 {
     $sources = array();
     foreach ($properties as $p) {
         $sourceId = $p->source_id;
         if (!array_key_exists($sourceId, $sources)) {
             $sources[$sourceId] = ImportSource::load($sourceId, $db);
         }
     }
     return $sources;
 }
Ejemplo n.º 4
0
 protected function getImportSource()
 {
     if ($this->importSource === null) {
         if ($this->hasObject()) {
             $src = ImportSource::load($this->object->source_id, $this->db);
         } else {
             $src = ImportSource::load($this->getSentValue('source_id'), $this->db);
         }
         $this->importSource = ImportSourceHook::loadByName($src->source_name, $this->db);
     }
     return $this->importSource;
 }