clsCatItem(TRUE);
$this->tablename=GetTablePrefix()."Topic";
$this->type=TYPE_TOPIC;
$this->BasePermission="TOPIC";
$this->id_field = "TopicId";
$this->TagPrefix = "topic";
$this->TitleField = 'TopicText';
if(isset($TopicId))
$this->LoadFromDatabase($TopicId);
if($objSession->HasSystemPermission("DEBUG.ITEM"))
{
$this->SetDebugLevel(1);
}
$this->OpenTagVar = "Topic_Highlight_OpenTag";
$this->CloseTagVar = "Topic_Highlight_CloseTag";
}
function ClearCacheData()
{
DeleteModuleTagCache('inbulletin');
/* $cats = explode(",",$this->CategoryMemberList());
if(is_array($cats))
{
foreach($cats as $c)
{
if(is_numeric($c))
{
$evar = "'%:m".$c."%'";
DeleteTagCache("bb_topic_list","",$evar);
DeleteTagCache("bb_topic_more","",$evar);
}
}
}
DeleteTagCache("bb_topic_modified%","");
DeleteTagCache("TopicPopValue","","");
DeleteTagCache("TopicHotValue","","");
DeleteTagCache("TopicNewValue","","");*/
}
function Validate()
{
global $Errors;
$dataValid = true;
if(!strlen($this->Get("TopicText")))
{
$objSession->AddError("error.fieldIsRequired",'TopicText',"","",get_class($this),"Validate");
$dataValid = false;
}
if(!(int)($this->Get("OwnerId")))
{
$Errors->AddError("error.fieldIsRequired",'Owner',"","",get_class($this),"Validate");
$dataValid = false;
}
return $dataValid;
}
function Update($UpdatedBy=NULL,$modificationDate=null)
{
parent::Update($UpdatedBy,$modificationDate);
if($this->tablename==GetTablePrefix()."Topic")
{
$this->ClearCacheData();
}
}
function Create()
{
parent::Create();
if($this->tablename==GetTablePrefix()."Topic")
{
$this->ClearCacheData();
DeleteTagCache("m_itemcount","Topic%");
}
}
function Delete()
{
global $objPostingList, $objCatList;
$PostCount = $this->Get("Posts");
$objPostingList->DeleteTopicPosts($this->Get("TopicId"));
$CategoryId = $this->Get("CategoryId");
if(!is_numeric($CategoryId))
$CategoryId = $objCatList->CurrentCategoryID();
if($this->tablename==GetTablePrefix()."Topic")
{
$this->ClearCacheData();
DeleteTagCache("m_itemcount","Topic%");
if($this->Get("NotifyOwnerOnChanges"))
{
$this->SendUserEventMail("TOPIC.DELETE",$this->Get('OwnerId') );
}
$this->SendAdminEventMail("TOPIC.DELETE");
}
parent::Delete();
$this->refreshLastUpdate($CategoryId);
$this->UpdateCategoryPostCount();
}
function UpdateModified($UserId)
{
$this->Set(array("Modified", "ModifiedById"), array(adodb_mktime(), $UserId));
$this->Update();
}
function UpdateNumPosts()
{
global $objSession;
$sql = "SELECT COUNT(PostingId) as PostCount FROM ".GetTablePrefix()."Posting WHERE TopicId=" . $this->Get("TopicId");
$result = $this->adodbConnection->Execute($sql);
if($result && !$result->EOF)
{
$sql = "UPDATE ".$this->tablename." SET Posts=".$result->fields["PostCount"]." WHERE TopicId=" . $this->Get("TopicId");
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"UpdateNumPosts");
return false;
}
}
}
function SetNewItem()
{
global $objConfig;
$value = $this->Get("CreatedOn");
$cutoff = adodb_date("U") - ($objConfig->Get("Topic_NewDays") * 86400);
$this->IsNew = FALSE;
if($value>$cutoff)
$this->IsNew = TRUE;
return $this->IsNew;
}
function SetPopItem()
{
global $objConfig, $objTopicList;
$cutoff = $objTopicList->GetPopValue();
if($cutoff > 0)
{
$this->IsPop = FALSE;
if($this->Get('Posts') >= $cutoff)
{
$this->IsPop = TRUE;
}
}
else
$this->IsPop = FALSE;
return $this->IsPop;
}
function SetHotItem()
{
global $objConfig, $objTopicList;
$this->IsHot = FALSE;
$cutoff = $objTopicList->GetHotValue();
if($cutoff>0)
{
if($this->Get("Views") >= $cutoff)
$this->IsHot = TRUE;
}
return $this->IsHot;
}
function Approve()
{
$this->Set("Status", 1);
$this->Update();
$this->SendUserEventMail("TOPIC.APPROVE",$this->Get("OwnerId"));
$this->SendAdminEventMail("TOPIC.APPROVE");
}
function Deny()
{
$this->Set("Status", 0);
$this->Update();
$this->SendUserEventMail("TOPIC.DENY",$this->Get("OwnerId"));
$this->SendAdminEventMail("TOPIC.DENY");
}
function LoadFromDatabase($Id)
{
global $Errors;
if(!isset($Id))
{
$Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromDatabase");
return false;
}
if($Id>0)
{
$sql = sprintf("SELECT * FROM ".$this->tablename." WHERE ".$this->IdField()." = '%s'",$Id);
$result = $this->adodbConnection->Execute($sql);
if ($result === FALSE)
{
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromDatabase");
return FALSE;
}
$data = $result->fields;
$this->SetFromArray($data);
return TRUE;
}
else
return FALSE;
}
function LoadFromResourceId($Id)
{
global $objSession, $Errors;
if(!isset($Id))
{
$Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromResourceId");
return false;
}
$sql = sprintf("SELECT * FROM ".$this->tablename." WHERE ResourceId = '%s'",$Id);
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$Errors->AddError("error.DatabaseError",NULL,$adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromResourceId");
return false;
}
$data = $result->fields;
if(is_array($data))
$this->SetFromArray($data);
}
function GetPostsSince($time_stamp)
{
global $Errors;
$Id = $this->Get("TopicId"); //get cur cat id
settype($time_stamp,"integer");
$sql = "SELECT count(PostingId) as pcount FROM ".GetTablePrefix()."Posting WHERE TopicId = $Id AND Posting.ModifiedOn >= $time_stamp ";
$result = $this->adodbConnection->Execute($sql);
if($result && !$result->EOF)
return $result->fields["pcount"];
else
{
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"GetPostsSince");
return false;
}
}
function GetPosts()
{
global $Errors;
/* if(!is_numeric($this->Get("Posts"))<1)
{
$Id = $this->Get("TopicId"); //get cur cat id
$sql = "SELECT count(PostingId) FROM ".GetTablePrefix()."Posting WHERE TopicId = $Id";
$result = $this->adodbConnection->Execute($sql);
if($result && !$result->EOF)
$this->Set("Posts",$result->fields[0]);
else
{
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"","clsTopic","GetPosts");
return false;
}
}*/
return $this->Get("Posts");
}
function StatusIcon()
{
global $rootURL;
$ret = $rootURL."/in-bulletin/admin/images/";
switch($this->Get("Status"))
{
case STATUS_DISABLED:
$ret .= "icon16_topic_disabled.gif";
break;
case STATUS_PENDING:
$ret .= "icon16_topic_pending.gif";
break;
case STATUS_ACTIVE:
$img = "icon16_topic.gif";
if($this->IsPopItem())
$img = "icon16_topic_top.gif";
if($this->IsHotItem())
$img = "icon16_topic_hot.gif";
if($this->IsNewItem())
$img = "icon16_topic_new.gif";
if($this->Is("EditorsPick"))
$img = "icon16_topic_pick.gif";
$ret .= $img;
break;
}
return $ret;
}
function ItemURL($Template=NULL,$SetCat=FALSE,$Action=NULL)
{
global $var_list_update,$var_list,$bb_var_list_update,$m_var_list_update;
$url_params = Array();
$var_list_update["t"] = $Template ? $Template : $var_list["t"];
// if($SetCat || (int)$this->Get("CategoryId")>0)
// {
$cat = $this->Get("CategoryId");
if(!is_numeric($cat))
$cat = $this->GetPrimaryCategory();
$m_var_list_update["cat"] = $cat;
// }
$bb_var_list_update["top"] = $this->Get("TopicId");
$bb_var_list_update["pp"] = 1;
if( isset($Action) && $Action ) $url_params['Action'] = $Action;
$ret = HREF_Wrapper('', $url_params);
unset($m_var_list_update["cat"],$bb_var_list_update["top"],$bb_var_list_update["tp"],$bb_var_list_update["pp"], $var_list_update["t"]);
return $ret;
}
function ParseObject($element)
{
global $objConfig, $objSession, $objUsers, $objCatList, $var_list_update, $var_list,
$bb_var_list_update, $m_var_list_update,$objCensorList;
//print_pre($element);
$extra_attribs = ExtraAttributes($element->attributes);
if(strtolower($element->name)==$this->TagPrefix)
{
$field = strtolower($element->attributes["_field"]);
switch($field)
{
/*
@field:topic.text
@description: Returns the topic title (or subject)
*/
case "text":
$topic_text = inp_unescape($objCensorList->CensorText($this->Get("TopicText")));
$num_chars = $element->GetAttributeByName('_numchars');
if ($num_chars && strlen($topic_text) > $num_chars) {
$ret = substr($topic_text, 0, $num_chars)."...";
}
else {
$ret = $topic_text;
}
$ret = $this->HighlightText($ret);
break;
/*
@field:topic.replies
@description: Returns the number of posts for the topic (The first post is not counted)
*/
case "replies":
$ret = $this->GetPosts() - 1;
break;
/*
@field:topic.views
@description: Returns the number of times the topic has been viewed
*/
case "views":
return round($this->Get("Views"));
break;
/*
@field:topic.category
@description:Return a category field from the link's category
@attrib:_cattag::Category field to parse
*/
case "lastposter":
/*
@field:topic.lastposter
@description:Returns the login name of the last poster in this topic
*/
if(strlen($this->Get("LastPoster")))
{
$ret = $this->Get("LastPoster");
}
else
{
$id = $this->Get("LastPostId");
if (!is_numeric($id)) {
$id = $this->GetLastPostId();
}
if ($id) {
$post = new clsPosting($id);
if (is_object($post)) {
$ret = $post->Get('PosterAlias');
if (!$ret && ($post->Get('CreatedById') < 0)) {
$ret = language('lu_Guest');
}
}
}
}
break;
case "lastpostdate":
/*
@field:topic.lastpostdate
@description:Returns the date/time a post was made to this topic
@attrib:_tz:bool:Convert the date to the user's local time
@attrib:_part::Returns part of the date. The following options are available: month,day,year,time_24hr,time_12hr
*/
$d = $this->Get("LastPostDate");
if (!$element->GetAttributeByName('_tz')) {
$element->SetAttributeByName('_tz', 'auto');
}
$ret = $this->ParseTimeStamp($d, $element->attributes);
break;
/*
@field:topic.image
@description:Return an image associated with the topic
@attrib:_primary:bool:If true, will return the default image if the requested image does not exist
@attrib:_name::Return the image with this name
@attrib:_thumbnail:bool:If true, return the thumbnail version of the image
@attrib:_imagetag:bool:If true, returns a complete image tag. exta html attributes are passed to the image tag
*/
case "modifiedby":
/*
@field:topic.modifiedby
@description:parse a user field of the user that last modified the topic
@attrib:_usertag::User field to return (defaults to login ID)
*/
$field = $element->attributes["_usertag"];
if(!strlen($field))
{
$field = "user_login";
}
$u =& $objUsers->GetItem($this->Get("ModifiedById"));
$ret = $u->parsetag($field);
break;
case "owner":
/*
@field:topic.owner
@description:parse a user field of the user that is the topic owner
@attrib:_usertag::User field to return (defaults to login ID)
*/
$field = $element->attributes["_usertag"];
if(!strlen($field))
{
$field = "user_login";
}
$u =& $objUsers->GetItem($this->Get("OwnerId"));
$ret = $u->parsetag($field);
break;
/*
@field:topic.custom
@description:Returns a custom field
@attrib:_customfield::field name to return
@attrib:_default::default value
*/
case "date":
/*
@field:topic.date
@description:Returns the date/time the topic was created
@attrib:_tz:bool:Convert the date to the user's local time
@attrib:_part::Returns part of the date. The following options are available: month,day,year,time_24hr,time_12hr
*/
$d = $this->Get('CreatedOn');
if (!$element->GetAttributeByName('_tz')) {
$element->SetAttributeByName('_tz', 'auto');
}
$ret = $this->ParseTimeStamp($d,$element->attributes);
break;
case "modifieddate":
/*
@field:link.modifieddate
@description:Returns the date/time the topic was last modified
@attrib:_tz:bool:Convert the date to the user's local time
@attrib:_part::Returns part of the date. The following options are available: month,day,year,time_24hr,time_12hr
*/
$d = $this->Get('Modified');
if (!$element->GetAttributeByName('_tz')) {
$element->SetAttributeByName('_tz', 'auto');
}
$ret = $this->ParseTimeStamp($d,$element->attributes);
break;
/*
@field:topic.fullpath
@description:The full category path of the item
*/
//break;
case "locked":
/*
@field:topic.locked
@description: Returns a value if the topic is locked
@attrib:_text:lang:Language tag to display as the link text
@attrib:_plaintext:: Plain text to use instead of language tag
@attrib:image::Image URL to display
*/
if($this->Get("TopicType")==0)
{
$text = $element->attributes["_text"];
if(!strlen($text))
{
$text = $element->attributes["_plaintext"];
if(!strlen($text))
{
if(strlen($element->attributes["_image"]))
{
$text = "attributes["_image"]."\" BORDER=\"0\" alt=\"\">";
}
}
$ret .= $text."";
}
else
$ret .= language($text)."";
if(!strlen($ret)) $ret = "locked";
}
else {
$ret = '';
}
break;
/*
@field:topic.cat_link
@description:Returns a URL setting the topic to the current topic and the topic's category to the current category
@attrib:_template:tpl:Template URL should point to
*/
/*
@field:topic.link
@description:Returns a URL setting the topic to the current topic
@attrib:_template:tpl:Template URL should point to
*/
case "perm_link":
/*
@field:topic.perm_link
@description: Returns a link to the current topic if permissions are set for the user
@attrib:_permission::Comma-separated permission list to check, any one permission granted to the user will create the link
@attrib:_system:bool:Set this to true if any one permission in the list is a system permission
@attrib:_noaccess:tpl:Template to link to if access is denied
@attrib:_template:tpl:Tempalte to link to if access is granted
@attrib:_text:lang:Language tag to display as the link text
@attrib:_plaintext:: Plain text to use instead of language tag
@attrib:image::Image URL to display in the anchor tag
*/
$p = $element->attributes["_permission"];
$sys = $element->attributes["_system"];
$cat = $this->Get("CategoryId");
if(!is_numeric($cat))
$cat = $this->GetPrimaryCategory();
$HasPerm = $objSession->HasCatPermInList($p,$cat, $sys);
if(!$HasPerm && strlen($element->attributes["_noaccess"])>0)
{
$t = $element->attributes["_noaccess"];
$ret = $this->ItemURL($t,FALSE,"");
}
if($HasPerm)
{
$t = $element->attributes["_template"];
$ret = "ItemURL($t)."\">";
$text = $element->attributes["_text"];
if(!strlen($text))
{
$text = $element->attributes["_plaintext"];
if(!strlen($text))
{
if(strlen($element->attributes["_image"]))
{
$text = "attributes["_image"]."\" BORDER=\"0\" alt=\"\">";
}
}
$ret .= $text."";
}
else
$ret .= language($text)."";
}
else
$ret = '';
break;
case "link_lock":
/*
@field:topic.link_lock
@description: Returns a link to lock or unlock the topic. A complete anchor tag is returned, and the tag class is set to 'topic_reply'
@attrib:_template:tpl:Template link should point to
@attrib:_text:lang:Language tag to display as the link text
@attrib:_plaintext:: Plain text to use instead of language tag
@attrib:image::Image URL to display in the anchor tag
*/
$cat = $this->Get("CategoryId");
if(!is_numeric($cat))
$cat = $this->GetPrimaryCategory();
if($objSession->HasCatPermission("TOPIC.LOCK",$cat))
{
$t = $element->attributes["_template"];
if(strlen($t))
{
$var_list_update["t"] = $t;
}
else
$var_list_update["t"] = $var_list["t"];
$bb_var_list_update["top"] = $this->Get("TopicId");
if($this->Get("TopicType")==1)
{
$ret = " 'bb_lock_topic') )."\">";
}
else
$ret = " 'bb_unlock_topic') )."\">";
$text = $element->attributes["_text"];
if(!strlen($text))
{
$text = $element->attributes["_plaintext"];
if(!strlen($text))
{
if(strlen($element->attributes["_image"]))
{
$text = "attributes["_image"]."\" BORDER=\"0\" alt=\"\">";
}
}
$ret .= $text."";
}
else
$ret .= language($text)."";
}
else
$ret = "";
unset($bb_var_list_update["top"], $m_var_list_update["cat"],$var_list_update["t"]);
break;
case "link_delete":
/*
@field:topic.link_delete
@description: Returns a link to delete the topic.
@attrib:_template:tpl:Template link should point to
@attrib:_text:lang:Language tag to display as the link text
@attrib:_plaintext:: Plain text to use instead of language tag
@attrib:image::Image URL to display in the anchor tag
*/
$cat = $this->Get("CategoryId");
if(!is_numeric($cat))
$cat = $this->GetPrimaryCategory();
$OwnerPerm = ($objSession->HasCatPermission("TOPIC.OWNER.DELETE", $cat) &&
$objSession->Get("PortalUserId")==$this->Get("OwnerId"));
if($objSession->HasCatPermission("TOPIC.DELETE",$cat) || $OwnerPerm)
{
$bb_var_list_update["top"] = $this->Get("TopicId");
$m_var_list_update["cat"] = $cat;
$ret = " 'bb_topic_delete') ) ."\">";
$text = $element->attributes["_text"];
if(!strlen($text))
{
$text = $element->attributes["_plaintext"];
if(!strlen($text))
{
if(strlen($element->attributes["_image"]))
{
$text = "attributes["_image"]."\" BORDER=\"0\" alt=\"\">";
}
}
$ret .= $text."";
}
else
$ret .= language($text)."";
}
else
$ret = "";
unset($bb_var_list_update["top"], $m_var_list_update["cat"]);
break;
case "link_edit":
/*
@field:topic.link_edit
@description: Rturns a link edit the topic. A complete anchor tag is returned, and the tag class is set to 'topic_reply'
@attrib:_template:tpl:Template link should point to
@attrib:_text:lang:Language tag to display as the link text
@attrib:_plaintext:: Plain text to use instead of language tag
@attrib:image::Image URL to display in the anchor tag
*/
$cat = $this->Get("CategoryId");
if (!is_numeric($cat)) {
$cat = $this->GetPrimaryCategory();
}
$perms[1] = $objSession->HasCatPermission('TOPIC.MODIFY', $cat) || $objSession->HasCatPermission("TOPIC.MODIFY.PENDING", $cat);
$perms[2] = $objSession->Get("PortalUserId") == $this->Get("OwnerId") && $objSession->HasCatPermission("TOPIC.OWNER.MODIFY", $cat);
$perms[3] = $objSession->Get("PortalUserId") == $this->Get("OwnerId") && $objSession->HasCatPermission("TOPIC.OWNER.MODIFY.PENDING", $cat);
if ( ($perms[1] || $perms[2] || $perms[3]) && ($this->Get("TopicType") == 1) ) {
$bb_var_list_update["top"] = $this->Get("TopicId");
$m_var_list_update["cat"] = $cat;
$var_list_update["t"] = $element->attributes["_template"];
if(strlen($element->attributes["_template"]))
{
$ret = "";
$text = $element->attributes["_text"];
if(!strlen($text))
{
$text = $element->attributes["_plaintext"];
if(!strlen($text))
{
if(strlen($element->attributes["_image"]))
{
$text = "attributes["_image"]."\" BORDER=\"0\" alt=\"\">";
}
}
$ret .= $text."";
}
else
$ret .= language($text)."";
}
else
$ret = "[no template]";
}
else
$ret = "";
unset($bb_var_list_update["top"], $var_list_update["t"],$m_var_list_update["cat"]);
break;
case "link_reply":
/*
@field:topic.link_reply
@description: Rturns a link to post a reply to the topic. A complete anchor tag is returned, and the tag class is set to 'topic_reply'
@attrib:_template:tpl:Template link should point to
@attrib:_text:lang:Language tag to display as the link text
@attrib:_plaintext:: Plain text to use instead of language tag
@attrib:image::Image URL to display in the anchor tag
*/
if(($objSession->HasCatPermission("TOPIC.REPLY.ADD") ||
$objSession->Get("PortalUserId")==$this->Get("OwnerId"))
&& $this->Get("TopicType")==1)
{
$bb_var_list_update["top"] = $this->Get("TopicId");
$var_list_update["t"] = $element->attributes["_template"];
if(strlen($element->attributes["_template"]))
{
$ret = "";
$text = $element->attributes["_text"];
if(!strlen($text))
{
$text = $element->attributes["_plaintext"];
if(!strlen($text))
{
if(strlen($element->attributes["_image"]))
{
$text = "attributes["_image"]."\" BORDER=\"0\" alt=\"\">";
}
}
$ret .= $text."";
}
else
$ret .= language($text)."";
}
else
$ret = "";
}
else
$ret = "";
unset($bb_var_list_update["top"],$var_list_update["t"]);
break;
case "add_favorite_link":
/*
@field:topic.add_favorite_link
@description:Returns a URL to add this topic to the user's favorites
@attrib:_template:tpl:Template URL should point to
*/
$t = $element->attributes["_template"];
if(!strlen($t))
$t = $var_list["t"];
$ret = $this->ItemURL($t,FALSE,"bb_add_favorite");
break;
case "del_favorite_link":
/*
@field:topic.del_favorite_link
@description:Returns a URL to remove this link from the user's favorites
@attrib:_template:tpl:Template URL should point to
*/
$t = $element->attributes["_template"];
if(!strlen($t))
$t = $var_list["t"];
$ret = $this->ItemURL($t,FALSE,"bb_del_favorite");
break;
/*
@field:topic.favorite_toggle
@description: Returns a link to set or reset the favorite flag for the current user
@attrib: _template:tpl:Template to link to if user has the FAVORITES permission (defaults to current template)
@attrib: _denytemplate:tpl: Template to link to if user does not have favorites permission (ie Guest) Defaults to current template
@attrib: _addlabel:lang:Language tag to display if link is to add favorite
@attrib: _addimage::Image url to include in link if adding favorite
@attrib: _dellabel:lang:Language tag to display if item is already a favorite
@attrib: _delimage::Image url to include in link if removing the favorite
*/
case "favorite_toggle":
$t = $element->attributes["_template"];
if(!strlen($t))
$t = $var_list["t"];
if(!$this->IsFavorite())
{
$action = "bb_add_favorite";
if (!strlen($element->attributes["_addlabel"])) {
$text = "attributes["_addimage"]."\" BORDER=\"0\" alt=\"\">";
}
else {
$label = $element->attributes["_addlabel"];
}
}
else
{
$action = "bb_del_favorite";
if (!strlen($element->attributes["_dellabel"])) {
$text = "attributes["_delimage"]."\" BORDER=\"0\" alt=\"\">";
}
else {
$label = $element->attributes["_dellabel"];
}
}
if (strlen($label)) {
$text = language($label);
}
$ret = "ItemURL($t,FALSE,$action)."\">".$text."";
break;
case "admin_icon":
if( $element->GetAttributeByName('_fulltag') )
{
$ret = "StatusIcon()."\" alt=\"\">";
}
else
$ret = $this->StatusIcon();
break;
case "admin_modified":
if($this->Get("Modified")<=0)
return "-";
return LangDate($this->Get("Modified"))."
".LangTime($this->Get("Modified"));
break;
case "post_pagelist":
/*
@field:topic.post_pagelist
@description: Returns a page navigation link set for this topic, assuming the current page of the post list is page 1. If less that one page full of posts exists, nothing is returned
@attrib:_DestTemplate:tpl: Template the links should point to
@attrib:_PagesToList:int: Number of pages listed in the bar
*/
$plist = new clsPostingList();
$plist->TopicID = $this->Get('TopicId'); //$this->TopicID;
$where = 'TopicId = '.$this->Get('TopicId');
$plist->QueryItemCount = $this->GetPosts();
$plist->Page = 0;
$t = $element->attributes['_desttemplate'];
$PagesToList = $element->attributes['_pagestolist'];
if (!is_numeric($PagesToList)) $PagesToList = 10;
if ($plist->QueryItemCount > $objConfig->Get('Perpage_Postings'))
{
$ret = $plist->GetPageLinkList($t,'',$PagesToList, $extra_attribs);
}
else
{
$ret = '';
}
break;
case "postedby":
/*
@field:topic.postedby
@description:Returns the login name of the last poster in this topic
*/
$ret = $this->Get("PostedBy");
if ($ret == '') {
$ret = admin_language("lu_Guest");
}
break;
case "admin_cell_back":
$ret = int_table_color_ret();
break;
/*
@field:topic.rating
@description:Displays the topic rating
@attrib:_displaymode:: How the rating should be displayed