";
-// }
-// else {
- $o = $objLinkList->QueryItemCount;
- }
- $o = $objLinkList->QueryItemCount; // only use when no highlighting issued
- }
- else
- {
- $o = $objLinkList->PerformItemCount($attribs);
- }
-
- if ($o == '') {
- $o = 0;
- }
- return $o;
-}
-
-
-/*
- @description: Used in conjuction with l_list_links. This function generates the page navigation
- for the list. If this tag is called before the list tag, this function will load
- the links. For that reason, the _ListType attribute is required if the pagnav
- tag preceeds the l_list_links tag in the template. Generally, it is good practice to
- duplicate all attributes set for l_list_links.
- @attrib: _PagesToList:int: Number of pages to list (default is 10)
- @attrib: _ShortList:bool: If set, uses the shortlist configuration value for links
- @attrib: _label:lang: language tag to include in the output if there are pages to list. If there are no pages listed, this text will not be included (resulting in an empty output)
- @attrib: _ListType::Determines the type of list to generate
- Possible values:
-
Category: List links from the current category (default)
-
Hot: Hot Links (Most Popular & highest rated links)
-
Pop: Most Popular links
-
New: List new links
-
Hot: List links with the most click-throughs
-
Pick: List editor's picks
-
myitems: List topics created by the current user
-
favorites: List topics marked as favorites by the current user
-
search: List search results
-
-
-*/
-function l_link_pagenav($attribs = array())
-{
- global $objLinkList, $objCatList, $objSession, $objConfig;
-
- $DestTemplate = getArrayValue($attribs,'_template');
- $PagesToList = getArrayValue($attribs,'_pagestolist');
- $image = getArrayValue($attribs,'_PageIcon');
- if(!is_numeric($PagesToList))
- $PagesToList = 10;
-
- $CatId = getArrayValue($attribs,'_catid');
- if(!is_numeric($CatId))
- $CatId = $objCatList->CurrentCategoryID();
-
- if ( ($attribs['_shortlist'] == 1) && $objConfig->Get('Perpage_Links_Short') ) {
- $objLinkList->PerPageVar = 'Perpage_Links_Short';
- }
- else {
- $objLinkList->PerPageVar = 'Perpage_Links';
- }
-
-
- $ListType = getArrayValue($attribs,'_listtype');
- if(!strlen($ListType))
- $ListType="category";
-
- if($objLinkList->ListType != $ListType) {
- LoadLinkList($attribs);
- }
-
- $o = $objLinkList->GetPageLinkList($DestTemplate, '', 10, true, '', ExtraAttributes($attribs) );
- if (strlen($image)) {
- $o_i = ' ';
- }
- else
- {
- $o_i='';
- }
- if(strlen($o) && strlen($attribs["_label"]))
- $o = $o_i.language($attribs["_label"]).' '.$o;
- return $o;
-}
-
-/*
- @description: Used in conjuction with l_list_links. This function generates a navigation link which is
- used to switch from a short list to a longer list. The page number is not changed.
- If this tag is called before the list tag, this function will load the link list.
- For that reason, the _ListType attribute is required if the pagnav
- tag preceeds the l_list_links tag in the template. Generally, it is good practice to
- duplicate all attributes set for l_list_links.
- @attrib: _root:bool: If set, the current category is set to In-Link's root category
- @attrib: _text:lang: language tag to include as text for the anchor tag
- @attrib: _ShortList:bool: If set, uses the shortlist configuration value for links
- @attrib: _plaintext:: plain text to include as text for the anchor tag. The _text attribute takes presedence
- if both are included.
- @attrib: _image:: URL to an image to include inside the anchor tag.
-*/
-function l_link_more($attribs = array())
-{
- global $objLinkList, $objConfig, $l_var_list_update, $objSession, $l_CachedList;
-
- $l_var_list_update['id'] = 0;
-
- $html_attribs = ExtraAttributes($attribs);
- $DestTemplate = $attribs["_template"];
-
- if ( ($attribs['_shortlist'] == 1) && $objConfig->Get('Perpage_Links_Short') ) {
- $objLinkList->PerPageVar = 'Perpage_Links_Short';
- }
- else {
- $objLinkList->PerPageVar = 'Perpage_Links';
- }
-
- $ListType = $attribs["_listtype"];
- if(!strlen($ListType))
- $ListType="category";
-
- if($ListType != "search")
- {
- $evar = $_GET["env"]; //m_BuildEnv().$objSession->GetVariable("Env_Link");
- $tagname = "l_list_links-".$ListType."-".(int)$attribs["_ShortList"];
- $CachedList = GetTagCache("inlink",$tagname,FALSE,$evar);
-
- if(strlen($CachedList))
- {
- $moretag = "l_link_more-".$ListType."-".(int)$attribs["_ShortList"];
- $CachedPageNav = GetTagCache("inlink",$moretag,FALSE,$evar);
- if(strlen($CachedPageNav))
- return $CachedPageNav;
- }
- }
- if($objLinkList->ListType != $ListType)
- LoadLinkList($attribs);
-
- if($objLinkList->QueryItemCount > $objConfig->Get($objLinkList->PerPageVar))
- {
- if($attribs["_root"])
- {
- $url = l_root_link($attribs);
- }
- else
- {
- $l_var_list_update["p"]=1;
- $url = m_template_link($attribs);
- unset($l_var_list_update["p"]);
- }
- $o = "";
- $text = $attribs["_text"];
- if(!strlen($text))
- {
- $text = $attribs["_plaintext"];
- if(!strlen($text))
- {
- }
- $o .= $text."";
- }
- else
- $o .= language($text);
- if(strlen($attribs["_image"]))
- {
- $o .= "";
- }
- $o .= "";
- }
- if(strlen($o) && strlen($CachedList)>0 && strlen($moretag)>0)
- SaveTagCache("inlink",$moretag,FALSE,$evar,$o);
- return $o;
-}
-
-/*
- @description: List items related to the current link
- @attrib: _ItemId:int: the link to use (If not set, the current link is used)
- @attrib: _ListItems:: List of item types to include (ie: _ListItems="Category,Topic")
- @attrib: _*Template:none: For each item type lsted in _ListItems, an item type template must be included
- (ie: _CategoryTemplate=".." _TopicTemplate="..")
- @example:
-*/
-function l_related_items($attribs)
-{
- global $objItemTypes, $objLinkList, $objCatList, $content_set;
- static $Related;
-
- global $LinkRelations;
-
- $id = getArrayValue($attribs,'_itemid');
- if(!is_numeric($id))
- {
- $c =& $objLinkList->GetCurrentItem();
- }
- else
- $c =& $objLinkList->GetItem($id);
-
- $data_sent=0;
- if(is_object($c))
- {
- $ResourceId = $c->Get("ResourceId");
- $IncludeList = explode(",",trim(strtolower($attribs["_listitems"])));
- $o = "";
-
- if(!is_object($LinkRelations))
- {
- //echo "
"; print_r($c); echo "
";
- $LinkRelations = new clsMultiTypeList();
- LoadRelatedItems($Related, $LinkRelations,$c->Get("ResourceId"));
- }
-
- if($LinkRelations->NumItems()>0)
- {
- for($inc=0;$incGetTypeByName($item_type);
- if(is_object($objType))
- {
- foreach($LinkRelations->Items as $item)
- {
- if(is_object($item))
- {
- if(strtolower($objType->Get("ItemName")) == strtolower($item_type) && $item->type==$objType->Get("ItemType"))
- {
- if(strlen($item->BasePermissionName))
- {
- $perm = $item->BasePermissionName.".VIEW";
- $haspem = $objSession->HasCatPermission($perm,$item->Get("CategoryId"));
- }
- else
- $hasperm = 1;
-
- if($hasperm)
- {
- $data_sent =1;
- $classname = $objType->Get("ClassName");
- if(strlen($classname))
- {
- $l = new $classname;
- $l->Data = $item->Data;
- $o .= $l->ParseTemplate($t);
- }
- }
- }
- }
- $item = NULL;
- }
- }
- else
- echo $item_type." not found \n";
- }
- }
- if($data_sent)
- {
- return $o;
- }
- else
- {
- $content_set=0;
- return "";
- }
- }
- else
- {
- $content_set = 0;
- return "";
- }
- }
- else
- {
- $content_set = 0;
- return "";
- }
-}
-
-/*
- @description: Returns the number of items related to the current link
- @attrib: _ItemId:int: the link to use (If not set, the current link is used)
- @attrib: _ItemType:: Name of item to count (ie: _ItemType="Category")
- @example:
-*/
-function l_related_count($attribs)
-{
- global $objItemTypes, $objLinkList, $content_set;
- global $LinkRelations;
-
- $count = 0;
-
- $id = getArrayValue($attribs,'_itemid');
- if( !is_numeric($id) )
- {
- $c =& $objLinkList->GetCurrentItem();
- }
- else
- {
- $c =& $objLinkList->GetItem($id);
- }
-
- if( is_object($c) )
- {
- $ResourceId = $c->Get('ResourceId');
- if( !is_object($LinkRelations) )
- {
- $LinkRelations = new clsMultiTypeList();
- LoadRelatedItems($Related, $LinkRelations,$c->Get('ResourceId'));
- }
-
- if(strlen($attribs['_itemtype']))
- {
- $objType = $objItemTypes->GetTypeByName($item_type);
- $TargetType = is_object($objType) ? $objType->Get('ItemType') : '';
- }
-
- if( $LinkRelations->NumItems() > 0 )
- {
- for($x=0;$x<$LinkRelations->NumItems();$x++)
- {
- $a = $LinkRelations->GetItemByIndex($x);
- if($a->type == $TargetType || !strlen($TargetType)) $count++;
- }
- }
- }
- return $count;
-}
-
-/*
- @description: Returns a list of reviews for a link
- @attrib: _LinkId:int: the link to use (If not set, the current link is used)
- @attrib: _maxcount:int: Maximum number of reviews to list (defaults to all)
- @attrib: _ShortList:bool: If set, uses the shortlist configuration value for link reviews
- @attrib: _ReviewTemplate:tpl: template used to display the reviews
-*/
-function l_list_reviews($attribs = array())
-{
- global $objLinkList,$content_set, $l_var_list;
-
- $max = (int)$attribs["_maxcount"];
- $LinkId = (int)$attribs["_linkid"];
- if($LinkId)
- {
- $link =& $objLinkList->GetItem($LinkId);
- }
- else
- $link =& $objLinkList->GetCurrentItem();
-
- if(is_object($link))
- {
- if($link->ReviewsLoaded()==0)
- {
- if($attribs["_shortlist"])
- {
- $link->ReviewPerPageVar = "Perpage_LinkReviews_Short";
- }
- else
- {
- $link->ReviewPerPageVar = "Perpage_LinkReviews";
- }
- $ReviewList =& $link->GetItemReviews($l_var_list["rp"]);
- }
- else
- $ReviewList =& $link->Reviews;
-
- $o = "";
- $t = $attribs["_reviewtemplate"];
- if($ReviewList->NumItems()>0 && strlen($t))
- {
- foreach($ReviewList->Items as $r)
- {
- if($i >= $max && $max>0)
- break;
-
- $o .= $r->ParseTemplate($t);
- $i++;
- }
- }
- }
- if(!strlen($o))
- $content_set =0;
- return $o;
-}
-
-/*
- @description: Used in conjuction with l_list_reviews. This function generates a navigation link which is
- used to switch from a short list to a longer list. The page number is not changed.
- If this tag is called before the list tag, this function will load the review list.
- Any extra HTML attributes are passed to the anchor tag used to create the link.
- @attrib: _LinkId:int: If set, the this value is used for a link ID (default to the current link)
- @attrib: _root:bool: If set, the current category is set to In-Link's root category
- @attrib: _text:lang: language tag to include as text for the anchor tag
- @attrib: _Template:tpl: Destination template of More link
- @attrib: _plaintext:: plain text to include as text for the anchor tag. The _text attribute takes presedence
- if both are included.
- @attrib: _ShortList:bool: If set, uses the shortlist configuration value for link reviews
- @attrib: _image:: URL to an image to include inside the anchor tag.
-*/
-function l_review_more($attribs)
-{
- global $objLinkList, $objConfig, $l_var_list_update, $l_var_list;
-
- $html_attribs = ExtraAttributes($attribs);
- $DestTemplate = $attribs["_template"];
-
- $LinkId = (int)$attribs["_linkid"];
- if($LinkId)
- {
- $link =& $objLinkList->GetItem($LinkId);
- }
- else
- $link =& $objLinkList->GetCurrentItem();
-
- if(is_object($link))
- {
- if($link->ReviewsLoaded()==0)
- {
- if($attribs["_shortlist"])
- {
- $link->ReviewPerPageVar = "Perpage_LinkReviews_Short";
- }
- else
- {
- $link->ReviewPerPageVar = "Perpage_LinkReviews";
- }
- $ReviewList =& $link->GetItemReviews($l_var_list["rp"]);
- }
- else
- $ReviewList =& $link->Reviews;
-
- if($ReviewList->ItemCount() < $ReviewList->QueryItemCount)
- {
- if($attribs["_root"])
- {
- $url = l_root_link($attribs);
- }
- else
- {
- $l_var_list_update['id'] = $l_var_list['id'];
- $url = m_template_link($attribs);
- }
- $o = "";
- $text = $attribs["_text"];
- if(!strlen($text))
- {
- $text = $attribs["_plaintext"];
- if(!strlen($text))
- {
- }
- $o .= $text."";
- }
- else
- $o .= language($text);
- if(strlen($attribs["_image"]))
- {
- $o .= "";
- }
- $o .= "";
- }
- }
- return $o;
-}
-
-/*
- @description: Used in conjuction with l_list_reviews. This function generates the page navigation
- for the list of reviews. If this tag is called before the list tag, this function will load
- the reviews. For that reason, the _ListType attribute is required if the pagnav
- tag preceeds the l_list_reviews tag in the template. Generally, it is good practice to
- duplicate all attributes set for l_list_reviews.
- @attrib: _PagesToList:int: Number of pages to list (default is 10)
- @attrib: _Template:tpl: destination template for page links (defaults to current template)
- @attrib: _ShortList:bool: If set, uses the shortlist configuration value for link reviews
- @attrib: _LinkId:int: If set, the this value is used for a link ID (default to the current link)
- @attrib: _label:lang: language tag to include in the output if there are pages to list. If there are no pages
- listed, this text will not be included (resulting in an empty output)
-*/
-function l_review_pagenav($attribs)
-{
- global $l_var_list, $l_var_list_update, $objLinkList;
-
- $DestTemplate = $attribs["_template"];
- $PagesToList = $attribs["_pagestolist"];
- if(!is_numeric($PagesToList))
- $PagesToList = 10;
- $LinkId = (int)$attribs["_linkid"];
- if($LinkId)
- {
- $link =& $objLinkList->GetItem($LinkId);
- }
- else
- $link =& $objLinkList->GetCurrentItem();
-
- if(is_object($link))
- {
- if($link->ReviewsLoaded()==0)
- {
- if($attribs["_shortlist"])
- {
- $link->ReviewPerPageVar = "Perpage_LinkReviews_Short";
- }
- else
- {
- $link->ReviewPerPageVar = "Perpage_LinkReviews";
- }
- $ReviewList =& $link->GetItemReviews($l_var_list["rp"]);
- }
- else
- $ReviewList =& $link->Reviews;
- $o = $ReviewList->GetPageLinkList($l_var_list_update,$DestTemplate);
- }
- if(strlen($o) && strlen($attribs["_label"]))
- $o = language($attribs["_label"]).$o;
- return $o;
-}
-
-/*
- @description: Parse a link item template
- @attrib: _ItemTemplate:tpl: Link template to parse
- @attrib: _LinkId:int: Link ID to parse (uses current link if not set)
-*/
-function l_link_detail($attribs = array())
-{
- global $objLinkList;
-
- $t = $attribs["_itemtemplate"];
- if(strlen($t))
- {
- $LinkId = (int)$attribs["_linkid"];
- if($LinkId)
- {
- $link = $objLinkList->GetItem($LinkId);
- }
- else
- $link = $objLinkList->GetCurrentItem();
- if(is_object($link))
- {
- $o = $link->ParseTemplate($t);
- }
- }
- return $o;
-}
-
- /*
- @description: Parse a link field and return the value
- @attrib: _Field:: Link field to parse
- @attrib: _LinkId:int: Link ID to parse (uses current link if not set)
- */
- function l_link_field($attribs = array())
- {
- global $objLinkList;
-
- $o = "";
- $field = $attribs["_field"];
- $LinkId = isset($attribs['_linkid']) ? (int)$attribs['_linkid'] : false;
- if($LinkId)
- {
- $link = $objLinkList->GetItem($LinkId);
- }
- else
- {
- $link = $objLinkList->GetCurrentItem();
- }
-
- if(strlen($field))
- {
- if(is_object($link))
- {
- $element = new clsHtmlTag();
- $element->name = $link->TagPrefix;
- $element->attributes = $attribs;
- $o = $link->ParseObject($element);
- }
- else
- $o = "";
- }
-
- if (substr($o, 0, 9) == "Undefined") {
- $attrib = Array();
- $attrib['_template'] = "error_template";
- $attrib['_unsecure'] = 1;
- $location = m_template_link($attrib);
- Header("Location: $location");
- }
-
- return $o;
- }
-
- function l_multiple_submit($params=Array())
- {
- global $objCatList,$objConfig,$objModules;
- $ret='';
- $root_cat_name=language($objConfig->Get('Root_Name'));
- $selected_tpl='