private function createLayerFromLink($layer)
 {
     //$layer is the link to another layer
     // the id of the other layer is stored under $layer->link_id
     $linkedLayer = C4gMapsModel::findById($layer->link_id);
     $arrReturnData = $this->getLayerData($linkedLayer->id);
     return $arrReturnData;
 }
Esempio n. 2
0
 /**
  * Summary of parseLayer
  *
  * @param mixed $objLayer
  * @return array
  */
 protected function parseLayer($objLayer)
 {
     $stringClass = $GLOBALS['con4gis']['stringClass'];
     $arrLayerData = array();
     $arrLayerData['id'] = $objLayer->id;
     $arrLayerData['pid'] = $objLayer->pid;
     $arrLayerData['name'] = $stringClass::decodeEntities($objLayer->name);
     // check parent hide status
     $parentLayer = C4gMapsModel::findById($objLayer->pid);
     if (!$parentLayer->is_map && $parentLayer->data_hidelayer) {
         $arrLayerData['hide'] = $parentLayer->data_hidelayer;
     } else {
         $arrLayerData['hide'] = $objLayer->data_hidelayer;
     }
     if ($objLayer->loc_minzoom > 0 || $objLayer->loc_maxzoom > 0) {
         $arrLayerData['zoom'] = array('min' => $objLayer->loc_minzoom, 'max' => $objLayer->loc_maxzoom);
     }
     if ($objLayer->data_layername) {
         $arrLayerData['name'] = $stringClass::decodeEntities($objLayer->data_layername);
         $arrLayerData['display'] = true;
     } else {
         $arrLayerData['display'] = false;
     }
     // hide when element is rendered in starboard tab
     if ($objLayer->hide_when_in_tab == 1) {
         $arrLayerData['hide_when_in_tab'] = true;
     }
     $arrLayerData['type'] = $objLayer->location_type;
     if ($objLayer->location_type === 'link') {
         $arrLayerData['link_id'] = $objLayer->link_id;
         $linkedLayer = C4gMapsModel::findByPk($objLayer->link_id);
         // check if linked element is overpass request and assign correct content values
         if ($linkedLayer->location_type == "overpass") {
             $arrLayerData['content'] = $this->getContentForType($linkedLayer);
         } else {
             $arrLayerData['content'] = $this->getContentForType($objLayer);
             $arrLayerData['hide'] = $objLayer->data_hidelayer;
         }
         // set zooms of links
         if ($linkedLayer->loc_minzoom > 0 || $linkedLayer->loc_maxzoom > 0) {
             $arrLayerData['zoom'] = array('min' => $linkedLayer->loc_minzoom, 'max' => $linkedLayer->loc_maxzoom);
         }
     } else {
         $arrLayerData['content'] = $this->getContentForType($objLayer);
     }
     if ($objLayer->location_type === 'startab') {
         $arrLayerData['awesomeicon'] = $objLayer->awesomeicon;
     }
     $arrLayerData['raw'] = $objLayer;
     return $arrLayerData;
 }