Location: PHPKode > projects > RabbitBB - Online Web Storage Project > mywebdrive/PHP_CON/file/DAOGetAttrList.php
<?PHP
include_once($webappcfg['APPPATH'] . "/general/DAOGAuth.php");
class DAOGetAttrList extends DAOGAuth
{
	var $db;
	var $db_table;
	var $db_field;

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

	function getUserFileParamAttrById($_id, $_ownerid)
	{
		$sqlq = new SQLSelect();
		$sqlq->setSelect($this->db_field['userfileparamattr'],
			$this->db_table['userfileparamattr']);
		$sqlq->setSelect($this->db_field['userdb'], 
			$this->db_table['userdb']);
		$sqlq->setWhere($this->db_table['userfileparamattr'].
			".filedb_id=".$_id);
		$sqlq->setWhere($this->db_table['userdb'].".id=".
			$this->db_table['userfileparamattr'].".user_id");
		$sqlq->setWhere($this->db_table['userdb'].".id<>".$_ownerid);
		//echo($sqlq->SQLReturn());
		$resultrow = $sqlq->getRow($this->db, $sqlq->SQLReturn());
		$rpop = $this->populate($resultrow);

		$daoua = new DAOUserAccount();
		$userAccount = $daoua->populate($resultrow);

		
		return array($rpop, $userAccount);
	}

	function getUserDirParamAttrById($_id, $_ownerid)
	{
		$sqlq = new SQLSelect();
		$sqlq->setSelect($this->db_field['userdirparamattr'],
			$this->db_table['userdirparamattr']);
		$sqlq->setSelect($this->db_field['userdb'], 
			$this->db_table['userdb']);
		$sqlq->setWhere($this->db_table['userdirparamattr'].
			".dirdb_id=".$_id);
		$sqlq->setWhere($this->db_table['userdb'].".id=".
			$this->db_table['userdirparamattr'].".user_id");
		//$sqlq->setWhere($this->db_table['userdb'].".id<>".$_ownerid);
		//echo($sqlq->SQLReturn());
		$resultrow = $sqlq->getRow($this->db, $sqlq->SQLReturn());
		$rpop = $this->populate($resultrow);

		$daoua = new DAOUserAccount();
		$userAccount = $daoua->populate($resultrow);

		return array($rpop, $userAccount);
	}

	function getOwnerParam($_id, $_ownerid, $_type=SFILE)
	{

		$sqlq = new SQLSelect();
		if ($_type==SFILE)
			$sqlq->setSelect($this->db_field['userfileparamattr'],
				$this->db_table['userfileparamattr']);
		elseif ($_type==DIRECTORY)
			$sqlq->setSelect($this->db_field['userdirparamattr'],
				$this->db_table['userdirparamattr']);
		$sqlq->setSelect($this->db_field['userdb'], 
			$this->db_table['userdb']);
		if ($_type==SFILE)
		{
			$sqlq->setWhere($this->db_table['userfileparamattr'].
				".filedb_id=".$_id);
			$sqlq->setWhere($this->db_table['userdb'].".id=".
				$this->db_table['userfileparamattr'].".user_id");
		}
		elseif ($_type==DIRECTORY)
		{
			$sqlq->setWhere($this->db_table['userdirparamattr'].
				".dirdb_id=".$_id);
			$sqlq->setWhere($this->db_table['userdb'].".id=".
				$this->db_table['userdirparamattr'].".user_id");
		}
		$sqlq->setWhere($this->db_table['userdb'].".id=".$_ownerid);
		$resultrow = $sqlq->getRow($this->db, $sqlq->SQLReturn());
		$rpop = $this->populate($resultrow);

		$daoua = new DAOUserAccount();
		$userAccount = $daoua->populate($resultrow);

		
		return array($rpop, $userAccount);
	}

	function getGroupFileParamAttrById($_id, $_groupid)
	{
		$sqlq = new SQLSelect();
		$sqlq->setSelect($this->db_field['groupfileparamattr'],
			$this->db_table['groupfileparamattr']);
		$sqlq->setWhere($this->db_table['groupfileparamattr'].
			".filedb_id=".$_id);
		$rpop = $this->populate($sqlq->getRow($this->db, $sqlq->SQLReturn()));
		return $rpop;
	}
}

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