Ejemplo n.º 1
0
 /**
  * Renders CMS page
  *
  * Call from controller action
  *
  * @param Mage_Core_Controller_Front_Action $action
  * @param integer $pageId
  * @return boolean
  */
 public function renderPage(Mage_Core_Controller_Front_Action $action, $identifier = null)
 {
     $page = Mage::getModel('blog/post');
     if (!is_null($identifier) && $identifier !== $page->getId()) {
         $page->setStoreId(Mage::app()->getStore()->getId());
         if (!$page->load($identifier)) {
             return false;
         }
     }
     if (!$page->getId()) {
         return false;
     }
     if ($page->getStatus() == 2) {
         return false;
     }
     $page_title = Mage::getSingleton('blog/post')->load($identifier)->getTitle();
     $blog_title = Mage::getStoreConfig('blog/blog/title') . " - ";
     $action->loadLayout();
     if ($storage = Mage::getSingleton('customer/session')) {
         $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
     }
     $action->getLayout()->getBlock('head')->setTitle($blog_title . $page_title);
     $action->getLayout()->getBlock('root')->setTemplate(Mage::getStoreConfig('blog/blog/layout'));
     $action->renderLayout();
     return true;
 }
Ejemplo n.º 2
0
 public function renderPage(Mage_Core_Controller_Front_Action $action, $identifier = null, $data)
 {
     $page = Mage::getSingleton('blog/blog');
     if (!is_null($identifier) && $identifier !== $page->getId()) {
         $page->setStoreId(Mage::app()->getStore()->getId());
         if (!$page->load($identifier)) {
             return false;
         }
     }
     if (!$page->getId()) {
         return false;
     }
     if ($page->getStatus() == 2) {
         return false;
     }
     $page_title = Mage::getSingleton('blog/blog')->load($identifier)->getTitle();
     $blog_title = Mage::getStoreConfig('blog/blog/title') . " - ";
     $action->loadLayout();
     if ($storage = Mage::getSingleton('customer/session')) {
         $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
     }
     /*
      if (Mage::getStoreConfig('blog/rss/enable'))
      {
      Mage::helper('blog')->addRss($action->getLayout()->getBlock('head'), Mage::getUrl(Mage::getStoreConfig('blog/blog/route')) . "rss");
      }
     */
     $action->getLayout()->getBlock('head')->setTitle($blog_title . $page_title);
     $action->getLayout()->getBlock('root')->setTemplate(Mage::getStoreConfig('blog/blog/layout'));
     $action->getLayout()->getBlock('post')->setCommentDetails($data['user'], $data['email'], $data['comment']);
     $action->renderLayout();
     return true;
 }
 public function loadLayout($handles = null, $generateBlocks = true, $generateXml = true)
 {
     $original_results = parent::loadLayout($handles, $generateBlocks, $generateXml);
     $handles = Mage::getSingleton('core/layout')->getUpdate()->getHandles();
     echo "<strong >Handles Generated For This Request : ", implode(",", $handles), "</strong>";
     return $original_results;
 }
Ejemplo n.º 4
0
 /**
  * Renders CMS page
  * Call from controller action
  *
  * @param Mage_Core_Controller_Front_Action $action
  * @param integer                           $identifier
  *
  * @return bool
  */
 public function renderPage(Mage_Core_Controller_Front_Action $action, $identifier = null)
 {
     if (!($catId = Mage::getSingleton('blog/cat')->load($identifier)->getCatId())) {
         return false;
     }
     $pageTitle = Mage::getSingleton('blog/cat')->load($identifier)->getTitle();
     $blogTitle = Mage::getStoreConfig('blog/blog/title') . " - " . $pageTitle;
     $action->loadLayout();
     if ($storage = Mage::getSingleton('customer/session')) {
         $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
     }
     $action->getLayout()->getBlock('head')->setTitle($blogTitle);
     $action->getLayout()->getBlock('root')->setTemplate(Mage::getStoreConfig('blog/blog/layout'));
     $action->renderLayout();
     return true;
 }
Ejemplo n.º 5
0
 /**
  * Renders page
  *
  * Call from controller action
  *
  * @param Mage_Core_Controller_Front_Action $action
  * @param integer $pageId
  * @return boolean
  */
 public function renderPage(Mage_Core_Controller_Front_Action $action, $id = null)
 {
     $model = Mage::getSingleton('manufacturer/manufacturer');
     if (!is_null($id) && $id !== $model->getId()) {
         if (!$model->load($id)) {
             return false;
         }
     }
     if (!$model->getId() or $model->getStatus() != 1) {
         return false;
     }
     //print_r($page->getData());exit;
     /*if ($page->getCustomTheme()) {
           $apply = true;
           $today = Mage::app()->getLocale()->date()->toValue();
           if (($from = $page->getCustomThemeFrom()) && strtotime($from)>$today) {
               $apply = false;
           }
           if ($apply && ($to = $page->getCustomThemeTo()) && strtotime($to)<$today) {
               $apply = false;
           }
           if ($apply) {
               list($package, $theme) = explode('/', $page->getCustomTheme());
               Mage::getSingleton('core/design_package')
                   ->setPackageName($package)
                   ->setTheme($theme);
           }
       }*/
     $action->loadLayout(array('default', 'manufacturer_view'), false, false);
     $action->getLayout()->getUpdate()->addUpdate($model->getLayoutUpdateXml());
     $action->generateLayoutXml()->generateLayoutBlocks();
     if ($storage = Mage::getSingleton('catalog/session')) {
         $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
     }
     if ($storage = Mage::getSingleton('checkout/session')) {
         $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
     }
     $action->renderLayout();
     return true;
 }
