Location: PHPKode > projects > ARBS > arbs-1.5.1.78/edit_entry.php
<?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");


#if user has no bookings yet, start a new array
if(!isset($_SESSION['session_booking_ids'])){
	session_register("session_booking_ids");
	session_register("session_booking_rid");
        $_SESSION['session_booking_ids']=array();#id of booked entry
        $_SESSION['session_booking_rid']=array();#repeat id, set=0 for non-repeating entrys

	#user fields are registered the first time, user field all neccesarry fields in edit_entry_handler.php
}

#If we dont know the right date then make it up
if(!isset($_GET['day']) or !isset($_GET['month']) or !isset($_GET['year'])or !isset($_GET['hour'])or !isset($_GET['minute'])){
	$day   = date("d");
	$month = date("m");
	$year  = date("Y");
	$hour=$morningstarts;
	$minute=0;
}
else{
	$day=(int)$_GET['day'];
	$month=(int)$_GET['month'];
	$year=(int)$_GET['year'];
	$hour=(int)$_GET['hour'];
	$minute=(int)$_GET['minute'];
}
$view=substr(strip_tags($_GET['view']),0,12);//for security reasons strip to 12 chars
$edit_type=substr(strip_tags($_GET['edit_type']),0,12);
$room=(int)(int)$_GET['room'];

if(!isset($_GET['area']))
	$area = get_default_area();
else
	$area=(int)$_GET['area'];



//request to change an entry
if(isset($_GET['id'])){
	$id=(int)$_GET['id'];
	$allow=false;
	if(is_array($_SESSION['session_booking_ids'])){
		foreach($_SESSION['session_booking_ids'] as $val){
			if($val==$id){
				$allow=true;
				break;
			}
		}
	}
	if(!$allow&&!getAuthorised(getUserName(), getUserPassword(), 1)){
		showAccessDenied($day, $month, $year, $area);
		exit;
	}
	else{
		$minOpt="F";
		$maxOpt = "G";
	}
}
else{
	$minOpt = $default_typel;
	$maxOpt = $default_typel;
}
?><HTML><?php

# This page will either add or modify a booking

# We need to know:
#  Name of booker
#  Description of meeting
#  Date (option select box for day, month, year)
#  Time
#  Duration
#  Internal/External

# Firstly we need to know if this is a new booking or modifying an old one
# and if it's a modification we need to get all the old data from the db.
# If we had $id passed in then it's a modification.
if (!isset($_GET['endhour']))
	$endhour = $hour+2;
else
	$endhour=(int)$_GET['endhour'];

