public function gatherbedbez() { $dienstmodel = new keukendienstModel(); //$kamermodel = new keukenkamerModel(); $model = new keukenpatientModel(); $statmodel = new bedbezModel(); $diensten = $dienstmodel->get(); $adiensten = array(); $time = time(); foreach ($diensten as $dienst) { $adiensten[$dienst->getId()] = $dienst; } $outputdiensten = array(); $totalcond = array(); $totalmax = 0; foreach ($adiensten as $id => $dienst) { //$kamercond = array(); //$kamers = $kamermodel->getfromDienstid($id); // foreach($kamers as $kamer){ // $kamercond[] = array('kamer' => array('mode' => '=','value' => $kamer->getKamernr())); // } // // $totalcond = array_merge($totalcond,$kamercond); // if(count($kamercond) > 0){ // $kamercond = array('OR' => $kamercond); // } // else { // //Geen kamers, lege lijst voorzien // $kamercond = array('kamer' => array('mode' => '=','value' => '-1')); // } $cond = array('ve' => array('mode' => '=', 'value' => $dienst->getDienstnr())); $count = $model->getcount($cond); $statobject = new bedbezObject(); $statobject->setTime($time); $statobject->setVe($dienst->getDienstnr()); $statobject->setAantal($count); try { $statmodel->save($statobject); } catch (Exception $e) { } } }
$model = new bedbezModel(); $cond = array('time' => array('mode' => 'BETWEEN', 'topvalue' => $endtime, 'value' => $starttime)); $condve = array('ve' => array('mode' => '=', 'value' => $dienstobj->getDienstnr())); $objects = $model->get(array('AND' => array($cond, $condve)), array('fields' => array('time'), 'type' => 'ASC')); foreach ($objects as $obj) { $ydata[] = $obj->getAantal(); $xdata[] = $obj->getTime(); } } } else { $naam = 'AZ Lokeren'; $dienstobjs = $dienstmodel->get(); foreach ($dienstobjs as $dienstobj) { $aantalbedden += $dienstobj->getAantalbedden(); } $model = new bedbezModel(); $cond = array('time' => array('mode' => 'BETWEEN', 'topvalue' => $endtime, 'value' => $starttime)); $objects = $model->get(array('AND' => array($cond)), array('fields' => array('time'), 'type' => 'ASC')); foreach ($objects as $obj) { $ydata[$obj->getTime()] += $obj->getAantal(); $xdata[$obj->getTime()] = $obj->getTime(); } $xdata = array_values($xdata); $ydata = array_values($ydata); } $width = 600; $height = 400; // Create a graph instance $graph = new Graph($width, $height); $graph->img->SetMargin(80, 30, 55, 90); $graph->img->SetAntiAliasing(true);