PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.6
VikBooking Hotel Booking Engine & PMS v1.8.6
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 1.7.3 All 36 releases
vikbooking / admin / views / shortcode / view.html.php

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

100 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // No direct access
4 defined('ABSPATH') or die('No script kiddies please!');
5
6 jimport('joomla.application.component.view');
7 jimport('adapter.acl.access');
8
9 /**
10 * VikBooking Shortcode view.
11 * @wponly
12 *
13 * @since 1.0
14 */
15 class VikBookingViewShortcode extends JView
16 {
17 /**
18 * @override
19 * View display method.
20 *
21 * @return void
22 */
23 public function display($tpl = null)
24 {
25 $app = JFactory::getApplication();
26 $input = $app->input;
27 $dbo = JFactory::getDbo();
28
29 $model = $this->getModel();
30
31 $type = $input->getString('type');
32 $return = $input->getBase64('return', '');
33
34 $shortcode = (array) $model->loadFormData();
35
36 JLoader::import('adapter.filesystem.folder');
37
38 // views
39
40 $views = array();
41
42 // get all the views that contain a default.xml file
43 // [0] : base path
44 // [1] : query
45 // [2] : true for recursive search
46 // [3] : true to return full paths
47 $files = JFolder::files(VBO_SITE_PATH . DIRECTORY_SEPARATOR . 'views', 'default.xml', true, true);
48
49 foreach ($files as $f)
50 {
51 // retrieve the view ID from the path: /views/[ID]/tmpl/default.xml
52 if (preg_match("/[\/\\\\]views[\/\\\\](.*?)[\/\\\\]tmpl[\/\\\\]default\.xml$/i", $f, $matches))
53 {
54 $id = $matches[1];
55 // load the XML form
56 $form = JForm::getInstance($id, $f);
57 // get the view title
58 $views[$id] = array(
59 'name' => (string) $form->getXml()->layout->attributes()->title,
60 'desc' => (string) $form->getXml()->layout->message,
61 );
62 }
63 }
64
65 $this->shortcode = $shortcode;
66 $this->views = $views;
67 $this->returnLink = $return;
68 $this->form = $form;
69
70 $this->shortcodesList = JModel::getInstance('vikbooking', 'shortcodes', 'admin')->all();
71
72 $this->addToolbar($type);
73
74 // display parent
75 parent::display($tpl);
76 }
77
78 /**
79 * Helper method to setup the toolbar.
80 *
81 * @return void
82 */
83 public function addToolbar($type)
84 {
85 if ($type == 'edit')
86 {
87 JToolbarHelper::title(JText::translate('VBOEDITSHORTCDMENUTITLE'));
88 }
89 else
90 {
91 JToolbarHelper::title(JText::translate('VBONEWSHORTCDMENUTITLE'));
92 }
93
94 JToolbarHelper::apply('shortcode.save');
95 JToolbarHelper::save('shortcode.saveclose');
96 JToolbarHelper::save2new('shortcode.savenew');
97 JToolbarHelper::cancel('shortcodes.cancel');
98 }
99 }
100