/** * Load Translations * * @param string $locale * @param string $section * @param boolean $excludeGlobalSection * @return array */ public function load($locale, $section = null, $excludeGlobalSection = false) { $this->_log("Loading translations from DB with params locale: {$locale},section: {$section},excludeGlobalSection: {$excludeGlobalSection}", Zend_Log::INFO); $locale = $this->getLang($locale); $select = $this->_dbTable->select(); $select->from(array('t' => 'translate'), array('t.key', 't.value'))->joinLeft(array('l' => 'translate_language'), 'l.id = t.language_id', array())->where('l.code = ?', $locale); if (isset($section) && $section != 'global') { if ($excludeGlobalSection) { $select->where("t.section = ?", $section); } else { $select->where("t.section = 'global' OR t.section = ?", $section); } } else { $select->where("t.section = 'global'"); } //echo $select->__toString(); $resultSet = $this->_dbTable->fetchAll($select); $trScheme = array(); if (0 == count($resultSet)) { return $trScheme; } foreach ($resultSet as $trElement) { $trScheme[$trElement['key']] = $trElement['value']; } return $trScheme; }
public static function getPagesCountByTemplate($templateName) { $pageDbTable = new Application_Model_DbTable_Page(); return $pageDbTable->getAdapter()->query($pageDbTable->select()->where('template_id="' . $templateName . '"'))->rowCount(); }