summaryrefslogtreecommitdiff
path: root/includes/model/Shifts_model.php
blob: 84d14c7aa76cb9a9f380a03b655ac80c91f11fbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

/**
 * Returns all shifts with needed angeltypes and count of subscribed jobs.
 */
function Shifts() {
  $shifts_source = sql_select("
    SELECT `Shifts`.*, `Room`.`RID`, `Room`.`Name` as `room_name` 
    FROM `Shifts`
    JOIN `Room` ON `Room`.`RID` = `Shifts`.`RID`
    ");
  if ($shifts_source === false)
    return false;
  
  foreach ($shifts_source as &$shift) {
    $needed_angeltypes = NeededAngelTypes_by_shift($shift);
    if ($needed_angeltypes === false)
      return false;
    
    $shift['angeltypes'] = $needed_angeltypes;
  }
}

?>