You are here

function rooms_availability_get_style in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Helper function to determine the $event style depending on permissions.

1 call to rooms_availability_get_style()
rooms_availability_generate_json in modules/rooms_availability/rooms_availability.module
Generates json based on date range provided.

File

modules/rooms_availability/rooms_availability.module, line 585
Manages availability for Bookable Units and displaying dates on the jquery FullCalendar plugin.

Code

function rooms_availability_get_style($event_style, $unit) {
  $event_style = is_numeric($event_style) ? (int) $event_style : (int) ROOMS_AVAILABILITY_ADMIN_STYLE;

  // If user don't have 'view named availability information' permission.
  if (!(user_access('view named availability information') || rooms_unit_access('update availability', $unit)) && $event_style == ROOMS_AVAILABILITY_ADMIN_STYLE) {
    $event_style = (int) ROOMS_AVAILABILITY_GENERIC_STYLE;
  }
  return $event_style;
}