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

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

	function getDriveTotalSize($_userid)
	{
		$sqlq = new SQLSelect();
		$sqlq->setSelect($this->db_field['userdb'],
			$this->db_table['userdb']);
		$sqlq->setSelect($this->db_field['acctypedb'],
			$this->db_table['acctypedb']);
		$sqlq->setWhere($this->db_table['userdb'].".acctype=".
			$this->db_table['acctypedb'].".id");
		$sqlq->setWhere($this->db_table['userdb'].".id=".
			$_userid);
		//echo($sqlq->SQLReturn());
		$res = $sqlq->getRow($this->db, $sqlq->SQLReturn());

		$daoua = new DAOUserAccount();
		$daoat = new DAOAcctype();
		
		$userobj = $daoua->populate($res);
		$acctypeobj = $daoat->populate($res);
		return array("userdb"=>$userobj, "acctypedb"=>$acctypeobj);
	}

	function getUsedSize($_userid)
	{
		$sqlq=new SQLSelect();
		$sqlq->setSelectOther("sum(filesize) as other__totalsize");
		$sqlq->setSelect($this->db_field['fileattr'],
			$this->db_table['fileattr']);
		$sqlq->setSelect($this->db_field['filedirdb'],
			$this->db_table['filedirdb']);

		$sqlq->setWhere($this->db_table['filedirdb'].".ownerid=".
			$_userid);
		$sqlq->setWhere($this->db_table['filedirdb'].".ownertype=".
			USER);
		$sqlq->setWhere($this->db_table['filedirdb'].".linkid=".
			$this->db_table['fileattr'].".id");
		$sqlq->setWhere($this->db_table['filedirdb'].".type=".
			DIRECTORY);
		$sqlq->setGroup($this->db_table['filedirdb'].".ownerid");
		$res = $sqlq->getRow($this->db, $sqlq->SQLReturn());
		return $res;
	}
}

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