<?php
	require_once( $GLOBALS["site_root"] . "/includes/widgets/Widget.inc.php" );
	require_once( $GLOBALS["site_root"] . "/includes/models/Articles.inc.php" );
	require_once( $GLOBALS["site_root"] . "/includes/models/Articlecategories.inc.php" );

	class ArticlesPanel extends Widget {
		protected $article_model = null;
		protected $ac_model = null;

		protected $aArticleIds = array();

		public function setArticleIds( $v ) { $this->aArticleIds = $v; }
		
		public function __construct( $id = "ArticlePanel" , $parent = null ) {
			parent::__construct( $id , $parent );
			$this->article_model = new ArticlesModel();
			$this->ac_model = new ArticlecategoriesModel();
		}

		public function render() {
			if ($this->sRendered) return $this->sRendered;
			// $cats = $this->ac_model->getPublicArticlecategoryOptions();
			// $categories = array_keys( $cats );
			// $articles = $this->article_model->getLatestArticlesFromCategories( $categories , $GLOBALS["langcode"] );
			$articles = $this->article_model->getViewArticlesFromIds( $this->aArticleIds );
			$this->setParam( "articles" , $articles );
			return parent::render();
		}

	}

?>