if (isset($insertError)){//this is NOT a get variable
	//variablen fuellen
		$room = (int)$_GET['room_id'];
		$start_day=$day;
		$start_month=$month;
		$start_year=$year;
        $start_hour=$hour;
		$start_min=(int)$_GET['minute'];
		$dur_units = $lang[$dur_units];
}
else{
	//id has been registred already
	if (isset($id)){
	
		$sql="SELECT create_by,start_time,end_time,type,room_id,entry_type,repeat_id FROM mrbs_entry WHERE id=$id";

		$res = sql_query($sql);
		if (! $res)
			fatal_error(1, sql_error());
		if (sql_count($res) != 1)
			fatal_error(1, sprintf(_("Entry ID %s not found"), $id));

		$row = sql_row($res, 0);
		sql_free($res);
# Note: Removed stripslashes() calls from name and description. Previous
# versions of MRBS mistakenly had the backslash-escapes in the actual database
# records because of an extra addslashes going on. Fix your database and
# leave this code alone, please.
#some of this variables are obsolute due to changes
		$create_by   = $row[0];
		$start_day   = strftime('%d', $row[1]);
		$start_month = strftime('%m', $row[1]);
		$start_year  = strftime('%Y', $row[1]);
		$end_day   = strftime('%d', $row[2]);
	        $end_month = strftime('%m', $row[2]);
	        $start_year  = strftime('%Y', $row[1]);
	        $start_hour  = strftime('%H', $row[1]);
		$start_min   = strftime('%M', $row[1]);
		$endhour  = strftime('%H', $row[2]);
		$endmin   = strftime('%M', $row[2]);
		$type        = $row[3];
		$room_id     = $row[4];
		$room  = $row[4];
		$entry_type  = $row[5];
		$rep_id      = $row[6];

		#get fields defined in config
		$sql="SELECT ";
		foreach($db_entry_fields as $val){
			$sql.=$val.",";
		}
		$sql.="1 FROM mrbs_entry WHERE id=$id";
		$res=sql_query($sql);
		$zeile=mysql_fetch_row($res);
		foreach($db_entry_fields as $key=>$val){
			$$val=$zeile[$key];
		}
		if(is_array($_SESSION['session_booking_ids'])){
			foreach($_SESSION['session_booking_ids'] as $key=>$val){
				if($val==$id){
					$session_key_to_update=$key;
					break;
				}
			}
			session_register("session_key_to_update");
			$_SESSION['session_key_to_update']=$session_key_to_update;
		}
		if($entry_type >= 1){
			#store key for session_booking_ids array to allow updating in edit_entry_handler.php
			foreach($_SESSION['session_booking_rid'] as $key=>$val){
				if($val==$rep_id){
					$session_key_to_update=$key;
					break;
				}
			}
			session_register("session_key_to_update");
                        $_SESSION['session_key_to_update']=$session_key_to_update;

			$sql = "SELECT rep_type, start_time, end_date, rep_opt, rep_num_weeks
		        FROM mrbs_repeat WHERE id=$rep_id";
			$res = sql_query($sql);
			if (! $res)
				fatal_error(1, sql_error());
			if (sql_count($res) != 1)
				fatal_error(1, sprintf(_("Repeat ID %s not found"), $rep_id));
			$row = sql_row($res, 0);
			sql_free($res);
			$rep_type = $row[0];

			if($_GET['edit_type'] == "series"){
				$start_day   = (int)strftime('%d', $row[1]);
				$start_month = (int)strftime('%m', $row[1]);
				$start_year  = (int)strftime('%Y', $row[1]);

				$rep_end_day   = (int)strftime('%d', $row[2]);
				$rep_end_month = (int)strftime('%m', $row[2]);
				$rep_end_year  = (int)strftime('%Y', $row[2]);

				switch($rep_type){
					case 2:
					case 6:
						$rep_day[0] = $row[3][0] != "0";
						$rep_day[1] = $row[3][1] != "0";
						$rep_day[2] = $row[3][2] != "0";
						$rep_day[3] = $row[3][3] != "0";
						$rep_day[4] = $row[3][4] != "0";
						$rep_day[5] = $row[3][5] != "0";
						$rep_day[6] = $row[3][6] != "0";
						$rep_num_weeks = $row[4];
						break;
					default:
						$rep_day = array(0, 0, 0, 0, 0, 0, 0);
				}
			}
			else{
				$rep_type     = $row[0];
				$rep_end_date = strftime('%A %d %B %Y',$row[2]);
				$rep_opt      = $row[3];
			}
		}
	}
	else{
		# It is a new booking. The data comes from whichever button the user clicked
		$edit_type   = "series";
		$create_by   = getUserName();
		$description = "";
		if(!$allowStartBookingAtWeekend){
			$weekendcheck=date("D",mktime(0,0,0,$month,$day,$year));
			if($weekendcheck=="Sat"||$weekendcheck=="Sun"){
				$insertError=LANG_EH_WEEKEND2;
				if($weekendcheck=="Sat"){
					$day=$day==1?3:$day-1;
				}
                                if($weekendcheck=="Sun"){
					$day=$day>1?$day+1:$day-2;
                                }
			}
		}

                $start_day   = $day;
                $start_month = $month;
                $start_year  = $year;

	        $end_day   = $day;
	        $end_month = $month;
	        $end_year  = $year;

	        $start_hour  = $hour>$lastBookingHour?$lastBookingHour:$hour;
		$start_min   = $minute;
		$endhour  = $hour+2>$eveningends?$eveningends:$hour+2;
		$endmin   = $hour+2>$eveningends?0:$minute;
		$type        = "I";
		$room_id     = $room;
		$rep_id        = 0;
		$rep_type      = 0;
		$rep_end_day   = $day;
		$rep_end_month = $month;
		$rep_end_year  = $year;
		$rep_day       = array(0, 0, 0, 0, 0, 0, 0);
	}
}
//DEFAULT-ORT und PLZ
if (strlen($address_city)==0)
	$address_city=$mrbs_city;
