joomla-oauth-server/com_oauthserver/administrator/tmpl/clients/default.php

130 lines
6.7 KiB
PHP
Raw Normal View History

<?php
2024-03-09 18:58:35 +03:00
/**
* @package Joomla.Administrator
* @subpackage com_oauthserver
*
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
* @license MIT; see LICENSE.txt
**/
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
defined('_JEXEC') or die;
/**
* @var \Webmasterskaya\Component\OauthServer\Administrator\View\Clients\HtmlView $this
*/
$wa = $this->document->getWebAssetManager();
$wa->useScript('table.columns')
->useScript('multiselect');
2024-03-09 18:58:35 +03:00
$user = Factory::getApplication()->getIdentity();
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
2024-03-09 18:58:35 +03:00
$listDirn = $this->escape($this->state->get('list.direction'));
?>
<form action="<?php echo Route::_('index.php?option=com_oauthserver&view=clients'); ?>" method="post" name="adminForm"
id="adminForm">
<div class="row">
<div class="col-md-12">
<div id="j-main-container" class="j-main-container">
<?php
// Search tools bar
echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]);
?>
<?php if (empty($this->items)) : ?>
<div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"></span><span
2024-03-09 18:58:35 +03:00
class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table" id="clientList">
<caption class="visually-hidden">
<?php echo Text::_('COM_OAUTHSERVER_CLIENTS_TABLE_CAPTION'); ?>,
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
</caption>
<thead>
<tr>
<td class="w-1 text-center">
<?php echo HTMLHelper::_('grid.checkall'); ?>
</td>
2024-03-03 23:21:53 +03:00
<th scope="col" class="w-15">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_OAUTHSERVER_CLIENTS_HEADING_NAME', 'client.name', $listDirn, $listOrder); ?>
</th>
2024-03-03 23:21:53 +03:00
<th scope="col" class="w-30 col-4">
<?php echo Text::_('COM_OAUTHSERVER_CLIENTS_HEADING_IDENTIFIER'); ?>
</th>
2024-03-03 23:21:53 +03:00
<th scope="col" class="w-30 col-4">
<?php echo Text::_('COM_OAUTHSERVER_CLIENTS_HEADING_SECRET'); ?>
</th>
2024-03-03 23:21:53 +03:00
<th scope="col" class="w-5">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_OAUTHSERVER_CLIENTS_HEADING_PUBLIC', 'client.public', $listDirn, $listOrder); ?>
</th>
<th scope="col" class="w-5 d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'client.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<?php $canCreate = $user->authorise('core.create', 'com_oauthserver.clients');
2024-03-09 18:58:35 +03:00
$canEdit = $user->authorise('core.edit', 'com_oauthserver.clients');
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
$canChange = $user->authorise('core.edit.state', 'com_oauthserver.clients') && $canCheckin; ?>
<tr class="row<?php echo $i % 2; ?>">
2024-03-03 23:21:53 +03:00
<td class="w-1 text-center">
<?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->name); ?>
</td>
2024-03-03 23:21:53 +03:00
<th scope="row" class="has-context">
<div>
<?php if ($item->checked_out) : ?>
<?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'clients.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canEdit) : ?>
2024-03-09 18:58:35 +03:00
<a href="<?php echo Route::_('index.php?option=com_oauthserver&task=client.edit&id=' . (int) $item->id); ?>"
2024-03-03 23:21:53 +03:00
title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->name); ?>">
<?php echo $this->escape($item->name); ?></a>
<?php else : ?>
<?php echo $this->escape($item->name); ?>
<?php endif; ?>
</div>
</th>
<td class="d-none d-md-table-cell">
<code>
<?php echo $item->identifier; ?>
</code>
</td>
2024-03-03 23:21:53 +03:00
<td class="d-none d-md-table-cell">
<code>
<?php echo !empty($item->secret) ? substr($item->secret, 0, 29) . '...' : ''; ?>
</code>
</td>
2024-03-03 23:21:53 +03:00
<td class="d-none d-md-table-cell">
2024-03-09 18:58:35 +03:00
<?php echo Text::_((bool) $item->public ? 'JYES' : 'JNO'); ?>
</td>
2024-03-03 23:21:53 +03:00
<td class="w-1 text-center">
<?php echo $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
</div>
</div>
<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<?php echo HTMLHelper::_('form.token'); ?>
2024-03-09 18:58:35 +03:00
</form>