Files
subform-power/admin/layouts/country/currencies_fullwidth.php
2024-06-28 09:05:08 +02:00

162 lines
6.1 KiB
PHP

<?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@created 24th May, 2024
@package Subform Power
@subpackage currencies_fullwidth.php
@author Oh Martin <https://nampharm.com.na>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use JCB\Component\Subformpower\Administrator\Helper\SubformpowerHelper;
use JCB\Joomla\Utilities\StringHelper;
use JCB\Joomla\Utilities\ArrayHelper;
// No direct access to this file
defined('_JEXEC') or die;
// set the defaults
$items = $displayData->vvvcurrencies;
$user = Factory::getApplication()->getIdentity();
$id = $displayData->item->id;
// set the edit URL
$edit = "index.php?option=com_subformpower&view=currencies&task=currency.edit";
// set a return value
$return = ($id) ? "index.php?option=com_subformpower&view=country&layout=edit&id=" . $id : "";
// check for a return value
$jinput = Factory::getApplication()->input;
if ($_return = $jinput->get('return', null, 'base64'))
{
$return .= "&return=" . $_return;
}
// check if return value was set
if (StringHelper::check($return))
{
// set the referral values
$ref = ($id) ? "&ref=country&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return));
}
else
{
$ref = ($id) ? "&ref=country&refid=" . $id : "";
}
// set the create new URL
$new = "index.php?option=com_subformpower&view=currencies&task=currency.edit" . $ref;
// set the create new and close URL
$close_new = "index.php?option=com_subformpower&view=currencies&task=currency.edit";
// load the action object
$can = SubformpowerHelper::getActions('currency');
?>
<div class="form-vertical">
<?php if ($can->get('currency.create')): ?>
<div class="btn-group">
<a class="btn btn-small btn-success" href="<?php echo $new; ?>"><span class="icon-new icon-white"></span> <?php echo Text::_('COM_SUBFORMPOWER_NEW'); ?></a>
<a class="btn btn-small" onclick="Joomla.submitbutton('country.cancel');" href="<?php echo $close_new; ?>"><span class="icon-new"></span> <?php echo Text::_('COM_SUBFORMPOWER_CLOSE_NEW'); ?></a>
</div><br /><br />
<?php endif; ?>
<?php if (ArrayHelper::check($items)): ?>
<table class="footable table data currencies metro-blue" data-page-size="20" data-filter="#filter_currencies">
<thead>
<tr>
<th data-toggle="true">
<?php echo Text::_('COM_SUBFORMPOWER_CURRENCY_NAME_LABEL'); ?>
</th>
<th data-hide="phone">
<?php echo Text::_('COM_SUBFORMPOWER_CURRENCY_SYMBOL_LABEL'); ?>
</th>
<th data-hide="phone">
<?php echo Text::_('COM_SUBFORMPOWER_CURRENCY_COUNTRY_LABEL'); ?>
</th>
<th width="10" data-hide="phone,tablet">
<?php echo Text::_('COM_SUBFORMPOWER_CURRENCY_STATUS'); ?>
</th>
<th width="5" data-type="numeric" data-hide="phone,tablet">
<?php echo Text::_('COM_SUBFORMPOWER_CURRENCY_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 = Factory::getContainer()->
get(\Joomla\CMS\User\UserFactoryInterface::class)->
loadUserById($item->checked_out);
$canDo = SubformpowerHelper::getActions('currency',$item,'currencies');
?>
<tr>
<td>
<?php if ($canDo->get('currency.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?><?php echo $ref; ?>"><?php echo $displayData->escape($item->name); ?></a>
<?php if ($item->checked_out): ?>
<?php echo Html::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'currencies.', $canCheckin); ?>
<?php endif; ?>
<?php else: ?>
<?php echo $displayData->escape($item->name); ?>
<?php endif; ?>
</td>
<td>
<?php echo $displayData->escape($item->symbol); ?>
</td>
<td>
<?php echo $displayData->escape($item->country_name); ?>
</td>
<?php if ($item->published == 1): ?>
<td class="center" data-value="1">
<span class="status-metro status-published" title="<?php echo Text::_('COM_SUBFORMPOWER_PUBLISHED'); ?>">
<?php echo Text::_('COM_SUBFORMPOWER_PUBLISHED'); ?>
</span>
</td>
<?php elseif ($item->published == 0): ?>
<td class="center" data-value="2">
<span class="status-metro status-inactive" title="<?php echo Text::_('COM_SUBFORMPOWER_INACTIVE'); ?>">
<?php echo Text::_('COM_SUBFORMPOWER_INACTIVE'); ?>
</span>
</td>
<?php elseif ($item->published == 2): ?>
<td class="center" data-value="3">
<span class="status-metro status-archived" title="<?php echo Text::_('COM_SUBFORMPOWER_ARCHIVED'); ?>">
<?php echo Text::_('COM_SUBFORMPOWER_ARCHIVED'); ?>
</span>
</td>
<?php elseif ($item->published == -2): ?>
<td class="center" data-value="4">
<span class="status-metro status-trashed" title="<?php echo Text::_('COM_SUBFORMPOWER_TRASHED'); ?>">
<?php echo Text::_('COM_SUBFORMPOWER_TRASHED'); ?>
</span>
</td>
<?php endif; ?>
<td class="nowrap center hidden-phone">
<?php echo $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot class="hide-if-no-paging">
<tr>
<td colspan="5">
<div class="pagination pagination-centered"></div>
</td>
</tr>
</tfoot>
</table>
<?php else: ?>
<div class="alert alert-no-items">
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php endif; ?>
</div>