| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikBooking |
| 4 |
* @subpackage com_vikbooking |
| 5 |
* @author Alessio Gaggii - e4j - Extensionsforjoomla.com |
| 6 |
* @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved. |
| 7 |
* @license GNU General Public License version 2 or later; see LICENSE |
| 8 |
* @link https://vikwp.com |
| 9 |
*/ |
| 10 |
|
| 11 |
defined('ABSPATH') or die('No script kiddies please!'); |
| 12 |
|
| 13 |
$rows = $this->rows; |
| 14 |
$lim0 = $this->lim0; |
| 15 |
$navbut = $this->navbut; |
| 16 |
|
| 17 |
$canEdit = JFactory::getUser()->authorise('core.edit', 'com_vikbooking'); |
| 18 |
|
| 19 |
if (empty($rows)) { |
| 20 |
?> |
| 21 |
<p class="warn"><?php echo JText::translate('VBNOFIELDSFOUND'); ?></p> |
| 22 |
<form action="index.php?option=com_vikbooking" method="post" name="adminForm" id="adminForm"> |
| 23 |
<input type="hidden" name="task" value="" /> |
| 24 |
<input type="hidden" name="option" value="com_vikbooking" /> |
| 25 |
</form> |
| 26 |
<?php |
| 27 |
} else { |
| 28 |
?> |
| 29 |
<form action="index.php?option=com_vikbooking" method="post" name="adminForm" id="adminForm" class="vbo-list-form"> |
| 30 |
<div class="table-responsive"> |
| 31 |
<table cellpadding="4" cellspacing="0" border="0" width="100%" class="table table-striped vbo-list-table"> |
| 32 |
<thead> |
| 33 |
<tr> |
| 34 |
<th width="20"> |
| 35 |
<input type="checkbox" onclick="Joomla.checkAll(this)" value="" name="checkall-toggle"> |
| 36 |
</th> |
| 37 |
<th class="title left" width="200"><?php echo JText::translate( 'VBPVIEWCUSTOMFONE' ); ?></th> |
| 38 |
<th class="title left" width="200"><?php echo JText::translate( 'VBPVIEWCUSTOMFTWO' ); ?></th> |
| 39 |
<th class="title center" width="100" align="center"><?php echo JText::translate( 'VBPVIEWCUSTOMFFOUR' ); ?></th> |
| 40 |
<th class="title center" width="100" align="center"><?php echo JText::translate( 'VBPVIEWCUSTOMFTHREE' ); ?></th> |
| 41 |
</tr> |
| 42 |
</thead> |
| 43 |
<?php |
| 44 |
$field_type_map = [ |
| 45 |
'text' => JText::translate('VBNEWCUSTOMFTHREE'), |
| 46 |
'textarea' => JText::translate('VBNEWCUSTOMFTEN'), |
| 47 |
'select' => JText::translate('VBNEWCUSTOMFFOUR'), |
| 48 |
'checkbox' => JText::translate('VBNEWCUSTOMFFIVE'), |
| 49 |
'date' => JText::translate('VBNEWCUSTOMFDATETYPE'), |
| 50 |
'country' => JText::translate('VBNEWCUSTOMFCOUNTRY'), |
| 51 |
'state' => JText::translate('VBO_STATE_PROVINCE'), |
| 52 |
'separator' => JText::translate('VBNEWCUSTOMFSEPARATOR'), |
| 53 |
]; |
| 54 |
|
| 55 |
$k = 0; |
| 56 |
$i = 0; |
| 57 |
for ($i = 0, $n = count($rows); $i < $n; $i++) { |
| 58 |
$row = $rows[$i]; |
| 59 |
$field_badge = ''; |
| 60 |
if ($row['isnominative'] == 1) { |
| 61 |
$field_badge = ' <span class="badge">'.JText::translate('VBISNOMINATIVE').'</span>'; |
| 62 |
} |
| 63 |
if ($row['isphone'] == 1) { |
| 64 |
$field_badge = ' <span class="badge">'.JText::translate('VBISPHONENUMBER').'</span>'; |
| 65 |
} |
| 66 |
if (!empty($row['flag']) && in_array($row['flag'], array('address', 'city', 'zip', 'company', 'vat'))) { |
| 67 |
$field_badge = ' <span class="badge">'.JText::translate('VBIS'.strtoupper($row['flag'])).'</span>'; |
| 68 |
} |
| 69 |
if (!empty($row['flag']) && $row['flag'] == 'fisccode') { |
| 70 |
$field_badge = ' <span class="badge">'.JText::translate('VBCUSTOMERFISCCODE').'</span>'; |
| 71 |
} |
| 72 |
if (!empty($row['flag']) && $row['flag'] == 'pec') { |
| 73 |
$field_badge = ' <span class="badge">'.JText::translate('VBCUSTOMERPEC').'</span>'; |
| 74 |
} |
| 75 |
if (!empty($row['flag']) && $row['flag'] == 'recipcode') { |
| 76 |
$field_badge = ' <span class="badge">'.JText::translate('VBCUSTOMERRECIPCODE').'</span>'; |
| 77 |
} |
| 78 |
if ($row['isemail'] > 0) { |
| 79 |
$field_badge = ' <span class="badge">'.JText::translate('VBPVIEWCUSTOMFFIVE').'</span>'; |
| 80 |
} |
| 81 |
if ($row['type'] == 'state') { |
| 82 |
$field_badge = ' <a href="index.php?option=com_vikbooking&view=states" class="label label-info"><i class="' . VikBookingIcons::i('edit') . '"></i> '.JText::translate('VBO_MANAGE').'</a>'; |
| 83 |
} |
| 84 |
?> |
| 85 |
<tr class="row<?php echo $k; ?>"> |
| 86 |
<td><input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row['id']; ?>" onclick="Joomla.isChecked(this.checked);"></td> |
| 87 |
<td class="vbo-highlighted-td"> |
| 88 |
<div class="name"> |
| 89 |
<?php if ($canEdit): ?> |
| 90 |
<a href="index.php?option=com_vikbooking&task=editcustomf&cid[]=<?php echo $row['id']; ?>"><?php echo JText::translate($row['name']); ?></a> |
| 91 |
<?php else: ?> |
| 92 |
<?php echo JText::translate($row['name']); ?> |
| 93 |
<?php endif; ?> |
| 94 |
</div> |
| 95 |
</td> |
| 96 |
<td><?php echo (isset($field_type_map[$row['type']]) ? $field_type_map[$row['type']] : ucwords($row['type'])) . $field_badge; ?></td> |
| 97 |
<td class="center"> |
| 98 |
<a href="<?php echo VBOFactory::getPlatform()->getUri()->addCSRF('index.php?option=com_vikbooking&task=sortfield&cid[]=' . $row['id'] . '&mode=up', true); ?>"><?php VikBookingIcons::e('arrow-up', 'vbo-icn-img'); ?></a> |
| 99 |
<a href="<?php echo VBOFactory::getPlatform()->getUri()->addCSRF('index.php?option=com_vikbooking&task=sortfield&cid[]=' . $row['id'] . '&mode=down', true); ?>"><?php VikBookingIcons::e('arrow-down', 'vbo-icn-img'); ?></a> |
| 100 |
</td> |
| 101 |
<td class="center"><?php echo intval($row['required']) == 1 ? "<i class=\"".VikBookingIcons::i('check', 'vbo-icn-img')."\" style=\"color: #099909;\"></i>" : "<i class=\"".VikBookingIcons::i('times-circle', 'vbo-icn-img')."\" style=\"color: #ff0000;\"></i>"; ?></td> |
| 102 |
</tr> |
| 103 |
<?php |
| 104 |
$k = 1 - $k; |
| 105 |
} |
| 106 |
?> |
| 107 |
</table> |
| 108 |
</div> |
| 109 |
<input type="hidden" name="option" value="com_vikbooking" /> |
| 110 |
<input type="hidden" name="task" value="customf" /> |
| 111 |
<input type="hidden" name="boxchecked" value="0" /> |
| 112 |
<?php echo JHtml::fetch('form.token'); ?> |
| 113 |
<?php echo $navbut; ?> |
| 114 |
</form> |
| 115 |
<?php |
| 116 |
} |
| 117 |
|