<?php
	fo3_model( "Cache" );

	class CatModel {
		public static function getCatOptions( $choose = true ) {
			$mc = CacheModel::getCacheNameOnParams( "cat_options" ,
				array( "lang" => $GLOBALS["language"], "choose" => $choose ) );
			$retval = CacheModel::getCacheValueOnString( $mc );
			if (is_array( $retval )) return $retval;
			$retval = array();
			if ($choose) $retval[0]=__("Choose");
			$query = sprintf( "select cat_id,cat_name from cats" );
			$data = FNTH_db_get_resultset( $query );
			foreach ($data as $row)
				$retval[$row["cat_id"]]=$row["cat_name"];
			CacheModel::cacheValueOnString( $mc , $retval );
			return $retval;
		}

		public static function getCatlevelOptions( $choose = true ) {
			$retval = array();
			if ($choose) $retval[0]=__("mycat_NA");
			for ($level=1;$level<=3;$level++) {
				$retval[$level]=__(sprintf("mycat_level%d",$level));
			}
			return $retval;
		}
	}

?>
