PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / site / helpers / libraries / availability / timeline / renderer / multiple.php
vikappointments / site / helpers / libraries / availability / timeline / renderer Last commit date
default.php 5 days ago dropdown.php 5 days ago index.html 5 days ago multiple.php 5 days ago ratesgrid.php 5 days ago seats.php 5 days ago table.php 5 days ago
multiple.php
67 lines
1 <?php
2 /**
3 * @package VikAppointments
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 VAPLoader::import('libraries.availability.timeline.renderer');
15
16 /**
17 * Multiple timelines renderer.
18 *
19 * @since 1.7
20 */
21 class VAPAvailabilityTimelineRendererMultiple extends VAPAvailabilityTimelineRenderer
22 {
23 /**
24 * Prepares the data to display.
25 *
26 * @param array $data An array of display data.
27 *
28 * @return array The resulting display data.
29 */
30 public function getDisplayData(array $data = array())
31 {
32 $data['employees'] = array();
33
34 // iterate all timelines
35 foreach ($this->timeline as $timeline)
36 {
37 // get most appropriate renderer
38 $renderer = VAPAvailabilityTimelineFactory::getRenderer($timeline->timeline);
39
40 // register display data
41 $data['employees'][] = array(
42 'id' => $timeline->id,
43 'name' => $timeline->name,
44 'timeline' => $renderer->display(),
45 );
46 }
47
48 return $data;
49 }
50
51 /**
52 * Renders the layout of the specified timeline.
53 *
54 * @param array $data An array of display data.
55 *
56 * @return string The timeline HTML.
57 */
58 protected function render(array $data = array())
59 {
60 $layout = new JLayoutFile('timeline.multiple');
61
62 // the layout is available only for the back-end
63
64 return $layout->render($data);
65 }
66 }
67