173 lines
6.4 KiB
PHP

<?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/
Agence Agerix
/-------------------------------------------------------------------------------------------------------/
@version 1.x.x
@build 2nd June, 2022
@created 12th December, 2020
@package Extension Distributor
@subpackage default_body.php
@author Emmanuel Danan <https://agerix.fr>
@copyright Copyright (C) 2021. All Rights Reserved.
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$edit = "index.php?option=com_extensiondistributor&view=extensions&task=extension.edit";
?>
<?php foreach ($this->items as $i => $item): ?>
<?php
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;
$userChkOut = JFactory::getUser($item->checked_out);
$canDo = ExtensiondistributorHelper::getActions('extension',$item,'extensions');
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="order nowrap center hidden-phone">
<?php if ($canDo->get('core.edit.state')): ?>
<?php
$iconClass = '';
if (!$this->saveOrder)
{
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
}
?>
<span class="sortable-handler<?php echo $iconClass; ?>">
<i class="icon-menu"></i>
</span>
<?php if ($this->saveOrder) : ?>
<input type="text" style="display:none" name="order[]" size="5"
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order " />
<?php endif; ?>
<?php else: ?>
&#8942;
<?php endif; ?>
</td>
<td class="nowrap center">
<?php if ($canDo->get('core.edit')): ?>
<?php if ($item->checked_out) : ?>
<?php if ($canCheckin) : ?>
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
<?php else: ?>
&#9633;
<?php endif; ?>
<?php else: ?>
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
<?php endif; ?>
<?php else: ?>
&#9633;
<?php endif; ?>
</td>
<td class="nowrap">
<div class="name">
<?php if ($canDo->get('core.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->name); ?></a>
<?php if ($item->checked_out): ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'extensions.', $canCheckin); ?>
<?php endif; ?>
<?php else: ?>
<?php echo $this->escape($item->name); ?>
<?php endif; ?>
</div>
</td>
<td class="hidden-phone">
<div>
<?php echo JText::_($item->type); ?>
<?php if ($item->group) : ?>&nbsp;&nbsp;<small>[
<?php echo $this->escape($item->group); ?> ]</small><?php endif; ?>
<?php if ($item->client) : ?>&nbsp;&nbsp;<small>[
<?php echo JText::_($item->client); ?> ]</small><?php endif; ?>
</div>
</td>
<td class="hidden-phone">
<div>
<?php
$releases = ExtensiondistributorHelper::getReleases($item->id);
$latest = null;
if (ExtensiondistributorHelper::checkArray($releases)) {
$latest = $releases[0];
unset($releases[0]);
}
$lists = ExtensiondistributorHelper::getApplicationLists();
$stability = $lists['stability'];
?>
<?php if ($latest) : ?>
<?php echo $this->escape($item->version_number); ?>
&nbsp;&nbsp;
<span class="label label-<?= $stability[$latest->stability]['color'] ?>"><?= $stability[$latest->stability]['label'] ?></span>
<?php else : ?>
<span class="label label-important">N/A</span>
<?php endif; ?>
</div>
</td>
<td class="hidden-phone">
<div>
<?php if ($item->release_date !== '0000-00-00 00:00:00') : ?>
<?= JHtml::date($item->release_date,'DATE_FORMAT_LC3'); ?>
<?php else : ?>
<span class="label label-important">N/A</span>
<?php endif; ?>
</div>
</td>
<td class="hidden-phone">
<div>
<?php if ($latest && $latest->file != '-1') : ?>
<span class="btn-group">
<a
class="btn btn-mini hasTooltip"
title="Download the latest release (v<?= $latest->version_number ?>)"
href="index.php?option=com_extensiondistributor&task=extension.download&extension=<?= $item->id ?>&<?= JSession::getFormToken() ?>=1"
>
<span class="icon-download"></span> Download
</a>
<a class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
<span class="caret" style="margin-bottom: 0;"></span>
</a>
<ul class="dropdown-menu">
<?php if (ExtensiondistributorHelper::checkArray($releases)) : ?>
<?php foreach ($releases as $r) : ?>
<li>
<a href="index.php?option=com_extensiondistributor&task=extension.download&extension=<?= $item->id ?>&release=<?= $r->id ?>&<?= JSession::getFormToken() ?>=1">
<?= $r->version_number ?> <span class="label label-<?= $stability[$r->stability]['color'] ?>"><?= $stability[$r->stability]['label'] ?></span>
</a>
</li>
<?php endforeach; ?>
<?php else: ?>
<li><a>No previous release available</a></li>
<?php endif; ?>
</ul>
</span>
<?php else : ?>
<span class="label label-important">N/A</span>
<?php endif; ?>
</div>
</td>
<td class="center">
<?php if ($canDo->get('core.edit.state')) : ?>
<?php if ($item->checked_out) : ?>
<?php if ($canCheckin) : ?>
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'extensions.', true, 'cb'); ?>
<?php else: ?>
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'extensions.', false, 'cb'); ?>
<?php endif; ?>
<?php else: ?>
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'extensions.', true, 'cb'); ?>
<?php endif; ?>
<?php else: ?>
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'extensions.', false, 'cb'); ?>
<?php endif; ?>
</td>
<td class="nowrap center hidden-phone">
<?php echo $item->id; ?>
</td>
</tr>
<?php endforeach; ?>