first commit
This commit is contained in:
103
administrator/components/com_guidedtours/tmpl/step/edit.php
Normal file
103
administrator/components/com_guidedtours/tmpl/step/edit.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_guidedtours
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\MVC\View\GenericDataException;
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('keepalive')
|
||||
->useScript('form.validate');
|
||||
|
||||
if (empty($this->item->tour_id)) {
|
||||
throw new GenericDataException("\nThe Tour id was not set!\n", 500);
|
||||
}
|
||||
|
||||
$lang = $this->getLanguage()->getTag();
|
||||
?>
|
||||
|
||||
<form action="<?php echo Route::_('index.php?option=com_guidedtours&view=step&layout=edit&id=' .
|
||||
(int) $this->item->id); ?>" method="post" name="adminForm" id="guidedtour-dates-form" class="form-validate">
|
||||
|
||||
<?php echo LayoutHelper::render('joomla.edit.title_alias', $this); ?>
|
||||
|
||||
<?php if ($this->item->id != 0 && strpos($this->item->title, 'GUIDEDTOUR') !== false) : ?>
|
||||
<div class="row title-alias form-vertical mb-3">
|
||||
<div class="col-12">
|
||||
<?php $this->form->setFieldAttribute('title_translation', 'label', Text::sprintf('COM_GUIDEDTOURS_STEP_TITLE_TRANSLATION', $lang)); ?>
|
||||
<?php echo $this->form->renderField('title_translation'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="main-card">
|
||||
<?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', ['active' => 'details', 'recall' => true, 'breakpoint' => 768]); ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'details', empty($this->item->id) ? Text::_('COM_GUIDEDTOURS_STEP_NEW_STEP') : Text::_('COM_GUIDEDTOURS_STEP_EDIT_STEP')); ?>
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<?php echo $this->form->renderField('description'); ?>
|
||||
|
||||
<?php if ($this->item->id != 0 && strpos($this->item->description, 'GUIDEDTOUR') !== false) : ?>
|
||||
<?php $this->form->setFieldAttribute('description_translation', 'label', Text::sprintf('COM_GUIDEDTOURS_STEP_DESCRIPTION_TRANSLATION', $lang)); ?>
|
||||
<?php echo $this->form->renderField('description_translation'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
<?php
|
||||
// Set main fields.
|
||||
$this->fields = [
|
||||
'published',
|
||||
'language',
|
||||
'position',
|
||||
'target',
|
||||
'type',
|
||||
'url',
|
||||
'interactive_type',
|
||||
'note',
|
||||
];
|
||||
|
||||
$this->hidden_fields = [
|
||||
'tour_id',
|
||||
];
|
||||
|
||||
echo LayoutHelper::render('joomla.edit.global', $this); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'publishing', Text::_('JGLOBAL_FIELDSET_PUBLISHING')); ?>
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-8">
|
||||
<fieldset id="fieldset-publishingdata" class="options-form">
|
||||
<legend><?php echo Text::_('JGLOBAL_FIELDSET_PUBLISHING'); ?></legend>
|
||||
<div>
|
||||
<?php
|
||||
$this->fields = [];
|
||||
$this->hidden_fields = [];
|
||||
echo LayoutHelper::render('joomla.edit.publishingdata', $this); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.endTabSet'); ?>
|
||||
</div>
|
||||
<input type="hidden" name="task" value="">
|
||||
<?php echo $this->form->getInput('tour_id'); ?>
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</form>
|
||||
234
administrator/components/com_guidedtours/tmpl/steps/default.php
Normal file
234
administrator/components/com_guidedtours/tmpl/steps/default.php
Normal file
@ -0,0 +1,234 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_guidedtours
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\Helpers\StringHelper;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\Component\Guidedtours\Administrator\Extension\GuidedtoursComponent;
|
||||
use Joomla\Component\Guidedtours\Administrator\View\Steps\HtmlView;
|
||||
|
||||
/** @var HtmlView $this */
|
||||
|
||||
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('table.columns')
|
||||
->useScript('multiselect');
|
||||
|
||||
$user = $this->getCurrentUser();
|
||||
$userId = $user->get('id');
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$saveOrder = $listOrder == 'a.ordering';
|
||||
$section = null;
|
||||
$mode = false;
|
||||
$tourId = $this->state->get('filter.tour_id');
|
||||
|
||||
$canEdit = $user->authorise('core.edit', 'com_guidedtours');
|
||||
$canEditOwnTour = $user->authorise('core.edit.own', 'com_guidedtours');
|
||||
$canEditStateTour = $user->authorise('core.edit.state', 'com_guidedtours');
|
||||
$hasCheckinPermission = $user->authorise('core.manage', 'com_checkin');
|
||||
|
||||
if ($saveOrder && !empty($this->items)) {
|
||||
$saveOrderingUrl = 'index.php?option=com_guidedtours&task=steps.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
|
||||
HTMLHelper::_('draggablelist.draggable');
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="<?php echo Route::_('index.php?option=com_guidedtours&view=steps&tour_id=' . $tourId); ?>"
|
||||
method="post" name="adminForm" id="adminForm">
|
||||
<div id="j-main-container" class="j-main-container">
|
||||
<?php
|
||||
// Search tools bar
|
||||
echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]);
|
||||
?>
|
||||
|
||||
<!-- If no steps -->
|
||||
<?php if (empty($this->items)) :
|
||||
?>
|
||||
<!-- No steps -->
|
||||
<div class="alert alert-info">
|
||||
<span class="icon-info-circle" aria-hidden="true"></span>
|
||||
<span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
|
||||
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- If there are steps, we start with the table -->
|
||||
<?php if (!empty($this->items)) :
|
||||
?>
|
||||
<!-- Steps table starts here -->
|
||||
<table class="table" id="stepsList">
|
||||
|
||||
<caption class="visually-hidden">
|
||||
<?php echo Text::_('COM_GUIDEDTOURS_STEPS_TABLE_CAPTION'); ?>,
|
||||
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?></span>,
|
||||
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
|
||||
</caption>
|
||||
|
||||
<!-- Steps table header -->
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="w-1 text-center">
|
||||
<?php echo HTMLHelper::_('grid.checkall'); ?>
|
||||
</td>
|
||||
<!-- Ordering?-->
|
||||
<th scope="col" class="w-3 text-center d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_(
|
||||
'searchtools.sort',
|
||||
'',
|
||||
'a.ordering',
|
||||
$listDirn,
|
||||
$listOrder,
|
||||
null,
|
||||
'asc',
|
||||
'JGRID_HEADING_ORDERING',
|
||||
'icon-sort'
|
||||
); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-1 text-center">
|
||||
<?php echo HTMLHelper::_(
|
||||
'searchtools.sort',
|
||||
'JSTATUS',
|
||||
'a.published',
|
||||
$listDirn,
|
||||
$listOrder
|
||||
); ?>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<?php echo Text::_('COM_GUIDEDTOURS_STEP_TITLE'); ?>
|
||||
</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">
|
||||
<?php echo Text::_('COM_GUIDEDTOURS_DESCRIPTION'); ?>
|
||||
</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_(
|
||||
'searchtools.sort',
|
||||
'COM_GUIDEDTOURS_STEP_TYPE',
|
||||
'a.type',
|
||||
$listDirn,
|
||||
$listOrder
|
||||
); ?>
|
||||
</th>
|
||||
|
||||
<th scope="col" class="w-10 text-center d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_(
|
||||
'searchtools.sort',
|
||||
'JGRID_HEADING_ID',
|
||||
'a.id',
|
||||
$listDirn,
|
||||
$listOrder
|
||||
); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<!-- Table body begins -->
|
||||
<tbody <?php if ($saveOrder) : ?>
|
||||
class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="true" <?php
|
||||
endif; ?>>
|
||||
<?php foreach ($this->items as $i => $item) :
|
||||
$canEditOwn = $canEditOwnTour && $item->created_by == $userId;
|
||||
$canCheckin = $hasCheckinPermission || $item->checked_out == $userId || is_null($item->checked_out);
|
||||
$canChange = $canEditStateTour && $canCheckin;
|
||||
?>
|
||||
|
||||
<!-- Row begins -->
|
||||
<tr class="row<?php echo $i % 2; ?>" data-draggable-group="none">
|
||||
<!-- Item Checkbox -->
|
||||
<td class="text-center">
|
||||
<?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
|
||||
</td>
|
||||
|
||||
<!-- Draggable handle -->
|
||||
<td class="text-center d-none d-md-table-cell">
|
||||
<?php
|
||||
$iconClass = '';
|
||||
|
||||
if (!$canChange) {
|
||||
$iconClass = ' inactive';
|
||||
} elseif (!$saveOrder) {
|
||||
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
|
||||
}
|
||||
?>
|
||||
|
||||
<span class="sortable-handler <?php echo $iconClass; ?>">
|
||||
<span class="icon-ellipsis-v" aria-hidden="true"></span>
|
||||
</span>
|
||||
|
||||
<?php if ($canChange && $saveOrder) : ?>
|
||||
<input type="text" class="hidden text-area-order" name="order[]" size="5" value="<?php echo $item->ordering; ?>">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
<!-- Step State -->
|
||||
<td class="text-center">
|
||||
<?php echo HTMLHelper::_(
|
||||
'jgrid.published',
|
||||
$item->published,
|
||||
$i,
|
||||
'steps.',
|
||||
$canChange
|
||||
); ?>
|
||||
</td>
|
||||
|
||||
<!-- Step name, edit link, and note -->
|
||||
<th scope="row">
|
||||
<div>
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'steps.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($canEdit || $canEditOwn) : ?>
|
||||
<a href="<?php echo Route::_('index.php?option=com_guidedtours&task=step.edit&id=' . $item->id); ?> " title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>">
|
||||
<?php echo $this->escape($item->title); ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php echo $this->escape($item->title); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($item->note) : ?>
|
||||
<div class="small break-word">
|
||||
<?php echo Text::sprintf('JGLOBAL_LIST_NOTE', $this->escape($item->note)); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</th>
|
||||
<td class="d-none d-md-table-cell">
|
||||
<?php echo StringHelper::truncate($item->description, 200, true, false); ?>
|
||||
</td>
|
||||
|
||||
<!-- Step Type -->
|
||||
<td class="d-none d-md-table-cell">
|
||||
<?php echo Text::_(GuidedtoursComponent::STEP_TYPE_NAMES[$item->type]) ?>
|
||||
</td>
|
||||
|
||||
<!-- Step ID -->
|
||||
<td class="d-none d-md-table-cell text-center">
|
||||
<?php echo (int) $item->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
// Load the pagination
|
||||
echo $this->pagination->getListFooter();
|
||||
?>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="task" value="">
|
||||
<input type="hidden" name="boxchecked" value="0">
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_guidedtours
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
$displayData = [
|
||||
'textPrefix' => 'COM_GUIDEDTOURS_STEPS',
|
||||
'formURL' => 'index.php?option=com_guidedtours&view=steps',
|
||||
'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Help4.x:Guided_Tours:_Steps',
|
||||
'icon' => 'icon-map-signs',
|
||||
];
|
||||
|
||||
$user = $this->getCurrentUser();
|
||||
|
||||
if ($user->authorise('core.create', 'com_guidedtours')) {
|
||||
$displayData['createURL'] = 'index.php?option=com_guidedtours&task=step.add';
|
||||
}
|
||||
|
||||
echo LayoutHelper::render('joomla.content.emptystate', $displayData);
|
||||
102
administrator/components/com_guidedtours/tmpl/tour/edit.php
Normal file
102
administrator/components/com_guidedtours/tmpl/tour/edit.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_guidedtours
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$user = $app->getIdentity();
|
||||
$input = $app->getInput();
|
||||
$lang = $this->getLanguage()->getTag();
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('keepalive')
|
||||
->useScript('form.validate');
|
||||
?>
|
||||
|
||||
<form action="<?php echo Route::_('index.php?option=com_guidedtours&view=tour&layout=edit&id=' .
|
||||
(int) $this->item->id); ?>" method="post" name="adminForm" id="guidedtours-form" class="form-validate">
|
||||
|
||||
<div class="row title-alias form-vertical mb-3">
|
||||
<div class="col-12 col-md-6">
|
||||
<?php echo $this->form->renderField('title'); ?>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<?php echo $this->form->renderField('uid'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($this->item->id != 0 && strpos($this->item->title, 'GUIDEDTOUR') !== false) : ?>
|
||||
<div class="row title-alias form-vertical mb-3">
|
||||
<div class="col-12">
|
||||
<?php $this->form->setFieldAttribute('title_translation', 'label', Text::sprintf('COM_GUIDEDTOURS_TITLE_TRANSLATION', $lang)); ?>
|
||||
<?php echo $this->form->renderField('title_translation'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="main-card">
|
||||
<?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', ['active' => 'details', 'recall' => true, 'breakpoint' => 768]); ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'details', empty($this->item->id) ? Text::_('COM_GUIDEDTOURS_NEW_TOUR') : Text::_('COM_GUIDEDTOURS_EDIT_TOUR')); ?>
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<?php echo $this->form->renderField('url'); ?>
|
||||
<?php echo $this->form->renderField('description'); ?>
|
||||
|
||||
<?php if ($this->item->id != 0 && strpos($this->item->description, 'GUIDEDTOUR') !== false) : ?>
|
||||
<?php $this->form->setFieldAttribute('description_translation', 'label', Text::sprintf('COM_GUIDEDTOURS_DESCRIPTION_TRANSLATION', $lang)); ?>
|
||||
<?php echo $this->form->renderField('description_translation'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
<?php
|
||||
// Set main fields.
|
||||
$this->fields = [
|
||||
'published',
|
||||
'access',
|
||||
'language',
|
||||
'extensions',
|
||||
'note',
|
||||
];
|
||||
|
||||
echo LayoutHelper::render('joomla.edit.global', $this); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'publishing', Text::_('JGLOBAL_FIELDSET_PUBLISHING')); ?>
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-8">
|
||||
<fieldset id="fieldset-publishingdata" class="options-form">
|
||||
<legend><?php echo Text::_('JGLOBAL_FIELDSET_PUBLISHING'); ?></legend>
|
||||
<div>
|
||||
<?php
|
||||
$this->fields = [];
|
||||
echo LayoutHelper::render('joomla.edit.publishingdata', $this); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.endTabSet'); ?>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="task" value="">
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</form>
|
||||
259
administrator/components/com_guidedtours/tmpl/tours/default.php
Normal file
259
administrator/components/com_guidedtours/tmpl/tours/default.php
Normal file
@ -0,0 +1,259 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_guidedtours
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\Helpers\StringHelper;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Language\Multilanguage;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\Component\Guidedtours\Administrator\View\Tours\HtmlView;
|
||||
|
||||
/** @var HtmlView $this */
|
||||
|
||||
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('table.columns')
|
||||
->useScript('multiselect');
|
||||
|
||||
try {
|
||||
$app = Factory::getApplication();
|
||||
} catch (Exception $e) {
|
||||
die('Failed to get app');
|
||||
}
|
||||
|
||||
$user = $app->getIdentity();
|
||||
$userId = $user->get('id');
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$saveOrder = $listOrder == 'a.ordering';
|
||||
$section = null;
|
||||
$mode = false;
|
||||
|
||||
$canEdit = $user->authorise('core.edit', 'com_guidedtours');
|
||||
$canEditOwnTour = $user->authorise('core.edit.own', 'com_guidedtours');
|
||||
$canEditStateTour = $user->authorise('core.edit.state', 'com_guidedtours');
|
||||
$hasCheckinPermission = $user->authorise('core.manage', 'com_checkin');
|
||||
|
||||
if ($saveOrder && !empty($this->items)) {
|
||||
$saveOrderingUrl =
|
||||
'index.php?option=com_guidedtours&task=tours.saveOrderAjax&tmpl=component&'
|
||||
. Session::getFormToken() . '=1';
|
||||
HTMLHelper::_('draggablelist.draggable');
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="<?php echo Route::_('index.php?option=com_guidedtours&view=tours'); ?>"
|
||||
method="post" name="adminForm" id="adminForm">
|
||||
<div id="j-main-container" class="j-main-container">
|
||||
<?php
|
||||
// Search tools bar
|
||||
echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]);
|
||||
?>
|
||||
|
||||
<!-- If no tours -->
|
||||
<?php if (empty($this->items)) :
|
||||
?>
|
||||
<!-- No tours -->
|
||||
<div class="alert alert-info">
|
||||
<span class="icon-info-circle" aria-hidden="true"></span>
|
||||
<span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
|
||||
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- If there are tours, we start with the table -->
|
||||
<?php if (!empty($this->items)) :
|
||||
?>
|
||||
<!-- Tours table starts here -->
|
||||
<table class="table" id="toursList">
|
||||
|
||||
<caption class="visually-hidden">
|
||||
<?php echo Text::_('COM_GUIDEDTOURS_GUIDEDTOURS_TABLE_CAPTION'); ?>,
|
||||
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
|
||||
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
|
||||
</caption>
|
||||
|
||||
<!-- Tours table header -->
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="w-1 text-center">
|
||||
<?php echo HTMLHelper::_('grid.checkall'); ?>
|
||||
</td>
|
||||
<!-- Ordering?-->
|
||||
<th scope="col" class="w-3 text-center d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_(
|
||||
'searchtools.sort',
|
||||
'',
|
||||
'a.ordering',
|
||||
$listDirn,
|
||||
$listOrder,
|
||||
null,
|
||||
'asc',
|
||||
'JGRID_HEADING_ORDERING',
|
||||
'icon-sort'
|
||||
); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-1 text-center">
|
||||
<?php echo HTMLHelper::_(
|
||||
'searchtools.sort',
|
||||
'JSTATUS',
|
||||
'a.published',
|
||||
$listDirn,
|
||||
$listOrder
|
||||
); ?>
|
||||
</th>
|
||||
|
||||
<th scope="col">
|
||||
<?php echo Text::_('COM_GUIDEDTOURS_TITLE'); ?>
|
||||
</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">
|
||||
<?php echo Text::_('COM_GUIDEDTOURS_DESCRIPTION'); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-10 text-center d-none d-md-table-cell">
|
||||
<?php echo Text::_('COM_GUIDEDTOURS_STEPS'); ?>
|
||||
</th>
|
||||
<th scope="col" class="text-center w-10 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
|
||||
<!-- Add language types if multi-language enabled -->
|
||||
<?php if (Multilanguage::isEnabled()) : ?>
|
||||
<th scope="col" class="text-center w-10 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
|
||||
<th scope="col" class="w-10 text-center d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_(
|
||||
'searchtools.sort',
|
||||
'JGRID_HEADING_ID',
|
||||
'a.id',
|
||||
$listDirn,
|
||||
$listOrder
|
||||
); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<!-- Table body begins -->
|
||||
<tbody <?php if ($saveOrder) : ?>
|
||||
class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="true" <?php
|
||||
endif; ?>>
|
||||
<?php foreach ($this->items as $i => $item) :
|
||||
$canEditOwn = $canEditOwnTour && $item->created_by == $userId;
|
||||
$canCheckin = $hasCheckinPermission || $item->checked_out == $userId || is_null($item->checked_out);
|
||||
$canChange = $canEditStateTour && $canCheckin;
|
||||
?>
|
||||
|
||||
<!-- Row begins -->
|
||||
<tr class="row<?php echo $i % 2; ?>" data-draggable-group="none">
|
||||
<!-- Item Checkbox -->
|
||||
<td class="text-center">
|
||||
<?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
|
||||
</td>
|
||||
|
||||
<!-- Draggable handle -->
|
||||
<td class="text-center d-none d-md-table-cell">
|
||||
<?php
|
||||
$iconClass = '';
|
||||
|
||||
if (!$canChange) {
|
||||
$iconClass = ' inactive';
|
||||
} elseif (!$saveOrder) {
|
||||
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
|
||||
}
|
||||
?>
|
||||
|
||||
<span class="sortable-handler <?php echo $iconClass; ?>">
|
||||
<span class="icon-ellipsis-v" aria-hidden="true"></span>
|
||||
</span>
|
||||
|
||||
<?php if ($canChange && $saveOrder) : ?>
|
||||
<input type="text" class="hidden text-area-order" name="order[]" size="5" value="<?php echo $item->ordering; ?>">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
<!-- Item State -->
|
||||
<td class="text-center">
|
||||
<?php echo HTMLHelper::_(
|
||||
'jgrid.published',
|
||||
$item->published,
|
||||
$i,
|
||||
'tours.',
|
||||
$canChange
|
||||
); ?>
|
||||
</td>
|
||||
|
||||
<th scope="row" class="has-context">
|
||||
<div>
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'tours.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($canEdit || $canEditOwn) : ?>
|
||||
<a href="<?php echo Route::_('index.php?option=com_guidedtours&task=tour.edit&id=' . $item->id); ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>">
|
||||
<?php echo $this->escape($item->title); ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php echo $this->escape($item->title); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($item->note) : ?>
|
||||
<div class="small break-word">
|
||||
<?php echo Text::sprintf('JGLOBAL_LIST_NOTE', $this->escape($item->note)); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</th>
|
||||
|
||||
<td class="d-none d-md-table-cell">
|
||||
<?php echo StringHelper::truncate($item->description, 200, true, false); ?>
|
||||
</td>
|
||||
|
||||
<td class="text-center btns d-none d-md-table-cell itemnumber">
|
||||
<a class="btn btn-info" href="index.php?option=com_guidedtours&view=steps&tour_id=<?php echo $item->id; ?>">
|
||||
<?php echo $item->steps_count; ?>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<!-- Adds access labels -->
|
||||
<td class="small text-center d-none d-md-table-cell">
|
||||
<?php echo $this->escape($item->access_level); ?>
|
||||
</td>
|
||||
|
||||
<?php if (Multilanguage::isEnabled()) : ?>
|
||||
<td class="text-center small d-none d-md-table-cell">
|
||||
<?php echo LayoutHelper::render('joomla.content.language', $item); ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Tour ID -->
|
||||
<td class="d-none d-md-table-cell text-center">
|
||||
<?php echo (int) $item->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
// Load the pagination.
|
||||
echo $this->pagination->getListFooter();
|
||||
?>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="task" value="">
|
||||
<input type="hidden" name="boxchecked" value="0">
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_GUIDEDTOURS_TOURS_VIEW_DEFAULT_TITLE">
|
||||
<message>
|
||||
<![CDATA[COM_GUIDEDTOURS_TOURS_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
</metadata>
|
||||
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_guidedtours
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
$displayData = [
|
||||
'textPrefix' => 'COM_GUIDEDTOURS_TOURS_LIST',
|
||||
'formURL' => 'index.php?option=com_guidedtours&view=tours',
|
||||
'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Help4.x:Guided_Tours',
|
||||
'icon' => 'icon-map-signs',
|
||||
];
|
||||
|
||||
$user = $this->getCurrentUser();
|
||||
|
||||
if ($user->authorise('core.create', 'com_guidedtours')) {
|
||||
$displayData['createURL'] = 'index.php?option=com_guidedtours&task=tour.add';
|
||||
}
|
||||
|
||||
echo LayoutHelper::render('joomla.content.emptystate', $displayData);
|
||||
Reference in New Issue
Block a user