| 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 |
// access the global operators object |
| 14 |
$oper_obj = VikBooking::getOperatorInstance(); |
| 15 |
|
| 16 |
$pitemid = VikRequest::getInt('Itemid', 0, 'request'); |
| 17 |
|
| 18 |
?> |
| 19 |
<div class="vbo-operator-dashboard"> |
| 20 |
<h3> |
| 21 |
<?php |
| 22 |
if (!empty($this->operator['pic'])) { |
| 23 |
?> |
| 24 |
<span class="vbo-operator-pic"> |
| 25 |
<img src="<?php echo strpos($this->operator['pic'], 'http') === 0 ? $this->operator['pic'] : VBO_SITE_URI . 'resources/uploads/' . $this->operator['pic']; ?>" /> |
| 26 |
</span> |
| 27 |
<?php |
| 28 |
} |
| 29 |
?> |
| 30 |
<span class="vbo-operator-name"><?php echo $this->operator['first_name'] . ' ' . $this->operator['last_name']; ?></span> |
| 31 |
</h3> |
| 32 |
<div class="vbo-operator-dashboard-logout"> |
| 33 |
<form action="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&task=operatorlogout&Itemid=' . $pitemid); ?>" method="post"> |
| 34 |
<input type="submit" name="logout" value="<?php echo JText::translate('VBOLOGOUT'); ?>" class="vbo-logout vbo-pref-color-btn-secondary" /> |
| 35 |
<input type="hidden" name="option" value="com_vikbooking" /> |
| 36 |
<input type="hidden" name="task" value="operatorlogout" /> |
| 37 |
<?php |
| 38 |
if (!empty($pitemid)) { |
| 39 |
?> |
| 40 |
<input type="hidden" name="Itemid" value="<?php echo $pitemid; ?>" /> |
| 41 |
<?php |
| 42 |
} |
| 43 |
?> |
| 44 |
</form> |
| 45 |
</div> |
| 46 |
<div class="vbo-operator-dashboard-links"> |
| 47 |
<ul> |
| 48 |
<?php |
| 49 |
foreach ($this->operator['perms'] as $perm) { |
| 50 |
// build tool link |
| 51 |
$tool_data = $oper_obj->getToolData($perm['type']); |
| 52 |
|
| 53 |
if (!$tool_data) { |
| 54 |
// tool is unknown |
| 55 |
continue; |
| 56 |
} |
| 57 |
|
| 58 |
// build tool link |
| 59 |
if (!strcasecmp(($tool_data['rendering_type'] ?? ''), 'view')) { |
| 60 |
// tool is an existing view |
| 61 |
$tool_link = JRoute::rewrite('index.php?option=com_vikbooking&view=' . $perm['type'] . (!empty($pitemid) ? '&Itemid=' . $pitemid : '')); |
| 62 |
} else { |
| 63 |
// tool is either native (layout) or custom |
| 64 |
$tool_link = JRoute::rewrite('index.php?option=com_vikbooking&view=operators&tool=' . $perm['type'] . (!empty($pitemid) ? '&Itemid=' . $pitemid : '')); |
| 65 |
} |
| 66 |
|
| 67 |
// tool icon |
| 68 |
$tool_icon = ($tool_data['icon'] ?? '') ?: '<i class="' . VikBookingIcons::i('cube') . '"></i>'; |
| 69 |
|
| 70 |
?> |
| 71 |
<li> |
| 72 |
<div class="vbo-operator-dashboard-link-left"> |
| 73 |
<a href="<?php echo $tool_link; ?>"><?php echo $tool_icon; ?> <?php echo $oper_obj->getToolName($perm['type']); ?></a> |
| 74 |
</div> |
| 75 |
<div class="vbo-operator-dashboard-link-right"> |
| 76 |
<a class="btn vbo-pref-color-btn" href="<?php echo $tool_link; ?>"><?php echo JText::translate('VBOOPERVIEWPG'); ?></a> |
| 77 |
</div> |
| 78 |
</li> |
| 79 |
<?php |
| 80 |
} |
| 81 |
?> |
| 82 |
</ul> |
| 83 |
</div> |
| 84 |
</div> |
| 85 |
|