You are here

function _resource_conflict_event_overlap in Resource Conflict 5

Determine if any events overlap the specified times

1. $start is within the event time 2. $end end is within the event time 3. The event encompasses $start and $end 4. Allow the end of one event to occur at the start of the next

Parameters

$start: The start time of events to search

$end: The end time of events to search

Return value

An array of node ID's

1 call to _resource_conflict_event_overlap()
resource_conflict_nodeapi in ./resource_conflict.module
Implementation of hook_nodeapi

File

./resource_conflict.module, line 116

Code

function _resource_conflict_event_overlap($start, $end) {
  $query = "SELECT nid FROM {event} WHERE (%d >= event_start AND %d < event_end)\n    OR (%d > event_start AND %d <= event_end)\n    OR (%d <= event_start AND %d >= event_end)";
  $result = db_query($query, $start, $start, $end, $end, $start, $end);

  // Create an array of all of the results
  while ($row = db_fetch_array($result)) {
    $rows[] = $row['nid'];
  }
  return $rows;
}