<?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() {

    $sql = "SELECT * FROM " . DB_PREFIX . "language ORDER BY sort_order, name";
    $query = $this->db->query($sql, true);

    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'],
          'filename'    => $result['filename'],
          'sort_order'  => $result['sort_order'],
          'status'      => $result['status']
        );
    }

		
		return $language_data;	
	}
}
