$where["cancelled"] = "= '0'"; $services = new CService(); $services = $services->loadList($where, $order); $listTypeRepas = new CTypeRepas(); $order = "debut, fin, nom"; $listTypeRepas = $listTypeRepas->loadList(null, $order); $aAffectation = array(); $aPatients = array(); $aMenus = array(); $aRepas = array(); $planningRepas = array(); $aSejours = array(); $aPlats = array(); $plats = new CPlat(); $order = "nom"; $aPlats = $plats->loadList(null, $order); if (!$service_id || !array_key_exists($service_id, $services)) { CValue::setSession("service_id", null); $service_id = null; } else { ($service =& $services[$service_id]) . $service->loadRefsBack(); foreach ($service->_ref_chambres as $chambre_id => &$chambre) { $chambre->loadRefsBack(); foreach ($chambre->_ref_lits as $lit_id => &$lit) { $lit->loadAffectations($date); foreach ($lit->_ref_affectations as $affectation_id => &$affectation) { $affectation->loadRefSejour(); if (!$affectation->_ref_sejour->sejour_id || $affectation->_ref_sejour->type == "ambu") { unset($lit->_ref_affectations[$affectation_id]); } else { $affectation->_ref_sejour->loadRefPatient();
$ds = CSQLDataSource::get("std"); $menu_id = CValue::getOrSession("menu_id", null); $repas_id = CValue::get("repas_id", null); if ($menu_id == "") { $menu_id = null; } $menu = new CMenu(); $menu->load($menu_id); $repas = new CRepas(); $repas->load($repas_id); // Chargement des plat complémentaires $plats = new CPlat(); $listPlats = array(); $where = array(); $where["typerepas"] = $ds->prepare("= %", $menu->typerepas); $order = "nom"; foreach ($plats->_specs["type"]->_list as $key => $value) { $listPlats[$value] = array(); if ($menu->modif) { $where["type"] = $ds->prepare("= %", $value); $listPlats[$value] = $plats->loadList($where, $order); } } // Création du template $smarty = new CSmartyDP(); $smarty->assign("menu_id", $menu_id); $smarty->assign("menu", $menu); $smarty->assign("listPlats", $listPlats); $smarty->assign("plats", $plats); $smarty->assign("repas", $repas); $smarty->display("inc_repas.tpl");