Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nczirjak-acdh committed Feb 6, 2023
2 parents 2c7ea3c + 1315079 commit ec6394e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
6 changes: 2 additions & 4 deletions src/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ public function getValuesByProperty(): array
*/
public function getValuesByPropertyApi(string $property): Response
{

$offset = (empty($_POST['start'])) ? 0 : $_POST['start'];
$limit = (empty($_POST['length'])) ? 10 : $_POST['length'];
$draw = (empty($_POST['draw'])) ? 0 : $_POST['draw'];
Expand Down Expand Up @@ -373,8 +372,8 @@ public function getValuesByPropertyApi(string $property): Response
* @param string $params
* @return array
*/
public function getValuesByPropertyDetail(string $params): array {
public function getValuesByPropertyDetail(string $params): array
{
$params = str_replace(':', '/', $params);
$params = str_replace('//', '://', $params);

Expand All @@ -397,7 +396,6 @@ public function getValuesByPropertyDetail(string $params): array {
*/
public function getValuesByPropertyDetailApi(string $params): Response
{

$offset = (empty($_POST['start'])) ? 0 : $_POST['start'];
$limit = (empty($_POST['length'])) ? 10 : $_POST['length'];
$draw = (empty($_POST['draw'])) ? 0 : $_POST['draw'];
Expand Down
17 changes: 9 additions & 8 deletions src/Helper/DashboardHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public function addUrlToTableData(array $data, string $key = "properties"): arra
* Get the cached query files path
* @return type
*/
public function getCachedFilePath() {
public function getCachedFilePath()
{
$extension_list = \Drupal::service('extension.list.module');
return $extension_list->getPath('arche_dashboard') . '/cache/';
}
Expand All @@ -164,33 +165,33 @@ private function formatNumberToGuiFriendlyFormat(int $size): string
* @param string $params
* @return array
*/
public function processValuesByPropApiParamaters(string $params): array {
public function processValuesByPropApiParamaters(string $params): array
{
$result = [];
$params = explode("&", $params);
$property = str_replace(':', '/', $params[0]);
$result['property'] = str_replace('//', '://', $property);
$rdf = str_replace(':', '/', $params[1]);
$result['rdf'] = str_replace('//', '://', $rdf);

if(isset($params[2])) {
if (isset($params[2])) {
$kw = str_replace(':', '/', $params[2]);
$result['keyword'] = str_replace('//', '://', $kw);
}
return $result;
}

public function dashboardValuesByPropertyTableFormat(array &$data, string $prop, array $rdf): array {
public function dashboardValuesByPropertyTableFormat(array &$data, string $prop, array $rdf): array
{
$prop = str_replace("#", "%23", $prop);
$rdf = implode("?", $rdf);
$rdf = str_replace("#", "%23", $rdf);

for ($x = 0; $x <= count($data); $x++) {
if(isset($data[$x]->count)) {


if (isset($data[$x]->count)) {
$data[$x]->count = '<a href="/browser/dashboard-vbp-detail/'.$prop.'&'.$rdf.'&'.str_replace("#", "%23", $data[$x]->key).'" >'.$data[$x]->count.'</a>';
}
}
}

return $data;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Model/DashboardModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public function getValuesByPropertyApiData(string $property, array $types, int $
':offset' => $offset,
':search' => $search
),
['allow_delimiter_in_query' => true, 'allow_square_brackets' => true]
['allow_delimiter_in_query' => true, 'allow_square_brackets' => true]
);
$return = $query->fetchAll();

Expand All @@ -325,7 +325,8 @@ public function changeBackDBConnection()
}


private function formatTypeArray(array $types): string {
private function formatTypeArray(array $types): string
{
$typeStr = 'ARRAY [ ';
$count = count($types);
$i = 0;
Expand All @@ -338,7 +339,7 @@ private function formatTypeArray(array $types): string {
}
$i++;
}
return $typeStr;
return $typeStr;
}

/**
Expand Down Expand Up @@ -368,7 +369,6 @@ public function getDBLastModificationDate(): string

public function getValuesByPropertyDetailData(array $params, int $offset, int $limit, string $search = "", int $orderby = 1, string $order = 'asc'): array
{

try {
$query = $this->repodb->query(
"WITH query_data as (
Expand Down Expand Up @@ -396,7 +396,7 @@ public function getValuesByPropertyDetailData(array $params, int $offset, int $l
':offset' => $offset,
':search' => $search
),
['allow_delimiter_in_query' => true, 'allow_square_brackets' => true]
['allow_delimiter_in_query' => true, 'allow_square_brackets' => true]
);
$return = $query->fetchAll();
$this->changeBackDBConnection();
Expand Down

0 comments on commit ec6394e

Please sign in to comment.