X-Git-Url: https://git.rohieb.name/iserv-mod-room-reservation.git/blobdiff_plain/b4fea5220b8c3fd880137f0f83d27b31f794860a..35b2b9d62465708e68835641ba737cd8bdcc4b9c:/inc/mod_roomReservationRoomsManager.inc
diff --git a/inc/mod_roomReservationRoomsManager.inc b/inc/mod_roomReservationRoomsManager.inc
index edce221..2ceb1b9 100644
--- a/inc/mod_roomReservationRoomsManager.inc
+++ b/inc/mod_roomReservationRoomsManager.inc
@@ -5,7 +5,6 @@
* @author Roland Hieber (roland.hieber@wilhelm-gym.net)
* @date 28.12.2007
*
- * TODO: move into M Class Library
* Copyright © 2007 Roland Hieber
*
* Permission is hereby granted, free of charge, to any person obtaining
@@ -32,6 +31,8 @@ require_once("mod_room-reservation/functions.inc");
require_once("mod_room-reservation/mod_roomReservationRoom.inc");
require_once("mod_room-reservation/mod_roomReservationConfig.inc");
+db_user("roomreservation");
+
/** Simple class for creating, editing and deleting rooms */
class mod_roomReservationRoomsManager {
/** (mod_roomReservationConfig) Reference to the configuration */
@@ -46,72 +47,6 @@ class mod_roomReservationRoomsManager {
public function __construct(mod_roomReservationConfig &$oCfg) {
$this->oCfg = $oCfg;
}
-
- /**
- * Insert or update a room in the database
- * param $or (rsRoom) Room to store in the database
- * return (int) The UID of the booking, or -1 in case of a failure.
- * Call getLastError() to get more information about the error.
- */
-/** public function write(rsRoom $or) {
- // Only administrators are allowed to create and alter rooms
- if(!$this->oCfg->userIsAdmin()) {
- // TODO throw exception
- setLastError(RS_ERROR_ACCESS_DENIED);
- return -1;
- }
-
- $strWhere = "";
- $strLog = "";
-
- // Update or insert?
- if($or->getUid() == null) {
- // No UID yet, insert new room
- $strLog = sprintf("Raum â%sâ angelegt", $or->getName());
- } else {
- $strWhere = "rsr_uid = ".qp(intval($or->getUid()));
- $strLog = sprintf("Raum â%sâ geändert", $or->getName());
- }
-
- $aPut["rsr_name"] = $or->getName();
- db_store("rooms", $aPut, $strWhere == "" ? null : $strWhere);
-
- $hQuery = db_query("SELECT currval('roomschedule_rooms_rsr_uid_seq') ".
- "FROM roomschedule_rooms;");
- $nNewUid = pg_fetch_result($hQuery, 0, "currval");
-
- rrInsertLog($strLog);
-
- // Return new UID
- return $nNewUid;
- }
- */
- /**
- * Delete a room from the database
- * param $nUid (int) Unique ID of the room
- * return (bool) true on success, otherwise false.
- * Call getLastError() to get more information about the error.
- */
-/* public function delete($nUid) {
- // Only administrators are allowed to delete rooms
- if(!$this->oCfg->userIsAdmin()) {
- // TODO throw exception
- setLastError(RS_ERROR_ACCESS_DENIED);
- return false;
- }
- // Delete it from the database
- $strRoom = $this->getRoomName($nUid);
- if(!db_query("DELETE FROM roomschedule_rooms WHERE rsr_uid = $1;",
- intval($nUid))) {
- // TODO throw exception
- setLastError(RS_ERROR_SQL);
- return false;
- } else {
- rsInsertLog(sprintf("Raum â%sâ gelöscht", $strRoom));
- return true;
- }
- }
-*/
/**
* Get a room by its OID. Returns null if the room was not found.