$plagesConsult = array(); $plagesOp = array(); $plagesPerDayOp = array(); for ($i = 0; CMbDT::date("+{$i} day", $debut) != $fin; $i++) { $date = CMbDT::date("+{$i} day", $debut); if (in_array("consult", $export)) { $where = array(); $where["chir_id"] = "= '{$prat_id}'"; $where["date"] = "= '{$date}'"; /** @var CPlageconsult[] $plagesPerDayConsult */ $plagesPerDayConsult = $plageConsult->loadList($where); if ($details) { CMbObject::massLoadBackRefs($plagesPerDayConsult, "consultations"); } foreach ($plagesPerDayConsult as $key => $plageConsult) { $plageConsult->countPatients(); $plageConsult->loadFillRate(); if ($details) { $plageConsult->loadRefsConsultations(); } } $plagesConsult[$date] = $plagesPerDayConsult; } if (in_array("interv", $export)) { $where = array(); $where[] = "chir_id = '{$prat_id}' OR anesth_id = '{$prat_id}'"; $where["date"] = "= '{$date}'"; $where["salle_id"] = CSQLDataSource::prepareIn(array_keys($listSalles)); $plagesPerDayOp = $plageOp->loadList($where); $salles = CMbObject::massLoadFwdRef($plagesPerDayOp, "salle_id"); CMbObject::massLoadFwdRef($salles, "bloc_id");
$order = "date, user_last_name, user_first_name, debut"; // Chargement des plages disponibles /** @var CPlageconsult[] $listPlage */ $listPlage = $plage->loadList($where, $order, null, "plageconsult_id", $ljoin); if (!array_key_exists($plageconsult_id, $listPlage)) { $plage->_id = $plageconsult_id = null; } $currPlage = new CPlageconsult(); foreach ($listPlage as $currPlage) { if (!$plageconsult_id && $date == $currPlage->date) { $plageconsult_id = $currPlage->_id; } $currPlage->_ref_chir = $listPrat[$currPlage->chir_id]; $currPlage->loadCategorieFill(); $currPlage->loadRefsNotes(); $currPlage->countPatients(); $currPlage->loadRefsConsultations(false); $currPlage->loadDisponibilities(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("period", $period); $smarty->assign("periods", $periods); $smarty->assign("hour", $hour); $smarty->assign("hours", CPlageconsult::$hours); $smarty->assign("hide_finished", $hide_finished); $smarty->assign("date", $date); $smarty->assign("today", CMbDT::date()); $smarty->assign("refDate", $refDate); $smarty->assign("ndate", $ndate); $smarty->assign("pdate", $pdate);