<?php
/*
* ARBS - Advanced Resource Booking System
* Copyright (C) 2005-2007 ITMC der TU Dortmund
* Based on MRBS by Daniel Gardner <http://mrbs.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
include_once("glob_inc.inc.php");;
$area=(int)$_GET['area'];//the area from mrbs_area
$room=(int)$_GET['room'];//the area from mrbs_area
$category=(int)$_GET['category'];//the area from mrbs_area
$day=(int)$_GET['day'];
$month=(int)$_GET['month'];
$year=(int)$_GET['year'];
print_header($day, $month, $year, $area);
echo "<br><br><table bgcolor=#000000 cellspacing=0 cellpadding=2 align=center><tr><td><table bgcolor=#ffffff width=520 align=center cellspacing=0 cellpadding=3><tr><td bgcolor=#C0E0FF align=center>";
echo "<h3>", _("You successfully booked this room:"), "</h3></td></tr><tr><td><font color=#009900 size=3>";
$t=explode(":",$_GET['confirm']);
foreach($t as $id){
if($id=="")
continue;
$id=(int)$id;
$res=sql_query("SELECT e.room_id,r.room_name from mrbs_entry as e left join mrbs_room as r on e.room_id=r.id WHERE e.id='$id'");
$zeile=mysql_fetch_row($res);
echo "<hr><b>",$zeile[1],":</b><br>";
$sql="SELECT repeat_id,advisor_email,confirmed,type from mrbs_entry WHERE id='".$id."'";
$res=sql_query($sql);
$zeile=mysql_fetch_row($res);
$rid=$zeile[0];
$type=$zeile[3];
$confirmed=$zeile[2];
//entry is part of an repeated entry:
if($rid>0){
$sql="SELECT start_time,end_time FROM mrbs_entry WHERE repeat_id='$rid' ORDER BY start_time";
$csql="UPDATE mrbs_entry SET confirmed=1 WHERE repeat_id='$rid'";
$rep_type=1;
}
else{
$sql="SELECT start_time,end_time FROM mrbs_entry WHERE id='$id'";
$csql="UPDATE mrbs_entry SET confirmed=1 WHERE id='$id'";
$rep_type=0;
}
sql_query($csql);
$res=sql_query($sql);
$advisor_email=$zeile[1];
//mailing
//wenn Email gefunden:
if (strlen($advisor_email)>0) {
//decide by $confirmed if this is a new entry or a changed one
//if entry is already confirmed, we most like got a change
//echo $confirmed;
if($sendmail_user_on_new){
//get Mail-Template
$text = getMailTemplate("new",$rep_type);
$pText = mailParseText($text,$id);
if (strlen($pText)>0){
mailto($advisor_email,$mrbs_robot_email,getSubject($pText),removeSubject($pText));
}
}
}
//send mail if request,not confirmed and not logged in as admin
if($sendmail_admn_on_new&&$confirmed==0&&(authGetUserLevel(getUserName(), $auth["admin"]) < 2)){
//admin-Info
$text = getMailTemplate("adminnew",$rep_type);
$pText = mailParseText($text,$id);
if (strlen($pText)>0){
mailto($mrbs_admin_email,$mrbs_robot_email,getSubject($pText),removeSubject($pText));
}
}
#output list of all entrys for this id (or single entry)
while($zeile=mysql_fetch_row($res)){
echo "<li>", sprintf(_("%s to %s"), date("d.m.y, G:i",$zeile[0]), date("d.m.y, G:i",$zeile[1])), " Uhr<br>";
}
}
?>
</font>
<br><br><center><?php
$res=mysql_query("SELECT room_name,id FROM mrbs_room WHERE id='".((int)$_SESSION['session_last_room_id'])."' LIMIT 0,1");
if(mysql_num_rows($res)>0){
$ars=mysql_fetch_row($res);
echo _("Continue to"), "<a href=week.php?room=", $ars[1], ">", $ars[0], "</a><br/>";
}
echo _("Continue to room"), $startpage;?></center>
</td></tr>
</table></td></tr></table>
<?php
include("trailer.inc.php");
?>