if (strlen($address_zip)==0)
	$address_zip=$mrbs_zip;

//hack to allow institutes value be empty in database but ' ' in select option
if(!isset($id)&&!isset($institute))
	$institute="not_selected";
elseif($institute=="")
	$institute=" ";

//Erkennung ob limitiert & room-name
$sql = "SELECT limit_hour, limit_day, limit_week, comment,room_name
FROM mrbs_room WHERE id='$room'";

$res = sql_query($sql);
if (! $res)
	fatal_error(1, sql_error().$sql);
if (sql_count($res) != 1)
	fatal_error(1, sprintf(_("Room ID %s not found"), $room));

$row = sql_row($res, 0);
sql_free($res);
$limit_hour = $row[0];
$limit_day = $row[1];
$limit_week = $row[2];
$limit_comment = $row[3];
$room_name=htmlspecialchars($row[4]);
$room_limited = ($limit_hour!=0) || ($limit_week!=0); //|| ($limit_day!=0)   uncomment this to restore limit_day capability


#now that we know all the data to fill the form with we start drawing it
if(isset($id)&&!getWritable($create_by, getUserName())){
	showAccessDenied($day, $month, $year, $area);
	exit;
}

print_header($day, $month, $year, $area);

?>
<LINK REL="stylesheet" href="calendar.css" type="text/css">
<script language=JavaScript src=js/cal.js>
</script>
<script language=JavaScript>
var cal_startdate = new CalendarPopup("ARBS_CALdiv1");
cal_startdate.setCssPrefix("ARBS_CAL");
cal_startdate.showNavigationDropdowns();
cal_startdate.setReturnFunction('CP_setStartDate');
cal_startdate.setTodayText('<?php echo(_("Today")); ?>');
function CP_setStartDate(y,m,d){
	sObj=document.getElementById('CP_startday');
	for (var i=0; i<sObj.options.length; i++) with (sObj.options[i]){
      		if(value==d)
			sObj.selectedIndex=i;
	}
        sObj=document.getElementById('CP_startmonth');
        for (var i=0; i<sObj.options.length; i++) with (sObj.options[i]){
                if(value==m)
                        sObj.selectedIndex=i;
        }
        sObj=document.getElementById('CP_startyear');
        for (var i=0; i<sObj.options.length; i++) with (sObj.options[i]){
                if(value==y)
                        sObj.selectedIndex=i;
        }
}

var cal_enddate = new CalendarPopup("ARBS_CALdiv2");
cal_enddate.setCssPrefix("ARBS_CAL");
cal_enddate.showNavigationDropdowns();
cal_enddate.setReturnFunction('CP_setEndDate');
cal_enddate.setTodayText('<?php echo(_("Today")); ?>');

function CP_setEndDate(y,m,d){
        sObj=document.getElementById('CP_endday');
        for (var i=0; i<sObj.options.length; i++) with (sObj.options[i]){
                if(value==d)
                        sObj.selectedIndex=i;
        }
        sObj=document.getElementById('CP_endmonth');
        for (var i=0; i<sObj.options.length; i++) with (sObj.options[i]){
                if(value==m)
                        sObj.selectedIndex=i;
        }
        sObj=document.getElementById('CP_endyear');
        for (var i=0; i<sObj.options.length; i++) with (sObj.options[i]){
                if(value==y)
                        sObj.selectedIndex=i;
        }

}

