Location: PHPKode > projects > ARBS > arbs-1.5.1.78/checkrepeater.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(!getAuthorised(getUserName(), getUserPassword(), 1)){
        showAccessDenied($day, $month, $year, $area);
        exit;
}
$dm=90;//look $dm days past
$entryid=(int)$_GET['id'];
$res=mysql_query("SELECT e.room_id,e.repeat_id,e.title,e.start_time,r.room_name FROM mrbs_entry AS e LEFT JOIN mrbs_room AS r ON r.id=e.room_id WHERE e.ID=$entryid LIMIT 0,1");
$zeile=mysql_fetch_row($res);
$room=$zeile[0];
$repeat=$zeile[1];
$title=$zeile[2];
$start=$zeile[3];
$rn=$zeile[4];

$res=mysql_QUERY("SELECT start_time,end_time FROM mrbs_entry WHERE room_id=$room AND (repeat_id=0 OR repeat_id !=".$repeat.") AND start_time<$start AND start_time>".($start-3600*$dm*24)." AND title ='$title'");
if(mysql_num_rows($res)>0){
	printf(_("The device %s has also been reserved by %4\$s in the time between %2\$s and %3\$s at the following times:"), "<i>".$rn."</i>", date("d.m.Y",$start-3600*24*$dm), date("d.m.Y",$start), '"'.$title.'"');
    while($zeile=mysql_fetch_row($res)){
    	printf(_("%s to %s"), date("d.m.Y H:i",$zeile[0]), date("d.m.Y H:i",$zeile[1]));
    	echo "<br>";
    }
}
else{
printf(_("This device <b>hasn't been reserved</b> between %2\$s and %3\$s by %1\$s."), "<i>".$rn."</i>", date("d.m.Y",$start-3600*24*$dm), date("d.m.Y",$start), '"'.$title.'"');
}
echo "<a href=javascript:window.close()>", _("Close this window"), "</a>";
?>

Return current item: ARBS