Example #1
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;
 }
 //letztes Komma abschneiden
 $listappointments = substr($listappointments, 0, -1);
 //Selektiere alle Räume, in denen im Zielzeitraum keine Vorlesung ist. --> Raum ist dann frei
 if ($listappointments == "") {
     $listappointments = "''";
 }
 //das IN Statement darf nicht leer sein, sonst kommt ein Fehler: Passiert wenn keine Vorlesung stattfindet momentan(Nachts,Abends)
 $queryexec = "select ID,rav." . DBCOL_RESOURCE_ATTRIBUTE_VALUE . " as VALUE from rapla_resource rr right outer join resource_attribute_value rav on \r\n\t\trr.ID = rav.RESOURCE_ID\r\n\t\tinner join resource_attribute_value rav2 on (rr.ID = rav2.RESOURCE_ID)\r\n\t\twhere rav.ATTRIBUTE_KEY = 'name' and \r\n\t\tid not in  (\r\n\t\t\t\tSELECT RESOURCE_ID FROM allocation a inner join rapla_resource rr on a.RESOURCE_ID = rr.ID where TYPE_KEY = '" . DBKEY_ROOM . "' and APPOINTMENT_ID IN (\r\n\t\t\t\t'{$listappointments}'\r\n\t\t\t\t)\r\n\t\t)\r\n\t\tand type_key = '" . DBKEY_ROOM . "' and rav." . DBCOL_RESOURCE_ATTRIBUTE_VALUE . " not in ({$filterRooms}) ";
 //distinguish between newer and older RAPLA versions
 if (DBCOL_RESOURCE_ATTRIBUTE_VALUE == "attribute_value") {
     $queryexec .= " and rav2." . DBCOL_RESOURCE_ATTRIBUTE_VALUE . " = " . $roomCategory;
 } else {
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;
}