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 / import / forms / columns / optiongroup.php
vikappointments / site / helpers / libraries / import / forms / columns Last commit date
city.php 3 days ago country.php 3 days ago currency.php 3 days ago date.php 3 days ago empgroup.php 3 days ago employee.php 3 days ago group.php 3 days ago index.html 3 days ago optiongroup.php 3 days ago service.php 3 days ago state.php 3 days ago user.php 3 days ago
optiongroup.php
65 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 /**
15 * Populate the options array with the existing option groups,
16 * in order to support the correct placeholders while
17 * importing and exporting the records.
18 *
19 * @since 1.7.3
20 */
21 class ImportColumnOptiongroup extends ImportColumn
22 {
23 /**
24 * Groups cache.
25 *
26 * @var array
27 */
28 private static $groups = null;
29
30 /**
31 * Binds the internal properties with the given array/object.
32 *
33 * @param mixed $data Either an array or an object.
34 *
35 * @return void
36 */
37 protected function setup($data)
38 {
39 // use parent to set up data
40 parent::setup($data);
41
42 foreach (static::getGroups() as $group)
43 {
44 // register group as option
45 $this->options[$group->value] = $group->text;
46 }
47 }
48
49 /**
50 * Loads a list of available groups.
51 *
52 * @return array
53 */
54 protected static function getGroups()
55 {
56 // load groups only once
57 if (is_null(static::$groups))
58 {
59 static::$groups = JHtml::fetch('vaphtml.admin.optiongroups', $blank = false);
60 }
61
62 return static::$groups;
63 }
64 }
65