2022-10-30 22:34:54 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2024-03-09 19:47:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
use Joomla\CMS\Factory;
|
|
|
|
use Joomla\CMS\Language\Text;
|
|
|
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
|
|
|
use Joomla\CMS\Layout\LayoutHelper;
|
|
|
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
2023-10-18 07:26:30 +00:00
|
|
|
use VDM\Joomla\Utilities\StringHelper;
|
2022-10-30 22:34:54 +00:00
|
|
|
|
2024-03-09 19:47:28 +00:00
|
|
|
// No direct access to this file
|
|
|
|
defined('JPATH_BASE') or die;
|
|
|
|
|
2023-10-18 07:26:30 +00:00
|
|
|
$table_id = (isset($displayData['id'])) ? $displayData['id'] : StringHelper::random(7);
|
2022-10-30 22:34:54 +00:00
|
|
|
$name = (isset($displayData['name'])) ? $displayData['name'] : false;
|
2023-10-18 07:26:30 +00:00
|
|
|
$table_class = (isset($displayData['table_class'])) ? $displayData['table_class'] : 'uk-table';
|
2024-03-09 19:47:28 +00:00
|
|
|
$table_container_class = (isset($displayData['table_container_class'])) ? $displayData['table_container_class'] : 'uk-overflow-auto';
|
|
|
|
$headers = (isset($displayData['headers'])) ? $displayData['headers'] : [Text::_('COM_COMPONENTBUILDER_NO'), Text::_('COM_COMPONENTBUILDER_HEADERS'), Text::_('COM_COMPONENTBUILDER_FOUND')];
|
2022-10-30 22:34:54 +00:00
|
|
|
$items = (isset($displayData['items'])) ? $displayData['items'] : 6;
|
|
|
|
|
|
|
|
?>
|
2024-03-09 19:47:28 +00:00
|
|
|
<div class="<?php echo $$table_container_class; ?>">
|
2023-10-18 07:26:30 +00:00
|
|
|
<table id="<?php echo $table_id; ?>" class="<?php echo $table_class; ?>">
|
2022-10-30 22:34:54 +00:00
|
|
|
<thead>
|
|
|
|
<?php if (is_array($headers)): ?>
|
|
|
|
<?php if ($name): ?>
|
|
|
|
<tr>
|
|
|
|
<th colspan="<?php echo count($headers); ?>" style="text-align:center"><b><?php echo $name; ?></b></th>
|
|
|
|
</tr>
|
|
|
|
<?php endif; ?>
|
|
|
|
<tr>
|
|
|
|
<?php foreach($headers as $code_name => $header): ?>
|
|
|
|
<?php
|
|
|
|
if (is_numeric($code_name))
|
|
|
|
{
|
2023-10-18 07:26:30 +00:00
|
|
|
$code_name = StringHelper::safe($header);
|
2022-10-30 22:34:54 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<th data-name="<?php echo $code_name; ?>"><?php echo $header; ?></th>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</tr>
|
|
|
|
<?php elseif (is_numeric($headers)): ?>
|
|
|
|
<?php if ($name): ?>
|
|
|
|
<tr>
|
|
|
|
<th colspan="<?php echo (int) $headers; ?>" style="text-align:center"><b><?php echo $name; ?></b></th>
|
|
|
|
</tr>
|
|
|
|
<?php endif; ?>
|
|
|
|
<tr style="position: absolute; top: -9999px; left: -9999px;">
|
|
|
|
<?php for( $row = 0; $row < $headers; $row++): ?>
|
2023-10-18 07:26:30 +00:00
|
|
|
<th><?php echo StringHelper::safe($row); ?></th>
|
2022-10-30 22:34:54 +00:00
|
|
|
<?php endfor; ?>
|
|
|
|
</tr>
|
|
|
|
<?php endif; ?>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2024-03-09 19:47:28 +00:00
|
|
|
<?php echo LayoutHelper::render('rows', ['headers' => $headers, 'items' => $items]); ?>
|
2022-10-30 22:34:54 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
// Initialize the table if [init is not set], or [is true]
|
|
|
|
// To stop initialization set $displayData['init'] = false;
|
|
|
|
if (!isset($displayData['init']) || $displayData['init']) :
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
2024-03-09 19:47:28 +00:00
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
var <?php echo $table_id; ?> = new DataTable('#<?php echo $table_id; ?>', {
|
2022-10-30 22:34:54 +00:00
|
|
|
paging: false,
|
|
|
|
select: true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<?php endif; ?>
|