<?php
	require_once( $GLOBALS["site_root"]."/includes/widgets/FrontendCheckboxList.inc.php" );
	require_once( $GLOBALS["site_root"]."/includes/models/Member.inc.php" );
	require_once( $GLOBALS["site_root"]."/includes/models/MyMember.inc.php" );
	require_once( $GLOBALS["site_root"]."/includes/models/Blueboard.inc.php" );

	class UserTypeFilter extends FrontendCheckboxList {

		protected function loadDatas() {
			$this->mmm = new MyMemberModel();
			$this->bbm = new BlueboardModel();

			$user_id = $this->mmm->getLoggedinUserId();
			$ft = $this->bbm->getSearchFilterTypes( $user_id );
			foreach ($ft as $name => $val) {
				$this->addCheckbox( "u_".$name , __("usertype_".$name) , $val );
			}
		}

		public function __construct( $id , $parent ) {
			parent::__construct( $id , $parent );	
			$this->sCheckboxSeparator = "<br/>";
		}

		public function modifyGetPost( &$g, &$p ) {
			$this->loadDatas();
			return parent::modifyGetPost( $g , $p );
		}

	}
?>
