Example #1
0
     echo "<br><br>" . $queryexec;
 }
 $listrooms = "";
 while ($row = $stmt->fetch(PDO::FETCH_BOTH)) {
     $listrooms .= $row["ID"] . ",";
 }
 $stmt = null;
 $listrooms = substr($listrooms, 0, -1);
 //SONDERFALL: Es kann vorkommen, dass Räume im Filter stehen, diese aber nicht existieren. Dann würdeen die folgenden Queries einen Teil absetzen, der "... where id IN () " enthält.
 //Die leere Klammer führt aber zu einem Fehler in SQL, da mindestens ein Argutment erwartet wird. Deshalb muss im Falle einer leeren $listrooms einfach 0 übergeben werden (Id 0 existiert nicht)
 if ($listrooms == "") {
     $listrooms = 0;
 }
 //Selektiere alle IDs der verschiedenen Terminarten während des Zeitraums und erzeuge eine Liste
 $listappointments = "";
 $listappointments .= getAppointmentsWithoutRepetition($start, $ende, $listrooms);
 if ($debug == 1) {
     echo $listappointments;
 }
 $listappointments .= getWeeklyAppointmentsWithEnd($start, $ende, $listrooms);
 if ($debug == 1) {
     echo $listappointments;
 }
 $listappointments .= getWeeklyAppointmentsWithoutEnd($start, $ende, $listrooms);
 if ($debug == 1) {
     echo $listappointments;
 }
 $listappointments .= getDailyAppointments($start, $ende, $listrooms);
 if ($debug == 1) {
     echo $listappointments;
 }
Example #2
0
/**
 * Diese Funktion ermittelt alle Termine zu einer bestimmten Resource, wie Raum,Kurs,Dozent,...
 * Dabei werden die Serientermine von RAPLA berücksichtigt (weekly,daily)
 */
function getAppointmentByResource($start, $ende, $id_resources)
{
    global $dbh;
    $listappointments = "";
    //Prüfe Übergabeparameter: Muss mit einem Wert belegt sein
    if (!isset($id_resources) || $id_resources == "") {
        throw new Exception("Der Übergabeparameter Ressourcen-ID ist leer!");
    }
    $listappointments .= getAppointmentsWithoutRepetition($start, $ende, $id_resources);
    $listappointments .= getWeeklyAppointmentsWithEnd($start, $ende, $id_resources);
    $listappointments .= getWeeklyAppointmentsWithoutEnd($start, $ende, $id_resources);
    $listappointments .= getDailyAppointments($start, $ende, $id_resources);
    $listappointments = substr($listappointments, 0, -1);
    if (!isset($listappointments) || $listappointments == "") {
        $listappointments = "0";
    }
    $queryexec = "select *, unix_timestamp(APPOINTMENT_START) as begin_ts, unix_timestamp(APPOINTMENT_END) as end_ts \r\n\tfrom appointment where id in({$listappointments}) order by hour(APPOINTMENT_START),minute(APPOINTMENT_START) asc";
    $stmt = $dbh->prepare($queryexec);
    $stmt->execute();
    if ($GLOBALS["debug"] == 1) {
        echo "<br><br>" . $queryexec;
    }
    $result = $stmt->fetchAll();
    $stmt = null;
    return $result;
}