diff --git a/application/controllers/ImportrunController.php b/application/controllers/ImportrunController.php new file mode 100644 index 00000000..4aa418e2 --- /dev/null +++ b/application/controllers/ImportrunController.php @@ -0,0 +1,25 @@ +view->title = $this->translate('Import run'); + $this->view->table = $this->applyPaginationLimits( + $this->loadTable('importedrows') + ->setChecksum( + $this->db()->getImportrunRowsetChecksum($this->params->get('id')) + ) + ->setConnection($this->db()) + ); + $this->render('list/table', null, true); + } +} diff --git a/application/tables/ImportedrowsTable.php b/application/tables/ImportedrowsTable.php new file mode 100644 index 00000000..b5f6f1e0 --- /dev/null +++ b/application/tables/ImportedrowsTable.php @@ -0,0 +1,60 @@ +connection(); + return $db->listImportedRowsetColumnNames($this->checksum); + } + + public function setChecksum($checksum) + { + $this->checksum = $checksum; + return $this; + } + + public function getTitles() + { + $view = $this->view(); + $cols = $this->getColumns(); + return array( + 'object_name' => $view->translate('Object name'), + ) + array_combine($cols, $cols); + } + + public function count() + { + $db = $this->connection()->getConnection(); + $query = $db->select() + ->from('imported_rowset_row', 'COUNT(*)') + ->where('rowset_checksum = ?', $this->checksum); + + return $db->fetchOne($query); + } + + public function fetchData() + { + $db = $this->connection()->getConnection(); + $query = $this->getBaseQuery(); + + if ($this->hasLimit() || $this->hasOffset()) { + $query->limit($this->getLimit(), $this->getOffset()); + } + + return $db->fetchAll($query); + } + + public function getBaseQuery() + { + return $this->connection()->createImportedRowsetRowsQuery( + $this->checksum + )->order('object_name'); + } +}