PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.20
VikAppointments Services Booking Calendar v1.2.20
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 1 month ago calendarweek.php 1 month ago cart.php 1 month ago confirmapp.php 1 month ago empaccountstat.php 1 month ago empattachser.php 1 month ago empcoupons.php 1 month ago empcustfields.php 1 month ago empeditcoupon.php 1 month ago empeditcustfield.php 1 month ago empeditlocation.php 1 month ago empeditpay.php 1 month ago empeditprofile.php 1 month ago empeditservice.php 1 month ago empeditwdays.php 1 month ago emplocations.php 1 month ago emplocwdays.php 1 month ago emplogin.php 1 month ago employeesearch.php 1 month ago employeeslist.php 1 month ago empmanres.php 1 month ago emppaylist.php 1 month ago empserviceslist.php 1 month ago empsettingsman.php 1 month ago empsubscrcart.php 1 month ago empsubscrhistory.php 1 month ago empsubscrorder.php 1 month ago empwdays.php 1 month ago index.html 1 month ago packages.php 1 month ago packagescart.php 1 month ago packagesconfirm.php 1 month ago packorders.php 1 month ago servicesearch.php 1 month ago serviceslist.php 1 month ago subscrcart.php 1 month ago subscrhistory.php 1 month ago subscrpayment.php 1 month 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