</script>
<input type=hidden name=CP_dummyinput>
<DIV ID="ARBS_CALdiv1" STYLE="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;"></DIV>
<DIV ID="ARBS_CALdiv2" STYLE="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;"></DIV>

<?php

echo "<table border=0><tr><td colspan=2>";
echo "<h2>";
echo isset($id) ? _("Change entry") : _("Create entry");
echo " - ", $room_name;
if ($db_entry_all_fields_set){
	echo "<br>"; echo _("Personal data is saved");
}
echo "</h2></td><td>";
if($limit_comment!=""){
	echo "<table align=center cellspacing=2 cellpadding=0 bgcolor=#ff0000><tr><td><table width=100% bgcolor=#ffffff cellspacing=0 cellpadding=4><tr><td>",$limit_comment,"</td></tr></table></td></tr></table>";
}
else{
	echo "&nbsp;";
}
?>
</td></tr>

<FORM NAME="main" ACTION="edit_entry_handler.php" METHOD="GET">
<?php
if(isset($insertError)){
?>
	<TR><TD CLASS=CR ><B><?php echo(_("Input error")); ?></B></TD>
  <TD CLASS=CL style="color:red"><?php echo($insertError); ?></TD>
  <TD><!-- Desc --></TD>
  </TR>
<?php
}
foreach($dbfield_structure as $key=>$val){
	echo "<tr><td colspan=3>",($key==""?"&nbsp;":"<b><u>". $key ."</u></b>"), "</td></tr>";
	foreach($val as $v)
		drawFormRow($v);

}
?>


<tr><td colspan=3>&nbsp;</td></tr>
<TR><TD CLASS=CR><B><?php echo(_("Pickup date")); ?></B></TD>
<TD CLASS=CL style="background-color:#DDDDDD">
<?php genDateSelector("", $start_day, $start_month, $start_year,0,"CP_start") ?>&nbsp;
<A HREF="javascript:void(0)" onClick="cal_startdate.select(document.getElementById('CP_dummyinput'),'anchor1x','MM/dd/yyyy'); return false;" NAME="anchor1x" ID="anchor1x"><?php echo(_("Select a date")); ?></A>
<br>
<?php genTimeSelector("hour","minute",$start_hour,$start_min) ?>
Uhr

</TD>
<TD style="background-color:#e0e4f1" rowspan=2>
<?php
if($limit_day>0)
	printf(_("The reservation of this room is restricted to %d days."), $limit_day);
else
	echo "&nbsp;";
?></TD>
</td></TR>
<?php
if (!$room_limited || isset($id)) {
?>
	<TR><TD CLASS=CR><B><?php echo(_("Type:")); ?></B></TD>
	<TD CLASS=CL style="background-color:#DDDDDD">
	<?php genDateSelector2("", $end_day, $end_month, $end_year) ?>&nbsp;
<A HREF="javascript:void(0)" onClick="cal_enddate.select(document.getElementById('CP_dummyinput'),'anchor2x','MM/dd/yyyy'); return false;" NAME="anchor2x" ID="anchor2x"><?php echo(_("Select a date")); ?></A>
<br>

	<?php genTimeSelector("endhour","endminute",$endhour,$endmin) ?>
	Uhr</TD></TR>
<?php
}
#########
#select entry type
#only visible for administrator
########
if(authGetUserLevel(getUserName(), $auth["admin"]) >= 2){
?>
	<TR><TD CLASS=CR><B><?php echo(_("Type:")); ?></B></TD>
	<TD CLASS=CL style="background-color:#DDDDDD"><SELECT NAME="type">
<?php
	for ($c = $minOpt; $c <= $maxOpt; $c++){
		if (!empty($typel[$c]))
			echo "<OPTION VALUE=$c" . ($type == $c ? " SELECTED" : "") . ">$typel[$c]\n";
	}
?>
	</SELECT></TD>
	<TD style="background-color:#e0e4f1">&#160;<!-- Desc --></TD></TR>
<?php
}

