public function __construct($array = null) { $this->price_list = AParameter::getPrice(); $this->depart_addon_price = 0; $this->return_addon_price = 0; $this->depart_price = 0; $this->return_price = 0; return parent::__construct($array); }
public static function getPrice() { if (!empty(self::$price_list)) { return self::$price_list; } if (!class_exists('BookproModelPrices')) { require_once JPATH_ADMINISTRATOR . '/components/com_bookpro/models/prices.php'; } $model = new BookproModelPrices(); self::$price_list = $model->getPriceList(); return self::$price_list; }
private function getTrip($cart, $roundtrip = false, $filter_date = false) { AImporter::helper('airport', 'parameter', 'math'); $price_list = AParameter::getPrice(); $rate = MathHelper::filterArrayObject($price_list->dayoff, 'date', JFactory::getDate($cart->start)->format('Y-m-d')); $trips = array(); if (!$rate) { $model = new BookProModelTransports(); $state = $model->getState(); $state->set('filter.state', 1); $state->set('filter.type', $cart->filter['type']); //depart $state->set('filter.destfrom', $cart->filter['destfrom']); $state->set('filter.destto', $cart->filter['destto']); $state->set('filter.depart_date', $cart->start); $trips['depart'] = $model->getItems(); foreach ($trips['depart'] as &$result) { $result->date = $cart->start; $result->start = $cart->start_time; $result->from = AirportHelper::getItem($result->from_dest); $result->to = AirportHelper::getItem($result->to_dest); } } if ($cart->filter['roundtrip']) { //find dayoff $rate = MathHelper::filterArrayObject($price_list->dayoff, 'date', JFactory::getDate($cart->end)->format('Y-m-d')); if (!$rate) { $model = new BookProModelTransports(); $state = $model->getState(); $state->set('filter.state', 1); $state->set('filter.type', $cart->filter['type']); $state->set('filter.destfrom', $cart->filter['destto']); $state->set('filter.destto', $cart->filter['destfrom']); $state->set('filter.depart_date', $cart->end); $trips['return'] = $model->getItems(); foreach ($trips['return'] as &$return) { $return->date = $cart->end; $return->start = $cart->return_time; $return->from = AirportHelper::getItem($return->from_dest); $return->to = AirportHelper::getItem($return->to_dest); } } } return $trips; }