Source for file class.ADMINBLOCKADEN.php
Documentation is available at class.ADMINBLOCKADEN.php
* Verwaltet die Adminitration der Datenbanktabelle 'blockaden'
* @author Kay Koch, <kay.koch@gmx.de>
* @subpackage foundation_admin
die('This file was generated for PHP 5');
* Parentklasse zur Administration der Tabellen
* @author Kay Koch, <kay.koch@gmx.de>
require_once ('src/foundation/admin/class.PARENTADMIN.php');
* Interface zur Administration der Datenbank
require_once ('src/interfaces/interface.ADMININTERFACE.php');
/* user defined includes */
// section -64--88-122--2--78ecc2cb:103d1b5ef00:-7fc5-includes begin
// section -64--88-122--2--78ecc2cb:103d1b5ef00:-7fc5-includes end
/* user defined constants */
// section -64--88-122--2--78ecc2cb:103d1b5ef00:-7fc5-constants begin
// section -64--88-122--2--78ecc2cb:103d1b5ef00:-7fc5-constants end
* Verwaltet die Adminitration der Datenbanktabelle 'blockaden'
* @author Kay Koch, <kay.koch@gmx.de>
* @subpackage foundation_admin
* Objekt der aktellen Datenbankklasse
* Array mit den Feldnamen der aktuellen Datebank
* Name des Haupttemplates
* Möglichkeiten, Daten zu blockieren
* zeigt alle Einträge einer Tabelle
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2--6176e79b:103fa06a375:-7fad begin
foreach ($this->arrOldData as $this->data) { // alle Seen
$this->seename =
$this->getSeen($this->data['see_id'])->name;
$this->realstunde =
($this->data['ganzerTag']) ?
"ganztägig" :
$this->data['stunde'];
$this->data['anzahlStunden'] =
($this->data['ganzerTag']) ?
"" :
$this->data['anzahlStunden'];
$this->oVereine->setParams($this->data['verein_nr']);
$this->data['info'] =
(!empty ($this->data['info'])) ?
$this->oVereine->name .
", " .
$this->data['info'] :
$this->oVereine->name;
switch ($this->data['wiederholung']) {
// section -64--88-122--2--6176e79b:103fa06a375:-7fad end
* liefert ein Formular zur Änderung bzw. Neueingabe eines Datensatzes
* Wenn die Tabellenspezifischen Parameter vorhergesetzt wurden wird der
* Datensatz ausgegeben. Ansonsten erscheint ein leeres Formular
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2--6176e79b:103fa06a375:-7fa9 begin
if (!empty ($this->block_id) AND !empty ($this->arrOldData)) {
$startTime =
$this->oSeen->getSeen($this->data['see_id'])->getStartTime($this->data['datum']);
if (!empty ($this->data['see_id'])) {
$startTime =
$this->oSeen->getSeen($this->data['see_id'])->getStartTime($this->data['datum']);
$this->data['datum'] =
date("Y-m-").
"01";
$this->data['anzahlZahler'] =
"0";
$this->data['anzahlStunden'] =
"1";
$this->data['stunde'] =
$this->oSeen->getMinStartTime();
$startTime =
$this->data['stunde'];
list
($this->data['jahr'], $m, $d) =
split("-", $this->data['datum']);
$this->vereinOptionList =
$this->getVereinOptionList($this->data['verein_nr']);
$this->seeOptionList =
$this->oSeen->getOptionList($this->data['see_id']);
$this->repeatOptionList =
$this->getRepeatOptionList($this->data['wiederholung']);
$this->checked =
($this->data['ganzerTag']) ?
"checked" :
"";
$this->readonly =
($this->data['ganzerTag']) ?
"readonly" :
"";
// section -64--88-122--2--6176e79b:103fa06a375:-7fa9 end
* Aktualisieet den vorher durch setzen der Parameter ausgewählten
* Die Neuen Daten befinden sich im Übergabefeld $data
* @author Kay Koch, <kay.koch@gmx.de>
public function update($data) {
// section -64--88-122--2--6176e79b:103fa06a375:-7f83 begin
$this->oVereine->setParams($data['verein_nr']);
$this->checkHoleDay($data);
$this->oNF->blockDates($data);
$oBuchungen->blockDates($data);
$this->oBlock->updateRow($data);
$this->saveRegularyBlockInfo();
// section -64--88-122--2--6176e79b:103fa06a375:-7f83 end
* Löscht den Datensatz der vorher durch Parameter ausgewählt wurde
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2--6176e79b:103fa06a375:-7f7f begin
$this->oBlock->deleteRow();
// section -64--88-122--2--6176e79b:103fa06a375:-7f7f end
* Fügt einen neuen Datensatz mit den Werten des Übergabeparameter $data
* @author Kay Koch, <kay.koch@gmx.de>
public function insert($data) {
// section -64--88-122--2--6176e79b:103fa06a375:-7f7d begin
$this->checkHoleDay($data);
$this->oBlock->insertRow($data);
$data['block_id'] =
$this->oBlock->block_id;
$this->oNF->blockDates($data);
$oBuchungen->blockDates($data);
// section -64--88-122--2--6176e79b:103fa06a375:-7f7d end
* überprüft die Korrektheit der eingebenen bzw. geänderten Daten
* @author Kay Koch, <kay.koch@gmx.de>
$returnValue = (bool)
false;
// section -64--88-122--2--62c31de:1048594e50f:-7fef begin
$data['ganzerTag'] =
(isset
($data['ganzerTag']) AND $data['ganzerTag'] ==
1) ?
"1" :
"0";
throw
new Exception("19,Seename");
if (empty ($data['verein_nr']))
throw
new Exception("26,VereinNr");
throw
new Exception("26,VereinNr");
if (empty ($data['tag']) or empty ($data['monat']) or empty ($data['jahr']))
throw
new Exception("49,Datum");
if (!isset
($data['datum']) or empty ($data['datum']))
throw
new Exception("51,Datum");
throw
new Exception("52,Stunde");
if (!$this->oSeen->getSeen($data['see_id'])->isInDiveRange($data['datum'], $data['stunde']))
throw
new Exception("111,Datum/Stunde");
throw
new Exception("28,Anzahl");
if (($diff =
$this->tooManyDivers($data)) >
0) // Feld
throw
new Exception("41,Anzahl: maximal " .
($data['anzahl'] -
$diff) .
" Plätze");
throw
new Exception("28,Anzahl Zahler");
if ($data['anzahlZahler'] >
$data['anzahl'])
throw
new Exception("29,Anzahl Zahler");
$message =
explode(",", $e->getMessage());
$this->errorMsg =
"<b>[" .
$message[1] .
"] : </b>" .
src_tools_ERROR :: getErrTxt($message[0]) .
"<br>" .
$this->zahlerInfo;
// section -64--88-122--2--62c31de:1048594e50f:-7fef end
return (bool)
$returnValue;
* erstellt ein Obejkt der zu beabeitenden Klassen
* list alle erlaubten Datenbankschlüssel ein
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2-66879486:104007981a3:-7f92 begin
$this->block_id =
$block_id;
$this->arrOldData =
$this->oBlock->getRowByID($block_id);
// section -64--88-122--2-66879486:104007981a3:-7f92 end
* Erstellt eine Liste mit allen Vereinen
* @author Kay Koch, <kay.koch@gmx.de>
private function prepareVereinList() {
$returnValue = (string)
"";
$arrVereine =
$this->oVereine->getRow();
foreach ($arrVereine as $arrVerband) {
foreach ($arrVerband as $verein) {
$returnValue .=
"arrVereine[\"" .
$verein['verband_nr'] .
"/" .
$verein['verein_nr'] .
"\"]=\"" .
$verein['name'] .
"\"\n";
return (string)
$returnValue;
* Erstellt eine Liste mit allen Vereinen
* @author Kay Koch, <kay.koch@gmx.de>
private function getVereinOptionList($index =
"") {
$returnValue = (string)
"";
$arrVereine =
$this->oVereine->getRow();
foreach ($arrVereine as $verband_id =>
$arrVerband) {
foreach ($arrVerband as $verein_id =>
$verein) {
$vereinNr =
$verband_id .
"/" .
$verein_id;
$selected =
($vereinNr ==
$index) ?
"SELECTED" :
"";
$returnValue .=
"<option $selected value='$vereinNr'>" .
$verein['stadt'] .
" (" .
$verein['name'] .
")</option>\n";
return (string)
$returnValue;
* überprüft, ob die gewählte Anzahl an Tauchern für diesen Termin erlaubt ist
* @author Kay Koch, <kay.koch@gmx.de>
private function checkMaxFrei($data) {
$returnValue = (boolean) false;
$oMaxFrei = new src_foundation_tables_MAXFREI();
$oMaxFrei->setParams($data['see_id'], $data['datum']);
$arrMaxFrei = $oMaxFrei->getRow();
$maxFrei = ($this->oSeen-> $data['see_id']->buchbarProTag ? $arrMaxFrei['sumTag'] : $arrMaxFrei[substr($data['stunde'], 0, 5)]);
if ($data['anzahl'] > $maxFrei) // Anzahl zu groß
$this->zahlerInfo = "Die maximale Anzahl zu dieser Zeit beträgt: <b>" . $maxFrei . "</b> Taucher";
return (boolean) $returnValue;
* liefert die Differenz zwischen angeforderten und verfügbaren Plätzen
* Das Ergebnis ist positiv, wenn zuviele angefordert wurden
* @author Kay Koch, <kay.koch@gmx.de>
private function tooManyDivers($data) {
// frei Plätze am gewünschten Zeitpunkt
$arrPlaces =
$this->oNF->getEntry($data['see_id'], $data['datum']);
$freePlaces =
$arrPlaces[0][$stunde];
// Der See, Datum und Zeit bleiben gleich
if (!empty ($this->block_id) AND $data['see_id'] ==
$this->arrOldData['see_id'] AND $data['datum'] ==
$this->arrOldData['datum'] AND $data['stunde'] ==
$this->arrOldData['stunde']) {
$freePlaces +=
$this->arrOldData['anzahl']; // freie Plätze werden um alten Betrag erhöht
// Differenz von angeforderten zu verfügbaren Plätzen
return $data['anzahl'] -
$freePlaces;
* speichert Informationen über regelmäßige Reservierungen als HTMl-Datei
* Die Pfad der Datei lautet /infos/blockaden_SEENAME.html
* wobei SEENAME der kleingeschriebene Name ohne Umlaute ist.
private function saveRegularyBlockInfo() {
$returnValue = (boolean)
false;
$rowtpl =
"<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>";
// Alle Blockaden durchlaufen
// Zwischenspeicher initialisieren
if (!isset
($arrBlockRow[$block['see_id']]))
$arrBlockRow[$block['see_id']] =
"";
$this->oVereine->setParams($block['verein_nr']);
$block['info'] =
(!empty ($block['info'])) ?
$this->oVereine->name .
", " .
$block['info'] :
$this->oVereine->name;
switch ($block['wiederholung']) {
$stunde =
($block['ganzerTag']) ?
"ganztägig" :
$block['stunde'];
$anzahl =
($block['ganzerTag']) ?
"" :
$block['anzahl'];
$anzahlStunden =
($block['ganzerTag']) ?
"" :
$block['anzahlStunden'];
$arrBlockRow[$block['see_id']] .=
sprintf($rowtpl, $zeitraum, $stunde, $anzahlStunden, $anzahl, $block['info']);
foreach ($arrBlockRow as $see_id =>
$this->blockRow) {
$this->seename =
$this->getSeen($see_id)->name;
* liefert ein Optionlist mit den Möglichkeiten von Wiederholungsarten
* @author Kay Koch, <kay.koch@gmx.de>
private function getRepeatOptionList($index =
'') {
$returnValue = (string)
'';
// section -64--88-122--2-339007d5:1043cd4e8c9:-7f92 begin
$selected =
($key ==
$index) ?
"SELECTED" :
"";
$returnValue .=
"<option $selected value='$key'> $title</option>\n";
// section -64--88-122--2-339007d5:1043cd4e8c9:-7f92 end
return (string)
$returnValue;
* @since 1.0 - 27.05.2007
* @param array $data Übergabeparameter
private function checkHoleDay(& $data) {
if (isset
($data['ganzerTag']) AND ($data['ganzerTag'] ==
1)) {
$oMaxFrei->setParams($data['see_id'], $data['datum']);
$arrMaxFrei =
$oMaxFrei->getRow();
$data['anzahl'] =
$arrMaxFrei['sumTag'];
$data['ganzerTag'] =
"0";
$this->oVereine->setParams($data['verein_nr']);
$data['name'] =
(!empty ($data['info'])) ?
$this->oVereine->name .
", " .
$data['info'] :
$this->oVereine->name;
} /* end of class src_foundation_admin_ADMINBLOCKADEN */
Documentation generated on Sat, 24 Mar 2007 09:58:25 +0100 by phpDocumentor 1.3.1