$where = array(); $where["group_id"] = CSQLDataSource::prepareIn(array_keys($etablissements)); $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]);
$menu["obj"] =& $repas->_ref_menu; $menu["total"] = 1; foreach ($typesPlats as $typePlat) { $menu["detail"][$typePlat] = 0; } } else { $menu["total"]++; } foreach ($typesPlats as $typePlat) { $plat_id =& $repas->{$typePlat}; if ($plat_id) { $plat_remplacement =& $listRemplacement[$typePlat][$plat_id]; if (isset($plat_remplacement)) { $plat_remplacement["nb"]++; } else { $plats2 = new CPlat(); $plats2->load($plat_id); $plat_remplacement = array("obj" => $plats2, "nb" => 1); } } else { $menu["detail"][$typePlat]++; } } } // Liste des types de repas $listTypeRepas = new CTypeRepas(); $order = "debut, fin, nom"; $listTypeRepas = $listTypeRepas->loadList(null, $order); // Liste des services $services = new CService(); $where = array();
$typerepas_id = null; CValue::setSession("typerepas_id", null); } $listHours = array(); for ($i = 0; $i <= 23; $i++) { $key = $i <= 9 ? "0" . $i : $i; $listHours[$key] = $key; } $smarty->assign("listHours", $listHours); $smarty->assign("typeRepas", $typeRepas); } elseif ($typeVue == 1) { // Chargement du plat demandé $plat = new CPlat(); $plat->load($plat_id); if ($plat->group_id != $group->_id) { $plat = new CPlat(); $plat_id = null; CValue::setSession("plat_id", null); } else { $plat->loadRefsFwd(); } // Liste des plats $listPlats = new CPlat(); $where = array("group_id" => $ds->prepare("= %", $group->_id)); $order = "nom, type"; $listPlats = $listPlats->loadList($where, $order); $smarty->assign("listPlats", $listPlats); $smarty->assign("plat", $plat); } else { // Chargement du menu demandé $menu = new CMenu();
* @version $Revision$ * @author Sébastien Fillonneau */ CCanDo::checkRead(); $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);