//create the image from JPEG file
$img = new hft_image($_FILES['bild']['tmp_name']);
$origWidth = $img->image_original_width;
$origHeight = $img->image_original_height;

if ($origWidth < $maxBreite){
	$maxBreite = $origWidth;
}
if ($origHeight < $maxHoehe){
	$maxHoehe = $origHeight;
}

//keep X to Y ratio
//so there will be no geometrical distortions:
$img->resize($maxBreite,$maxHoehe,"-"); 		
//save the resized image to file
//commented to save server load
$img->output_resized($_FILES['bild']['tmp_name']);
//file-upload war erfolgreich:
$pfad = $_FILES['bild']['tmp_name'];
	//mietobjekt speichern:
$bild_id = setBild($pfad,"Tischbild Tisch".$defaultBezeichnung,
			  $img->image_resized_width,$img->image_resized_height,
			  $fileExtension);
*/
//mietobjekt speichern:
setTisch($raum_id, $defaultBezeichnung, $defaultBeschreibung, $minimaleBelegung, $maximaleBelegung, $status, null, $gruppenname);
$anzahlVorhandenerMietobjekte = getAnzahlVorhandeneTische($gastro_id);
$info = true;
$nachricht = "Der Tisch im Raum " . getRaumBezeichnung($raum_id) . " wurde erfolgreich hinzugefügt.";
include_once "./index.php";
$root = "../..";
$ueberschrift = "Tisch bearbeiten";
/*   
	date: 26.9.05
	author: christian osterrieder utilo				
*/
//header einfuegen:
include_once $root . "/backoffice/templates/header.inc.php";
include_once $root . "/backoffice/templates/breadcrumps.inc.php";
$breadcrumps = erzeugenBC($root, "Tisch", "tischBearbeiten/index.php");
include_once $root . "/backoffice/templates/bodyStart.inc.php";
include_once $root . "/include/mietobjektFunctions.inc.php";
?>
<table>
	<?php 
if (getAnzahlVorhandeneTische($gastro_id) > 0) {
    ?>
	<tr height="30">
    	<td><a href="<?php 
    echo $root;
    ?>
/backoffice/tischBearbeiten/tischAendern/index.php"><?php 
    echo getUebersetzung("Tisch ändern");
    ?>
</a></td>
    	<td> - </td>
    	<td><?php 
    echo getUebersetzung("Anzeigen und Ändern von Tischen");
    ?>
.</td>
	</tr>
<?php

$root = "../../..";
$ueberschrift = "Tisch bearbeiten";
$unterschrift = "Löschen";
/*
 * Created on 06.12.2007
 * Author: LI Haitao
 * Company: Alpstein-Austria  
 */
//header einfuegen:
include_once $root . "/backoffice/templates/header.inc.php";
include_once $root . "/backoffice/templates/breadcrumps.inc.php";
$breadcrumps = erzeugenBC($root, "Tisch", "tischBearbeiten/index.php", $unterschrift, "tischBearbeiten/tischLoeschen/index.php");
include_once $root . "/backoffice/templates/bodyStart.inc.php";
$anzahlVorhandTische = getAnzahlVorhandeneTische($gastro_id);
if ($anzahlVorhandTische > 0) {
    ?>

<form action="./tischLoeschenBestaetigen.php" method="post" name="tischLoeschenBestaetigen" target="_self">
  <table>
    <h2><?php 
    echo getUebersetzung("Tisch löschen");
    ?>
</h2>
    <tr>
      <td colspan="2"><?php 
    echo getUebersetzung("Bitte wählen Sie die zu löschenden Tische aus");
    ?>
. 
          <?php 
/**
@author coster
@date 30.07.2007
check of all tables of an gastronomy has the same limitation of a typ
* */
function hasAllTablesWithTableIdSameLimitation($tischnummer, $typ)
{
    global $db;
    global $gastro_id;
    global $root;
    if (empty($db) || empty($gastro_id) || empty($root)) {
        die("Fehler bei globaler Variable.");
    }
    $anzahlEinschr = 0;
    $res = getBuchungseinschraenkungenOfTisch($tischnummer, $typ);
    $d = $res->FetchNextObject();
    $einschraenkungs_id = $d->RESERVIERUNGSEINSCHRAENKUNG_ID;
    $von = getFromDateOfLimitation($einschraenkungs_id);
    $bis = getToDateOfLimitation($einschraenkungs_id);
    $query = "select count(TISCHNUMMER) as anzahl\n\t\t\t   from\n\t\t\t   BOOKLINE_RESERVIERUNGSEINSCHRAENKUNG\n\t\t\t   where\n\t\t\t   TYP = '{$typ}' and\n\t\t\t   VON = '{$von}' and\n\t\t\t   BIS = '{$bis}' \n   \t\t\t  ";
    $res = $db->Execute($query);
    if (!$res) {
        print $db->ErrorMsg();
        die($query);
    } else {
        $res = $db->Execute($query);
        if ($res) {
            $anzahlEinschr = $res->fields["anzahl"];
        }
    }
    include_once $root . "/include/mietobjektFunctions.inc.php";
    $anzahlTische = getAnzahlVorhandeneTische($gastro_id);
    if ($anzahlTische == $anzahlEinschr) {
        return true;
    }
    return false;
}