function updateAssign($check_locks = true)
    {
        global $TERMIN_TYP;

        $query = "SELECT termin_id FROM termine WHERE range_id = ?";
        $statement = DBManager::get()->prepare($query);
        $statement->execute(array($this->seminar_id));
        while ($termin_id = $staetment->fetchColumn()) {
            $result = array_merge((array)$result, (array)$this->changeDateAssign($termin_id));
        }
        //kill all assigned rooms (only roomes and only resources assigned directly to the Veranstaltung, not to a termin!) to create new ones
        $this->deleteAssignedRooms();

        //Raumanfrage als bearbeitet markieren, wenn vorhanden
        if(get_config('RESOURCES_ALLOW_ROOM_REQUESTS')){
            $request = new RoomRequest(getSeminarRoomRequest($this->seminar_id));
            if (!$request->isNew()){
                $request->checkOpen(true);
            }
        }
        return $result;
    }
Example #2
0
    /**
     * this function returns a human-readable status of a room-request, if any, false otherwise
     *
     * the int-values of the states are:
     *  0 - room-request is open
     *  1 - room-request has been edited, but no confirmation has been sent
     *  2 - room-request has been edited and a confirmation has been sent
     *  3 - room-request has been declined
     *
     * they are mapped with:
     *  0 - open
     *  1 - pending
     *  2 - closed
     *  3 - declined
     *
     * @return string the mapped text
     */
    public function getRoomRequestStatus()
    {
        // check if there is any room-request
        if (!$this->request_id) {
            $this->request_id = getSeminarRoomRequest($this->id);

            // no room request found
            if (!$this->request_id) return FALSE;
        }

        // room-request found, parse int-status and return string-status
        if (!$this->room_request) {
            $this->room_request = new RoomRequest($this->request_id);
            if ($this->room_request->isNew()) {
                throw new Exception("Room-Request with the id {$this->request_id} does not exists!");
            }
        }

        switch ($this->room_request->getClosed()) {
            case '0'; return 'open'; break;
            case '1'; return 'pending'; break;
            case '2'; return 'closed'; break;
            case '3'; return 'declined'; break;
        }

        return FALSE;
    }