Example #1
0
$where = array("bloc_id" => "='{$bloc->_id}'");
$bloc->_ref_salles = $salle->loadListWithPerms(PERM_READ, $where, "nom");
$total_salles = count($bloc->_ref_salles);
$page_size = CAppUI::conf("dPbloc mode_presentation salles_count", $group);
$page_count = null;
$current_page = null;
if ($page) {
    $page_count = ceil($total_salles / $page_size);
    $current_page = ($page - 1) % $page_count;
    $slice = $current_page * $page_size;
    $bloc->_ref_salles = array_slice($bloc->_ref_salles, $slice, $page_size, true);
}
$systeme_materiel_expert = CAppUI::conf("dPbloc CPlageOp systeme_materiel") == "expert";
foreach ($bloc->_ref_salles as &$salle) {
    /** @var CSalle $salle */
    $salle->loadRefsForDay($date_suivi);
    if ($systeme_materiel_expert) {
        foreach ($salle->_ref_plages as $_plage) {
            foreach ($_plage->_ref_operations as $_operation) {
                $besoins = $_operation->loadRefsBesoins();
                CMbObject::massLoadFwdRef($besoins, "type_ressource_id");
                foreach ($besoins as $_besoin) {
                    $_besoin->loadRefTypeRessource();
                }
            }
        }
        foreach ($salle->_ref_urgences as $_operation) {
            $besoins = $_operation->loadRefsBesoins();
            CMbObject::massLoadFwdRef($besoins, "type_ressource_id");
            foreach ($besoins as $_besoin) {
                $_besoin->loadRefTypeRessource();
 * @package    Mediboard
 * @subpackage bloodSalvage
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision:$
 */
CCanDo::checkRead();
$date = CValue::getOrSession("date", CMbDT::date());
$operation_id = CValue::getOrSession("operation_id");
$salle_id = CValue::getOrSession("salle");
// Chargement des praticiens
$listAnesths = new CMediusers();
$listAnesths = $listAnesths->loadAnesthesistes(PERM_READ);
// Liste des blocs
$listBlocs = new CBlocOperatoire();
$listBlocs = $listBlocs->loadGroupList();
// Selection des plages opératoires de la journée
$salle = new CSalle();
if ($salle->load($salle_id)) {
    $salle->loadRefsForDay($date);
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("vueReduite", false);
$smarty->assign("salle", $salle);
$smarty->assign("praticien_id", null);
$smarty->assign("listBlocs", $listBlocs);
$smarty->assign("listAnesths", $listAnesths);
$smarty->assign("date", $date);
$smarty->assign("operation_id", $operation_id);
$smarty->display("inc_liste_plages.tpl");
$default_salles_id = json_decode($default_salles_id);
if (isset($default_salles_id->{"g{$group_id}"})) {
    $default_salle_id = reset(explode("|", $default_salles_id->{"g{$group_id}"}));
}
if (!$salle_id) {
    $salle_id = $default_salle_id;
}
// Chargement des praticiens
$mediuser = new CMediusers();
$listAnesths = $mediuser->loadAnesthesistes(PERM_READ);
// Selection des salles
$listBlocs = CGroups::loadCurrent()->loadBlocs(PERM_READ);
// Selection des plages opératoires de la journée
$salle = new CSalle();
if ($salle->load($salle_id)) {
    $salle->loadRefsForDay($date, true);
}
if ($hide_finished == 1 && $salle->_ref_plages) {
    foreach ($salle->_ref_plages as $_plage) {
        foreach ($_plage->_ref_operations as $_key => $_op) {
            if ($_op->sortie_salle) {
                unset($_plage->_ref_operations[$_key]);
            }
        }
        foreach ($_plage->_unordered_operations as $_key => $_op) {
            if ($_op->sortie_salle) {
                unset($_plage->_unordered_operations[$_key]);
            }
        }
    }
    foreach ($salle->_ref_deplacees as $_key => $_op) {