function getLayer($layerId = null) { $user = new User(Mapbender::session()->get("mb_user_id")); $wmsIdArray = $user->getOwnedWms(); if (!is_array($wmsIdArray) || count($wmsIdArray) === 0) { abort(_mb("No metadata sets available.")); } $wmsId = wms::getWmsIdByLayerId($layerId); if (is_null($wmsId) || !in_array($wmsId, $wmsIdArray)) { abort(_mb("You are not allowed to access WMS " . $wmsId)); } return; }
public function getParents() { $parents = array(); $wmsId = wms::getWmsIdByLayerId($this->layer_uid); $wmsFactory = new UniversalWmsFactory(); $wms = $wmsFactory->createFromDb($wmsId); if (!is_null($wms)) { try { $currentLayer = $wms->getLayerById($this->layer_uid); } catch (Exception $e) { return $parents; } while (!is_null($currentLayer)) { $pos = $currentLayer->layer_parent; $currentLayer = $wms->getLayerByPos($pos); if (!is_null($currentLayer)) { $parents[] = $currentLayer; } } } return $parents; }
public function createLayerFromDb($id, $appId = null) { $wmsId = intval(wms::getWmsIdByLayerId($id)); $version = $this->getVersionByWmsId($wmsId); if (!is_null($version)) { $factory = $this->getFactory($version); if (!is_null($factory)) { if (!is_null($appId)) { return $factory->createLayerFromDb($id, $wmsId, $appId); } return $factory->createLayerFromDb($id, $wmsId); } return null; } }