PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.6.7
VikBooking Hotel Booking Engine & PMS v1.6.7
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
vikbooking / admin / views / managecarat / view.html.php

view.html.php in VikBooking Hotel Booking Engine & PMS 1.6.7, at admin/views/managecarat/view.html.php

111 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 // import Joomla view library
14 jimport('joomla.application.component.view');
15
16 class VikBookingViewManagecarat extends JViewVikBooking {
17
18 function display($tpl = null) {
19 // Set the toolbar
20 $this->addToolBar();
21
22 $cid = VikRequest::getVar('cid', array(0));
23 if (!empty($cid[0])) {
24 $id = $cid[0];
25 }
26
27 $dbo = JFactory::getDbo();
28 $row = array();
29 $allrooms = array();
30 if (!empty($cid[0])) {
31 $q = "SELECT * FROM `#__vikbooking_characteristics` WHERE `id`=".(int)$id.";";
32 $dbo->setQuery($q);
33 $dbo->execute();
34 if ($dbo->getNumRows() != 1) {
35 VikError::raiseWarning('', 'Not found.');
36 $mainframe = JFactory::getApplication();
37 $mainframe->redirect("index.php?option=com_vikbooking&task=carat");
38 exit;
39 }
40 $row = $dbo->loadAssoc();
41 }
42
43 // read all rooms
44 $q = "SELECT `id`, `name`, `idcarat` FROM `#__vikbooking_rooms`;";
45 $dbo->setQuery($q);
46 $dbo->execute();
47 if ($dbo->getNumRows()) {
48 $records = $dbo->loadAssocList();
49 foreach ($records as $r) {
50 $r['idcarat'] = empty($r['idcarat']) ? array() : explode(';', rtrim($r['idcarat'], ';'));
51 $allrooms[$r['id']] = $r;
52 }
53 }
54
55 // preset icons
56 $exclude_html = array();
57 $q = "SELECT `textimg` FROM `#__vikbooking_characteristics`;";
58 $dbo->setQuery($q);
59 $dbo->execute();
60 if ($dbo->getNumRows()) {
61 $records = $dbo->loadAssocList();
62 foreach ($records as $v) {
63 if (count($row) && !empty($row['textimg']) && $row['textimg'] == $v['textimg']) {
64 // when in edit mode, we want the current icon to be kept in the list
65 continue;
66 }
67 if (strpos($v['textimg'], '</i>') !== false) {
68 // we set this pre-set icon as already used for excluding it from the list
69 array_push($exclude_html, $v['textimg']);
70 }
71 }
72 }
73 $preset_icons = VikBookingIcons::loadCharacteristicsPreset($exclude_html);
74
75 $this->row = $row;
76 $this->allrooms = $allrooms;
77 $this->preset_icons = $preset_icons;
78
79 // Display the template
80 parent::display($tpl);
81 }
82
83 /**
84 * Sets the toolbar
85 */
86 protected function addToolBar() {
87 $cid = VikRequest::getVar('cid', array(0));
88
89 if (!empty($cid[0])) {
90 //edit
91 JToolBarHelper::title(JText::translate('VBMAINCARATTITLEEDIT'), 'vikbooking');
92 if (JFactory::getUser()->authorise('core.edit', 'com_vikbooking')) {
93 JToolBarHelper::save( 'updatecarat', JText::translate('VBSAVE'));
94 JToolBarHelper::spacer();
95 }
96 JToolBarHelper::cancel( 'cancelcarat', JText::translate('VBANNULLA'));
97 JToolBarHelper::spacer();
98 } else {
99 //new
100 JToolBarHelper::title(JText::translate('VBMAINCARATTITLENEW'), 'vikbooking');
101 if (JFactory::getUser()->authorise('core.create', 'com_vikbooking')) {
102 JToolBarHelper::save( 'createcarat', JText::translate('VBSAVE'));
103 JToolBarHelper::spacer();
104 }
105 JToolBarHelper::cancel( 'cancelcarat', JText::translate('VBANNULLA'));
106 JToolBarHelper::spacer();
107 }
108 }
109
110 }
111