public function getEventPrice($event_id, $startDate) { $this->event = Sp4kAppsEventApp::getInstance(new Registry(['id' => $event_id]))->getItem(); $this->venue = Sp4kAppsVenueApp::getInstance(new Registry(['id' => $this->event->venue_id]))->getItem(); $this->getState()->set('event.rrule', Sp4kAppsRruleApp::getInstance(new Registry(['id' => $this->event->rrule_id]))->getItem()); $daysinbilling = $this->getNumDates(strftime('%Y%m%dT115959Z', $startDate), strftime('%Y%m%dT115959Z', strtotime('+30 days', $startDate))); $total = $daysinbilling * $this->getState()->get('pricing')->unit_price; return $total; }
private function setNumDates() { $this->date_start = $this->_state->get('start_date'); $this->paydate = $this->_state->get('pay_date', 1); $this->next_paydate = strftime('%Y-%m-' . $this->paydate, strtotime('+1 month', $this->date_start)); $this->rrule = Sp4kAppsRruleApp::getInstance(new Registry($this->_product->config->schedule->rrule))->getItem(); //get the number of dates in the billing period based on the recurrence and the start date. $this->timezone = JFactory::getConfig()->get('offset'); $this->setNumDatesNow(); $this->setNumDatesNext(); }
private function setSublines() { $this->getState()->set('event.rrule', Sp4kAppsRruleApp::getInstance(new Registry(['id' => $this->event->rrule_id]))->getItem()); //iterate over children in the cart and set up values. foreach ($this->getState()->get('children') as $child_id) { $childItem = Sp4kAppsChildApp::getInstance(new Registry(['id' => $child_id]))->getItem(); $startDate = $this->getState()->get('startdates')[$child_id]; $daysinbilling = $this->getNumDates(strftime('%Y%m%dT115959Z', $startDate), strftime('%Y%m%dT115959Z', strtotime('+30 days', $startDate))); $this->sublines[$child_id]['startdate'] = $startDate; $this->sublines[$child_id]['description'] = $childItem->name . ' starting ' . strftime('%d/%m/%Y', $startDate); $this->total += $this->sublines[$child_id]['total'] = $daysinbilling * json_decode($this->product->config)->pricing->unit_price; } }
private function setStartDateOptions() { $this->event_id = JFactory::$application->input->get('event_id'); $this->event = Sp4kAppsEventApp::getInstance(new Registry(['id' => $this->event_id]))->getItem(); //get the event.rrule and calculate start dates for 30 days. //get the next viable date. //get the dates $firstDate = new \DateTime(); $firstDateThirty = new \DateTime(strftime('%Y%m%d', strtotime('+30days'))); /** @var Sp4kAppsRruleItem $rrule */ $rrule = Sp4kAppsRruleApp::getInstance(new Registry(['id' => $this->event->rrule_id]))->getItem(); $dateStartCollection = $rrule->getDatesBetween($firstDate, $firstDateThirty); $dateStartCollection = $dateStartCollection->toArray(); foreach ($dateStartCollection as $dateStartCollectionItem) { /** @var DateTime $startDateObject */ $startDateObject = $dateStartCollectionItem->getStart(); $this->dateStartOptions[] = $startDateObject->getTimeStamp(); } }
private function setValidDates() { parse_str(str_replace(';', '&', $this->_config->schedule->rrule), $rruleArray); /** @var Sp4kAppsRruleItem $rrule */ $rrule = Sp4kAppsRruleApp::getInstance(new Registry(array_change_key_case($rruleArray)))->getItem(); // check the configuration for a limit to the number of days // in advance members can book and set to 90 if not set $limit = isset($this->_config->booking->future_date_limit) ? $this->_config->booking->future_date_limit : 90; $today_plus_limit = strtotime('+' . $limit . ' days'); if (!isset($this->dtstart) || $rrule->dtstart < time()) { $rrule->dtstart = time(); } if (!isset($this->until) || $rrule->until > $today_plus_limit) { $rrule->until = $today_plus_limit; } $validDateCollection = $rrule->getDatesBetween()->toArray(); foreach ($validDateCollection as $dateStartCollectionItem) { /** @var DateTime $startDateObject */ $startDateObject = $dateStartCollectionItem->getStart(); $this->validDates[] = $startDateObject->getTimeStamp(); } $test = 'test'; }
public function update() { //update the rule in case its new so we can get the rrule id //update the event item. parse_str(str_replace(';', '&', $this->getState()->get('rrule')), $rrule); $rrule = new Registry(array_change_key_case($rrule)); $rrule->set('dtstart', $this->datestart); $rrule->set('until', $this->dateend); $rrule->set('id', $this->rrule_id); /** @var Sp4kAppsRruleItem $rrule */ $rrule = Sp4kAppsRruleApp::getInstance($rrule)->getItem(); $this->getState()->set('rrule', $rrule->toString()); $rrule->update(); $rrule->dtstart = strftime('%Y%m%dT115959Z', $this->datestart); $rrule->until = strftime('%Y%m%dT115959Z', $this->dateend); $this->rrule_id = $rrule->getId(); $this->getTable()->save($this); $this->getState()->loadArray(get_object_vars($this->_table)); $this->getState()->set('rrule', $rrule->toString()); // ?? is this necessary ?? $this->bind(); return $this; }
private function setRrule() { parse_str(str_replace(';', '&', $this->_product->config->schedule->rrule), $rrule); $this->_rrule = Sp4kAppsRruleApp::getInstance(new Registry(array_change_key_case($rrule)))->getItem(); }
private function setRrule() { parse_str(str_replace(';', '&', $this->_state->get('options')->rrule), $rrule); $this->rrule = Sp4kAppsRruleApp::getInstance(new Registry(array_change_key_case($rrule)))->getItem(); }