Ejemplo n.º 6
0
 /**
  * Renders CMS page
  *
  * Call from controller action
  *
  * @param Mage_Core_Controller_Front_Action $action
  * @param integer $pageId
  * @return boolean
  */
 public function renderPage(Mage_Core_Controller_Front_Action $action, $identifier = null)
 {
     if (!($cat_id = Mage::getSingleton('blog/cat')->load($identifier)->getcatId())) {
         return false;
     }
     $page_title = Mage::getSingleton('blog/cat')->load($identifier)->getTitle();
     $blog_title = Mage::getStoreConfig('blog/blog/title') . " - ";
     $action->loadLayout();
     if ($storage = Mage::getSingleton('customer/session')) {
         $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
     }
     $action->getLayout()->getBlock('head')->setTitle($page_title);
     /*
      if (Mage::getStoreConfig('blog/rss/enable'))
      {
      Mage::helper('blog')->addRss($action->getLayout()->getBlock('head'), Mage::getUrl(Mage::getStoreConfig('blog/blog/route') . "/cat/" .$identifier) . "rss");
      }
     */
     $action->getLayout()->getBlock('root')->setTemplate(Mage::getStoreConfig('blog/blog/layout'));
     $action->renderLayout();
     return true;
 }
Ejemplo n.º 7
0
 /**
  * Renders CMS page
  *
  * Call from controller action
  *
  * @param Mage_Core_Controller_Front_Action $action
  * @param integer $pageId
  * @return boolean
  */
 public function renderPage(Mage_Core_Controller_Front_Action $action, $identifier = null)
 {
     if (!($cat_id = Mage::getSingleton("blog/cat")->load($identifier)->getCatId())) {
         return false;
     }
     $action->loadLayout();
     $layout = $action->getLayout();
     if ($storage = Mage::getSingleton("customer/session")) {
         $layout->getMessagesBlock()->addMessages($storage->getMessages(true));
     }
     $blogTitle = Mage::getStoreConfig("fontis_blog/blog/title");
     $pageTitle = Mage::getSingleton("blog/cat")->load($identifier)->getTitle();
     if ($head = $layout->getBlock("head")) {
         $head->setTitle($blogTitle . " - " . $pageTitle);
         if (Mage::getStoreConfig("fontis_blog/rss/enabled")) {
             $head->addItem("rss", Mage::getUrl(Mage::helper("blog")->getBlogRoute() . "/cat/" . $identifier) . "rss");
         }
     }
     $layout->getBlock("root")->setTemplate(Mage::getStoreConfig("fontis_blog/blog/layout"));
     $action->renderLayout();
     return true;
 }
Ejemplo n.º 8
0
 /**
  * Renders CMS page
  *
  * Call from controller action
  *
  * @param Mage_Core_Controller_Front_Action $action
  * @param integer $pageId
  * @return boolean
  */
 public function renderPage(Mage_Core_Controller_Front_Action $action, $pageId = null)
 {
     $page = AO::getSingleton('cms/page');
     if (!is_null($pageId) && $pageId !== $page->getId()) {
         $page->setStoreId(AO::app()->getStore()->getId());
         if (!$page->load($pageId)) {
             return false;
         }
     }
     if (!$page->getId()) {
         return false;
     }
     if ($page->getCustomTheme()) {
         $apply = true;
         $today = AO::app()->getLocale()->date()->toValue();
         if (($from = $page->getCustomThemeFrom()) && strtotime($from) > $today) {
             $apply = false;
         }
         if ($apply && ($to = $page->getCustomThemeTo()) && strtotime($to) < $today) {
             $apply = false;
         }
         if ($apply) {
             list($package, $theme) = explode('/', $page->getCustomTheme());
             AO::getSingleton('core/design_package')->setPackageName($package)->setTheme($theme);
         }
     }
     $action->loadLayout(array('default', 'cms_page'), false, false);
     $action->getLayout()->getUpdate()->addUpdate($page->getLayoutUpdateXml());
     $action->generateLayoutXml()->generateLayoutBlocks();
     if ($storage = AO::getSingleton('catalog/session')) {
         $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
     }
     if ($storage = AO::getSingleton('checkout/session')) {
         $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
     }
     $action->renderLayout();
     return true;
 }
Ejemplo n.º 9
0
 /**
  * Renders CMS page
  *
  * Call from controller action
  *
  * @param Mage_Core_Controller_Front_Action $action
  * @param integer $pageId
  * @return boolean
  */
 public function renderPage(Mage_Core_Controller_Front_Action $action, $pageId = null)
 {
     $page = Mage::getSingleton('cms/page');
     if (!is_null($pageId) && $pageId !== $page->getId()) {
         $page->setStoreId(Mage::app()->getStore()->getId());
         if (!$page->load($pageId)) {
             return false;
         }
     }
     if (!$page->getId()) {
         return false;
     }
     //        $customerSession = Mage::getSingleton('customer/session');
     //        if (!$customerSession->authenticate($action)) {
     //            $customerSession->setBeforeAuthUrl(Mage::getBaseUrl().$page->getIdentifier());
     //            return true;
     //        }
     if ($page->getCustomTheme()) {
         $apply = true;
         $today = strtotime('today');
         if (($from = $page->getCustomThemeFrom()) && strtotime($from) > $today) {
             $apply = false;
         }
         if ($apply && ($to = $page->getCustomThemeTo()) && strtotime($to) < $today) {
             $apply = false;
         }
         if ($apply) {
             list($package, $theme) = explode('/', $page->getCustomTheme());
             Mage::getSingleton('core/design_package')->setPackageName($package)->setTheme($theme);
         }
     }
     $action->loadLayout(array('default', 'cms_page'), false, false);
     $action->getLayout()->getUpdate()->addUpdate($page->getLayoutUpdateXml());
     $action->generateLayoutXml()->generateLayoutBlocks();
     $action->renderLayout();
     return true;
 }