Skip to content

Commit

Permalink
Merge pull request #288 from RRZE-Webteam/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
rvdforst authored Sep 11, 2023
2 parents b71fc02 + fd360c7 commit 9e31c3d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
15 changes: 10 additions & 5 deletions class_Forschungsbereiche.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public function fieldListe($param = array()) {
$output = '<p>' . __('Es wurden leider keine Forschungsbereiche gefunden.', 'fau-cris') . '</p>';
return $output;
}
if (array_key_exists('relation left seq', reset($fieldsArray)->attributes)) {
$firstItem = reset($fieldsArray);
if ($firstItem && isset($firstItem->attributes['relation left seq'])) {
//if (array_key_exists('relation left seq', reset($fieldsArray)->attributes)) {
$sortby = 'relation left seq';
$orderby = $sortby;
} else {
Expand All @@ -72,10 +74,11 @@ public function fieldListe($param = array()) {
$hide = $param['hide'];
$formatter = new CRIS_formatter(NULL, NULL, $sortby, SORT_ASC);
$res = $formatter->execute($fieldsArray);
$list = $res[$orderby] ?? [];
if ($param['limit'] != '')
$fieldList = array_slice($res[$orderby], 0, $param['limit']);
$fieldList = array_slice($list, 0, $param['limit']);
else
$fieldList = $res[$orderby];
$fieldList = $list;
$output = '';
$output .= $this->make_list($fieldList);

Expand Down Expand Up @@ -137,7 +140,9 @@ public function fieldsArray($seed=false, $sortby=NULL) {
$sortby = $sortby . '_en';
$orderby = $sortby;
} else {
if (array_key_exists('relation left seq', reset($fieldsArray)->attributes)) {
$firstItem = reset($fieldsArray);
if ($firstItem && isset($firstItem->attributes['relation left seq'])) {
//if (array_key_exists('relation left seq', reset($fieldsArray)->attributes)) {
$sortby = 'relation left seq';
$orderby = $sortby;
} else {
Expand All @@ -148,7 +153,7 @@ public function fieldsArray($seed=false, $sortby=NULL) {

$formatter = new CRIS_formatter(NULL, NULL, $sortby, SORT_ASC);
$res = $formatter->execute($fieldsArray);
$fieldList = $res[$orderby];
$fieldList = $res[$orderby] ?? [];

return $fieldList;
}
Expand Down
16 changes: 11 additions & 5 deletions class_Projekte.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ public function pubProj($pub, $seed = false) {
if (!count($projArray))
return;

if (array_key_exists('relation right seq', reset($projArray)->attributes)) {
$firstItem = reset($projArray);
if ($firstItem && isset($firstItem->attributes['relation right seq'])) {
//if (array_key_exists('relation right seq', reset($projArray)->attributes)) {
$sortby = 'relation right seq';
$orderby = $sortby;
} else {
Expand All @@ -325,7 +327,9 @@ public function pubProj($pub, $seed = false) {
}

// sortiere nach Erscheinungsdatum
if (array_key_exists('relation right seq', reset($projArray)->attributes)) {
$firstItem = reset($projArray);
if ($firstItem && isset($firstItem->attributes['relation right seq'])) {
//if (array_key_exists('relation right seq', reset($projArray)->attributes)) {
$sortby = 'relation right seq';
$orderby = $sortby;
} else {
Expand All @@ -334,7 +338,7 @@ public function pubProj($pub, $seed = false) {
}
$formatter = new CRIS_formatter(NULL, NULL, $sortby, SORT_ASC);
$res = $formatter->execute($projArray);
$projList = $res[$orderby];
$projList = $res[$orderby] ?? [];

$hide = array();
$output = $this->make_list($projList, $hide, 0, 1);
Expand Down Expand Up @@ -798,7 +802,9 @@ public function fieldProj($field, $return = 'list', $seed = false) {
return $projArray;

// sortiere nach Erscheinungsdatum
if (array_key_exists('relation right seq', reset($projArray)->attributes)) {
$firstItem = reset($projArray);
if ($firstItem && isset($firstItem->attributes['relation right seq'])) {
//if (array_key_exists('relation right seq', reset($projArray)->attributes)) {
$sortby = 'relation right seq';
$orderby = $sortby;
} else {
Expand All @@ -807,7 +813,7 @@ public function fieldProj($field, $return = 'list', $seed = false) {
}
$formatter = new CRIS_formatter(NULL, NULL, $sortby, SORT_ASC);
$res = $formatter->execute($projArray);
$projList = $res[$orderby];
$projList = $res[$orderby] ?? [];

if ($this->cms == 'wp' && shortcode_exists('collapsibles')) {
$output = $this->make_accordion($projList);
Expand Down
18 changes: 12 additions & 6 deletions class_Publikationen.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,9 @@ public function projectPub($param = array()) {
return '';
}

if (array_key_exists('relation right seq', reset($pubArray)->attributes)) {
$firstItem = reset($pubArray);
if ($firstItem && isset($firstItem->attributes['relation right seq'])) {
//if (array_key_exists('relation right seq', reset($pubArray)->attributes)) {
$sortby = 'relation right seq';
$orderby = $sortby;
} else {
Expand All @@ -454,7 +456,7 @@ public function projectPub($param = array()) {
}
$formatter = new CRIS_formatter(NULL, NULL, $sortby, SORT_ASC);
$res = $formatter->execute($pubArray);
$pubList = $res[$orderby];
$pubList = $res[$orderby] ?? [];

if ($param['publications_limit'] != '') {
$pubList = array_slice($pubList, 0, $param['publications_limit'], true);
Expand Down Expand Up @@ -486,7 +488,9 @@ public function fieldPub($param = array(), $seed = false) {
return '';
}

if (array_key_exists('relation right seq', reset($pubArray)->attributes)) {
$firstItem = reset($pubArray);
if ($firstItem && isset($firstItem->attributes['relation right seq'])) {
//if (array_key_exists('relation right seq', reset($pubArray)->attributes)) {
$sortby = 'relation right seq';
$orderby = $sortby;
} else {
Expand All @@ -495,7 +499,7 @@ public function fieldPub($param = array(), $seed = false) {
}
$formatter = new CRIS_formatter(NULL, NULL, $sortby, SORT_ASC);
$res = $formatter->execute($pubArray);
$pubList = $res[$orderby];
$pubList = $res[$orderby] ?? [];

if ($param['publications_limit'] != '') {
$pubList = array_slice($pubList, 0, $param['publications_limit'], true);
Expand Down Expand Up @@ -524,7 +528,9 @@ public function equiPub($equipment, $quotation = '', $seed = false, $publication
if (!count($pubArray))
return;

if (array_key_exists('relation right seq', reset($pubArray)->attributes)) {
$firstItem = reset($pubArray);
if ($firstItem && isset($firstItem->attributes['relation right seq'])) {
//if (array_key_exists('relation right seq', reset($pubArray)->attributes)) {
$sortby = 'relation right seq';
$orderby = $sortby;
} else {
Expand All @@ -533,7 +539,7 @@ public function equiPub($equipment, $quotation = '', $seed = false, $publication
}
$formatter = new CRIS_formatter(NULL, NULL, $sortby, SORT_ASC);
$res = $formatter->execute($pubArray);
$pubList = $res[$orderby];
$pubList = $res[$orderby] ?? [];

if ($publications_limit != '') {
$pubList = array_slice($pubList, 0, $publications_limit, true);
Expand Down
6 changes: 3 additions & 3 deletions fau-cris.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
/**
* Plugin Name: FAU CRIS
* Description: Anzeige von Daten aus dem FAU-Forschungsportal CRIS in WP-Seiten
* Version: 3.19.1
* Version: 3.19.2
* Author: RRZE-Webteam
* Author URI: http://blogs.fau.de/webworking/
* Text Domain: fau-cris
* Domain Path: /languages
* Requires at least: 3.9.2
* Tested up to: 6.2
* Requires at least: 6.2
* Tested up to: 6.3
* License: GPLv2 or later
* GitHub Plugin URI: https://github.com/RRZE-Webteam/fau-cris
* GitHub Branch: master
Expand Down

0 comments on commit 9e31c3d

Please sign in to comment.