<?php
/**
 * Class that operate on table 'relusergroupproperties'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2013-04-06 10:57
 */
class RelusergrouppropertiesMySqlExtDAO extends RelusergrouppropertiesMySqlDAO{
	
	public function queryAllwithUsergroupid($id)
	{
		$sql = 'SELECT relusergroupproperties.propertyid, relusergroupproperties.relusergrouppropertiesid, relusergroupproperties.propertyvalue, properties.propertyname , properties.propertyparent FROM relusergroupproperties join properties
		on relusergroupproperties.propertyid = properties.propertyid
		where relusergroupproperties.usergroupid='.$id.'';
		$sqlQuery = new SqlQuery($sql);
		return $this->getList($sqlQuery);
	}
	
	
	public function queryAllwithUsergroupidAndValue($id)
	{
		$sql = 'SELECT relusergroupproperties.propertyid, relusergroupproperties.propertyvalue, properties.propertyname, properties.propertyurl FROM relusergroupproperties join properties
		on relusergroupproperties.propertyid = properties.propertyid
		where relusergroupproperties.usergroupid='.$id.' and propertyvalue=0 and properties.propertyparent=0 order by relusergroupproperties.propertyid ASC';
		//print($sql);
		$sqlQuery = new SqlQuery($sql);
		return $this->getList($sqlQuery);
	}
	
	
	
	public function queryAllwithUsergroupidAndPropertyparent($id,$parent)
	{
		$sql = 'SELECT relusergroupproperties.propertyid, relusergroupproperties.propertyvalue, properties.propertyname, properties.propertyurl  FROM relusergroupproperties join properties
		on relusergroupproperties.propertyid = properties.propertyid
		where relusergroupproperties.usergroupid='.$id.' and propertyvalue=0 and properties.propertyparent='.$parent.' order by relusergroupproperties.propertyid ASC';
		//print($sql);
		$sqlQuery = new SqlQuery($sql);
		return $this->getList($sqlQuery);
	}
	
	
	public function queryAllwithUsergroupidAndURL($id,$url)
	{
		$sql = 'SELECT relusergroupproperties.propertyid, relusergroupproperties.propertyvalue, properties.propertyname, properties.propertyurl FROM relusergroupproperties join properties
		on relusergroupproperties.propertyid = properties.propertyid
		where relusergroupproperties.usergroupid='.$id.' and propertyvalue=0 and properties.propertyurl="'.$url.'"';
		
		$sqlQuery = new SqlQuery($sql);
		return $this->getList($sqlQuery);
	}


	
}
?>