$block->setNote($_POST['infos']); $block->setRecursion('7'); $block->setIdDoctor($_SESSION['user']->getIdMember()); $errors['blocage-horaires'] = SchedulesManager::instance()->addBlock($block); } } } else { $errors['blocage-horaires'] = new Error("Veuillez indiquer le nombre de semaines pour la récursivité"); } } else { $block = new Schedule(); $block->setDateStart(strtotime($_POST['ddebut'] . " " . $_POST['hdebut'] . ":0")); $block->setDateStop(strtotime($_POST['dfin'] . " " . $_POST['hfin'] . ":0")); $block->setNote($_POST['infos']); $block->setRecursion('0'); $block->setIdDoctor($_SESSION['user']->getIdMember()); $errors['blocage-horaires'] = SchedulesManager::instance()->addBlock($block); } } else { $errors['blocage-horaires'] = new Error("Veuillez remplir tous les champs correctement"); } } else { $errors['blocage-horaires'] = new Error("Veuillez remplir tous les champs correctement"); } } //Suppresion d'un blocage if (isset($_GET['del']) and isset($_GET['id'])) { if ($_GET['del'] == "delete") { //SchedulesManager::instance()->deleteBlock($_GET['id']); SchedulesManager::instance()->deleteBlock($_SESSION['user']->getIdMember(), $_GET['id']); }
} } if (!isset($_GET['start']) or !isset($dateStart)) { $dateStart = new DateTime(date("Y-m-d H:i:s")); } } else { Tools::redirect("home"); } } else { Tools::redirect("home"); } //PRISE D'UN RENDEZ-VOUS if (isset($_POST['date-rdv']) and isset($_POST['time-rdv']) and isset($_POST['tk']) and $_POST['tk'] == $_SESSION['token2'] and $_SESSION['user']->getIdMember() != $_GET['doctor']) { if (Tools::checkDate($_POST['date-rdv']) and Tools::checkTime($_POST['time-rdv']) and isset($_POST['valid-rdv'])) { $sc = new Schedule(); $sc->setIdDoctor($doctor->getIdMember()); $sc->setIdMember($_SESSION['user']->getIdMember()); $sc->setDateStart(strtotime($_POST['date-rdv'] . " " . $_POST['time-rdv'] . ":00")); $sc->setDateStop($sc->getDateStart() + $doctor->getRdvDuration() * 60); if ($doctor->getRdvConfirm() == 0) { $sc->setValidate(1); } if (isset($_POST['note'])) { $sc->setNote(Tools::secure($_POST['note'])); } $dayStartHour = strtotime($_POST['date-rdv'] . " " . $doctor->getStartHour('h') . ":" . $doctor->getStartHour('m') . ":00"); $result = SchedulesManager::instance()->getLastBlockedBlockHour($doctor->getIdMember(), $dayStartHour, $sc->getDateStart()); $calage = abs($sc->getDateStart() - $result); $calage = $calage % ($doctor->getRdvDuration() * 60); if ($calage != 0) { $errors['rdv'] = new Error("Vous ne pouvez pas prendre un rendez-vous en dehors des heures fixées par le calendrier.");