summaryrefslogtreecommitdiff
path: root/includes/model/Shifts_model.php
blob: 5e8a2b54468af9468f6078f61a793ea7e81b8413 (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
25
26
<?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;
  }
  
  return $shifts_source;
}

?>