Continued development on the search feature
This commit is contained in:
43
admin/layouts/rows.php
Normal file
43
admin/layouts/rows.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die('Restricted access');
|
||||
|
||||
$headers = $displayData['headers'];
|
||||
$items = $displayData['items'];
|
||||
|
||||
?>
|
||||
<?php if (is_array($items)): ?>
|
||||
<?php foreach ($items as $row => $values): ?>
|
||||
<tr>
|
||||
<?php foreach($values as $value): ?>
|
||||
<td class=""><?php echo $value; ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php elseif (is_numeric($items) && is_array($headers)): ?>
|
||||
<?php for( $row = 0; $row < $items; $row++): ?>
|
||||
<tr class="">
|
||||
<?php foreach($headers as $header): ?>
|
||||
<td class=""> </td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endfor; ?>
|
||||
<?php elseif (is_numeric($items) && is_numeric($headers)): ?>
|
||||
<?php for( $row = 0; $row < $items; $row++): ?>
|
||||
<tr class="">
|
||||
<?php for( $column = 0; $column < $headers; $column++): ?>
|
||||
<td class=""> </td>
|
||||
<?php endfor; ?>
|
||||
</tr>
|
||||
<?php endfor; ?>
|
||||
<?php endif; ?>
|
72
admin/layouts/table.php
Normal file
72
admin/layouts/table.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die('Restricted access');
|
||||
|
||||
$table_id = (isset($displayData['id'])) ? $displayData['id'] : ComponentbuilderHelper::randomkey(7);
|
||||
$name = (isset($displayData['name'])) ? $displayData['name'] : false;
|
||||
$headers = (isset($displayData['headers'])) ? $displayData['headers'] : [JText::_('COM_COMPONENTBUILDER_NO'), JText::_('COM_COMPONENTBUILDER_HEADERS'), JText::_('COM_COMPONENTBUILDER_FOUND')];
|
||||
$items = (isset($displayData['items'])) ? $displayData['items'] : 6;
|
||||
|
||||
?>
|
||||
<div class="uk-overflow-auto">
|
||||
<table id="<?php echo $table_id; ?>" class="uk-table">
|
||||
<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))
|
||||
{
|
||||
$code_name = ComponentbuilderHelper::safeString($header);
|
||||
}
|
||||
?>
|
||||
<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++): ?>
|
||||
<th><?php echo ComponentbuilderHelper::safeString($row); ?></th>
|
||||
<?php endfor; ?>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php echo JLayoutHelper::render('rows', ['headers' => $headers, 'items' => $items]); ?>
|
||||
</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">
|
||||
jQuery(document).ready(function() {
|
||||
var <?php echo $table_id; ?> = jQuery('#<?php echo $table_id; ?>').DataTable({
|
||||
paging: false,
|
||||
select: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php endif; ?>
|
Reference in New Issue
Block a user