Exemple #1
0
 public static function applyDeeplinkPerPage(Application_Model_Models_Deeplink $deeplink, Application_Model_Models_Page $page)
 {
     $containerMapper = Application_Model_Mappers_ContainerMapper::getInstance();
     //$containers      = $containerMapper->findByPageId($page->getId());
     $containers = $containerMapper->findContentContainersByPageId($page->getId());
     if (!empty($containers)) {
         foreach ($containers as $container) {
             $initialContentLength = strlen($container->getContent());
             if (Zend_Registry::isRegistered('applied') && Zend_Registry::get('applied') === true) {
                 Zend_Registry::set('applied', false);
                 return;
             }
             $container->setContent(self::applyDeeplink($deeplink, $container->getContent()));
             $container->registerObserver(new Tools_Seo_Watchdog(array('unwatch' => '_updateDeeplinks')));
             $gc = new Tools_Content_GarbageCollector(array('model' => $container));
             $gc->updateContentLinksRelatios();
             if ($initialContentLength != strlen($container->getContent())) {
                 $containerMapper->save($container);
                 $container->notifyObservers();
             }
         }
     }
 }
 public function delete(Application_Model_Models_Page $page)
 {
     $where = $this->getDbTable()->getAdapter()->quoteInto('id = ?', $page->getId());
     $deleteResult = $this->getDbTable()->delete($where);
     $page->notifyObservers();
     return $deleteResult;
 }
 private function _createTrackingPage($formName, $templateName)
 {
     $trackingPageName = 'form-' . $formName . '-thank-you';
     $trackingName = 'Form ' . $formName . ' Thank you';
     $trackingPageUrl = $this->_helper->page->filterUrl($trackingPageName);
     $pageMapper = Application_Model_Mappers_PageMapper::getInstance();
     $pageModel = new Application_Model_Models_Page();
     $trackingPageExist = $pageMapper->findByUrl($trackingPageUrl);
     if (empty($trackingPageExist)) {
         $pageModel->setParentId(-1);
         $pageModel->setDraft(0);
         $pageModel->setTemplateId($templateName);
         $pageModel->setH1($trackingName);
         $pageModel->setHeaderTitle($trackingName);
         $pageModel->setMetaDescription($trackingName);
         $pageModel->setNavName($trackingName);
         $pageModel->setUrl($trackingPageUrl);
         $pageModel->setSystem(0);
         $pageMapper->save($pageModel);
     }
     return $trackingPageUrl;
 }