*/
global $can, $m, $tab;
CCanDo::checkRead();
$hors_plage = new CIntervHorsPlage();
if (!$hors_plage->canRead()) {
    $can->redirect();
}
// Toutes les salles des blocs
$listBlocs = CGroups::loadCurrent()->loadBlocs(PERM_READ);
// Les salles autorisées
$salle = new CSalle();
$listSalles = $salle->loadListWithPerms(PERM_READ);
// Liste des Etablissements selon Permissions
$etablissements = CMediusers::loadEtablissements(PERM_READ);
// Chargement des prestations
$prestations = CPrestation::loadCurrentList();
$operation_id = CValue::getOrSession("operation_id");
$chir_id = CAppUI::conf("dPplanningOp COperation use_session_praticien") ? CValue::getOrSession("chir_id") : CValue::get("chir_id");
$sejour_id = CValue::get("sejour_id");
$hour_urgence = CValue::get("hour_urgence");
$min_urgence = CValue::get("min_urgence");
$date_urgence = CValue::get("date_urgence");
$salle_id = CValue::get("salle_id");
$patient_id = CValue::get("pat_id");
$grossesse_id = CValue::get("grossesse_id");
$consult_related_id = CValue::get("consult_related_id");
// L'utilisateur est-il un praticien
$user = $chir = CMediusers::get();
if ($chir->isPraticien() and !$chir_id) {
    $chir_id = $chir->user_id;
}
CSejour::massCountPrestationSouhaitees(array($sejour));
foreach ($operations as $operation) {
    $operation->loadRefsActes();
    $dossier_anesth = $operation->loadRefsConsultAnesth();
    $consultation = $dossier_anesth->loadRefConsultation();
    $consultation->loadRefPlageConsult();
    $dossier_anesth->_date_consult = $consultation->_date;
}
if (CAppUI::conf("dPadmissions show_deficience")) {
    CDossierMedical::massCountAntecedentsByType(array($dossier_medical), "deficience");
}
$list_mode_entree = array();
if (CAppUI::conf("dPplanningOp CSejour use_custom_mode_entree")) {
    $mode_entree = new CModeEntreeSejour();
    $where = array("actif" => "= '1'");
    $list_mode_entree = $mode_entree->loadGroupList($where);
}
$smarty = new CSmartyDP();
$smarty->assign("_sejour", $sejour);
$smarty->assign("date_min", $date_min);
$smarty->assign("date_max", $date_max);
$smarty->assign("date_actuelle", $date_actuelle);
$smarty->assign("date_demain", $date_demain);
$smarty->assign("list_mode_entree", $list_mode_entree);
$smarty->assign("prestations", CPrestation::loadCurrentList());
$smarty->assign("canAdmissions", CModule::getCanDo("dPadmissions"));
$smarty->assign("canPatients", CModule::getCanDo("dPpatients"));
$smarty->assign("canPlanningOp", CModule::getCanDo("dPplanningOp"));
$smarty->assign("single_line", true);
// Indique qu'on charge la ligne seulement (pour les evenements de formulaire)
$smarty->display("inc_vw_admission_line.tpl");