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

	class CategoryArticlesPanel extends FilteredArticlesPanel {
		protected $sArticleCategory = "";
		public function __construct(
			$id = "CategoryArticlesPanel",
			$parent = null,
			$article_category_name = "--news--" ) {
			parent::__construct( $id , $parent );
			$this->sArticleCategory = $article_category_name;
			$this->sFilterArticleCategory = $article_category_name;
		}

		public function render() {
			if ($this->sRendered) return $this->sRendered;
			$acm = new ArticlecategoriesModel();
			$ac=$acm->getArticleCategoryFromName($this->sArticleCategory);
			$ac_id = $ac["article_category_id"];
			$acoptions = $acm->getArticleCategoryOptions( false , false );
			$this->sTitle = $acoptions[$ac_id];
			$page_title = sprintf( "%s | %s" , $this->sTitle , GlobalsModel::getSiteName() );
			fo3_set_page_title( $page_title );
			return parent::render();
		}
	}
?>
