public function executeEmbed() { $culture = $this->getCulture(); if ($this->getRequestParameter('edit') == 'true') { if (!$this->checkEditorCredential()) { $this->CMS_error_msg = 'You need the editor credential to edit this content'; return; } $page = sfSimpleCMSPagePeer::retrieveBySlug($this->slug, $culture); } else { $page = sfSimpleCMSPagePeer::retrievePublicBySlug($this->slug, $culture); } if (!$page) { $this->CMS_error_msg = sprintf('The page %s does not exist in culture %c', $this->slug, $culture); return; } $this->page = $page; $this->culture = $culture; $this->getRequest()->setAttribute('culture', $culture); $this->templatePath = sfLoader::getTemplatePath('sfSimpleCMS', $this->page->getTemplate() . 'Template.php'); sfConfig::set('app_sfSimpleCMS_disable_editor_toolbar', true); }
<div id="menu"> <ul> <?php $home = sfSimpleCMSPagePeer::retrieveBySlug('home'); $home_title = $home->getTitle($sf_user->getCulture()); ?> <li><?php echo link_to($home_title, '@simple_slug_lang?slug=home&sf_culture=' . $sf_user->getCulture()); ?> </li> <?php foreach ($level1_nodes as $node) { ?> <li <?php if ($node->getSlug() == $page->getSlug()) { ?> class="current"<?php } ?> > <?php echo link_to($node->__toString($culture), '@simple_slug_lang?sf_culture=' . $culture . '&slug=' . $node->getSlug()); ?> <?php if ($node->hasChildren()) { ?> <ul class="secondlevel pages">
public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } sfSimpleCMSSlotPeer::addSelectColumns($c); $startcol2 = sfSimpleCMSSlotPeer::NUM_COLUMNS - sfSimpleCMSSlotPeer::NUM_LAZY_LOAD_COLUMNS + 1; sfSimpleCMSPagePeer::addSelectColumns($c); $startcol3 = $startcol2 + sfSimpleCMSPagePeer::NUM_COLUMNS; $c->addJoin(sfSimpleCMSSlotPeer::PAGE_ID, sfSimpleCMSPagePeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = sfSimpleCMSSlotPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = sfSimpleCMSPagePeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getsfSimpleCMSPage(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addsfSimpleCMSSlot($obj1); break; } } if ($newObject) { $obj2->initsfSimpleCMSSlots(); $obj2->addsfSimpleCMSSlot($obj1); } $results[] = $obj1; } return $results; }
public function countsfSimpleCMSPagesRelatedByTreeParent($criteria = null, $distinct = false, $con = null) { include_once 'plugins/sfSimpleCMSPlugin/lib/model/om/BasesfSimpleCMSPagePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(sfSimpleCMSPagePeer::TREE_PARENT, $this->getId()); return sfSimpleCMSPagePeer::doCount($criteria, $distinct, $con); }
public function getsfSimpleCMSPage($con = null) { if ($this->asfSimpleCMSPage === null && $this->page_id !== null) { include_once 'plugins/sfSimpleCMSPlugin/lib/model/om/BasesfSimpleCMSPagePeer.php'; $this->asfSimpleCMSPage = sfSimpleCMSPagePeer::retrieveByPK($this->page_id, $con); } return $this->asfSimpleCMSPage; }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(sfSimpleCMSPagePeer::ID, $pks, Criteria::IN); $objs = sfSimpleCMSPagePeer::doSelect($criteria, $con); } return $objs; }
public function executeDelete() { $this->checkEditorCredential(); $culture = $this->getCulture(); $page = sfSimpleCMSPagePeer::retrieveBySlug($this->getRequestParameter('slug')); $this->forward404Unless($page); $page->delete(); $this->redirect(sfSimpleCMSTools::urlForPage(sfConfig::get('app_sfSimpleCMS_default_page', 'home'), 'edit=true', $culture)); }
public function executeList() { parent::executeList(); $this->getRequest()->setAttribute('page_names', sfSimpleCMSPagePeer::getAllPagesWithLevel()); }