/** * constructor * * @param string $date date chosen */ public function __construct($date = null) { if (!$date) { $date = CMbDT::date(); } $this->date = $date; $this->number = (int) CMbDT::transform("", $date, "%j"); $dateTmp = explode("-", $date); $this->name = CMbDate::$days_name[(int) $dateTmp[1]][(int) ($dateTmp[2] - 1)]; $this->_nbDaysYear = CMbDT::format($date, "L") ? 366 : 365; $this->days_left = $this->_nbDaysYear - $this->number; //jour férie ? $holidays = CMbDate::getHolidays($this->date); if (array_key_exists($this->date, $holidays)) { $this->ferie = $holidays[$this->date]; } }
/** * @see parent::getValue() */ function getValue($object, $smarty = null, $params = array()) { if ($smarty) { include_once $smarty->_get_plugin_filepath('modifier', 'date_format'); } $propValue = $object->{$this->fieldName}; $format = CMbArray::extract($params, "format", CAppUI::conf("datetime")); if ($format === "relative") { $relative = CMbDate::relative($propValue, CMbDT::dateTime()); return $relative["count"] . " " . CAppUI::tr($relative["unit"] . ($relative["count"] > 1 ? "s" : "")); } $date = CMbArray::extract($params, "date"); if ($date && CMbDT::date($propValue) == $date) { $format = CAppUI::conf("time"); } return $propValue && $propValue != "0000-00-00 00:00:00" ? smarty_modifier_date_format($propValue, $format) : ""; }
/** * Calculate the bank holidays in France * * @param string $date The relative date, used to calculate the bank holidays of a specific year * * @deprecated Use CMbDate::getHolidays($date) instead * @return array List of bank holidays as dates **/ static function bankHolidays($date = null) { return CMbDate::getHolidays($date); }
/** * Calcul l'âge du patient en mois * * @param string $date Date de référence pour le calcul, maintenant si null * * @return int l'age du patient en mois */ function evalAgeMois($date = null) { $achieved = CMbDate::achievedDurations($this->naissance, $date); return $this->_mois = $achieved["month"]; }
*/ CCanDo::checkRead(); $operation_id = CValue::get("operation_id"); $interv = new COperation(); $interv->load($operation_id); $interv->loadRefSejour()->loadRefPatient()->loadRefLatestConstantes(); $interv->loadRefPlageOp(); $interv->_ref_sejour->_ref_patient->loadRefDossierMedical(); $consult_anesth = $interv->loadRefsConsultAnesth(); $group = CGroups::loadCurrent(); $pack = $interv->loadRefGraphPack(); list($graphs, $yaxes_count, $time_min, $time_max, $time_debut_op_iso, $time_fin_op_iso) = CObservationResultSet::buildGraphs($interv, $pack->_id); $time_debut_op = CMbDate::toUTCTimestamp($time_debut_op_iso); $time_fin_op = CMbDate::toUTCTimestamp($time_fin_op_iso); $evenements = CObservationResultSet::buildEventsGrid($interv, $time_debut_op_iso, $time_fin_op_iso, $time_min, $time_max); $now = 100 * (CMbDate::toUTCTimestamp(CMbDT::dateTime()) - $time_min) / ($time_max - $time_min); $graph_packs = CSupervisionGraphPack::getAllFor($group); $concentrators = null; if (CModule::getActive("patientMonitoring")) { $concentrator = new CMonitoringConcentrator(); $concentrators = $concentrator->loadList(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("pack", $pack); $smarty->assign("interv", $interv); $smarty->assign("graphs", $graphs); $smarty->assign("evenements", $evenements); $smarty->assign("time_debut_op", $time_debut_op); $smarty->assign("time_fin_op", $time_fin_op); $smarty->assign("yaxes_count", $yaxes_count);
$operation->loadRefsFwd(); $operation->loadRefsActesCCAM(); foreach ($operation->_ref_actes_ccam as $keyActe => $acte) { $acte =& $operation->_ref_actes_ccam[$keyActe]; $acte->loadRefsFwd(); } if (CAppUI::conf('dPccam CCodeCCAM use_new_association_rules')) { $operation->guessActesAssociation(); } else { foreach ($operation->_ref_actes_ccam as $acte) { $acte->guessAssociation(); } } $sejour =& $operation->_ref_sejour; $sejour->loadRefsFwd(); $sejour->loadRefPrescriptionSejour(); $sejour->loadRefGrossesse(); list($perop_graphs, $yaxes_count, $time_min, $time_max, $time_debut_op_iso, $time_fin_op_iso) = CObservationResultSet::buildGraphs($operation, $operation->graph_pack_id); $time_debut_op = CMbDate::toUTCTimestamp($time_debut_op_iso); $time_fin_op = CMbDate::toUTCTimestamp($time_fin_op_iso); $evenements = CObservationResultSet::buildEventsGrid($operation, $time_debut_op_iso, $time_fin_op_iso, $time_min, $time_max); // Création du template $smarty = new CSmartyDP(); $smarty->assign("patient", $operation->_ref_sejour->_ref_patient); $smarty->assign("operation", $operation); $smarty->assign("perop_graphs", $perop_graphs); $smarty->assign("yaxes_count", $yaxes_count); $smarty->assign("time_debut_op", $time_debut_op); $smarty->assign("time_fin_op", $time_fin_op); $smarty->assign("evenements", $evenements); $smarty->display("vw_partogramme.tpl");
* $Id:$ * * @package Mediboard * @subpackage dPpersonnel * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision:$ */ //CCanDo::checkRead(); $choix = CValue::get("choix", "mois"); $filter = new CPlageConge(); $filter->user_id = CValue::get("user_id", CAppUI::$user->_id); $filter->date_debut = CValue::get("date_debut", CMbDT::date()); // Tableau des jours fériés sur 2 ans, car // en mode semaine : 31 décembre - 1 janvier $bank_holidays = array_merge(CMbDate::getHolidays($filter->date_debut), CMbDate::getHolidays(CMbDT::transform("+1 YEAR", $filter->date_debut, "%Y-%m-%d"))); $mediuser = new CMediusers(); $mediusers = $mediuser->loadListFromType(); if (!$filter->date_debut) { $filter->date_debut = Date("Y-m-d"); } // Si la date rentrée par l'utilisateur est un lundi, // on calcule le dimanche d'avant et on rajoute un jour. $tab_start = array(); if ($choix == "semaine") { $last_sunday = CMbDT::transform('last sunday', $filter->date_debut, '%Y-%m-%d'); $last_monday = CMbDT::transform('+1 day', $last_sunday, '%Y-%m-%d'); $debut_periode = $last_monday; $fin_periode = CMbDT::transform('+6 day', $debut_periode, '%Y-%m-%d'); } elseif ($choix == "annee") { list($year, $m, $j) = explode("-", $filter->date_debut);
/** * Récupère les congés pour un pays * * @param string $date the date to check * @param bool $includeRegion are the territory holidays included ? * * @deprecated use CMbDate::getHolidays instead * @return array * */ function getHolidays($date = null, $includeRegion = true) { return CMbDate::getHolidays($date, $includeRegion); }
if (!$_nb) { $debute = "{$jour} {$_timing}"; $event = new CPlanningEvent($debute, $debute, $_plage->_freq, "", $color, true, null, null); $event->type = "rdvfree"; $event->plage["id"] = $_plage->_id; if ($_plage->locked == 1) { $event->disabled = true; } $event->plage["color"] = $_plage->color; //Ajout de l'évènement au planning $planning->addEvent($event); } } } } $week = CMbDate::weekNumber($debut); // Création du template $smarty = new CSmartyDP(); $smarty->assign("period", $period); $smarty->assign("periods", $periods); $smarty->assign("date", $date); $smarty->assign("refDate", $debut); $smarty->assign("ndate", $ndate); $smarty->assign("pdate", $pdate); $smarty->assign("listPraticiens", $listPraticiens); $smarty->assign("chir_id", $chir_id); $smarty->assign("function_id", $function_id); $smarty->assign("plageconsult_id", $plageconsult_id); $smarty->assign("plage", $plage); $smarty->assign("planning", $planning); $smarty->assign("bank_holidays", $bank_holidays);
$_indispo->_width = $_indispo->_fin_offset - $_indispo->_debut_offset; if ($_indispo->_width <= 0) { continue; } $indispos_by_ressource[$_indispo->ressource_materielle_id][] = $_indispo; } // Les besoins sur cete même période $besoins = $ressource->loadRefsBesoins($date_min, $date_max); unset($besoins[$besoin_ressource_id]); foreach ($besoins as $key => $_besoin) { $_operation = $_besoin->loadRefOperation(); $_operation->loadRefPlageOp(); $_debut_op = $_operation->_datetime; $_fin_op = CMbDT::addDateTime($_operation->temp_operation, $_debut_op); $_besoin->_debut_offset = CMbDate::position($_debut_op, $date_min, "1hour"); $_besoin->_fin_offset = CMbDate::position(min($date_max, $_fin_op), $date_min, "1hour"); $_besoin->_width = $_besoin->_fin_offset - $_besoin->_debut_offset; if ($_besoin->_width <= 0) { unset($besoins[$key]); } foreach ($ressources as $_ressource) { if ($min_fin_op <= $_debut_op && CMbDT::addDateTime($_ressource->retablissement, $min_fin_op) > $_debut_op) { $display_alert[$_ressource->_id] = 1; } } } $smarty = new CSmartyDP(); $smarty->assign("ressources", $ressources); $smarty->assign("hours", $hours); $smarty->assign("operation", $operation); $smarty->assign("date", $date);
static function getReleaseInfo() { $svn_status_file = __DIR__ . "/../tmp/svnstatus.txt"; $root_release_file = __DIR__ . "/../release.xml"; $applicationVersion = array("releaseTitle" => null, "releaseDate" => null, "releaseCode" => null, "releaseRev" => null, "revision" => null, "date" => null, "relative" => null, "title" => ""); // Release information if (is_readable($root_release_file)) { $releaseInfoDOM = new DOMDocument(); $releaseInfoDOM->load($root_release_file); $releaseElement = $releaseInfoDOM->documentElement; $releaseCode = $releaseElement->getAttribute("code"); list($year, $month) = explode("_", $releaseCode); $title = strftime("%B", mktime(0, 0, 0, $month, 10)) . " " . $year; $applicationVersion["releaseTitle"] = $title; $applicationVersion["releaseDate"] = CMbDT::dateTimeFromXMLDuration($releaseElement->getAttribute("date")); $applicationVersion["releaseCode"] = $releaseCode; $applicationVersion["releaseRev"] = $releaseElement->getAttribute("rev"); $applicationVersion["title"] = "Branche de " . $applicationVersion["releaseTitle"]; } // Revision information if (is_readable($svn_status_file)) { $svnInfo = file($svn_status_file); $revision = array("revision" => explode(": ", $svnInfo[0]), "date" => explode(": ", $svnInfo[1])); $applicationVersion["revision"] = trim($revision["revision"][1]); $applicationVersion["date"] = CMbDT::dateTime(trim($revision["date"][1])); $applicationVersion["relative"] = CMbDate::relative($applicationVersion["date"]); $applicationVersion["title"] .= "\n" . "Mise à jour le " . CMbDT::dateToLocale($applicationVersion["date"]) . "\n" . "Révision : " . $applicationVersion["revision"]; } return $applicationVersion; }
$sql = "SELECT sexe\n FROM affectation\n LEFT JOIN lit ON lit.lit_id = affectation.lit_id\n LEFT JOIN sejour ON sejour.sejour_id = affectation.sejour_id\n LEFT JOIN patients ON patients.patient_id = sejour.patient_id\n WHERE lit.chambre_id = '{$_lit->chambre_id}'\n AND lit.lit_id != '{$_lit->_id}'\n AND '{$datetime}' BETWEEN affectation.entree AND affectation.sortie"; $_lit->_sexe_other_patient = $ds->loadResult($sql); $where = array("lit_id" => "= '{$_lit->_id}'", "entree" => " >= '{$sortie}'"); $_lit->_ref_next_dispo = new CAffectation(); $_lit->_ref_next_dispo->loadObject($where, "entree ASC"); $_lit->_dispo_depuis_friendly = CMbDate::relative($_lit->_ref_last_dispo->sortie, $entree); if ($_lit->_ref_next_dispo->entree) { $_lit->_occupe_dans = strtotime($_lit->_ref_next_dispo->entree) - strtotime($sortie); if ($_lit->_occupe_dans < 0) { unset($lits[$key]); continue; } if ($max_sortie < $_lit->_occupe_dans) { $max_sortie = $_lit->_occupe_dans; } $_lit->_occupe_dans_friendly = CMbDate::relative($sortie, $_lit->_ref_next_dispo->entree); } else { $_lit->_occupe_dans = "libre"; } } $sorter = CMbArray::pluck($lits, "_dispo_depuis"); array_multisort($sorter, SORT_ASC, $lits); $smarty = new CSmartyDP(); $smarty->assign("lits", $lits); $smarty->assign("affectation_id", $affectation_id); $smarty->assign("max_entree", $max_entree); $smarty->assign("max_sortie", $max_sortie); $smarty->assign("_link_affectation", $_link_affectation); $smarty->assign("services_ids_suggest", $services_ids_suggest); $smarty->assign("datetime", $datetime); $smarty->display("inc_suggest_lit.tpl");
case "4weeks": $minDate = CMbDT::date("last sunday", $date); $maxDate = CMbDT::date("+ 3 weeks", CMbDT::date("next saturday", $date)); $refDate = CMbDT::date("+1 day", $minDate); break; case "month": $minDate = CMbDT::format($date, "%Y-%m-01"); $maxDate = CMbDT::transform("+1 month", $minDate, "%Y-%m-01"); $maxDate = CMbDT::date("-1 day", $maxDate); $refDate = $minDate; break; default: trigger_error("Période '{$period}' inconnue"); break; } $bank_holidays = array_merge(CMbDate::getHolidays($minDate), CMbDate::getHolidays($maxDate)); $where["date"] = $ds->prepare("BETWEEN %1 AND %2", $minDate, $maxDate); $where[] = "libelle != 'automatique' OR libelle IS NULL"; $ljoin["users"] = "users.user_id = plageconsult.chir_id OR users.user_id = plageconsult.remplacant_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; } foreach ($listPlage as $currPlage) { if (!$plageconsult_id && $date == $currPlage->date) { $plageconsult_id = $currPlage->_id; } $currPlage->_ref_chir = $listPrat[$currPlage->chir_id];
<?php /** * $Id: httpreq_vw_object_notes.php 19290 2013-05-26 19:48:24Z phenxdesign $ * * @package Mediboard * @subpackage System * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 19290 $ */ $object = mbGetObjectFromGet("object_class", "object_id", "object_guid"); $object->loadRefsNotes(PERM_READ); foreach ($object->_ref_notes as $note) { $note->_ref_user->loadRefsFwd(); $note->_date_relative = CMbDate::relative($note->date); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("notes", $object->_ref_notes); $smarty->assign("object", $object); $smarty->display("vw_object_notes.tpl");
$res_current_etab["CChambre"] = $chambre->countList($where, null, $ljoin); // - Utilisateurs $ljoin = array(); $where = array(); $mediuser = new CMediusers(); $ljoin["functions_mediboard"] = "users_mediboard.function_id = functions_mediboard.function_id"; $where["functions_mediboard.group_id"] = " = '{$current_group}'"; $res_current_etab["CMediusers"] = $mediuser->countList($where, null, $ljoin); $smarty->assign("res_current_etab", $res_current_etab); $smarty->display("inc_metrique_current_etab.tpl"); } else { $ds = CSQLDataSource::get("std"); $etab = CGroups::loadCurrent(); $result = array(); $listeClasses = CApp::getInstalledClasses(); foreach ($listeClasses as $class) { $object = new $class(); if ($object->_spec->measureable) { $sql = "SHOW TABLE STATUS LIKE '{$object->_spec->table}'"; $statusTable = $ds->loadList($sql); if ($statusTable) { $result[$class] = $statusTable[0]; $result[$class]["Update_relative"] = CMbDate::relative($result[$class]["Update_time"]); } } } $smarty->assign("result", $result); $smarty->assign("etab", $etab); $smarty->assign("nb_etabs", $etab->countList()); $smarty->display("view_metrique.tpl"); }
} } } $empty_liaison = new CItemLiaison(); $empty_liaison->_id = "temp"; $empty_liaison->loadRefItem(); $empty_liaison->loadRefItemRealise(); // La date pour l'ajout d'une prestation ponctuelle doit être dans les dates du séjour // Si la date actuelle est hors des bornes, alors réinitialisation à la date d'entrée du séjour $today_ponctuelle = CMbDT::date(); if ($today_ponctuelle < CMbDT::date($sejour->entree) || $today_ponctuelle > CMbDT::date($sejour->sortie)) { $today_ponctuelle = CMbDT::date($sejour->entree); } $smarty = new CSmartyDP(); $smarty->assign("today", CMbDT::date()); $smarty->assign("today_ponctuelle", $today_ponctuelle); $smarty->assign("dates", $dates); $smarty->assign("dates_after", $dates_after); $smarty->assign("relative_date", $relative_date); $smarty->assign("sejour", $sejour); $smarty->assign("affectations", $affectations); $smarty->assign("prestations_j", $prestations_j); $smarty->assign("prestations_p", $prestations_p); $smarty->assign("empty_liaison", $empty_liaison); $smarty->assign("liaisons_p", $liaisons_p); $smarty->assign("liaisons_j", $liaisons_j); $smarty->assign("date_modified", $date_modif); $smarty->assign("context", $context); $smarty->assign("editRights", $editRights); $smarty->assign("bank_holidays", CMbDate::getHolidays(CMbDT::date())); $smarty->display("inc_vw_prestations.tpl");
foreach ($planifications as &$_planifs) { foreach ($_planifs as &$_planif) { $line_element = $_planif->loadTargetObject(); $element_prescription = $line_element->_ref_element_prescription; $element_prescription->loadRefsIndicesCout(); if (!count($element_prescription->_ref_indices_cout)) { continue; } if (!isset($charge[$_planif->sejour_id])) { foreach ($datetimes as $_datetime) { $charge[$_planif->sejour_id][$_datetime] = array(); } } foreach ($element_prescription->_ref_indices_cout as $_indice_cout) { $ressource = $_indice_cout->loadRefRessourceSoin(); $planif_date_time = CMbDate::dirac($period, $_planif->dateTime); $ressources[$ressource->_id] = $ressource; @($charge[$_planif->sejour_id][$planif_date_time][$ressource->_id] += $_indice_cout->nb); @($total_sejour[$_planif->sejour_id][$ressource->_id] += $_indice_cout->nb); @($total_datetime[$planif_date_time][$ressource->_id] += $_indice_cout->nb); @($total[$ressource->_id] += $_indice_cout->nb); } } } $bank_holidays = CMbDT::bankHolidays(); // Création du template $smarty = new CSmartyDP(); $smarty->assign("service_id", $service_id); $smarty->assign("services", $services); $smarty->assign("bank_holidays", $bank_holidays); $smarty->assign("datetimes", $datetimes);
function loadVueTempo(&$objects = array(), $suivi_affectation, $lits = array(), &$operations = array(), $date_min, $date_max, $period, $prestation_id, &$functions_filter = null, $filter_function = null, &$sejours_non_affectes = null) { $maternite_active = CModule::getActive("maternite"); foreach ($objects as $_object) { $_object->_entree = $_object->entree; $_object->_sortie = $_object->sortie; switch (get_class($_object)) { case "CAffectation": if ($_object->_is_prolong) { $_object->_sortie = CMbDT::dateTime(); } $_object->loadRefsAffectations(); $_object->_affectations_enfant_ids = CMbArray::pluck($_object->loadBackRefs("affectations_enfant"), "affectation_id"); /** @var CSejour $sejour **/ $sejour = $_object->loadRefSejour(); if (!$suivi_affectation && $_object->parent_affectation_id) { $suivi_affectation = true; } $lits[$_object->lit_id]->_ref_affectations[$_object->_id] = $_object; if ($_object->_is_prolong) { $_object->_start_prolongation = CMbDate::position(max($date_min, $_object->_entree), $date_min, $period); $_object->_end_prolongation = CMbDate::position(min($date_max, $_object->_sortie), $date_min, $period); $_object->_width_prolongation = $_object->_end_prolongation - $_object->_start_prolongation; } break; case "CSejour": $sejour = $_object; } $sejour->loadRefPraticien()->loadRefFunction(); if (is_array($functions_filter)) { $functions_filter[$sejour->_ref_praticien->function_id] = $sejour->_ref_praticien->_ref_function; if ($filter_function && $filter_function != $sejour->_ref_praticien->function_id) { unset($objects[$_object->_id]); continue; } } $sejour->loadRefPrestation(); $sejour->loadRefChargePriceIndicator(); $patient = $sejour->loadRefPatient(); $patient->loadRefPhotoIdentite(); $constantes = $patient->getFirstConstantes(); $patient->_overweight = $constantes->poids > 120; $patient->loadRefDossierMedical(false); $_object->_entree_offset = CMbDate::position(max($date_min, $_object->_entree), $date_min, $period); $_object->_sortie_offset = CMbDate::position(min($date_max, $_object->_sortie), $date_min, $period); $_object->_width = $_object->_sortie_offset - $_object->_entree_offset; if ($_object->_width === 0) { $_object->_width = 0.01; } if (!isset($operations[$sejour->_id])) { $operations[$sejour->_id] = $sejour->loadRefsOperations(); } if ($prestation_id) { $sejour->loadRefFirstLiaisonForPrestation($prestation_id); $sejour->loadLiaisonsForPrestation($prestation_id, CMbDT::date(max($date_min, $_object->_entree)), CMbDT::date(min($date_max, $_object->_sortie))); if ($_object->_class == "CAffectation") { $_object->_liaisons_for_prestation = $sejour->_liaisons_for_prestation; } } if ($maternite_active && $sejour->grossesse_id) { $sejour->_sejours_enfants_ids = CMbArray::pluck($sejour->loadRefsNaissances(), "sejour_enfant_id"); } foreach ($operations[$sejour->_id] as $_operation) { $_operation->loadRefPlageOp(1); $hour_operation = CMbDT::format($_operation->temp_operation, "%H"); $min_operation = CMbDT::format($_operation->temp_operation, "%M"); $fin_operation = CMbDT::dateTime("+{$hour_operation} hours +{$min_operation} minutes", $_operation->_datetime_best); if ($_operation->_datetime_best > $date_max || $fin_operation < $date_min) { unset($sejour->_ref_operations[$_operation->_id]); continue; } $_operation->_debut_offset[$_object->_id] = CMbDate::position($_operation->_datetime_best, max($date_min, $_object->_entree), $period); $_operation->_fin_offset[$_object->_id] = CMbDate::position($fin_operation, max($date_min, $_object->_entree), $period); $_operation->_width[$_object->_id] = $_operation->_fin_offset[$_object->_id] - $_operation->_debut_offset[$_object->_id]; if ($_operation->_datetime_best > $date_max) { $_operation->_width_uscpo[$_object->_id] = 0; } else { $fin_uscpo = $hour_operation + 24 * $_operation->duree_uscpo; $_operation->_width_uscpo[$_object->_id] = CMbDate::position(CMbDT::dateTime("+{$fin_uscpo} hours + {$min_operation} minutes", $_operation->_datetime_best), max($date_min, $_object->_entree), $period) - $_operation->_fin_offset[$_object->_id]; } if (!$sejour->_ref_next_operation && $_operation->_datetime_best >= $date_min && $_operation->_datetime_best <= $date_max) { $sejour->_ref_next_operation = $_operation; } } if (is_array($sejours_non_affectes)) { $lit = new C**t(); $lit->_selected_item = new CItemPrestation(); $lit->_lines = array(); if ($_object instanceof CAffectation) { $lit->_affectation_id = $_object->_id; $lit->_lines[] = $_object->_id; } else { $lit->_sejour_id = $_object->_id; $lit->_lines[] = $_object->_guid; } @($sejours_non_affectes[$_object->service_id ? $_object->service_id : "np"][] = $lit); } } }
$smarty_plageop = htmlspecialchars_decode(CMbString::htmlEntities($smarty_plageop, ENT_NOQUOTES), ENT_NOQUOTES); $event = new CPlanningEvent($_plage->_guid, $debut, $duree, $smarty_plageop, "#efbf99", true, null, $_plage->_guid, false); $event->below = true; $event->type = "plage_planning"; $event->plage["id"] = $_plage->_id; if ($can_edit) { $event->addMenuItem("edit", CMbString::htmlEntities("Modifier cette plage")); $event->addMenuItem("list", CMbString::htmlEntities("Gestion des interventions")); } $planning->addEvent($event); } } $m = $save_m; $planning->rearrange(true); //ReArrange the planning $bank_holidays = CMbDate::getHolidays($date_planning); $smarty = new CSmartyDP(); $smarty->assign("planning", $planning); $smarty->assign("salles", $salles); $smarty->assign("salles_ids", $salles_ids); $smarty->assign("date_planning", $date_planning); $smarty->assign("scroll_top", $scroll_top); $smarty->assign("show_cancelled", $show_cancelled); $smarty->assign("show_operations", $show_operations); $smarty->assign("bank_holidays", $bank_holidays); $smarty->assign("bloc_id", $bloc_id); $smarty->assign("prestations", $prestations_journalieres); $smarty->assign("height_planning_resa", CAppUI::pref("planning_resa_height", 1500)); $smarty->assign("nbIntervNonPlacees", $nbIntervNonPlacees); $smarty->assign("nbIntervHorsPlage", $nbIntervHorsPlage); $smarty->assign("nbAlertesInterv", $nbAlertesInterv);
/** * find the next plageop according * to the current plageop parameters * return the number of weeks jumped * * @param int $init_salle_id Salle initiale * @param int $init_chir_id Chirurgien intial * @param int $init_spec_id Spécialité intiale * @param int $init_secondary_function_id Spécialité secondaire initiale * * @return int */ function becomeNext($init_salle_id = null, $init_chir_id = null, $init_spec_id = null, $init_secondary_function_id = null) { $week_jumped = 0; if (!$this->_type_repeat) { $this->_type_repeat = "simple"; } switch ($this->_type_repeat) { case "quadruple": $this->date = CMbDT::date("+4 WEEK", $this->date); $week_jumped += 4; break; case "triple": $this->date = CMbDT::date("+3 WEEK", $this->date); $week_jumped += 3; break; case "double": $this->date = CMbDT::date("+2 WEEK", $this->date); $week_jumped += 2; break; case "simple": $this->date = CMbDT::date("+1 WEEK", $this->date); $week_jumped++; break; case "sameweek": $week_number = CMbDate::weekNumberInMonth($this->date); $next_month = CMbDate::monthNumber(CMbDT::date("+1 MONTH", $this->date)); $i = 0; do { $this->date = CMbDT::date("+1 WEEK", $this->date); $week_jumped++; $i++; } while ($i < 10 && CMbDate::monthNumber($this->date) < $next_month || CMbDate::weekNumberInMonth($this->date) != $week_number); break; } // Stockage des champs modifiés $salle_id = $this->salle_id; $chir_id = $this->chir_id; $spec_id = $this->spec_id; $secondary_function_id = $this->secondary_function_id === null ? "" : $this->secondary_function_id; $debut = $this->debut; $fin = $this->fin; $temps_inter_op = $this->temps_inter_op; $max_intervention = $this->max_intervention; $anesth_id = $this->anesth_id; $delay_repl = $this->delay_repl; $spec_repl_id = $this->spec_repl_id; $type_repeat = $this->_type_repeat; $unique_chir = $this->unique_chir; // Recherche de la plage suivante $where = array(); $where["date"] = "= '{$this->date}'"; $where[] = "`debut` = '{$this->debut}' OR `fin` = '{$this->fin}'"; $where["salle_id"] = $init_salle_id ? "= '{$init_salle_id}'" : "= '{$this->salle_id}'"; if ($chir_id || $init_chir_id) { $where["chir_id"] = $init_chir_id ? "= '{$init_chir_id}'" : "= '{$chir_id}'"; } else { $where["spec_id"] = $init_spec_id ? "= '{$init_spec_id}'" : "= '{$spec_id}'"; } if ($secondary_function_id || $init_secondary_function_id) { $where["secondary_function_id"] = $init_secondary_function_id ? "= '{$init_secondary_function_id}'" : "= '{$secondary_function_id}'"; } $plages = $this->loadList($where); if (count($plages) > 0) { $this->load(reset($plages)->plageop_id); } else { $this->plageop_id = null; } if (!$this->chir_id) { $this->chir_id = ""; } if (!$this->spec_id) { $this->spec_id = ""; } // Remise en place des champs modifiés $this->salle_id = $salle_id; $this->chir_id = $chir_id; $this->secondary_function_id = $secondary_function_id; $this->spec_id = $spec_id; $this->debut = $debut; $this->fin = $fin; $this->temps_inter_op = $temps_inter_op; $this->max_intervention = $max_intervention; $this->anesth_id = $anesth_id; $this->delay_repl = $delay_repl; $this->spec_repl_id = $spec_repl_id; $this->_type_repeat = $type_repeat; $this->unique_chir = $unique_chir; $this->updateFormFields(); return $week_jumped; }
*/ CCanDo::checkRead(); $ds = CSQLDataSource::get("std"); // Initialisation de variables $date = CValue::getOrSession("date", CMbDT::date()); $month_min = CMbDT::date("first day of +0 month", $date); $lastmonth = CMbDT::date("last day of -1 month", $date); $nextmonth = CMbDT::date("first day of +1 month", $date); $current_m = CValue::get("current_m"); $selSortis = CValue::getOrSession("selSortis", "0"); $type = CValue::getOrSession("type"); $services_ids = CValue::getOrSession("services_ids"); $prat_id = CValue::getOrSession("prat_id"); $only_confirmed = CValue::getOrSession("only_confirmed"); $enabled_service = CValue::getOrSession("active_filter_services", 0); $bank_holidays = CMbDate::getHolidays($date); if (is_array($services_ids)) { CMbArray::removeValue("", $services_ids); } $hier = CMbDT::date("- 1 day", $date); $demain = CMbDT::date("+ 1 day", $date); // Initialisation des totaux $days = array(); for ($day = $month_min; $day < $nextmonth; $day = CMbDT::date("+1 DAY", $day)) { $days[$day]["sorties"] = 0; $days[$day]["sorties_non_effectuees"] = 0; $days[$day]["sorties_non_preparees"] = 0; $days[$day]["sorties_non_facturees"] = 0; } // filtre sur les types de sortie $filterType = "";
/** * Donne les heures limites d'une intervention * * @param COperation $interv Reference interv * * @return array */ static function getLimitTimes(COperation $interv) { $round_minutes = 10; $round = $round_minutes * 60000; // FIXME $sejour = $interv->loadRefSejour(); // Cas du partogramme if ($sejour->grossesse_id) { $grossesse = $sejour->loadRefGrossesse(); // Debut = debut travail OU entree salle if ($grossesse->datetime_debut_travail) { $time_debut_op_iso = $grossesse->datetime_debut_travail; } else { $time_min = $interv->entree_salle; $date = CMbDT::date($interv->_datetime); $time_debut_op_iso = "{$date} {$time_min}"; } // Fin = fin accouchement OU debut+1 heure OU maintenant if ($grossesse->datetime_accouchement) { $time_fin_op_iso = $grossesse->datetime_accouchement; } else { $time_fin_op_iso = max(CMbDT::dateTime(), CMbDT::dateTime("+1 HOUR", $time_debut_op_iso)); } } else { $time_min = $interv->entree_salle; $time_max = CMbDT::time("+" . CMbDT::minutesRelative("00:00:00", $interv->temp_operation) . " MINUTES", $interv->entree_salle); $date = CMbDT::date($interv->_datetime); $fin = CValue::first($interv->sortie_salle, $interv->fin_op, $interv->retrait_garrot); if ($fin) { $time_max = max($time_max, $fin); } $time_debut_op_iso = "{$date} {$time_min}"; $time_fin_op_iso = "{$date} {$time_max}"; } $timestamp_min = floor(CMbDate::toUTCTimestamp($time_debut_op_iso) / $round) * $round; $timestamp_max = ceil(CMbDate::toUTCTimestamp($time_fin_op_iso) / $round) * $round; return array($timestamp_min, $timestamp_max, $time_debut_op_iso, $time_fin_op_iso); }
$unite = "hour"; $nb_unite = 6; $nb_ticks = 28; $date_min = CMbDT::dateTime("-2 days", $date); break; case "4weeks": $period = "1day"; $unite = "day"; $nb_unite = 1; $nb_ticks = 28; $date_min = CMbDT::dateTime("-1 week", CMbDate::dirac("week", $date)); default: } $offset = $nb_ticks * $nb_unite; $date_max = CMbDT::dateTime("+ {$offset} {$unite}", $date_min); $current = CMbDate::dirac("hour", CMbDT::dateTime()); $temp_datetime = CMbDT::dateTime(null, $date_min); // Pour l'affichage des prestations en mode journée if ($granularite == "day") { $date_max = CMbDT::dateTime("-1 second", $date_max); } for ($i = 0; $i < $nb_ticks; $i++) { $offset = $i * $nb_unite; $datetime = CMbDT::dateTime("+ {$offset} {$unite}", $date_min); $datetimes[] = $datetime; if ($granularite == "4weeks") { if (CMbDT::date($current) == CMbDT::date($temp_datetime) && CMbDT::time($current) >= CMbDT::time($temp_datetime) && CMbDT::time($current) > CMbDT::time($datetime)) { $current = $temp_datetime; } $week_a = CMbDT::transform($temp_datetime, null, "%V"); $week_b = CMbDT::transform($datetime, null, "%V");
/** * Format to relative datetime * Example: {$datetime|rel_datetime:$now} * * @param string $datetime The date to format * @param string $reference Reference datetime * * @return string */ function rel_datetime($datetime, $reference = null) { if (!$datetime) { return; } $relative = CMbDate::relative(CMbDT::dateTime($reference), $datetime); return $relative["count"] . " " . CAppUI::tr($relative["unit"] . (abs($relative["count"]) > 1 ? "s" : "")); }
/** * Check the modifiers of the given act * * @param CObject &$modifiers The modifiers to check * @param CActeCCAM &$act The dateTime of the execution of the act * @param CCodable $codable The codable * * @return void */ public static function precodeModifiers(&$modifiers, &$act, $codable) { $date = CMbDT::date(null, $act->execution); $time = CMbDT::time(null, $act->execution); $act->loadRefExecutant(); $act->_ref_executant->loadRefDiscipline(); $discipline = $act->_ref_executant->_ref_discipline; $patient = $codable->loadRefPatient(); $patient->evalAge(); $checked = 0; $spe_gyneco = $spe_gyneco = array('GYNECOLOGIE MEDICALE, OBSTETRIQUE', 'GYNECOLOGIE-OBSTETRIQUE', 'MEDECINE DE LA REPRODUCTION ET GYNECOLOGIE MEDICAL'); $spe_gen_pediatre = array("MEDECINE GENERALE", "PEDIATRIE"); $count_exclusive_modifiers = self::countExclusiveModifiers($act); $store_act = 0; $modifiers_to_add = ""; $achieved = CMbDate::achievedDurations($patient->naissance, CMbDT::date(null, $act->execution)); $patient_age = $achieved["year"]; foreach ($modifiers as $_modifier) { switch ($_modifier->code) { case 'A': $checked = $patient_age < 4 || $patient_age >= 80; $_modifier->_state = $checked ? 'prechecked' : 'not_recommended'; break; case 'E': $checked = $patient->_annees < 5; $_modifier->_state = $checked ? 'prechecked' : 'not_recommended'; break; case 'F': $checked = ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers == 0) && (CMbDT::transform('', $act->execution, '%w') == 0 || CMbDate::isHoliday($date)) && ($time > '08:00:00' && $time < '20:00:00'); if ($checked) { $_modifier->_state = 'prechecked'; } elseif ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers > 0) { $_modifier->_state = 'forbidden'; } else { $_modifier->_state = 'not_recommended'; } break; case "J": $checked = $codable->_class == 'COperation' && CAppUI::pref('precode_modificateur_J'); $_modifier->_state = $checked ? 'prechecked' : null; break; case 'K': $checked = !$act->montant_depassement && ($act->_ref_executant->secteur == 1 || $act->_ref_executant->secteur == 2 && $patient->cmu || $act->_ref_executant->contrat_acces_soins || $act->_ref_executant->option_coordination); if ($checked) { $_modifier->_state = 'prechecked'; } elseif (!in_array($discipline, $spe_gyneco)) { $_modifier->_state = 'not_recommended'; } if (self::isModifierchecked('K', $act) && !$act->montant_depassement) { $checked = true; } break; case 'L': if (self::isModifierchecked('L', $act)) { $_modifier->_state = 'prechecked'; $checked = true; } break; case 'M': $checked = 0; if (!in_array($discipline->text, $spe_gen_pediatre)) { $_modifier->_state = 'not_recommended'; } break; case 'N': $checked = $patient->_annees < 13; $_modifier->_state = $checked ? 'prechecked' : 'not_recommended'; break; case 'P': $checked = ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers == 0) && in_array($discipline->text, $spe_gen_pediatre) && ($time > "20:00:00" && $time < "23:59:59"); if ($checked) { $_modifier->_state = 'prechecked'; } elseif ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers > 0) { $_modifier->_state = 'forbidden'; } else { $_modifier->_state = 'not_recommended'; } break; case 'R': if (self::isModifierchecked('R', $act)) { $_modifier->_state = 'prechecked'; $checked = true; } break; case 'S': $checked = (in_array($discipline->text, $spe_gen_pediatre) || $codable->_class == "COperation" && $codable->_lu_type_anesth) && ($time >= "00:00:00" && $time < "08:00:00") && ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers == 0); if ($checked) { $_modifier->_state = 'prechecked'; } elseif ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers > 0) { $_modifier->_state = 'forbidden'; } else { $_modifier->_state = 'not_recommended'; } break; case 'U': $checked = ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers == 0) && !in_array($discipline->text, $spe_gen_pediatre) && ($time > '20:00:00' || $time < '08:00:00'); if ($checked) { $_modifier->_state = 'prechecked'; } elseif ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers > 0) { $_modifier->_state = 'forbidden'; } else { $_modifier->_state = 'not_recommended'; } break; case "7": $checked = CAppUI::pref('precode_modificateur_7') && $codable->_class == 'COperation' && (isset($codable->anesth_id) || $act->_ref_executant->isAnesth()); if ($checked) { $_modifier->_state = 'prechecked'; } else { $_modifier->_state = $codable->_class == 'COperation' && (isset($codable->anesth_id) || $act->_ref_executant->isAnesth()) ? null : 'not_recommended'; } break; default: $checked = 0; break; } if (!$act->_id && !isset($_modifier->_checked)) { $_modifier->_checked = $checked; } } /* Handle the case where the mods S and U are both prechecked */ if (isset($modifiers['S']) && isset($modifiers['U'])) { $modS =& $modifiers['S']; $modU =& $modifiers['U']; if ($modS->_state == 'prechecked' && $modU->_state == 'prechecked') { $modU->_checked = 0; $modU->_state = 'forbidden'; } } }
/** * Find the next occurence of similar Plageconsult * using the _type_repeat form field * * @return int Number of weeks jumped */ function becomeNext() { $week_jumped = 0; switch ($this->_type_repeat) { case "octuple": $this->date = CMbDT::date("+8 WEEK", $this->date); // 8 $week_jumped += 8; break; case "septuple": $this->date = CMbDT::date("+7 WEEK", $this->date); // 7 $week_jumped += 7; break; case "sextuple": $this->date = CMbDT::date("+6 WEEK", $this->date); // 6 $week_jumped += 6; break; case "quintuple": $this->date = CMbDT::date("+5 WEEK", $this->date); // 5 $week_jumped += 5; break; case "quadruple": $this->date = CMbDT::date("+4 WEEK", $this->date); // 4 $week_jumped += 4; break; case "triple": $this->date = CMbDT::date("+3 WEEK", $this->date); // 3 $week_jumped += 3; break; case "double": $this->date = CMbDT::date("+2 WEEK", $this->date); // 2 $week_jumped += 2; break; case "simple": $this->date = CMbDT::date("+1 WEEK", $this->date); // 1 $week_jumped++; break; case "sameweek": $week_number = CMbDate::weekNumberInMonth($this->date); $next_month = CMbDate::monthNumber(CMbDT::date("+1 MONTH", $this->date)); $i = 0; do { $this->date = CMbDT::date("+1 WEEK", $this->date); $week_jumped++; $i++; } while ($i < 10 && CMbDate::monthNumber($this->date) < $next_month || CMbDate::weekNumberInMonth($this->date) != $week_number); break; default: return ++$week_jumped; } // Stockage des champs modifiés $debut = $this->debut; $fin = $this->fin; $freq = $this->freq; $libelle = $this->libelle; if ($this->_propagation) { $locked = $this->locked; $pour_tiers = $this->pour_tiers; } $color = $this->color; $desistee = $this->desistee; $remplacant_id = $this->remplacant_id; $pour_compte_id = $this->pour_compte_id; // Recherche de la plage suivante $where["date"] = "= '{$this->date}'"; $where["chir_id"] = "= '{$this->chir_id}'"; $where[] = "`debut` = '{$this->debut}' OR `fin` = '{$this->fin}'"; if (!$this->loadObject($where)) { $this->plageconsult_id = null; } // Remise en place des champs modifiés $this->debut = $debut; $this->fin = $fin; $this->freq = $freq; $this->libelle = $libelle; if ($this->_propagation) { $this->locked = $locked; $this->pour_tiers = $pour_tiers; } $this->color = $color; $this->desistee = $desistee; $this->remplacant_id = $remplacant_id; $this->pour_compte_id = $pour_compte_id; $this->updateFormFields(); return $week_jumped; }
static function getPosition($datetime, $time_min, $time_max) { return 100 * (CMbDate::toUTCTimestamp($datetime) - $time_min) / ($time_max - $time_min); }
$mediuser = CMediusers::get(); if ($mediuser->isPraticien()) { $chir = $mediuser->createUser(); } // Type de vue $show_payees = CValue::getOrSession("show_payees", 1); $show_annulees = CValue::getOrSession("show_annulees", 0); // Praticien selectionné $chirSel = CValue::getOrSession("chirSel", $chir ? $chir->user_id : null); // Période $today = CMbDT::date(); $debut = CValue::getOrSession("debut", $today); $debut = CMbDT::date("last sunday", $debut); $fin = CMbDT::date("next sunday", $debut); $debut = CMbDT::date("+1 day", $debut); $bank_holidays = array_merge(CMbDate::getHolidays($debut), CMbDate::getHolidays($fin)); $is_in_period = $today >= $debut && $today <= $fin; $prec = CMbDT::date("-1 week", $debut); $suiv = CMbDT::date("+1 week", $debut); // Plage de consultation selectionnée $plageconsult_id = CValue::getOrSession("plageconsult_id", null); $plageSel = new CPlageconsult(); $canEditPlage = $plageSel->getPerm(PERM_EDIT); if ($plageconsult_id === null && $chirSel && $is_in_period) { $nowTime = CMbDT::time(); $where = array("chir_id" => "= '{$chirSel}'", "date" => "= '{$today}'", "debut" => "<= '{$nowTime}'", "fin" => ">= '{$nowTime}'"); $plageSel->loadObject($where); } if (!$plageSel->plageconsult_id) { $plageSel->load($plageconsult_id); } else {
/** * load Holidays for the current year * * @return array _ref_holidays */ function loadHolidays() { return $this->_ref_holidays = CMbDate::getHolidays($this->date) + CMbDate::getHolidays(CMbDT::date("-1 YEAR", $this->date)); }
$consultation->countDocItems(); } if ($chirSel && $plageSel->chir_id != $chirSel) { $plageconsult_id = null; $plageSel = new CPlageconsult(); } CValue::setSession("plageconsult_id", $plageconsult_id); // Liste des chirurgiens $mediusers = new CMediusers(); $listChirs = $mediusers->loadProfessionnelDeSanteByPref(PERM_EDIT); $listDaysSelect = array(); for ($i = 0; $i < 7; $i++) { $dateArr = CMbDT::date("+{$i} day", $debut); $listDaysSelect[$dateArr] = $dateArr; } $holidays = CMbDate::getHolidays(); // Variable permettant de compter les jours pour la suppression du samedi et du dimanche $i = 0; // Détermination des bornes du semainier $min = CPlageconsult::$hours_start . ":" . reset(CPlageconsult::$minutes) . ":00"; $max = CPlageconsult::$hours_stop . ":" . end(CPlageconsult::$minutes) . ":00"; // Extension du semainier s'il y a des plages qui dépassent des bornes // de configuration hours_start et hours_stop $hours = CPlageconsult::$hours; $min_hour = sprintf("%01d", CMbDT::transform($min, null, "%H")); $max_hour = sprintf("%01d", CMbDT::transform($max, null, "%H")); if (!isset($hours[$min_hour])) { for ($i = $min_hour; $i < CPlageconsult::$hours_start; $i++) { $hours[$i] = sprintf("%02d", $i); } }