return 0; } return $arrA->_datetime < $arrB->_datetime ? -1 : 1; } function cmp_dateAsc($arrA, $arrB) { if ($arrA->_datetime == $arrB->_datetime) { return 0; } return $arrA->_datetime > $arrB->_datetime ? -1 : 1; } // Récuperation du sejour sélectionné $sejour = new CSejour(); $sejour->load($sejour_id); $sejour->loadRefs(); $sejour->loadRefService(); $sejour->loadRefsAffectations(); $operations = $sejour->_ref_operations; $affectations = $sejour->_ref_affectations; $datesOperation = array(); // load service for affectations if ($sejour->_ref_last_affectation) { $sejour->_ref_last_affectation->loadRefService(); } foreach ($operations as $key) { $key->loadRefPlageOp(); $datesOperation[$key->operation_id]['id'] = $key->operation_id; $datesOperation[$key->operation_id]['date'] = $key->_datetime; $datesOperation[$key->operation_id]['entree_salle'] = $key->entree_salle; $datesOperation[$key->operation_id]['sortie_salle'] = $key->sortie_salle; $datesOperation[$key->operation_id]['entree_reveil'] = $key->entree_reveil;
/** * Get PL : person location * * @param CInteropReceiver $receiver Receiver * @param CSejour $sejour Admit * @param CAffectation $affectation Affectation * * @return array */ function getPL(CInteropReceiver $receiver, CSejour $sejour, CAffectation $affectation = null) { $group = $sejour->loadRefEtablissement(); $default_name = null; if ($receiver && $receiver->_id && isset($receiver->_configs)) { $default_name = $receiver->_configs["build_PV1_3_1_default"]; } if (!$affectation) { // Chargement de l'affectation courante $affectation = $sejour->getCurrAffectation(); // Si on n'a pas d'affectation on va essayer de chercher la première if (!$affectation->_id) { $affectation = $sejour->loadRefFirstAffectation(); } } $affectation->loadRefLit()->loadRefChambre(); $current_uf = $sejour->getUFs(null, $affectation->_id); $name = null; if ($receiver && $receiver->_id && isset($receiver->_configs)) { switch ($receiver->_configs["build_PV1_3_1"]) { case "UF": $name = $current_uf["hebergement"]->code; break; case "service": if ($affectation->_id) { $name = $affectation->loadRefService()->nom; } if (!$name) { $name = $sejour->loadRefService()->nom; } break; default: } } $pl1 = $name ? $name : $default_name; return array(array($pl1, $this->getPL2($receiver, $affectation), $this->getPL3($receiver, $affectation), $this->getGroupAssigningAuthority($sejour->loadRefEtablissement()), $this->getPL5($receiver), null, CHL7v2TableEntry::mapTo("307", $group->_id))); }