if(isset($id)) {
?>
	<INPUT TYPE="HIDDEN" NAME="oldType" VALUE="<?php echo($type) ?>"></INPUT>
<?php
}

if(!$room_limited || isset($id)){
$tag = $end_day - $start_day ;
if (false)  {
// ALL_DAY deaktiviert
?>
<TR>
<TD CLASS=CR><B>&#160;</B></TD>
<TD CLASS=CL style="background-color:#DDDDDD"><INPUT TYPE="RADIO" NAME="dur_type" VALUE='all_day' <?php if ($dur_type=="all_day") echo "checked"; ?>></INPUT><?php echo(_("Whole day")); ?></TD>
</TR>
<?php
}
?>

<?php
if($edit_type == "series"||$_GET['edit_type']=="series") {
?>
	<TR><TD CLASS=CR>&nbsp;</TD><TD CLASS=CL style="background-color:#DDDDDD">
<?php
//hier nur KEINE, $i=0
	$i=0;
	echo "<INPUT NAME=\"rep_type\" TYPE=\"RADIO\" VALUE=\"" . $i . "\"";
	if($i == $rep_type )
		echo " CHECKED";
	echo ">";
	switch($i) {
		case 0:		echo(_("once")); break;
		case 1:		echo(_("daily repeating")); break;
		case 2:		echo(_("weekly repeating")); break;
		case 3:		echo(_("weekly while in the term")); break;
	}
	echo "\n";
?>
	</TD>
	<TD style="background-color:#e0e4f1" rowspan="2">&nbsp;<?php /*echo $lang["duration_description"]*/ ?></TD>
	</TR><TR>
	<TD valign=top><B><?php echo $lang["rep_type"] ?></B></TD>
	<TD CLASS=CL style="background-color:#DDDDDD">
	 <table cellpadding="0" cellspacing="1">
<?php
	for($i = 1; /*isset($lang["rep_type_$i"]) &&*/ $i<3; $i++){
		if ($tag > 0) {
			$i ++ ;
			$tag = 0;
                }
		echo "<tr><td colspan='2'><INPUT NAME=\"rep_type\" TYPE=\"RADIO\" VALUE=\"" . $i . "\"";
		if($i == $rep_type)
			echo " CHECKED";
		echo ">";
		switch($i) {
			case 0:		echo(_("once")); break;
			case 1:		echo(_("daily repeating")); break;
			case 2:		echo(_("weekly repeating")); break;
			case 3:		echo(_("weekly while in the term")); break;
		}
		echo "\n</td></tr>";
	}

?>
 	<tr><td><?php echo(_("Last day of this repetition")); ?></td><td>
	<?php genDateSelector("rep_end_", $rep_end_day, $rep_end_month, $rep_end_year) ?>
 	</td></tr></table></TD></TR>
<?php
//perioden (semester)
	$td = time();
	$sql = "SELECT id, startdate, enddate, title
	        FROM mrbs_periods where enddate>'$td' order by startdate";
	$res = sql_query($sql);
	if ($res && sql_count($res) > 0) {
?>
		<TD CLASS=CR><B>&#160;</B></TD>
		<TD CLASS=CL style="background-color:#DDDDDD">
<?php
		$i=3;
		echo "<INPUT NAME=\"rep_type\" TYPE=\"RADIO\" VALUE=\"" . $i . "\"";
		if($i == $rep_type)
			echo " CHECKED";
		echo ">";
		switch($i) {
			case 0:		echo(_("once")); break;
			case 1:		echo(_("daily repeating")); break;
			case 2:		echo(_("weekly repeating")); break;
			case 3:		echo(_("weekly while in the term")); break;
		}
		echo "\n";
?>
		<BR>
		<SELECT name="period">
<?php
		for ($i = 0; ($row = sql_row($res, $i)); $i++){
			$year = ((date("Y",$row[1])!=date("Y",$row[2])) ? date("y",$row[1])."/".date("y",$row[2]) : date("Y",$row[1]));
			$caption = $row[3]." ".$year." (".date("d.m.y",$row[1])."-".date("d.m.y",$row[2]).")";
			echo "<OPTION value='".$row[0]."'>$caption</OPTION>";
		}
		sql_free($res);
?>
		</SELECT>
		<TD style="background-color:#e0e4f1">
		<?php 
			echo(_("<b>Notice:</b></br>The booking will only be within the term.<br>So we ask you to reserve the weeks till the start of the semester seperately.<br>If the semester has already started, only the remaining time will be reserved."));
		?>
		</TD>
		</TR>
<?php
	}
}
##########
#display end-date of repeatition as read-only text
#########
else{
	$key = "rep_type_" . (isset($rep_type) ? $rep_type : "0");
	echo "<tr><td class=\"CR\"><b>", _("Type of repetition"), "</b></td><td class=\"CL\">";
	switch($i) {
		case 1:		echo(_("daily repeating")); break;
		case 2:		echo(_("weekly repeating")); break;
		case 3:		echo(_("weekly while in the term")); break;
		default:
		case 0:		echo(_("once")); break;
	}
	echo "</td></tr>\n";
	if(isset($rep_type) && ($rep_type != 0)){
		$opt = "";
		if ($rep_type == 2){
			# Display day names according to language and preferred weekday start.
			for ($i = 0; $i < 7; $i++){
				$wday = ($i + $weekstarts) % 7;
				if ($rep_opt[$wday])
					$opt .= day_name($wday) . " ";
			}
		}
		if($opt)
			echo "<tr><td class=\"CR\"><b>", _("Day of repetition:"), "</b></td><td class=\"CL\">$opt</td></tr>\n";
		echo "<tr><td class=\"CR\"><b>", _("Last day of this repetition"), "</b></td><td class=\"CL\">".parseDate($rep_end_date)."</td></tr>\n";
	}
}
//room is limited..
}
else{
	if ($limit_hour==0)
		$limit_hour=12;
?>
	

	<TR><TD CLASS=TL colspan="2">&#160;</TD></TR>
	<TR><TD CLASS=TL colspan="2"><B><U><?php echo(_("Duration and repetition")); ?></U></B></TD>
	<TR>
	<TD CLASS=CR>&#160;</TD>
	<TD CLASS=CL colspan="2"><b>
	<?php echo(_("The duration for booking this room is limited to the following options:")); ?></b>
	</TD>
	</TR>
	<TR>
	<TD CLASS=CR><B>&#160;</B></TD>
	<TD CLASS=CL style="background-color:#DDDDDD">
 	<INPUT TYPE=RADIO NAME="limit_type" VALUE="hour" checked></INPUT><?php echo(_("once")); ?>
	<select name="li_hour"><?php buildSelect(1,$limit_hour,1,1); ?></select> <?php echo(_("Hours")); ?>
	</TD>
	<TD style="background-color:#e0e4f1" rowspan="<?php echo(($limit_day!=0?"2":"1"))?>"><?php echo(_("Please select \"once\" if you just want to book a single event.")); ?></TD>
	</TR>
<?php
	if($limit_day!=0) {
?>
		<TR>
		<TD CLASS=CR><B>&#160;</B></TD>
		<TD CLASS=CL style="background-color:#DDDDDD">
	 	<INPUT TYPE=RADIO NAME="limit_type" VALUE="day"></INPUT><?php echo(_("once")); ?>
	 	<select name="li_day"><?php buildSelect(1,$limit_day,1,1); ?></select> <?php echo(_("Days")); ?>
		</TD></TR>
<?php
	}
	if($limit_week!=0) {
?>
		<TR>
		<TD CLASS=CR><B>&#160;</B></TD>
		<TD CLASS=CL style="background-color:#DDDDDD">
		<table cellpadding=0 cellspacing=0>
		<tr><td>
	 	<INPUT TYPE=RADIO NAME="limit_type" VALUE="week"></INPUT></td>
	 	<td>
	 	<?php echo(_("Number of weeks")); ?>
	 	<select name="li_week"><?php buildSelect(1,$limit_week,1,1); ?></select> <?php echo(_("Weeks")); ?></td></tr>
	 	<tr><td>&#160;</td><td><INPUT TYPE=RADIO NAME="rep_li_type" VALUE="hour" checked></INPUT>
	 	<?php echo(_("Duration per:")); ?><select name="rep_li_hour"><?php buildSelect(1,$limit_hour,1,1); ?></select> <?php echo(_("Hours")); ?></td></tr>
<?php
		if($limit_day!=0) {
			if ($limit_day>7)
				$limit_day=7;
?>
			<tr><td>&#160;</td><td><INPUT TYPE=RADIO NAME="rep_li_type" VALUE="day"></INPUT>
		 	<?php echo(_("Duration per:")); ?><select name="rep_li_day"><?php buildSelect(1,$limit_day,1,1); ?></select> <?php echo(_("Days")); ?></td></tr>
<?php
		}
?>
		</table>
		</TD>
		<TD style="background-color:#e0e4f1"><?php
			echo (_("blubb")); 
		?>
		</TD>
		</TR>
<?php
	}
}
?>
<TR>
<TD>&#160;</td>
<TD colspan=2 align=left>
<p style="color:red">
<?php
printf(_("Notice: Fields marked with %s are mandatory."), star());
?></p>
<INPUT TYPE="submit" name=submitform VALUE="<?php echo(_("Continue")); ?>" onclick="javascript:
<?php if(!isset($id)) {
  ?>
  if(confirm('<?php echo(_("The room")); ?> <?php echo($room_name); ?> <?php echo(_("from")); ?> '+document.main.day.options[document.main.day.selectedIndex].text+'.'+document.main.month.options[document.main.month.selectedIndex].text+'.'+document.main.year.options[document.main.year.selectedIndex].text+' '+document.main.hour.options[document.main.hour.selectedIndex].text+':'+document.main.minute.options[document.main.minute.selectedIndex].text+' <?php echo(_("till")); ?> '+document.main.end_day.options[document.main.end_day.selectedIndex].text+'.'+document.main.end_month.options[document.main.end_month.selectedIndex].text+'.'+document.main.end_year.options[document.main.end_year.selectedIndex].text+' '+document.main.endhour.options[document.main.endhour.selectedIndex].text+':'+document.main.endminute.options[document.main.endminute.selectedIndex].text+' <?php echo(_("book?")); ?>')){
  <?php } else echo "if(true){";?>

document.main.submitform.value='<?php echo(_("Your booking is being checked. Please wait...")); ?>';document.main.submitform.disabled=true;document.main.submit();}">
</TD></TR>
</TABLE>
<INPUT TYPE=HIDDEN NAME="returl"    VALUE="<?php echo $_SERVER['HTTP_REFERER']?>">
<INPUT TYPE=HIDDEN NAME="room_id"   VALUE="<?php echo $room_id?>">
<INPUT TYPE=HIDDEN NAME="view" VALUE="<?php echo $view?>">
<INPUT TYPE=HIDDEN NAME="rep_id"    VALUE="<?php echo $rep_id?>">
<INPUT TYPE=HIDDEN NAME="edit_type" VALUE="<?php echo $edit_type?>">
<?php if(isset($id)) echo "<INPUT TYPE=HIDDEN NAME=\"id\"        VALUE=\"$id\">\n"; ?>
<INPUT Type=HIDDEN NAME="Zeit" VALUE="<?php echo time() ?>">
</FORM>
<?php include("trailer.inc.php"); ?>
Return current item: ARBS