Skip to content

Commit

Permalink
PHP code fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Github Actions Workflow committed Aug 31, 2021
1 parent 34caf4a commit 3357b7c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
11 changes: 5 additions & 6 deletions src/Model/OntologyTwigExtensionModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
*
* @author nczirjak
*/
class OntologyTwigExtensionModel extends ArcheModel
class OntologyTwigExtensionModel extends ArcheModel
{
protected $repodb;
protected $siteLang;
private $dbResult = array();

public function __construct()
public function __construct()
{
parent::__construct();
(isset($_SESSION['language'])) ? $this->siteLang = strtolower($_SESSION['language']) : $this->siteLang = "en";
}

public function getViewData(): array
public function getViewData(): array
{
return $this->getImportDate();
}
Expand All @@ -28,7 +28,7 @@ public function getViewData(): array
* Get the latest owl file import from the DB
* @return array
*/
private function getImportDate(): array
private function getImportDate(): array
{
try {
$this->setSqlTimeout();
Expand All @@ -39,7 +39,7 @@ private function getImportDate(): array
where
i.ids = 'https://vocabs.acdh.oeaw.ac.at/schema' limit 1
",
array(
array(
':avdate' => $this->repo->getSchema()->creationDate
)
);
Expand All @@ -52,5 +52,4 @@ private function getImportDate(): array
$this->changeBackDBConnection();
return $this->dbResult;
}

}
7 changes: 4 additions & 3 deletions src/TwigExtension/OntologyTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @author nczirjak
*/
class OntologyTwigExtension extends \Twig_Extension
class OntologyTwigExtension extends \Twig_Extension
{
private $model;
private $str = "";
Expand Down Expand Up @@ -39,15 +39,16 @@ public function get_acdh_ontology_import_date()
$this->createModel();
$importDate = $this->model->getViewData();

if(isset($importDate['value'])) {
if (isset($importDate['value'])) {
$date = new \DateTime($importDate['value']);
$this->str = "Ontology import date: ".$date->format('Y-m-d H:i:s');
}

return $this->str;
}

private function createModel() {
private function createModel()
{
$this->model = new \Drupal\acdh_repo_gui\Model\OntologyTwigExtensionModel();
}
}

0 comments on commit 3357b7c

Please sign in to comment.