com_extensiondistributor/admin/layouts/statewidget.php

85 lines
4.1 KiB
PHP

<?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/
Agence Agerix
/-------------------------------------------------------------------------------------------------------/
@version 1.x.x
@build 2nd June, 2022
@created 12th December, 2020
@package Extension Distributor
@subpackage statewidget.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('JPATH_BASE') or die('Restricted access');
$release = $displayData[0];
$view = strtolower(JFactory::getApplication()->input->get('view'));
$token = '&'.JSession::getFormToken().'=1';
// set the edit URL
$edit = "index.php?option=com_extensiondistributor&view=releases&task=release.edit";
$publish = "index.php?option=com_extensiondistributor&view=releases&task=release.changestate&state=publish&id=".$release->id;
$unpublish = "index.php?option=com_extensiondistributor&view=releases&task=release.changestate&state=unpublish&id=".$release->id;
$trash = "index.php?option=com_extensiondistributor&view=releases&task=release.changestate&state=trash&id=".$release->id;
$delete = "index.php?option=com_extensiondistributor&view=releases&task=release.reldelete&id=".$release->id;
// set a return value
$return = ($view !== 'releases') ? "index.php?option=com_extensiondistributor&view=" . $view . "&layout=edit&id=" . $release->$view : "";
// check if return value was set
if (ExtensiondistributorHelper::checkString($return))
{
// set the referral values
$ref = ($release->$view) ? "&ref=" . $view . "&refid=" . $release->$view . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return));
}
else
{
$ref = ($view !== 'releases') ? "&ref=" . $view . "&refid=" . $release->$view : "";
}
$publish_states = array(
0 => array(
'tooltip' => 'Unpublished',
'icon' => 'unpublish'
),
1 => array(
'tooltip' => 'Published',
'icon' => 'publish'
),
-2 => array(
'tooltip' => 'Trashed',
'icon' => 'trash'
)
);
?>
<span class="agxbtn-group">
<a class="agxbtn agxbtn-mini" href="<?= $edit . '&id=' . $release->id . $ref ?>"><span class="icon-pencil"></span>&nbsp;Edit</a>
<a class="agxbtn agxbtn-mini"><span class="icon-<?= $publish_states[$release->published]['icon'] ?>"></span></a>
<a class="agxbtn agxbtn-mini dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<?php if ($release->published == 1) : ?>
<li><a href="<?= $unpublish . $ref . $token ?>"><span class="icon-unpublish"></span> Unpublish</a></li>
<li><a href="<?= $trash . $ref . $token ?>"><span class="icon-purge"></span> Trash</a></li>
<?php elseif ($release->published == 0) : ?>
<li><a href="<?= $publish . $ref . $token ?>"><span class="icon-publish"></span> Publish</a></li>
<li><a href="<?= $trash . $ref . $token ?>"><span class="icon-purge"></span> Trash</a></li>
<?php elseif ($release->published == -2) : ?>
<li><a href="<?= $delete . $ref . $token ?>"><span class="icon-delete"></span> Delete</a></li>
<li><a href="<?= $publish . $ref . $token ?>"><span class="icon-publish"></span> Publish</a></li>
<li><a href="<?= $unpublish . $ref . $token ?>"><span class="icon-unpublish"></span> Unpublish</a></li>
<?php endif; ?>
</ul>
</span>