<?php

/**
 * PowerBB Engine - The Engine Helps You To Create Bulletin Board System.
 */

/**
 * @package 	: 	PowerBBUserRating (UserRating)
 * @author 		: 	MSHRAQ abu-rakan (xxx_abu_rakan_xxx@hotmail.com)
 * @start 		: 	7/2/2010 , 03:25 AM
 */
class PowerBBUserRating
{
	var $id;
	var $Engine;

	function PowerBBUserRating($Engine)
	{
		$this->Engine = $Engine;
	}

	function InsertUserRating($param)
	{
 		if (!isset($param)
 			or !is_array($param))
 		{
 			$param = array();
 		}

		$query = $this->Engine->records->Insert($this->Engine->table['userrating'],$param['field']);

		if ($param['get_id'])
		{
			$this->id = $this->Engine->DB->sql_insert_id();
		}

		return ($query) ? true : false;
	}

	function GetUserRatingList($param)
	{
 		if (!isset($param)
 			or !is_array($param))
 		{
 			$param = array();
 		}

 		$param['select'] 	= 	'*';
 		$param['from'] 		= 	$this->Engine->table['userrating'];

 	 	$rows = $this->Engine->records->GetList($param);

 		return $rows;
	}

	function GetUserRatingInfo($param)
	{
 		if (!isset($param)
 			or !is_array($param))
 		{
 			$param = array();
 		}

 	 	$param['select'] 	= 	'*';
 	 	$param['from'] 		= 	$this->Engine->table['userrating'];

 	 	$rows = $this->Engine->records->GetInfo($param);

 	 	return $rows;
	}

	function UpdateUserRating($param)
	{
 		if (!isset($param)
 			or !is_array($param))
 		{
 			$param = array();
 		}

		$query = $this->Engine->records->Update($this->Engine->table['userrating'],$param['field'],$param['where']);

		return ($query) ? true : false;
	}

	function DeleteUserRating($param)
	{
 		if (!isset($param)
 			or !is_array($param))
 		{
 			$param = array();
 		}

 		$param['table'] = $this->Engine->table['userrating'];

		$del = $this->Engine->records->Delete($param);

		return ($del) ? true : false;
	}


}

?>
