<?php
	require_once( $GLOBALS["site_root"] . "/includes/widgets/Widget.inc.php" );
	require_once( $GLOBALS["site_root"] . "/includes/urlgen/News.inc.php" );

	class ArticleBreadcrumb extends Widget {
		protected $article_id = 0;
		protected $larticle_id = 0;
		protected $article_model = null;
	
		public function __construct( $id = "ArticleBreadcrumb" , $parent = null ) {
			parent::__construct( $id , $parent );
			$this->article_model = new ArticlesModel();
		}

		public function setArticleId( $v ) { $this->article_id = $v; }
		public function setLarticleId( $v ) { $this->larticle_id = $v; }

		public function render() {
			if ($this->sRendered) return $this->sRendered;
			if (!$this->larticle_id) {
				$this->article = $this->article_model->getArticleFromId( $this->article_id );
				$this->larticle = $this->article_model->getLanguageArticle(
					$this->article_id , $GLOBALS["langcode"] );
			} else {
				$this->larticle = $this->article_model->getLanguageArticleFromLarticleId( $this->larticle_id );
			}
			$this->setParam( "url_news" , NewsURL::renderURL() );
			$this->setParam( "article" , $this->article );
			$this->setParam( "larticle" , $this->larticle );
			return parent::render();
		}

	}

?>
