diff options
Diffstat (limited to 'public/catalog/model/localisation/language.php')
-rw-r--r-- | public/catalog/model/localisation/language.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/public/catalog/model/localisation/language.php b/public/catalog/model/localisation/language.php new file mode 100644 index 0000000..5304f44 --- /dev/null +++ b/public/catalog/model/localisation/language.php @@ -0,0 +1,35 @@ +<?php +class ModelLocalisationLanguage extends Model { + public function getLanguage($language_id) { + $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "language WHERE language_id = '" . (int)$language_id . "'"); + + return $query->row; + } + + public function getLanguages() { + $language_data = $this->cache->get('language'); + + if (!$language_data) { + $language_data = array(); + + $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "language WHERE status = '1' ORDER BY sort_order, name"); + + foreach ($query->rows as $result) { + $language_data[$result['code']] = array( + 'language_id' => $result['language_id'], + 'name' => $result['name'], + 'code' => $result['code'], + 'locale' => $result['locale'], + 'image' => $result['image'], + 'directory' => $result['directory'], + 'sort_order' => $result['sort_order'], + 'status' => $result['status'] + ); + } + + $this->cache->set('catalog.language', $language_data); + } + + return $language_data; + } +}
\ No newline at end of file |