$where="PortalUserId=".$objSession->Get("PortalUserId")." AND $ltable.Status=1";
$where.=" AND $favtable.Modified >= $today AND ItemTypeId=".$this->ItemType;
$p=$this->BasePermission.".VIEW";
$sql="SELECT $ltable.*,$CategoryTable.CategoryId,$CategoryTable.CachedNavBar FROM $favtable INNER JOIN $ltable ON ($favtable.ResourceId=$ltable.ResourceId) ";
$sql.=$this->GetJoinedSQL($p,NULL,$where);
$ret=QueryCount($sql);
}
else
{
if(!$this->ListType=="favorites")
{
$this->ListType="favorites";
$this->LoadFavorites($attribs);
$ret=$this->QueryItemCount;
}
else
$ret=$this->QueryItemCount;
}
return$ret;
}
functionCountPickItems($attribs)
{
if(!$this->ListType=="pick")
{
$this->ListType="pick";
$this->LoadPickItems($attribs);
$ret=$this->QueryItemCount;
}
else
$ret=$this->QueryItemCount;
return$ret;
}
functionCountMyItems($attribs)
{
if(!$this->ListType=="myitems")
{
$this->ListType="myitems";
$this->LoadMyItems($attribs);
$ret=$this->QueryItemCount;
}
else
$ret=$this->QueryItemCount;
return$ret;
}
functionCountHotItems($attribs)
{
if(!$this->ListType=="hotitems")
{
$this->ListType="hotitems";
$this->LoadHotItems($attribs);
$ret=$this->QueryItemCount;
}
else
$ret=$this->QueryItemCount;
return$ret;
}
functionCountNewItems($attribs)
{
if(!$this->ListType=="newitems")
{
$this->ListType="newitems";
$this->LoadNewItems($attribs);
$ret=$this->QueryItemCount;
}
else
$ret=$this->QueryItemCount;
return$ret;
}
functionCountPopItems($attribs)
{
if(!$this->ListType=="popitems")
{
$this->ListType="popitems";
$this->LoadPopItems($attribs);
$ret=$this->QueryItemCount;
}
else
$ret=$this->QueryItemCount;
return$ret;
}
functionCountSearchItems($attribs)
{
if(!$this->ListType=="search")
{
$this->ListType="search";
$this->LoadSearchItems($attribs);
$ret=$this->QueryItemCount;
}
else
$ret=$this->QueryItemCount;
return$ret;
}
functionSqlFavorites($attribs)
{
global$objSession,$objConfig,$objPermissions;
$acl=$objSession->GetACLClause();
$favtable=GetTablePrefix()."Favorites";
$ltable=$this->SourceTable;
$cattable=GetTablePrefix()."CategoryItems";
$CategoryTable=GetTablePrefix()."Category";
$ptable=GetTablePrefix()."PermCache";
$where="PortalUserId=".$objSession->Get("PortalUserId")." AND $ltable.Status=1";
$where.=" AND $favtable.Modified >= $today AND ItemTypeId=".$this->ItemType;
}
$p=$this->BasePermission.".VIEW";
$sql="SELECT $ltable.*,$CategoryTable.CategoryId,$CategoryTable.CachedNavBar FROM $favtable INNER JOIN $ltable ON ($favtable.ResourceId=$ltable.ResourceId) ";
$where="CategoryId =".$catid." AND ((".$TableName.".CreatedOn >=".$cutoff." AND ".$TableName.".NewItem != 0) OR ".$TableName.".NewItem=1 ) AND ".$TableName.".Status=1 ";
}
else
{
$where="((".$TableName.".CreatedOn >=".$this->GetNewValue()." AND ".$TableName.".NewItem != 0) OR ".$TableName.".NewItem=1 ) AND ".$TableName.".Status=1 ";
}
$CategoryTable=GetTablePrefix()."Category";
$sql="SELECT $TableName.*,$CategoryTable.CategoryId,$CategoryTable.CachedNavBar FROM $TableName ";
$where="CategoryId =".$catid." AND ((".$TableName.".Hits >=".$this->GetLinkPopValue()." AND ".$TableName.".PopItem !=0) OR ".$TableName.".PopItem=1) AND ".$TableName.".Status=1";
}
else
{
$where="((".$TableName.".CachedRating >=".$this->GetPopValue()." AND ".$TableName.".PopItem !=0 ) OR ".$TableName.".PopItem=1) AND ".$TableName.".Status=1 ";
$where="((".$TableName.".Hits >=".$this->GetPopValue()." AND ".$TableName.".PopItem !=0) OR ".$TableName.".PopItem=1) AND ".$TableName.".Status=1 ";
$where="CategoryId =".$catid." AND ((".$TableName.".CachedRating >=".$this->GetHotValue()." AND ".$TableName.".PopItem !=0) OR ".$TableName.".PopItem=1) AND ".$TableName.".Status=1";
}
else
{
$where="((".$TableName.".CachedRating >=".$this->GetPopValue()." AND ".$TableName.".PopItem !=0 ) OR ".$TableName.".PopItem=1) AND ".$TableName.".Status=1 ";