Location: PHPKode > projects > RabbitBB - Online Web Storage Project > mywebdrive/PHP_CON/theme/DAOTheme.php
<?PHP

class DAOTheme
{
	var $db;
	var $db_table;
	var $db_field;

	function DAOTheme()
	{
		global $db, $db_table, $db_field;
		$this->db = $db;
		$this->db_table = $db_table;
		$this->db_field = $db_field;
	}

	function getTheme($_themeid)
	{
		$sqlq = new SQLSelect();
		$sqlq->setSelect($this->db_field['themedb'],
			$this->db_table['themedb']);
		$sqlq->setWhere($this->db_table['themedb'].".id=".$_themeid);
		return $this->populate($sqlq->getRow($this->db, $sqlq->SQLReturn()));
	}

	function populate($_res)
	{
		$tobj = array();
		if (!isset($_res[$this->db_table['themedb']]))
		{
			return $tobj;
		}

		$themeres = $_res[$this->db_table['themedb']];

		for ($i=0; $i<count($themeres); $i++)
		{
			$tobj[] = $this->createTheme($themeres[$i]);
		}

		return $tobj;
	}

	function createTheme($_row)
	{
		return new Theme($_row['id'], $_row['themename'], 
			$_row['themepath']);
	}
}

?>
Return current item: RabbitBB - Online Web Storage Project