<?php defined('SYSPATH') or die('No direct access allowed.');

/**
 * OSB Country Model
 *
 * @package    OSB
 * @category   Models
 * @author     Deon George
 * @copyright  (c) 2009-2013 Open Source Billing
 * @license    http://dev.osbill.net/license.html
 */
class Model_Country extends ORM_OSB {
	protected $_has_one = array(
		'currency'=>array('far_key'=>'id'),
	);

	protected $_has_many = array(
		'tax'=>array('far_key'=>'id'),
	);

	protected $_sorting = array(
		'name'=>'ASC',
	);

	protected $_form = array('id'=>'id','value'=>'name');

	public static function icon() {
		return HTML::image(sprintf('media/img/country/%s.png',strtolower($this->two_code)),array('alt'=>$this->currency->symbol));
	}
}
?>
