예제 #1
0
 private static function initializeRootPage()
 {
     $oRootPage = new Page();
     $oRootPage->makeRoot();
     $oRootPage->setName('root');
     $oRootPage->setIsInactive(false);
     $oRootPage->setPageType('default');
     $oRootPage->setTemplateName(null);
     $oFirstUser = UserQuery::create()->findOne();
     $oFirstUserId = $oFirstUser !== null ? $oFirstUser->getId() : 0;
     $oRootPage->setCreatedBy($oFirstUserId);
     $oRootPage->setUpdatedBy($oFirstUserId);
     $sPageString = new PageString();
     $sPageString->setLanguageId(Settings::getSetting("session_default", Session::SESSION_LANGUAGE_KEY, 'de'));
     $sPageString->setPageTitle('Home');
     $sPageString->setIsInactive(false);
     $oRootPage->addPageString($sPageString);
     $oRootPage->save();
     return $oRootPage;
 }
예제 #2
0
 /**
  * @param	PageString $pageString The pageString object to add.
  */
 protected function doAddPageString($pageString)
 {
     $this->collPageStrings[] = $pageString;
     $pageString->setPage($this);
 }
예제 #3
0
 /**
  * Filter the query by a related PageString object
  *
  * @param   PageString|PropelObjectCollection $pageString  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 PageQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByPageString($pageString, $comparison = null)
 {
     if ($pageString instanceof PageString) {
         return $this->addUsingAlias(PagePeer::ID, $pageString->getPageId(), $comparison);
     } elseif ($pageString instanceof PropelObjectCollection) {
         return $this->usePageStringQuery()->filterByPrimaryKeys($pageString->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByPageString() only accepts arguments of type PageString or PropelCollection');
     }
 }
예제 #4
0
 /**
  * Exclude object from result
  *
  * @param   PageString $pageString Object to remove from the list of results
  *
  * @return PageStringQuery The current query, for fluid interface
  */
 public function prune($pageString = null)
 {
     if ($pageString) {
         $this->addCond('pruneCond0', $this->getAliasedColName(PageStringPeer::PAGE_ID), $pageString->getPageId(), Criteria::NOT_EQUAL);
         $this->addCond('pruneCond1', $this->getAliasedColName(PageStringPeer::LANGUAGE_ID), $pageString->getLanguageId(), Criteria::NOT_EQUAL);
         $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
     }
     return $this;
 }
예제 #5
0
 private function handlePageStrings($aPageData)
 {
     if (isset($aPageData['edited_languages'])) {
         foreach ($aPageData['edited_languages'] as $iCounter => $sLanguageId) {
             $oPageString = $this->oPage->getPageStringByLanguage($sLanguageId);
             if ($oPageString === null) {
                 $oPageString = new PageString();
                 $oPageString->setLanguageId($sLanguageId);
                 $this->oPage->addPageString($oPageString);
             }
             $oPageString->setPageTitle($aPageData['page_title'][$iCounter] ? $aPageData['page_title'][$iCounter] : null);
             $oPageString->setLinkText($aPageData['link_text'][$iCounter] ? $aPageData['link_text'][$iCounter] : null);
             $oPageString->setMetaDescription($aPageData['meta_description'][$iCounter] ? $aPageData['meta_description'][$iCounter] : null);
             $oPageString->setMetaKeywords($aPageData['meta_keywords'][$iCounter] ? $aPageData['meta_keywords'][$iCounter] : null);
             $bIsActive = $oPageString->getPageTitle() !== null ? $aPageData['is_active'][$iCounter] : false;
             $oPageString->setIsInactive(!$bIsActive);
             $oPageString->save();
         }
     }
 }