| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikBooking |
| 4 |
* @subpackage core |
| 5 |
* @author Alessio Gaggii - E4J s.r.l. |
| 6 |
* @copyright Copyright (C) 2022 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 |
/** |
| 15 |
* Defines a data registry container for the admin widgets |
| 16 |
* being rendered in the multitask panel for encapsulation. |
| 17 |
* |
| 18 |
* @since 1.15.0 (J) - 1.5.0 (WP) |
| 19 |
*/ |
| 20 |
final class VBOMultitaskData extends JObject |
| 21 |
{ |
| 22 |
/** |
| 23 |
* Gets the current name of the view/task. |
| 24 |
* |
| 25 |
* @return string |
| 26 |
*/ |
| 27 |
public function getPage() |
| 28 |
{ |
| 29 |
return $this->get('page_name', null); |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Sets the current name of the view/task. |
| 34 |
* |
| 35 |
* @param string $page the name of the view/task. |
| 36 |
* |
| 37 |
* @return self |
| 38 |
*/ |
| 39 |
public function setPage($page = '') |
| 40 |
{ |
| 41 |
$this->set('page_name', (string)$page); |
| 42 |
|
| 43 |
return $this; |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Gets the current page URI. |
| 48 |
* |
| 49 |
* @return string |
| 50 |
*/ |
| 51 |
public function getURI() |
| 52 |
{ |
| 53 |
return $this->get('page_uri', null); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Sets the current page URI. |
| 58 |
* |
| 59 |
* @param string $uri the current page URI. |
| 60 |
* |
| 61 |
* @return self |
| 62 |
*/ |
| 63 |
public function setURI($uri = '') |
| 64 |
{ |
| 65 |
$this->set('page_uri', (string)$uri); |
| 66 |
|
| 67 |
return $this; |
| 68 |
} |
| 69 |
|
| 70 |
/** |
| 71 |
* Gets the current page query. |
| 72 |
* |
| 73 |
* @return array |
| 74 |
*/ |
| 75 |
public function getQuery() |
| 76 |
{ |
| 77 |
return $this->get('page_query', []); |
| 78 |
} |
| 79 |
|
| 80 |
/** |
| 81 |
* Sets the current page query. |
| 82 |
* |
| 83 |
* @param array $query the current page query. |
| 84 |
* |
| 85 |
* @return self |
| 86 |
*/ |
| 87 |
public function setQuery($query = array()) |
| 88 |
{ |
| 89 |
$this->set('page_query', (array)$query); |
| 90 |
|
| 91 |
return $this; |
| 92 |
} |
| 93 |
|
| 94 |
/** |
| 95 |
* Gets the current booking id. |
| 96 |
* |
| 97 |
* @return int the booking id. |
| 98 |
*/ |
| 99 |
public function getBookingId() |
| 100 |
{ |
| 101 |
$bid = $this->get('booking_id', 0); |
| 102 |
|
| 103 |
if ($bid) { |
| 104 |
return $bid; |
| 105 |
} |
| 106 |
|
| 107 |
return $this->get('id_order', 0); |
| 108 |
} |
| 109 |
|
| 110 |
/** |
| 111 |
* Sets the current booking id. |
| 112 |
* |
| 113 |
* @param int $bid the reservation id. |
| 114 |
* |
| 115 |
* @return self |
| 116 |
*/ |
| 117 |
public function setBookingId($bid = 0) |
| 118 |
{ |
| 119 |
$this->set('booking_id', (int)$bid); |
| 120 |
|
| 121 |
return $this; |
| 122 |
} |
| 123 |
|
| 124 |
/** |
| 125 |
* Tells whether the admin widget is being rendered within a modal. |
| 126 |
* |
| 127 |
* @return bool |
| 128 |
* |
| 129 |
* @since 1.16.0 (J) - 1.6.0 (WP) |
| 130 |
*/ |
| 131 |
public function isModalRendering() |
| 132 |
{ |
| 133 |
return (bool)$this->get('_modalRendering', false); |
| 134 |
} |
| 135 |
|
| 136 |
/** |
| 137 |
* If the admin widget is being rendered within a modal, some |
| 138 |
* additional data for the JS events may be attached to an ID. |
| 139 |
* Useful for the admin widget to clear intervals through JS. |
| 140 |
* |
| 141 |
* @return string |
| 142 |
* |
| 143 |
* @since 1.16.0 (J) - 1.6.0 (WP) |
| 144 |
*/ |
| 145 |
public function getModalJsIdentifier() |
| 146 |
{ |
| 147 |
return $this->get('_modalJsId', ''); |
| 148 |
} |
| 149 |
} |
| 150 |
|