예제 #1
0
 /**
  * Retrieve snippet model for system messages.
  *
  * @return Model_Snippet
  */
 protected function _getSnippetModel()
 {
     $snippetModel = new Model_Snippet();
     if ($snippetModel->getObserver('Translatable')) {
         $i18nModelFactory = new Garp_I18n_ModelFactory();
         $snippetModel = $i18nModelFactory->getModel($snippetModel);
     }
     return $snippetModel;
 }
예제 #2
0
 /**
  * Fetch existing snippet by identifier
  *
  * @param string $identifier
  * @return Garp_Db_Table_Row
  */
 protected function _fetchExisting($identifier)
 {
     $this->_validateLoadable();
     $snippetModel = new Model_Snippet();
     $select = $snippetModel->select()->where('identifier = ?', $identifier);
     $row = $snippetModel->fetchRow($select);
     return $row;
 }
예제 #3
0
 protected function _getSnippet($identifier)
 {
     $snippetModel = new Model_Snippet();
     if ($snippetModel->isMultilingual()) {
         $snippetModel = instance(new Garp_I18n_ModelFactory())->getModel('Snippet');
     }
     return $snippetModel->fetchByIdentifier($identifier)->text;
 }
예제 #4
0
 protected function _setCmsClosedMessage()
 {
     $config = Zend_Registry::get('config');
     if (!isset($config->cms->closed) || !$config->cms->closed) {
         return;
     }
     $this->view->isClosed = true;
     try {
         $snippetModel = new Model_Snippet();
         if ($snippetModel->isMultilingual()) {
             $snippetModel = instance(new Garp_I18n_ModelFactory())->getModel('Snippet');
         }
         $snippet = $snippetModel->fetchByIdentifier('cms closed message');
         $cmsClosedMessage = $snippet->html;
         if (isset($cmsClosedMessage[Garp_I18n::getCurrentLocale()])) {
             $cmsClosedMessage = $cmsClosedMessage[Garp_I18n::getCurrentLocale()];
         }
         $this->view->cmsClosedMessage = $cmsClosedMessage;
     } catch (Exception $e) {
         throw $e;
         $this->view->cmsClosedMessage = '<p>The CMS is closed.</p>';
     }
 }