mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-01-27 22:38:28 +00:00
Group by subcategories on mod_weblinks (#38)
* Group by subcategories on mod_weblinks * BUGFIX: added missing 1-column option. * GroupBySubcategories turned Off by default. * Improved readability of inline php statements.
This commit is contained in:
parent
7faa44cdb8
commit
cff91ba244
@ -121,9 +121,20 @@ class WeblinksModelCategory extends JModelList
|
|||||||
// Filter by category.
|
// Filter by category.
|
||||||
if ($categoryId = $this->getState('category.id'))
|
if ($categoryId = $this->getState('category.id'))
|
||||||
{
|
{
|
||||||
$query->where('a.catid = ' . (int) $categoryId)
|
// Group by subcategory
|
||||||
->join('LEFT', '#__categories AS c ON c.id = a.catid')
|
if($this->getState('category.group', 0))
|
||||||
->where('c.access IN (' . $groups . ')');
|
{
|
||||||
|
$query->select('c.title AS category_title')
|
||||||
|
->where('c.parent_id = ' . (int) $categoryId)
|
||||||
|
->join('LEFT', '#__categories AS c ON c.id = a.catid')
|
||||||
|
->where('c.access IN (' . $groups . ')');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query->where('a.catid = ' . (int) $categoryId)
|
||||||
|
->join('LEFT', '#__categories AS c ON c.id = a.catid')
|
||||||
|
->where('c.access IN (' . $groups . ')');
|
||||||
|
}
|
||||||
|
|
||||||
// Filter by published category
|
// Filter by published category
|
||||||
$cpublished = $this->getState('filter.c.published');
|
$cpublished = $this->getState('filter.c.published');
|
||||||
@ -176,6 +187,16 @@ class WeblinksModelCategory extends JModelList
|
|||||||
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
||||||
$query->where('(a.title LIKE ' . $search . ')');
|
$query->where('(a.title LIKE ' . $search . ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If grouping by subcategory, add the subcategory list ordering clause.
|
||||||
|
if($this->getState('category.group', 0))
|
||||||
|
{
|
||||||
|
$query->order(
|
||||||
|
$db->escape(
|
||||||
|
$this->getState('category.ordering', 'c.lft')) . ' ' . $db->escape($this->getState('category.direction', 'ASC')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Add the list ordering clause.
|
// Add the list ordering clause.
|
||||||
$query->order(
|
$query->order(
|
||||||
|
@ -5,6 +5,16 @@
|
|||||||
|
|
||||||
MOD_WEBLINKS="Web Links"
|
MOD_WEBLINKS="Web Links"
|
||||||
MOD_WEBLINKS_FIELD_CATEGORY_DESC="Choose the Web Links category to display."
|
MOD_WEBLINKS_FIELD_CATEGORY_DESC="Choose the Web Links category to display."
|
||||||
|
MOD_WEBLINKS_FIELD_GROUPBY_DESC="If set to yes, weblinks will be grouped by subcategories."
|
||||||
|
MOD_WEBLINKS_FIELD_GROUPBY_LABEL="Group By Subcategories"
|
||||||
|
MOD_WEBLINKS_FIELD_GROUPBYSHOWTITLE_DESC="If set to yes, will show groups titles (valid only if grouping)."
|
||||||
|
MOD_WEBLINKS_FIELD_GROUPBYSHOWTITLE_LABEL="Show Group Title"
|
||||||
|
MOD_WEBLINKS_FIELD_GROUPBYORDERING_DESC="Ordering for the subcategories (valid only if grouping)."
|
||||||
|
MOD_WEBLINKS_FIELD_GROUPBYORDERING_LABEL="Group Ordering"
|
||||||
|
MOD_WEBLINKS_FIELD_GROUPBYDIRECTION_DESC="Direction for the subcategories (valid only if grouping)."
|
||||||
|
MOD_WEBLINKS_FIELD_GROUPBYDIRECTION_LABEL="Group Ordering Direction"
|
||||||
|
MOD_WEBLINKS_FIELD_COLUMNS_DESC="When grouping by subcategories, split into # columns."
|
||||||
|
MOD_WEBLINKS_FIELD_COLUMNS_LABEL="Columns"
|
||||||
MOD_WEBLINKS_FIELD_COUNT_DESC="Number of Web Links to display."
|
MOD_WEBLINKS_FIELD_COUNT_DESC="Number of Web Links to display."
|
||||||
MOD_WEBLINKS_FIELD_COUNT_LABEL="Count"
|
MOD_WEBLINKS_FIELD_COUNT_LABEL="Count"
|
||||||
MOD_WEBLINKS_FIELD_COUNTCLICKS_DESC="If set to yes, the number of times the link has been clicked will be recorded."
|
MOD_WEBLINKS_FIELD_COUNTCLICKS_DESC="If set to yes, the number of times the link has been clicked will be recorded."
|
||||||
|
@ -57,6 +57,9 @@ class ModWeblinksHelper
|
|||||||
|
|
||||||
$catid = (int) $params->get('catid', 0);
|
$catid = (int) $params->get('catid', 0);
|
||||||
$model->setState('category.id', $catid);
|
$model->setState('category.id', $catid);
|
||||||
|
$model->setState('category.group', $params->get('groupby', 0));
|
||||||
|
$model->setState('category.ordering', $params->get('groupby_ordering', 'c.lft'));
|
||||||
|
$model->setState('category.direction', $params->get('groupby_direction', 'ASC'));
|
||||||
|
|
||||||
// Create query object
|
// Create query object
|
||||||
$db = JFactory::getDbo();
|
$db = JFactory::getDbo();
|
||||||
|
@ -20,141 +20,204 @@
|
|||||||
<fields name="params">
|
<fields name="params">
|
||||||
<fieldset name="basic">
|
<fieldset name="basic">
|
||||||
<field
|
<field
|
||||||
name="catid"
|
name="catid"
|
||||||
type="category"
|
type="category"
|
||||||
extension="com_weblinks"
|
extension="com_weblinks"
|
||||||
required="true"
|
required="true"
|
||||||
label="JCATEGORY"
|
label="JCATEGORY"
|
||||||
description="MOD_WEBLINKS_FIELD_CATEGORY_DESC" />
|
description="MOD_WEBLINKS_FIELD_CATEGORY_DESC" />
|
||||||
<field
|
<field
|
||||||
name="count"
|
name="groupby"
|
||||||
type="text"
|
type="radio"
|
||||||
default="5"
|
class="btn-group btn-group-yesno"
|
||||||
label="MOD_WEBLINKS_FIELD_COUNT_LABEL"
|
default="0"
|
||||||
description="MOD_WEBLINKS_FIELD_COUNT_DESC" />
|
label="MOD_WEBLINKS_FIELD_GROUPBY_LABEL"
|
||||||
<field
|
description="MOD_WEBLINKS_FIELD_GROUPBY_DESC">
|
||||||
name="ordering"
|
|
||||||
type="list"
|
|
||||||
default="title"
|
|
||||||
label="MOD_WEBLINKS_FIELD_ORDERING_LABEL"
|
|
||||||
description="MOD_WEBLINKS_FIELD_ORDERING_DESC">
|
|
||||||
<option
|
<option
|
||||||
value="title">JGLOBAL_TITLE</option>
|
value="1">JYES</option>
|
||||||
<option
|
<option
|
||||||
value="order">MOD_WEBLINKS_FIELD_VALUE_ORDER</option>
|
value="0">JNO</option>
|
||||||
<option
|
|
||||||
value="hits">MOD_WEBLINKS_FIELD_VALUE_HITS</option>
|
|
||||||
</field>
|
</field>
|
||||||
<field
|
<field
|
||||||
name="direction"
|
name="groupby_showtitle"
|
||||||
type="list"
|
type="radio"
|
||||||
default="asc"
|
class="btn-group btn-group-yesno"
|
||||||
label="MOD_WEBLINKS_FIELD_ORDERDIRECTION_LABEL"
|
default="1"
|
||||||
description="MOD_WEBLINKS_FIELD_ORDERDIRECTION_DESC">
|
label="MOD_WEBLINKS_FIELD_GROUPBYSHOWTITLE_LABEL"
|
||||||
|
description="MOD_WEBLINKS_FIELD_GROUPBYSHOWTITLE_DESC">
|
||||||
<option
|
<option
|
||||||
value="asc">MOD_WEBLINKS_FIELD_VALUE_ASCENDING</option>
|
value="1">JYES</option>
|
||||||
<option
|
<option
|
||||||
value="desc">MOD_WEBLINKS_FIELD_VALUE_DESCENDING</option>
|
value="0">JNO</option>
|
||||||
</field>
|
</field>
|
||||||
<field
|
<field
|
||||||
name="target"
|
name="groupby_ordering"
|
||||||
type="list"
|
type="list"
|
||||||
default="3"
|
default="c.lft"
|
||||||
label="MOD_WEBLINKS_FIELD_TARGET_LABEL"
|
label="MOD_WEBLINKS_FIELD_GROUPBYORDERING_LABEL"
|
||||||
description="MOD_WEBLINKS_FIELD_TARGET_DESC">
|
description="MOD_WEBLINKS_FIELD_GROUPBYORDERING_DESC">
|
||||||
<option
|
<option
|
||||||
value="1">JBROWSERTARGET_NEW</option>
|
value="c.title">JGLOBAL_TITLE</option>
|
||||||
<option
|
<option
|
||||||
value="2">JBROWSERTARGET_POPUP</option>
|
value="c.lft">MOD_WEBLINKS_FIELD_VALUE_ORDER</option>
|
||||||
<option
|
|
||||||
value="3">JBROWSERTARGET_PARENT</option>
|
|
||||||
</field>
|
</field>
|
||||||
<field
|
<field
|
||||||
name="follow"
|
name="groupby_direction"
|
||||||
type="list"
|
type="list"
|
||||||
default="0"
|
default="asc"
|
||||||
label="MOD_WEBLINKS_FIELD_FOLLOW_LABEL"
|
label="MOD_WEBLINKS_FIELD_GROUPBYDIRECTION_LABEL"
|
||||||
description="MOD_WEBLINKS_FIELD_FOLLOW_DESC">
|
description="MOD_WEBLINKS_FIELD_GROUPBYDIRECTION_DESC">
|
||||||
<option
|
<option
|
||||||
value="follow">MOD_WEBLINKS_FIELD_VALUE_FOLLOW</option>
|
value="asc">MOD_WEBLINKS_FIELD_VALUE_ASCENDING</option>
|
||||||
<option
|
<option
|
||||||
value="nofollow">MOD_WEBLINKS_FIELD_VALUE_NOFOLLOW</option>
|
value="desc">MOD_WEBLINKS_FIELD_VALUE_DESCENDING</option>
|
||||||
</field>
|
</field>
|
||||||
<field
|
<field
|
||||||
name="description"
|
name="groupby_columns"
|
||||||
type="radio"
|
type="list"
|
||||||
class="btn-group btn-group-yesno"
|
default="3"
|
||||||
default="0"
|
label="MOD_WEBLINKS_FIELD_COLUMNS_LABEL"
|
||||||
label="MOD_WEBLINKS_FIELD_DESCRIPTION_LABEL"
|
description="MOD_WEBLINKS_FIELD_COLUMNS_DESC">
|
||||||
description="MOD_WEBLINKS_FIELD_DESCRIPTION_DESC">
|
|
||||||
<option
|
<option
|
||||||
value="1">JSHOW</option>
|
value="1">1</option>
|
||||||
|
<option
|
||||||
|
value="2">2</option>
|
||||||
<option
|
<option
|
||||||
value="0">JHIDE</option>
|
value="3">3</option>
|
||||||
|
<option
|
||||||
|
value="4">4</option>
|
||||||
|
<option
|
||||||
|
value="6">6</option>
|
||||||
</field>
|
</field>
|
||||||
<field
|
<field
|
||||||
name="hits"
|
name="count"
|
||||||
type="radio"
|
type="text"
|
||||||
class="btn-group btn-group-yesno"
|
default="5"
|
||||||
default="0"
|
label="MOD_WEBLINKS_FIELD_COUNT_LABEL"
|
||||||
label="MOD_WEBLINKS_FIELD_HITS_LABEL"
|
description="MOD_WEBLINKS_FIELD_COUNT_DESC" />
|
||||||
description="MOD_WEBLINKS_FIELD_HITS_DESC">
|
<field
|
||||||
|
name="ordering"
|
||||||
|
type="list"
|
||||||
|
default="title"
|
||||||
|
label="MOD_WEBLINKS_FIELD_ORDERING_LABEL"
|
||||||
|
description="MOD_WEBLINKS_FIELD_ORDERING_DESC">
|
||||||
<option
|
<option
|
||||||
value="1">JSHOW</option>
|
value="title">JGLOBAL_TITLE</option>
|
||||||
<option
|
<option
|
||||||
value="0">JHIDE</option>
|
value="order">MOD_WEBLINKS_FIELD_VALUE_ORDER</option>
|
||||||
|
<option
|
||||||
|
value="hits">MOD_WEBLINKS_FIELD_VALUE_HITS</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="direction"
|
||||||
|
type="list"
|
||||||
|
default="asc"
|
||||||
|
label="MOD_WEBLINKS_FIELD_ORDERDIRECTION_LABEL"
|
||||||
|
description="MOD_WEBLINKS_FIELD_ORDERDIRECTION_DESC">
|
||||||
|
<option
|
||||||
|
value="asc">MOD_WEBLINKS_FIELD_VALUE_ASCENDING</option>
|
||||||
|
<option
|
||||||
|
value="desc">MOD_WEBLINKS_FIELD_VALUE_DESCENDING</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="target"
|
||||||
|
type="list"
|
||||||
|
default="3"
|
||||||
|
label="MOD_WEBLINKS_FIELD_TARGET_LABEL"
|
||||||
|
description="MOD_WEBLINKS_FIELD_TARGET_DESC">
|
||||||
|
<option
|
||||||
|
value="1">JBROWSERTARGET_NEW</option>
|
||||||
|
<option
|
||||||
|
value="2">JBROWSERTARGET_POPUP</option>
|
||||||
|
<option
|
||||||
|
value="3">JBROWSERTARGET_PARENT</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="follow"
|
||||||
|
type="list"
|
||||||
|
default="0"
|
||||||
|
label="MOD_WEBLINKS_FIELD_FOLLOW_LABEL"
|
||||||
|
description="MOD_WEBLINKS_FIELD_FOLLOW_DESC">
|
||||||
|
<option
|
||||||
|
value="follow">MOD_WEBLINKS_FIELD_VALUE_FOLLOW</option>
|
||||||
|
<option
|
||||||
|
value="nofollow">MOD_WEBLINKS_FIELD_VALUE_NOFOLLOW</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="description"
|
||||||
|
type="radio"
|
||||||
|
class="btn-group btn-group-yesno"
|
||||||
|
default="0"
|
||||||
|
label="MOD_WEBLINKS_FIELD_DESCRIPTION_LABEL"
|
||||||
|
description="MOD_WEBLINKS_FIELD_DESCRIPTION_DESC">
|
||||||
|
<option
|
||||||
|
value="1">JSHOW</option>
|
||||||
|
<option
|
||||||
|
value="0">JHIDE</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="hits"
|
||||||
|
type="radio"
|
||||||
|
class="btn-group btn-group-yesno"
|
||||||
|
default="0"
|
||||||
|
label="MOD_WEBLINKS_FIELD_HITS_LABEL"
|
||||||
|
description="MOD_WEBLINKS_FIELD_HITS_DESC">
|
||||||
|
<option
|
||||||
|
value="1">JSHOW</option>
|
||||||
|
<option
|
||||||
|
value="0">JHIDE</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="count_clicks"
|
name="count_clicks"
|
||||||
type="list"
|
type="list"
|
||||||
class="chzn-color"
|
class="chzn-color"
|
||||||
default="0"
|
default="0"
|
||||||
label="MOD_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
|
label="MOD_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
|
||||||
description="MOD_WEBLINKS_FIELD_COUNTCLICKS_DESC">
|
description="MOD_WEBLINKS_FIELD_COUNTCLICKS_DESC">
|
||||||
|
<option
|
||||||
|
value="">JGLOBAL_USE_GLOBAL</option>
|
||||||
<option
|
<option
|
||||||
value="">JGLOBAL_USE_GLOBAL</option>
|
value="0">JNO</option>
|
||||||
<option
|
<option
|
||||||
value="0">JNO</option>
|
value="1">JYES</option>
|
||||||
<option
|
|
||||||
value="1">JYES</option>
|
|
||||||
</field>
|
</field>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset
|
<fieldset
|
||||||
name="advanced">
|
name="advanced">
|
||||||
<field
|
<field
|
||||||
name="layout"
|
name="layout"
|
||||||
type="modulelayout"
|
type="modulelayout"
|
||||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||||
<field
|
<field
|
||||||
name="moduleclass_sfx"
|
name="moduleclass_sfx"
|
||||||
type="textarea" rows="3"
|
type="textarea" rows="3"
|
||||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||||
<field
|
<field
|
||||||
name="cache"
|
name="cache"
|
||||||
type="list"
|
type="list"
|
||||||
default="1"
|
default="1"
|
||||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||||
<option
|
<option
|
||||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||||
<option
|
<option
|
||||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||||
</field>
|
</field>
|
||||||
<field
|
<field
|
||||||
name="cache_time"
|
name="cache_time"
|
||||||
type="text"
|
type="text"
|
||||||
default="900"
|
default="900"
|
||||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||||
<field
|
<field
|
||||||
name="cachemode"
|
name="cachemode"
|
||||||
type="hidden"
|
type="hidden"
|
||||||
default="static">
|
default="static">
|
||||||
<option
|
<option
|
||||||
value="static"></option>
|
value="static"></option>
|
||||||
</field>
|
</field>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</fields>
|
</fields>
|
||||||
|
@ -9,47 +9,120 @@
|
|||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
?>
|
?>
|
||||||
<ul class="weblinks<?php echo $moduleclass_sfx; ?>">
|
<?php
|
||||||
<?php
|
if($params->get('groupby', 0)) :
|
||||||
foreach ($list as $item) :
|
|
||||||
?>
|
|
||||||
<li>
|
|
||||||
<?php
|
|
||||||
$link = $item->link;
|
|
||||||
|
|
||||||
switch ($params->get('target', 3))
|
$cats = array();
|
||||||
{
|
$cols = $params->get('groupby_columns', 3);
|
||||||
case 1:
|
|
||||||
// Open in a new window
|
|
||||||
echo '<a href="' . $link . '" target="_blank" rel="' . $params->get('follow', 'nofollow') . '">' .
|
|
||||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
foreach ($list as $l)
|
||||||
// Open in a popup window
|
$cats[] = array('catid' => $l->catid, 'title' => $l->category_title);
|
||||||
echo "<a href=\"#\" onclick=\"window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\">" .
|
|
||||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
$cats = array_values(array_map('unserialize', array_unique(array_map('serialize', $cats))));
|
||||||
// Open in parent window
|
|
||||||
echo '<a href="' . $link . '" rel="' . $params->get('follow', 'nofollow') . '">' .
|
|
||||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($params->get('description', 0))
|
foreach ($cats as $k => $cat) :
|
||||||
{
|
|
||||||
echo nl2br($item->description);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($params->get('hits', 0))
|
$items = array();
|
||||||
{
|
|
||||||
echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')';
|
foreach ($list as $item)
|
||||||
}
|
if ($item->catid == $cat['catid'])
|
||||||
?>
|
$items[] = $item;
|
||||||
</li>
|
?>
|
||||||
<?php
|
<?php if($cols > 1) : ?>
|
||||||
endforeach;
|
<?php if($k % $cols == 0) : ?>
|
||||||
?>
|
<div class="row row-fluid">
|
||||||
</ul>
|
<?php endif; ?>
|
||||||
|
<div class="span<?php echo (12 / $cols); ?>">
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if($params->get('groupby_showtitle', 1)) : ?>
|
||||||
|
<h4><?php echo htmlspecialchars($cat['title']); ?></h4>
|
||||||
|
<?php endif; ?>
|
||||||
|
<ul class="weblinks<?php echo $moduleclass_sfx; ?>">
|
||||||
|
<?php foreach ($items as $item) : ?>
|
||||||
|
<li>
|
||||||
|
<?php
|
||||||
|
$link = $item->link;
|
||||||
|
|
||||||
|
switch ($params->get('target', 3))
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
// Open in a new window
|
||||||
|
echo '<a href="' . $link . '" target="_blank" rel="' . $params->get('follow', 'nofollow') . '">' .
|
||||||
|
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
// Open in a popup window
|
||||||
|
echo "<a href=\"#\" onclick=\"window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\">" .
|
||||||
|
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Open in parent window
|
||||||
|
echo '<a href="' . $link . '" rel="' . $params->get('follow', 'nofollow') . '">' .
|
||||||
|
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($params->get('description', 0))
|
||||||
|
{
|
||||||
|
echo nl2br($item->description);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($params->get('hits', 0))
|
||||||
|
{
|
||||||
|
echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php if($cols > 1) : ?>
|
||||||
|
</div>
|
||||||
|
<?php if(($k + 1) % $cols == 0 || $k == count($cats) - 1) : ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<ul class="weblinks<?php echo $moduleclass_sfx; ?>">
|
||||||
|
<?php foreach ($list as $item) : ?>
|
||||||
|
<li>
|
||||||
|
<?php
|
||||||
|
$link = $item->link;
|
||||||
|
|
||||||
|
switch ($params->get('target', 3))
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
// Open in a new window
|
||||||
|
echo '<a href="' . $link . '" target="_blank" rel="' . $params->get('follow', 'nofollow') . '">' .
|
||||||
|
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
// Open in a popup window
|
||||||
|
echo "<a href=\"#\" onclick=\"window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\">" .
|
||||||
|
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Open in parent window
|
||||||
|
echo '<a href="' . $link . '" rel="' . $params->get('follow', 'nofollow') . '">' .
|
||||||
|
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($params->get('description', 0))
|
||||||
|
{
|
||||||
|
echo nl2br($item->description);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($params->get('hits', 0))
|
||||||
|
{
|
||||||
|
echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user