Exemplo n.º 1
0
 /**
  * Récupération des blocages de la salle
  *
  * @param string $date Date de vérification des blocages
  *
  * @return CBlocage[]
  */
 function loadRefsBlocages($date = "now")
 {
     if (!$this->_id) {
         return array();
     }
     if ($date == "now") {
         $date = CMbDT::date();
     }
     $where = array();
     $where["salle_id"] = "= '{$this->_id}'";
     $where[] = "'{$date}' BETWEEN deb AND fin";
     $blocage = new CBlocage();
     return $blocage->loadList($where);
 }
Exemplo n.º 2
0
 */
CCanDo::checkEdit();
$blocage_id = CValue::getOrSession("blocage_id");
$date_replanif = CValue::getOrSession("date_replanif", CMbDT::date());
$date_min = CMbDT::format($date_replanif, "%Y-%m-01");
$date_max = CMbDT::date("-1 day", CMbDT::date("+1 month", $date_min));
$bloc = new CBlocOperatoire();
$where = array("group_id" => "= '" . CGroups::loadCurrent()->_id . "'");
/** @var CBlocOperatoire[] $blocs */
$blocs = $bloc->loadListWithPerms(PERM_READ, $where, "nom");
$blocages = array();
$salles = array();
foreach ($blocs as $_bloc) {
    $salles[$_bloc->_id] = $_bloc->loadRefsSalles();
    foreach ($salles[$_bloc->_id] as $_salle) {
        $blocage = new CBlocage();
        $whereBloc = array();
        $whereBloc["salle_id"] = "= '{$_salle->_id}'";
        $whereBloc[] = "deb <= '{$date_max}' AND fin >= '{$date_min}'";
        $blocages[$_salle->_id] = $blocage->loadList($whereBloc);
    }
}
$smarty = new CSmartyDP();
$smarty->assign("blocs", $blocs);
$smarty->assign("salles", $salles);
$smarty->assign("blocages", $blocages);
$smarty->assign("blocage_id", $blocage_id);
$smarty->assign("date_replanif", $date_replanif);
$smarty->assign("date_before", CMbDT::date("-1 month", $date_replanif));
$smarty->assign("date_after", CMbDT::date("+1 month", $date_replanif));
$smarty->display("inc_list_blocages.tpl");