示例#1
0
 protected function getData()
 {
     try {
         $locale = Zend_Registry::get("Zend_Locale");
     } catch (Exception $e) {
         return array();
     }
     $cacheKey = "glossary_" . $locale->getLanguage();
     try {
         $data = Zend_Registry::get($cacheKey);
         return $data;
     } catch (Exception $e) {
     }
     if (!($data = Pimcore_Model_Cache::load($cacheKey))) {
         $list = new Glossary_List();
         $list->setCondition("language = ?", $locale->getLanguage());
         $list->setOrderKey("LENGTH(`text`)", false);
         $list->setOrder("DESC");
         $data = $list->getDataArray();
         $data = $this->prepareData($data);
         Pimcore_Model_Cache::save($data, $cacheKey, array("glossary"), null, 995);
         Zend_Registry::set($cacheKey, $data);
     }
     return $data;
 }
示例#2
0
 protected function getData()
 {
     if (Zend_Registry::isRegistered("Zend_Locale")) {
         $locale = Zend_Registry::get("Zend_Locale");
     } else {
         return array();
     }
     $siteId = "";
     try {
         $site = Site::getCurrentSite();
         if ($site instanceof Site) {
             $siteId = $site->getId();
         }
     } catch (Exception $e) {
         // not inside a site
     }
     $cacheKey = "glossary_" . $locale->getLanguage() . "_" . $siteId;
     try {
         $data = Zend_Registry::get($cacheKey);
         return $data;
     } catch (Exception $e) {
     }
     if (!($data = Pimcore_Model_Cache::load($cacheKey))) {
         $list = new Glossary_List();
         $list->setCondition("(language = ? OR language IS NULL OR language = '') AND (site = ? OR site IS NULL OR site = '')", array($locale->getLanguage(), $siteId));
         $list->setOrderKey("LENGTH(`text`)", false);
         $list->setOrder("DESC");
         $data = $list->getDataArray();
         $data = $this->prepareData($data);
         Pimcore_Model_Cache::save($data, $cacheKey, array("glossary"), null, 995);
         Zend_Registry::set($cacheKey, $data);
     }
     return $data;
 }