mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-12-27 02:12:50 +00:00
Layout Weblinks Category - first attempt
This commit is contained in:
parent
5dc2bfb818
commit
43145030c7
@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<metadata>
|
<metadata>
|
||||||
<layout title="com_weblinks_category_view_default_title" option="com_weblinks_category_view_default_option">
|
<layout title="COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_TITLE" option="com_weblinks_category_view_default_option">
|
||||||
<help
|
<help
|
||||||
key="JHELP_MENUS_MENU_ITEM_WEBLINK_CATEGORY"
|
key="JHELP_MENUS_MENU_ITEM_WEBLINK_CATEGORY"
|
||||||
/>
|
/>
|
||||||
<message>
|
<message>
|
||||||
<![CDATA[com_weblinks_category_view_default_desc]]>
|
<![CDATA[COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_DESC]]>
|
||||||
</message>
|
</message>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
||||||
|
@ -13,9 +13,10 @@ use Joomla\CMS\Factory;
|
|||||||
use Joomla\CMS\HTML\HTMLHelper;
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
use Joomla\CMS\Language\Text;
|
use Joomla\CMS\Language\Text;
|
||||||
use Joomla\CMS\Layout\FileLayout;
|
use Joomla\CMS\Layout\FileLayout;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
use Joomla\CMS\Uri\Uri;
|
use Joomla\CMS\Uri\Uri;
|
||||||
|
|
||||||
// HTMLHelper::_('behavior.framework');
|
HTMLHelper::_('behavior.core');
|
||||||
|
|
||||||
// Create a shortcut for params.
|
// Create a shortcut for params.
|
||||||
$params = &$this->category->params;
|
$params = &$this->category->params;
|
||||||
@ -36,140 +37,166 @@ $listDirn = $this->escape($this->state->get('list.direction'));
|
|||||||
<?php if (empty($this->items)) : ?>
|
<?php if (empty($this->items)) : ?>
|
||||||
<p> <?php echo Text::_('COM_WEBLINKS_NO_WEBLINKS'); ?></p>
|
<p> <?php echo Text::_('COM_WEBLINKS_NO_WEBLINKS'); ?></p>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
|
<div class="com-weblinks-category__items">
|
||||||
|
<form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
|
||||||
|
<?php if ($this->params->get('filter_field')) : ?>
|
||||||
|
<div class="com-weblinks-category__filter btn-group">
|
||||||
|
<label class="filter-search-lbl visually-hidden" for="filter-search">
|
||||||
|
<?php echo Text::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="filter-search"
|
||||||
|
id="filter-search"
|
||||||
|
value="<?php echo $this->escape($this->state->get('list.filter')); ?>"
|
||||||
|
class="inputbox" onchange="document.adminForm.submit();"
|
||||||
|
placeholder="<?php echo Text::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>"
|
||||||
|
>
|
||||||
|
<button type="submit" name="filter_submit" class="btn btn-primary"><?php echo Text::_('JGLOBAL_FILTER_BUTTON'); ?></button>
|
||||||
|
<button type="reset" name="filter-clear-button" class="btn btn-secondary"><?php echo Text::_('JSEARCH_FILTER_CLEAR'); ?></button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->params->get('show_pagination_limit')) : ?>
|
||||||
|
<div class="com-weblinks-category__pagination btn-group float-end">
|
||||||
|
<label for="limit" class="visually-hidden">
|
||||||
|
<?php echo Text::_('JGLOBAL_DISPLAY_NUM'); ?>
|
||||||
|
</label>
|
||||||
|
<?php echo $this->pagination->getLimitBox(); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
|
<ul class="category list-group list-unstyled">
|
||||||
<?php if ($this->params->get('filter_field') != 'hide' || $this->params->get('show_pagination_limit')) : ?>
|
|
||||||
<fieldset class="filters btn-toolbar">
|
|
||||||
<?php if ($this->params->get('filter_field') != 'hide') : ?>
|
|
||||||
<div class="btn-group">
|
|
||||||
<label class="filter-search-lbl element-invisible" for="filter-search"><?php echo Text::_('COM_WEBLINKS_FILTER_LABEL') . ' '; ?></label>
|
|
||||||
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" title="<?php echo Text::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo Text::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" />
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($this->params->get('show_pagination_limit')) : ?>
|
<?php foreach ($this->items as $i => $item) : ?>
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<label for="limit" class="element-invisible">
|
|
||||||
<?php echo Text::_('JGLOBAL_DISPLAY_NUM'); ?>
|
|
||||||
</label>
|
|
||||||
<?php echo $this->pagination->getLimitBox(); ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</fieldset>
|
|
||||||
<?php endif; ?>
|
|
||||||
<ul class="category list-striped list-condensed">
|
|
||||||
<?php foreach ($this->items as $i => $item) : ?>
|
|
||||||
<?php if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
|
|
||||||
<?php if ($this->items[$i]->state == 0) : ?>
|
|
||||||
<li class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
|
|
||||||
<?php else : ?>
|
|
||||||
<li class="cat-list-row<?php echo $i % 2; ?>" >
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($this->params->get('show_link_hits', 1)) : ?>
|
|
||||||
<span class="list-hits badge badge-info pull-right">
|
|
||||||
<?php echo Text::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
|
|
||||||
</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($canEdit) : ?>
|
<?php // Shouldn't this be checked in the model?The pagination will be affected
|
||||||
<span class="list-edit pull-left width-50">
|
if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
|
||||||
<?php echo HTMLHelper::_('weblinkicon.edit', $item, $params); ?>
|
|
||||||
</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="list-title">
|
|
||||||
<?php if ($this->params->get('icons', 1) == 0) : ?>
|
|
||||||
<?php echo Text::_('COM_WEBLINKS_LINK'); ?>
|
|
||||||
<?php elseif ($this->params->get('icons', 1) == 1) : ?>
|
|
||||||
<?php if (!$this->params->get('link_icons')) : ?>
|
|
||||||
<?php echo HTMLHelper::_('image', 'system/weblink.png', Text::_('COM_WEBLINKS_LINK'), null, true); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php echo '<img src="' . $this->params->get('link_icons') . '" alt="' . Text::_('COM_WEBLINKS_LINK') . '" />'; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php // Compute the correct link ?>
|
|
||||||
<?php $menuclass = 'category' . $this->pageclass_sfx; ?>
|
|
||||||
<?php $link = $item->link; ?>
|
|
||||||
<?php $width = $item->params->get('width'); ?>
|
|
||||||
<?php $height = $item->params->get('height'); ?>
|
|
||||||
<?php if ($width == null || $height == null) : ?>
|
|
||||||
<?php $width = 600; ?>
|
|
||||||
<?php $height = 500; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($this->items[$i]->state == 0) : ?>
|
|
||||||
<span class="label label-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
switch ($item->params->get('target', $this->params->get('target')))
|
// Shouldn't this be only for users with admin rights?
|
||||||
{
|
if ($item->state == 0) : ?>
|
||||||
case 1:
|
<li class="system-unpublished list-group-item">
|
||||||
// Open in a new window
|
<?php else : ?>
|
||||||
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
|
<li class="list-group-item" >
|
||||||
$this->escape($item->title) . '</a>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
// Open in a popup window
|
|
||||||
$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' . $this->escape($width) . ',height=' . $this->escape($height) . '';
|
|
||||||
echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\">" .
|
|
||||||
$this->escape($item->title) . '</a>';
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
// Open in a modal window
|
|
||||||
HTMLHelper::_('behavior.modal', 'a.modal');
|
|
||||||
echo '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x:' . $this->escape($width) . ', y:' . $this->escape($height) . '}}">' .
|
|
||||||
$this->escape($item->title) . ' </a>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// Open in parent window
|
|
||||||
echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' .
|
|
||||||
$this->escape($item->title) . ' </a>';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<?php $tagsData = $item->tags->getItemTags('com_weblinks.weblink', $item->id); ?>
|
|
||||||
<?php if ($this->params->get('show_tags', 1)) : ?>
|
|
||||||
<?php $this->category->tagLayout = new FileLayout('joomla.content.tags'); ?>
|
|
||||||
<?php echo $this->category->tagLayout->render($tagsData); ?>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if (($this->params->get('show_link_description')) and ($item->description != '')) : ?>
|
|
||||||
<?php $images = json_decode($item->images); ?>
|
<?php if ($this->params->get('show_link_hits', 1)) : ?>
|
||||||
<?php if (isset($images->image_first) and !empty($images->image_first)) : ?>
|
<span class="list-hits badge badge-info float-end">
|
||||||
<?php $imgfloat = (empty($images->float_first)) ? $this->params->get('float_first') : $images->float_first; ?>
|
<?php echo Text::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
|
||||||
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image"> <img
|
</span>
|
||||||
<?php if ($images->image_first_caption) : ?>
|
<?php endif; ?>
|
||||||
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_first_caption) . '"'; ?>
|
|
||||||
|
<?php if ($canEdit) : ?>
|
||||||
|
<?php echo LayoutHelper::render('joomla.content.icons', array('params' => $params, 'item' => $item)); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="list-title">
|
||||||
|
<?php if (!$this->params->get('icons', 1)) : ?>
|
||||||
|
<?php echo Text::_('COM_WEBLINKS_LINK'); ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<?php // ToDo css icons as variables ?>
|
||||||
|
<?php if (!$this->params->get('link_icons')) : ?>
|
||||||
|
<span class="icon-globe" aria-hidden="true"></span>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo '<img src="' . $this->params->get('link_icons') . '" alt="' . Text::_('COM_WEBLINKS_LINK') . '" />'; ?>
|
||||||
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
src="<?php echo htmlspecialchars($images->image_first); ?>" alt="<?php echo htmlspecialchars($images->image_first_alt); ?>"/> </div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if (isset($images->image_second) and !empty($images->image_second)) : ?>
|
|
||||||
<?php $imgfloat = (empty($images->float_second)) ? $this->params->get('float_second') : $images->float_second; ?>
|
|
||||||
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image"> <img
|
|
||||||
<?php if ($images->image_second_caption) : ?>
|
|
||||||
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_second_caption) . '"'; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
src="<?php echo htmlspecialchars($images->image_second); ?>" alt="<?php echo htmlspecialchars($images->image_second_alt); ?>"/> </div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php echo $item->description; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</li>
|
|
||||||
<?php endif;?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<?php // Code to add a link to submit a weblink. ?>
|
<?php // Compute the correct link ?>
|
||||||
<?php if ($this->params->get('show_pagination')) : ?>
|
<?php $menuclass = 'category' . $this->pageclass_sfx; ?>
|
||||||
<div class="pagination">
|
<?php $link = $item->link; ?>
|
||||||
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
|
<?php $width = $item->params->get('width'); ?>
|
||||||
<p class="counter">
|
<?php $height = $item->params->get('height'); ?>
|
||||||
<?php echo $this->pagination->getPagesCounter(); ?>
|
<?php if ($width == null || $height == null) : ?>
|
||||||
</p>
|
<?php $width = 600; ?>
|
||||||
|
<?php $height = 500; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($item->state == 0) : ?>
|
||||||
|
<span class="label label-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
switch ($item->params->get('target', $this->params->get('target')))
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
// Open in a new window
|
||||||
|
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
|
||||||
|
$this->escape($item->title) . '</a>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
// Open in a popup window
|
||||||
|
$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' . $this->escape($width) . ',height=' . $this->escape($height) . '';
|
||||||
|
echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\">" .
|
||||||
|
$this->escape($item->title) . '</a>';
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// Open in a modal window
|
||||||
|
HTMLHelper::_('behavior.modal', 'a.modal');
|
||||||
|
echo '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x:' . $this->escape($width) . ', y:' . $this->escape($height) . '}}">' .
|
||||||
|
$this->escape($item->title) . ' </a>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Open in parent window
|
||||||
|
echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' .
|
||||||
|
$this->escape($item->title) . ' </a>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($this->params->get('show_tags', 1)) : ?>
|
||||||
|
<?php $tagsData = $item->tags->getItemTags('com_weblinks.weblink', $item->id); ?>
|
||||||
|
<?php $this->category->tagLayout = new FileLayout('joomla.content.tags'); ?>
|
||||||
|
<?php echo $this->category->tagLayout->render($tagsData); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (($this->params->get('show_link_description')) && ($item->description != '')) : ?>
|
||||||
|
<?php $images = json_decode($item->images); ?>
|
||||||
|
<?php if (isset($images->image_first) and !empty($images->image_first)) : ?>
|
||||||
|
<?php $imgfloat = (empty($images->float_first)) ? $this->params->get('float_first') : $images->float_first; ?>
|
||||||
|
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image">
|
||||||
|
<img
|
||||||
|
<?php if ($images->image_first_caption) : ?>
|
||||||
|
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_first_caption) . '"'; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
src="<?php echo htmlspecialchars($images->image_first); ?>"
|
||||||
|
alt="<?php echo htmlspecialchars($images->image_first_alt); ?>"/>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (isset($images->image_second) and !empty($images->image_second)) : ?>
|
||||||
|
<?php $imgfloat = (empty($images->float_second)) ? $this->params->get('float_second') : $images->float_second; ?>
|
||||||
|
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image">
|
||||||
|
<img
|
||||||
|
<?php if ($images->image_second_caption) : ?>
|
||||||
|
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_second_caption) . '"'; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
src="<?php echo htmlspecialchars($images->image_second); ?>"
|
||||||
|
alt="<?php echo htmlspecialchars($images->image_second_alt); ?>"/> </div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php echo $item->description; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<?php // Code to add a link to submit a weblink. ?>
|
||||||
|
<?php if ($this->params->get('show_pagination')) : ?>
|
||||||
|
<div class="pagination">
|
||||||
|
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
|
||||||
|
<p class="counter">
|
||||||
|
<?php echo $this->pagination->getPagesCounter(); ?>
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php echo $this->pagination->getPagesLinks(); ?>
|
||||||
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php echo $this->pagination->getPagesLinks(); ?>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user