com_extensiondistributor/admin/layouts/extension/releases_fullwidth.php

186 lines
7.3 KiB
PHP

<?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/
Agence Agerix
/-------------------------------------------------------------------------------------------------------/
@version 1.x.x
@build 2nd June, 2022
@created 12th December, 2020
@package Extension Distributor
@subpackage releases_fullwidth.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');
// set the defaults
$items = $displayData->vvwreleases;
$user = JFactory::getUser();
$id = $displayData->item->id;
// set the edit URL
$edit = "index.php?option=com_extensiondistributor&view=releases&task=release.edit";
// set a return value
$return = ($id) ? "index.php?option=com_extensiondistributor&view=extension&layout=edit&id=" . $id : "";
// check for a return value
$jinput = JFactory::getApplication()->input;
if ($_return = $jinput->get('return', null, 'base64'))
{
$return .= "&return=" . $_return;
}
// check if return value was set
if (ExtensiondistributorHelper::checkString($return))
{
// set the referral values
$ref = ($id) ? "&ref=extension&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return));
}
else
{
$ref = ($id) ? "&ref=extension&refid=" . $id : "";
}
// set the create new URL
$new = "index.php?option=com_extensiondistributor&view=releases&task=release.edit" . $ref;
// load the action object
$can = ExtensiondistributorHelper::getActions('release');
?>
<div class="form-vertical">
<?php if ($can->get('core.create')): ?>
<a class="btn btn-small btn-success" href="<?php echo $new; ?>"><span class="icon-new icon-white"></span> <?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_NEW'); ?></a><br /><br />
<?php endif; ?>
<?php if (ExtensiondistributorHelper::checkArray($items)): ?>
<table class="footable table data releases" data-show-toggle="true" data-toggle-column="first" data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true">
<thead>
<tr>
<th data-breakpoints="xs sm" data-type="html" data-sort-use="text">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_RELEASES_'); ?>
</th>
<th data-type="html" data-sort-use="text">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_RELEASE_VERSION_NUMBER_LABEL'); ?>
</th>
<th data-breakpoints="xs sm" data-type="html" data-sort-use="text">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_RELEASES_DOWNLOAD'); ?>
</th>
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_RELEASE_RELEASE_DATE_LABEL'); ?>
</th>
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_RELEASE_RELTYPE_LABEL'); ?>
</th>
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_RELEASE_DESCRIPTION_LABEL'); ?>
</th>
<th width="10" data-breakpoints="xs sm md">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_RELEASE_STATUS'); ?>
</th>
<th width="5" data-type="number" data-breakpoints="xs sm md">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_RELEASE_ID'); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($items as $i => $item): ?>
<?php
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0;
$userChkOut = JFactory::getUser($item->checked_out);
$canDo = ExtensiondistributorHelper::getActions('release',$item,'releases');
?>
<tr>
<td>
<div><?php echo JLayoutHelper::render( 'statewidget', array($item) ); ?>
</div>
</td>
<td>
<div><span class="lead">
<?php if ($canDo->get('core.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?><?php echo $ref; ?>"><?php echo $displayData->escape($item->version_number); ?></a>
<?php if ($item->checked_out): ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'releases.', $canCheckin); ?>
<?php endif; ?>
<?php else: ?>
<?php echo $displayData->escape($item->version_number); ?>
<?php endif; ?></span>
<?php
$lists = ExtensiondistributorHelper::getApplicationLists();
$level = ExtensiondistributorHelper::getVar('release',$item->id,'id','stability');
$stability = $lists['stability'];
?>
<span class="uk-margin-small-left label label-<?= $stability[$level]['color'] ?>"><?= $stability[$level]['label'] ?></span>
<!-- [11]=> Version (releases); [41]=> Stability (releases) -->
</div>
</td>
<td>
<div><?php if ($item->file == -1) : ?>
<div class="label label-important"><span class="icon-warning"></span> N/A</div>
<?php else : ?>
<?php $view = strtolower(JFactory::getApplication()->input->get('view')); ?>
<a
class="agxbtn agxbtn-mini"
href="index.php?option=com_extensiondistributor&task=extension.download&<?= $view ?>=<?= $item->$view ?>&release=<?= $item->id ?>&<?= JSession::getFormToken() ?>=1"
>
<span class="icon-download"></span> Download
</a>
<?php endif; ?>
</div>
</td>
<td>
<div><?= JHtml::date($item->release_date,'DATE_FORMAT_LC3'); ?>
</div>
</td>
<td>
<?php echo JText::_($item->reltype); ?>
</td>
<td>
<div><?= $item->description; ?>
</div>
</td>
<?php if ($item->published == 1): ?>
<td class="center" data-sort-value="1">
<span class="status-metro status-published" title="<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_PUBLISHED'); ?>">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_PUBLISHED'); ?>
</span>
</td>
<?php elseif ($item->published == 0): ?>
<td class="center" data-sort-value="2">
<span class="status-metro status-inactive" title="<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_INACTIVE'); ?>">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_INACTIVE'); ?>
</span>
</td>
<?php elseif ($item->published == 2): ?>
<td class="center" data-sort-value="3">
<span class="status-metro status-archived" title="<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_ARCHIVED'); ?>">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_ARCHIVED'); ?>
</span>
</td>
<?php elseif ($item->published == -2): ?>
<td class="center" data-sort-value="4">
<span class="status-metro status-trashed" title="<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_TRASHED'); ?>">
<?php echo JText::_('COM_EXTENSIONDISTRIBUTOR_TRASHED'); ?>
</span>
</td>
<?php endif; ?>
<td class="nowrap center hidden-phone">
<?php echo $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="alert alert-no-items">
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php endif; ?>
</div>