<?php
/**
 * Klasa prostych artykulow
 *
 */
class MfHomeSiteBaner extends DataObject {


	/**
	 * nazwa tabeli
	 */
	static $tableName = 'mf_home_site_baner';

	/**
	 * nazwa klucza tabeli
	 */
	static $classTablePK = 'id_mf_home_site_baner';

	/**
	 * nazwa klasy
	 */
	static $className = __CLASS__;

	
	/**
	 * tabela mapująca pola z bazy SQL na pola klasy.
	 * `id_mf_home_site`, `lang``description`, `id_source`, `sort`, `photo`
	 */
	static $fields = array(
	'id_mf_home_site_baner' =>'id',
	'lang' =>'lang' ,
	'name' =>'name',
	'description' =>'description',
	'id_source' => 'idSource',
	'sort' =>'sort',
	'photo' =>'photo',
	'source_url' =>'sourceUrl'
	);

	protected $id;
	private $lang;
	private $name;
	private $description;
	private $idSource;
	private $sort;
	private $photo;
	private $sourceUrl;
	public $objSource;


	public function GetId() {
		return $this->id;
	}

	public function SetId($id) {
		$this->id = $id;
	}

	public function GetDescription() {
		return $this->description;
	}

	public function SetDescription($d) {
		$this->description = $d;
	}
	public function GetIdSource() {
		return $this->idSource;
	}

	public function SetIdSource($idSource) {
		$this->idSource = $idSource;
	}

	public function GetSort() {
		return $this->sort;
	}

	public function SetSort($sort) {
		$this->sort = $sort;
	}

	public function GetName() {
		return $this->name;
	}

	public function SetName($name) {
		$this->name = $name;
	}

	public function GetSourceUrl() {
		return $this->sourceUrl;
	}

	public function SetSourceUrl($sourceUrl) {
		$this->sourceUrl = $sourceUrl;
	}

	public function GetLang() {
		if($this->lang=='') {

			$this->SetLang(Router::$curLang);

		}


		return $this->lang;
	}

	public function SetLang($lang) {
		$this->lang = $lang;
	}


	public function SetPhoto($photo) {
		return $this->photo = $photo;
	}

	public function GetPhoto() {
		return $this->photo;
	}

	public function GetPhotoUrl() {
		if ($this->GetPhoto()) {
			return Config::Get('URL_STATIC_CONTENT') . '/upload/home/' . $this->GetPhoto();
		} else {
			return null;
		}
	}

	public function GetPhotoPath() {
		if ($this->GetPhoto()) {
			return Config::Get('PATH_STATIC_CONTENT') . '/upload/home/' . $this->GetPhoto();
		} else {
			return null;
		}
	}

	/**
	 * Konstruktor klasy
	 *
	 * @param integer $id
	 */

	public function __construct($id = -1) {
		$this->SetId($id);
	}

	/**
	 * Pobiera nazwę tabeli reprezentującej obiekt w SQL
	 * @return string
	 */

	public  function GetTableName(){
		return self::$tableName;
	}
	/**
       * Pobiera taablice mapującą pola klasy na pola tabeli
       * @return array
       */
	public  function GetFields(){
		return self::$fields;
	}
	/**
       * Pobiera nazwę klasy
       * @return string
       */
	public  function GetClassName(){
		return self::$className;
	}


	public function GetClassTablePK() {
		return self::$classTablePK;
	}



}
?>