/** * Returns the language in the system, by locale. If there was no this locale in the system, tries to find * other language with the same ISO code, if there was no this language installed returns the default one 'en-GB' * * @param $locale - string locale in format: <language>_<TRANSLATION> * @return Zend_Db_Table_Row_Abstract */ public function find($locale = null) { if ($locale == null || strlen($locale) < 5) { return parent::find($this->_defaultLocale); } $rows = parent::find($locale); if ($rows->count() !== 0) { return $rows; } list($language, $translation) = explode('_', $locale); $rows = $this->fetchAll($this->select()->where("iso LIKE '" . $language . "_%'")); if ($rows->count() !== 0) { return $rows; } return parent::find($this->_defaultLocale); }
/** * @param mixed $id - primary key value * @return array */ public function getToGUI($id) { $data = parent::find($id)->current(); $data = $this->convertToGUI($data); return $data; }