/** * Loescht eine Page aus der Navigation einer Website * * @param string $websiteId * @param string $pageid */ public function removePageFromNavigation($websiteId, $pageid) { $website = $this->getService()->getById($websiteId); $navigation = \Zend_Json::decode($website->getNavigation()); if (is_array($navigation)) { $data = new \Seitenbau\ArrayData(); $data->remove($navigation, $pageid); $result = \Zend_Json::encode($navigation); $attributes = array('navigation' => $result); $this->getService()->update($websiteId, $attributes); return $result; } }
/** * Gibt die Website-IDs zurueck, welche unter einer angegeben Parent-ID liegen * Die Pages werden als flaches Array zurueckgegeben * * @param string $websiteId ID der Website * @param string $parentId ID von der Unter-Pages zurueckgegeben werdnen * * @return array */ public function getSubPagesFromNavigation($websiteId, $parentId) { $pages = array(); $website = $this->getById($websiteId); $navigation = \Zend_Json::decode($website->getNavigation()); if (!is_array($navigation)) { return $pages; } $subNavigation = null; $this->getSubNavigation($navigation, $parentId, $subNavigation); if (is_array($subNavigation)) { $data = new \Seitenbau\ArrayData(); $data->setValuesAsArray($pages, $subNavigation); } return $pages; }
/** * Holt anhand der Website-ID Daten zu den in der Navigation verwendeten Pages * * @param string $websiteId * * @return string */ protected function getNavigationWithDataByWebsiteId($websiteId) { $website = $this->getBusiness('Website')->getById($websiteId); $pageInfos = $this->getBusiness('Page')->getInfosByWebsiteId($website->getId()); $navigation = \Zend_Json::decode($website->getNavigation()); $arrayVerwalter = new Seitenbau\ArrayData(); if (is_array($pageInfos) && count($pageInfos) > 0 && is_array($navigation)) { $arrayVerwalter->mergeData($navigation, $pageInfos); } return $navigation; }