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 / models / empsubscrcart.php
vikappointments / site / models Last commit date
allorders.php 4 days ago calendarweek.php 4 days ago cart.php 4 days ago confirmapp.php 4 days ago empaccountstat.php 4 days ago empattachser.php 4 days ago empcoupons.php 4 days ago empcustfields.php 4 days ago empeditcoupon.php 4 days ago empeditcustfield.php 4 days ago empeditlocation.php 4 days ago empeditpay.php 4 days ago empeditprofile.php 4 days ago empeditservice.php 4 days ago empeditwdays.php 4 days ago emplocations.php 4 days ago emplocwdays.php 4 days ago emplogin.php 4 days ago employeesearch.php 4 days ago employeeslist.php 4 days ago empmanres.php 4 days ago emppaylist.php 4 days ago empserviceslist.php 4 days ago empsettingsman.php 4 days ago empsubscrcart.php 4 days ago empsubscrhistory.php 4 days ago empsubscrorder.php 4 days ago empwdays.php 4 days ago index.html 4 days ago packages.php 4 days ago packagescart.php 4 days ago packagesconfirm.php 4 days ago packorders.php 4 days ago servicesearch.php 4 days ago serviceslist.php 4 days ago subscrcart.php 4 days ago subscrhistory.php 4 days ago subscrpayment.php 4 days ago
empsubscrcart.php
83 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('models.subscrcart', VAPBASE);
15
16 /**
17 * VikAppointments subscription cart model.
18 *
19 * @since 1.7
20 */
21 class VikAppointmentsModelEmpsubscrcart extends VikAppointmentsModelSubscrcart
22 {
23 /**
24 * An optional suffix to be included within the session keys.
25 *
26 * @var string
27 */
28 protected $suffix = 'emp';
29
30 /**
31 * Loads all the subscriptions available for the current user.
32 *
33 * @return array
34 */
35 public function getAllSubscriptions()
36 {
37 static $subscriptions = null;
38
39 // load subscriptions only once
40 if (is_null($subscriptions))
41 {
42 // load all the active subscriptions (ignore TRIAL, if any)
43 $subscriptions = VAPSubscriptions::getList($group = 1);
44 }
45
46 return $subscriptions;
47 }
48
49 /**
50 * Loads all the subscriptions available for the current user.
51 *
52 * @return array
53 */
54 public function getTrial()
55 {
56 $auth = VAPEmployeeAuth::getInstance();
57
58 // get TRIAL subscription, if any
59 $trial = VAPSubscriptions::getTrial($group = 1);
60
61 // make sure the TRIAL exists and the employee never activated its account
62 if ($auth->isEmployee() && $trial && $auth->active_to == 0)
63 {
64 return $trial;
65 }
66
67 return null;
68 }
69
70 /**
71 * Helper method used to fetch the subscription data.
72 * Override to load the subscription of the employees.
73 *
74 * @param integer $id_subscr The subscription ID.
75 *
76 * @return array
77 */
78 protected function fetchSubscription($id_subscr)
79 {
80 return VAPSubscriptions::get($id_subscr, $group = 1);
81 }
82 }
83