예제 #1
0
$prat_id = CValue::getOrSession("praticien_id");
$function_id = CValue::get("function_id");
if (!$prat_id && !$function_id) {
    $prat_id = $user->_id;
}
$prat = new CMediusers();
$where = array();
if ($function_id) {
    $where["function_id"] = " = '{$function_id}'";
} else {
    $where["user_id"] = " = '{$prat_id}'";
}
$prats = $prat->loadList($where);
$function = new CFunctions();
$function->load($function_id);
$ds = $function->getDS();
$calendar = new CPlanningMonth($date);
$calendar->title = htmlentities(CMbDT::format($date, "%B %Y"));
foreach ($prats as $_prat) {
    // plages de congés (si mode prat)
    if (!$function_id && CModule::getActive("dPpersonnel")) {
        $plage_cong = new CPlageConge();
        $plages_cong = $plage_cong->loadListForRange($_prat->_id, $calendar->date_min, $calendar->date_max);
        foreach ($plages_cong as $_conge) {
            $first_day = $_conge->date_debut;
            $last_day = $_conge->date_fin;
            $replaced_by = new CMediusers();
            $replaced_by->load($_conge->replacer_id);
            while ($last_day >= $first_day) {
                $calendar->addClassesForDay("disabled", $first_day);
                if ($replaced_by->_id) {