public function executeAddPage() { $relative_page = sfSimpleCMSPagePeer::retrieveBySlug($this->getRequestParameter('position')); $positionType = $this->getRequestParameter('position_type'); if ($relative_page && $relative_page->isRoot() && $positionType != 'under') { throw new Exception('Attempting to create a page at the same level as the home page. Please make sure select a position under the root node.'); } $page = new sfSimpleCMSPage(); if ($positionType == 'under') { $page->insertAsFirstChildOf($relative_page); } else { $page->insertAsNextSiblingOf($relative_page); } $page->setSlug($this->getRequestParameter('slug')); $page->setTemplate($this->getRequestParameter('template')); $page->save(); $this->redirect('sfSimpleCMSAdmin/list?page=' . $this->getRequestParameter('page', 1)); }
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 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)); }