$patients = CStoredObject::massLoadFwdRef($sejours, "patient_id");
$dossiers = CStoredObject::massLoadBackRefs($patients, "dossier_medical");
CDossierMedical::massCountAllergies($dossiers);
// Récupération des commentaires
$commentaire = new CCommentairePlanning();
$where = array();
$where["debut"] = " <= '{$date_planning} 23:59:59'";
$where["fin"] = " >= '{$date_planning} 00:00:00'";
$where["salle_id"] = CSQLDataSource::prepareIn($salles_ids);
$commentaires = $commentaire->loadListWithPerms(PERM_READ, $where);
// Récupération des plages opératoires
$plageop = new CPlageOp();
$where = array();
$where["date"] = " = '{$date_planning}'";
$where["salle_id"] = CSQLDataSource::prepareIn($salles_ids);
$plages = $plageop->loadListWithPerms(PERM_READ, $where);
// Création du planning
$planning = new CPlanningWeek(0, 0, count($salles), count($salles), false, "auto");
$planning->title = "Planning du " . CMbDT::format($date_planning, CAppUI::conf("longdate"));
//load the current bloc
if (isset($current_bloc)) {
    $planning->title .= " - {$current_bloc->nom}";
}
$planning->guid = "planning_interv";
$planning->hour_min = str_pad(CAppUI::conf("reservation debut_planning"), 2, 0, STR_PAD_LEFT);
$planning->dragndrop = $planning->resizable = CCanDo::edit() ? 1 : 0;
//hack for "false => 0"
$planning->hour_divider = 12;
$planning->show_half = true;
$i = 0;
$today = CMbDT::date();