Register Child and Waitlist working
This commit is contained in:
@@ -97,11 +97,23 @@ class Model_Setup extends ORM {
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function open_dates($date,$days=0) {
|
||||
public function open_days() {
|
||||
$result = array();
|
||||
|
||||
//@todo this needs to change to node have any dates, since the current date may be closed, or a public holiday
|
||||
foreach ($this->open_dates(Site::DateStartOfWeek(time()),7) as $date => $open)
|
||||
$result[date('w',$date)] = $open;
|
||||
|
||||
ksort($result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function open_dates($date,$days=0,$code='O') {
|
||||
$result = array();
|
||||
|
||||
$date_end = $date+$days*86400;
|
||||
foreach ($this->dates->where('code','=','O')->where_startstop($date,$date_end)->find_all() as $o)
|
||||
foreach ($this->dates->where('code','=',$code)->where_startstop($date,$date_end)->find_all() as $o)
|
||||
while ($date<$date_end) {
|
||||
// If we havent made the start date yet, we need to advance
|
||||
if ($o->date_start > $date AND $o->date_stop > $date_end) {
|
||||
@@ -146,5 +158,20 @@ class Model_Setup extends ORM {
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function total_places($date_start,$days=0) {
|
||||
$result = array();
|
||||
|
||||
foreach ($this->rooms->find_all() as $ro) {
|
||||
foreach ($ro->availability_dates($date_start,$days) as $date => $total) {
|
||||
if (! isset($result[$date]))
|
||||
$result[$date] = 0;
|
||||
|
||||
$result[$date] += $total;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user