[Mapbender-commits] r9651 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Jan 12 08:49:59 PST 2017
Author: armin11
Date: 2017-01-12 08:49:59 -0800 (Thu, 12 Jan 2017)
New Revision: 9651
Modified:
trunk/mapbender/http/classes/class_iso19139.php
Log:
fix for missing array function
Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php 2017-01-12 16:33:41 UTC (rev 9650)
+++ trunk/mapbender/http/classes/class_iso19139.php 2017-01-12 16:49:59 UTC (rev 9651)
@@ -150,6 +150,31 @@
$this->inspireRegulations = $this->getRelevantInspireRegulations();
}
+ public function array_column(array $input, $columnKey, $indexKey = null) {
+ $array = array();
+ foreach ($input as $value) {
+ if ( !array_key_exists($columnKey, $value)) {
+ trigger_error("Key \"$columnKey\" does not exist in array");
+ return false;
+ }
+ if (is_null($indexKey)) {
+ $array[] = $value[$columnKey];
+ }
+ else {
+ if ( !array_key_exists($indexKey, $value)) {
+ trigger_error("Key \"$indexKey\" does not exist in array");
+ return false;
+ }
+ if ( ! is_scalar($value[$indexKey])) {
+ trigger_error("Key \"$indexKey\" does not contain scalar value");
+ return false;
+ }
+ $array[$value[$indexKey]] = $value[$columnKey];
+ }
+ }
+ return $array;
+ }
+
public function getRelevantInspireRegulations($withAmendmentAndCorrigendum = true) {
//use $this->hierachyLevel and give back all relevant regulations (only the newest of each type) with their dates in the requested language
$language = $this->inspireLegislation->default_language;
@@ -167,7 +192,7 @@
if (in_array($regulation->type, $legislationTypeArray) && in_array($regulation->group, array("data_specifications","metadata","network_services"))) {
if (in_array($this->hierachyLevel, $regulation->subject)) {
//check if already a regulation with this name exists in the array - if it is already there, check if the date is newer or older!
- $keyInArray = array_search($regulation->label->{$language}, array_column($regulations, 'name'));//TODO []
+ $keyInArray = array_search($regulation->label->{$language}, $this->array_column($regulations, 'name'));//TODO []
if ($keyInArray !== false) {
$newDateTime = new dateTime($regulation->date);
if ($newDateTime < $regulations[$keyInArray]['date']) {
More information about the Mapbender_commits
mailing list