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;
 }
 private function getLinkedChilds($layer)
 {
     $childs = array();
     $dbValues = C4gMapsModel::findPublishedByPid($layer['link_id']);
     if ($dbValues) {
         while ($dbValues->next()) {
             $child = array();
             $child['link_id'] = $dbValues->id;
             $child['name'] = $dbValues->name;
             $child['id'] = uniqid();
             $child['pid'] = $layer['id'];
             $child['display'] = $layer['display'];
             $child['content'] = $this->getContentForType($dbValues);
             $child['type'] = "link";
             $child['childs'] = $this->getLinkedChilds($child);
             if ($child['childs'] && sizeof($child['childs']) > 0) {
                 $child['hasChilds'] = true;
                 $child['childCount'] = sizeof($child['childs']);
             }
             $childs[] = $child;
         }
         return $childs;
     } else {
         return array();
     }
 }