<?php
class DModelLocalisationCountry extends Model {
	public function getCountry($country_id) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "country WHERE country_id = '" . (int)$country_id . "' AND status = '1'");
		
		return $query->row;
	}

  public function getCountryFromCode($code) {
    $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "country WHERE (iso_code_2 = '$code' or iso_code_3 = '$code') AND status = '1'");

    return $query->row;
  }

  public function getCountries() {

	  $sql = "SELECT * FROM " . DB_PREFIX . "country WHERE status = '1' ORDER BY name ASC";
    $query = $this->db->query($sql, true);
    $country_data = $query->rows;

		return $country_data;
	}
}
