<?php
// check if classes are valid
$strKlasse = '';
function __autoload($strKlasse)
{ try { if(!preg_match('=^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$=m',$strKlasse))
{ throw new Exception("Class '$strKlasse' is not valid."); }
$strIncludeFile = 'classes/'.$strKlasse. '.class.php';
if (!file_exists($strIncludeFile))
{ throw new Exception("Include file <i>$strIncludeFile</i> not found.<br>"); }
require_once($strIncludeFile);
if(!class_exists($strKlasse))
{ throw new Exception("Include file <i>$strIncludeFile</i>
contains no class '$strKlasse'.<br>"); }
return true; }
catch(Exception $e)
{ die($e->getMessage()); }
}
?>
<html>
<head>
<title>MyRentABike / Manage vehicles / data </title>
<link href="css/filesqlite.css" rel="stylesheet" media="screen">
</head>
<body>
<a href="index.html">back</a>
<h3>MyRentABike / Manage vehicle fleet</h3>
<p>
<?php
$vrview = new VRViewAll();
if(isset($_GET['id'])) {
try {
$id = $_GET['id'];
$num = $_GET['num'];
$rep = $_GET['rep'];
$repend = $_GET['repend'];
$end = $_GET['end'];
$junk = $_GET['junk'];
$miete = $_GET['miete'];
$quantity = $_GET['miete'];
$marke = $_GET['marke'];
$vid = $_GET['vid'];
$priceklasse = $_GET['preisklasse'];
// id with correct format
$vrview->isId($id);
// quantity with correct format
$vrview->isQuantity($num);
// error exceptions
} catch(IdException $e) {
die($e->getMessage());
} catch(QtyException $e) {
die($e->getMessage());
} catch (Exception $e) {
print $e;
exit();
}
}
$vrview->openFile();
echo $vrview->htmlvehicle;
if(isset($_POST['submitMietdatum'])) {
$mietstdatum = $_POST['mietstartdatum'];
$mietenddatum = $_POST['mietenddatum'];
$setmiete = $_POST['setmiete'];
try {
// if not correct start date, end date or similar dates call exception
$vrview->isStartDate($mietstdatum);
$vrview->isReturnDate($mietenddatum);
$vrview->isCompareDate($mietstdatum,$mietenddatum);
// error exceptions
} catch(StartDateException $e) {
die($e->getMessage());
} catch(ReturnDateException $e) {
die($e->getMessage());
} catch(CompareDateException $e) {
die($e->getMessage());
} catch (Exception $e) {
print $e;
exit();
}
}
$vredit = new VRProcessFile($counter,$marke,$rahmen,$sattel,$raeder,$antrieb,
$farbe,$alter,$type,$preisklasse,$date);
if(isset($id) && !isset($rep) && !isset($repend) && !isset($junk)) {
// is there a customer who has rent a bike
$rcount = new VRCounter();
if($rcount->countSingleRentRecord($vid) == 0) {
die("<span class=\"mess\">This vehicle is not rented by someone.</span>");
} else { $rcount->vid = $vid; }
echo $vrview->showDetails($num,$id,$quantity,$vid,$mietstdatum,$mietenddatum,$setmiete);
}
if(isset($rep)) {
if($vredit instanceof VRProcessFile) {
$vredit->setRepStatus($num,$id,$rep,$miete); }
}
if(isset($repend)) {
if($vredit instanceof VRProcessFile) {
$vredit->endRepStatus($num,$id,$repend,$miete); }
}
if(isset($junk)) {
if($vredit instanceof VRProcessFile) {
$vredit->setEntsorgtStatus($num,$id,$end,$junk); }
}
?></p>
</body>
</html>