You are here

public function PricingEvent::formatJson in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Returns event in a format amenable to FullCalendar display or generally sensible json.

Return value

array The processed event, in JSON ready format.

Overrides PricingEventInterface::formatJson

File

modules/rooms_pricing/includes/rooms_pricing.pricing_event.inc, line 87
contains PricingEvent.

Class

PricingEvent
@file contains PricingEvent.

Code

public function formatJson() {
  $amount = $this->amount;
  $event = array(
    "id" => $amount,
    "start" => $this
      ->startYear() . '-' . $this
      ->startMonth('m') . '-' . $this
      ->startDay('d') . 'T13:00:00',
    "end" => $this
      ->endYear() . '-' . $this
      ->endMonth('m') . '-' . $this
      ->endDay('d') . 'T13:00:00',
  );

  // Set the color.
  if ($amount < 100) {
    $event['color'] = variable_get('rooms_price_low_value_color', '#F3C776');
    $event['title'] = $amount;
  }
  elseif ($amount >= 100) {
    $event['color'] = variable_get('rooms_price_high_value_color', '#9DDC9D');
    $event['title'] = $amount;
  }
  return $event;
}