Exemplo n.º 1
0
 /**
  * Override the doSave function to do some custom tweaks.
  * @param PropelPDO $con
  */
 protected function doSave(PropelPDO $con)
 {
     if (!$this->getSlot()->isEditable() && $this->getPageId() == $this->getSlot()->getPageId()) {
         $slotConfigs = sfPlopSlotConfigPeer::retrieveDescendants($this->getSlotId(), $this->getPageId());
         if ($slotConfigs) {
             foreach ($slotConfigs as $slotConfig) {
                 if ($slotConfig->getId() != $this->getId()) {
                     $slotConfig->delete();
                 }
             }
         }
     }
     $this->getPage()->setUpdatedAt(time());
     $this->getPage()->save();
     return parent::doSave($con);
 }
 /**
  * Function which aims to bind a contact form without rendering the view
  * @param sfWebRequest $request
  */
 public function executeContact(sfWebRequest $request)
 {
     $user = $this->getUser();
     $isAjax = $request->isXmlHttpRequest();
     $referer = $request->getParameter('r');
     if ($request->getMethod() == sfRequest::POST) {
         $slot = sfPlopSlotConfigPeer::retrieveByPk($request->getParameter('c'));
         $form = new sfPlopPublicContactForm(null, array('contact' => $slot ? $slot->getOption('contact', null, $this->culture) : null));
         $form->bind($request->getParameter('contact'));
         $user->setAttribute('contactForm_valid', false);
         $user->setAttribute('contactForm_form', $form);
         if ($form->isValid()) {
             $mailer = new sfPlopMessaging($form->getValues());
             $return = $mailer->sendEmail($this->getMailer());
             if ($return['count'] == $return['sent']) {
                 //        {
                 $user->setAttribute('contactForm_valid', true);
             }
             //        }
             //        else
             //        {
             //        }
         }
         //      else
         //      {
         //        $user->setAttribute('contactForm_valid', false);
         //        $user->setAttribute('contactForm_form', $form);
         //      }
     }
     return $this->redirect('@sf_plop_page_show?slug=' . $referer);
 }
Exemplo n.º 3
0
<?php

if (!isset($isUserAdmin)) {
    $isUserAdmin = null;
}
$isEditable = $isUserAdmin && $slot->isEditable();
$isTemplate = $isUserAdmin && $page->isTemplate();
$isPageArea = !$isTemplate && $page->getTemplate() && $page->getTemplate()->hasSlotArea();
$isArea = !$isTemplate && $isUserAdmin && $isSlotArea == true;
$withHandle = $isTemplate || $isArea && !isset($slots) || !$slot->getPage()->hasSlotArea();
$slotTemplateObject = $slot->getTemplateObject();
$classes = array($slot->getLayout(), $slot->getTemplate());
$slotConfig = isset($slotConfig) ? $slotConfig : sfPlopSlotConfigPeer::getOneByPageSlotAndCulture(isset($pageTemplate) && !$slot->isEditable() && $slot->getId() == $pageTemplate->getId() ? $pageTemplate : $page, $slot, $culture, true);
?>

<<?php 
echo html5Tag('section');
?>
  <?php 
if ($isUserAdmin) {
    ?>
id="slot_<?php 
    echo $slot->getId();
    ?>
"<?php 
}
?>
  class="section <?php 
echo implode(' ', $classes);
?>
"
Exemplo n.º 4
0
 /**
  * Override the doSave function to do some custom tweaks.
  * @param PropelPDO $con
  */
 protected function doSave(PropelPDO $con)
 {
     if (!$this->getPage()->isTemplate() && $this->isEditable() && !$this->getPage()->getTemplate()->hasSlotArea()) {
         $this->setIsEditable(false);
     }
     if (!$this->isNew() && !$this->isEditable()) {
         foreach (sfPlopSlotConfigPeer::retrieveDescendants($this->getId(), $this->getPageId()) as $slotConfig) {
             if ($slotConfig->getSlotId() != $this->getId()) {
                 $slotConfig->delete();
             }
         }
     }
     $this->getPage()->setUpdatedAt(time());
     $this->getPage()->save();
     return parent::doSave($con);
 }