function resetModifications() { $typeRepas = new CTypeRepas(); $typeRepas->load($this->typerepas_id); $service = new CService(); $service->load($this->service_id); $service->loadRefsBack(); foreach ($service->_ref_chambres as $chambre_id => &$chambre) { $chambre->loadRefsBack(); foreach ($chambre->_ref_lits as $lit_id => &$lit) { $lit->loadAffectations($this->date); foreach ($lit->_ref_affectations as $affectation_id => &$affectation) { $affectation->loadRefSejour(); $affectation->loadMenu($this->date, array($this->typerepas_id => null)); $sejour =& $affectation->_ref_sejour; $date_entree = substr($affectation->entree, 0, 10); $date_sortie = substr($affectation->sortie, 0, 10); $heure_entree = substr($affectation->entree, 11, 5); $heure_sortie = substr($affectation->sortie, 11, 5); if (!$sejour->sejour_id || $sejour->type == "ambu" || $this->date == $date_entree && $heure_entree > $typeRepas->fin || $this->date == $date_sortie && $heure_sortie < $typeRepas->debut) { } else { $repas =& $affectation->_list_repas[$this->date][$this->typerepas_id]; if ($repas->modif) { $repas->modif = 0; $repas->_no_synchro = true; $repas->store(); } } } } } }
$menu_id = CValue::getOrSession("menu_id", null); $plat_id = CValue::getOrSession("plat_id", null); $typerepas_id = CValue::getOrSession("typerepas_id", null); $typeVue = CValue::getOrSession("typeVue", 0); // Liste des Type de Repas $listTypeRepas = new CTypeRepas(); $where = array("group_id" => $ds->prepare("= %", $group->_id)); $order = "debut, fin, nom"; $listTypeRepas = $listTypeRepas->loadList($where, $order); // Création du template $smarty = new CSmartyDP(); $smarty->assign("typeVue", $typeVue); $smarty->assign("listTypeRepas", $listTypeRepas); if ($typeVue == 2) { // Chargement du type de repas demandé $typeRepas = new CTypeRepas(); $typeRepas->load($typerepas_id); if ($typeRepas->group_id != $group->_id) { $typeRepas = new CTypeRepas(); $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é
<?php /* $Id$ */ /** * @package Mediboard * @subpackage dPrepas * @version $Revision$ * @author Sébastien Fillonneau */ CCanDo::checkEdit(); $date = CValue::getOrSession("date", CMbDT::date()); $typerepas_id = CValue::getOrSession("typerepas_id", null); $affectation_id = CValue::getOrSession("affectation_id", null); $affectation = new CAffectation(); $listRepas = new CMenu(); $typeRepas = new CTypeRepas(); $repas = new CRepas(); if (!$affectation->load($affectation_id) || !$typeRepas->load($typerepas_id)) { // Pas d'affectation CValue::setSession("affectation_id", null); CAppUI::setMsg("Veuillez sélectionner une affectation", UI_MSG_ALERT); CAppUI::redirect("m=dPrepas&tab=vw_planning_repas"); } else { $affectation->loadRefSejour(); $affectation->loadRefLit(); $affectation->_ref_lit->loadCompleteView(); $canAffectation = $affectation->canDo(); if (!$canAffectation->read || !$affectation->_ref_sejour->sejour_id || $affectation->_ref_sejour->type == "ambu") { // Droit Interdit ou Ambulatoire CValue::setSession("affectation_id", null); $affectation_id = null;
*/ CCanDo::checkRead(); $group = CGroups::loadCurrent(); $type = CValue::getOrSession("type", null); $service_id = CValue::getOrSession("service_id", null); $date = CValue::getOrSession("date", CMbDT::date()); $service = null; // Liste des services $services = new CService(); $where = array(); $where["group_id"] = "= '{$group->_id}'"; $where["cancelled"] = "= '0'"; $order = "nom"; $services = $services->loadListWithPerms(PERM_READ, $where, $order); // Type de repas $typeRepas = new CTypeRepas(); $typeRepas->load($type); $typeRepas_id =& $typeRepas->_id; if (!$service_id || !array_key_exists($service_id, $services)) { CValue::setSession("service_id", null); $service_id = null; } else { ($service =& $services[$service_id]) . $service->validationRepas($date); $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(); $affectation->loadMenu($date, array($typeRepas_id => null));