Source for file class.ADMINNOCHFREI.php

Documentation is available at class.ADMINNOCHFREI.php

  1. <?php
  2.  
  3. /**
  4.  * Verwaltet die Adminitration der Datenbanktabelle 'nachttermine'
  5.  *
  6.  * @author Kay Koch, <kay.koch@gmx.de>
  7.  * @package src
  8.  * @subpackage foundation_admin
  9.  */
  10.  
  11. if (version_compare(PHP_VERSION'5')) {
  12.     die('This file was generated for PHP 5');
  13. }
  14.  
  15. /**
  16.  * Parentklasse zur Administration der Tabellen
  17.  *
  18.  * @author Kay Koch, <kay.koch@gmx.de>
  19.  */
  20. require_once ('src/foundation/admin/class.PARENTADMIN.php');
  21.  
  22. /**
  23.  * Interface zur Administration der Datenbank
  24.  *
  25.  * @author Kay Koch
  26.  * @since 06.2005
  27.  * @version 1.0
  28.  */
  29. require_once ('src/interfaces/interface.ADMININTERFACE.php');
  30.  
  31. /* user defined includes */
  32. // section -64--88-122--2-3ef144c5:103f62d89fa:-7f9e-includes begin
  33. // section -64--88-122--2-3ef144c5:103f62d89fa:-7f9e-includes end
  34.  
  35. /* user defined constants */
  36. // section -64--88-122--2-3ef144c5:103f62d89fa:-7f9e-constants begin
  37. // section -64--88-122--2-3ef144c5:103f62d89fa:-7f9e-constants end
  38.  
  39. /**
  40.  * Verwaltet die Adminitration der Datenbanktabelle 'nachttermine'
  41.  *
  42.  * @access public
  43.  * @author Kay Koch, <kay.koch@gmx.de>
  44.  * @package src
  45.  * @subpackage foundation_admin
  46.  */
  47.     // --- ATTRIBUTES ---
  48.  
  49.     
  50.     /**
  51.      * Objekt der aktellen Datenbankklasse
  52.      *
  53.      * @access private
  54.      * @var NACHTTERMINE 
  55.      */
  56.     private $oNFnull;
  57.  
  58.     /**
  59.      * Array mit den Feldnamen der aktuellen Datebank
  60.      *
  61.      * @access protected
  62.      * @var array 
  63.      */
  64.     protected $arrKeysarray ();
  65.  
  66.     /**
  67.      * Name des Haupttemplates
  68.      *
  69.      * @access protected
  70.      * @var string 
  71.      */
  72.     protected $pageTemplate'';
  73.  
  74.     // --- OPERATIONS ---
  75.  
  76.     
  77.     /**
  78.      * zeigt alle Einträge einer Tabelle
  79.      *
  80.      * @access public
  81.      * @author Kay Koch, <kay.koch@gmx.de>
  82.      * @return void 
  83.      */
  84.     public function show({
  85.         // section -64--88-122--2--6176e79b:103fa06a375:-7fad begin
  86.         if ($this->loginOK{
  87.             $this->todo"change";
  88.             $this->rows"";
  89.             $this->seeOptionList$this->oSeen->getOptionList();
  90.             $this->monthOptionListsrc_tools_TIME :: getMonthOL();
  91.             $this->dayOptionListsrc_tools_TIME :: getDayOL();
  92.             $this->jahr date("Y");
  93.             $this->makePage("admin_" $this->pageTemplate);
  94.         }
  95.         // section -64--88-122--2--6176e79b:103fa06a375:-7fad end
  96.     }
  97.  
  98.     /**
  99.      * liefert ein Formular zur Änderung bzw. Neueingabe eines Datensatzes
  100.      *
  101.      * Wenn die Tabellenspezifischen Parameter vorhergesetzt wurden wird der
  102.      * Datensatz ausgegeben. Ansonsten erscheint ein leeres Formular
  103.      *
  104.      * @access public
  105.      * @author Kay Koch, <kay.koch@gmx.de>
  106.      * @return void 
  107.      */
  108.     public function change({
  109.         // section -64--88-122--2--6176e79b:103fa06a375:-7fa9 begin
  110.         if ($this->loginOK{
  111.             if ($this->checkData($this->data)) {
  112.                 $this->todo"update";
  113.                 $this->blockInfo "";
  114.                 $this->ntgInfo "";
  115.                 if (!isset($this->data['datum']or empty($this->data['datum']) ){
  116.                     $this->data['datum'src_tools_TIME::formatDate($this->data['tag'],$this->data['monat'],$this->data['jahr']);
  117.                 }
  118.                 $see_id $this->data['see_id'];
  119.                 $this->seename $this->oSeen->$see_id->name;
  120.                 $this->realDatum src_tools_TIME::sqlT2realT($this->data['datum']);
  121.                 $this->start $this->oSeen->$see_id->getStartTime($this->data['datum']);
  122.                 $this->ende =$this->oSeen->$see_id->getEndTime($this->data['datum']);
  123.                 $oBlock new src_foundation_tables_BLOCKADEN();
  124.                 $oBlock->setParams($see_id,$this->data['datum']);
  125.                 if ($oBlock->isBlocked()){
  126.                     $oVereine new src_foundation_tables_VEREINE();
  127.                     foreach ($oBlock->getRow(as $hourRow){
  128.                         $oVereine->setParams($hourRow['verein_nr']);
  129.                          $hourRow['info'(!empty ($data['info'])) $oVereine->name ", " $data['info'$oVereine->name;
  130.                         $info ($hourRow['ganzerTag'])?"ganztägig":$hourRow['stunde'].", ".$hourRow['anzahlStunden']." Stunden ";
  131.                         $this->blockInfo .= $info.",".$hourRow['anzahl']." Taucher (".$hourRow['info'].")<br>";
  132.                     }
  133.                 }
  134.                 $oNTG  new src_foundation_tables_NACHTTERMINE();
  135.                 $oNTG->setParams($see_id,$this->data['datum']);
  136.                 $arrNTG "";
  137.                 if ($oNTG->isNightDive()){
  138.                     $arrNTG $oNTG->getRow();
  139.                     $this->ntgInfo "bis: ".$arrNTG['uhrzeitEnde'];
  140.                 }
  141.                 $this->row $this->makeRows($this->oNF->getEntry($this->data['see_id'],$this->data['datum']),$arrNTG);
  142.                 $this->makePage("admin_" $this->pageTemplate . "_input");
  143.             }else
  144.                 $this->show();
  145.         }
  146.         // section -64--88-122--2--6176e79b:103fa06a375:-7fa9 end
  147.     }
  148.  
  149.     /**
  150.      * Aktualisieet den vorher durch setzen der Parameter ausgewählten
  151.      *
  152.      * Die Neuen Daten befinden sich im Übergabefeld $data
  153.      *
  154.      * @access public
  155.      * @author Kay Koch, <kay.koch@gmx.de>
  156.      * @param array 
  157.      * @return void 
  158.      */
  159.     public function update($data{
  160.         // section -64--88-122--2--6176e79b:103fa06a375:-7f83 begin
  161.         if ($this->loginOK{
  162.             if ($this->checkData($data)) {
  163.                 $this->oNF->updateEntry($data);
  164.                 $this->show();
  165.             else
  166.                 $this->change();
  167.         }
  168.         // section -64--88-122--2--6176e79b:103fa06a375:-7f83 end
  169.     }
  170.  
  171.     /**
  172.      * Löscht den Datensatz der vorher durch Parameter ausgewählt wurde
  173.      *
  174.      * @access public
  175.      * @author Kay Koch, <kay.koch@gmx.de>
  176.      * @return void 
  177.      */
  178.     public function delete({
  179.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7f begin
  180.         if ($this->loginOK{
  181.             $this->updateNochfrei($this->oNTG->getRow(),true);
  182.             $this->oNTG->deleteRow();
  183.             $this->show();
  184.         }
  185.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7f end
  186.     }
  187.  
  188.     /**
  189.      * Fügt einen neuen datensatz mit den Werten des Übergabeparameter $data
  190.      *
  191.      * @access public
  192.      * @author Kay Koch, <kay.koch@gmx.de>
  193.      * @param array 
  194.      * @return void 
  195.      */
  196.     public function insert($data{
  197.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7d begin
  198.  
  199.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7d end
  200.     }
  201.  
  202.     /**
  203.      * überprüft die Korrektheit der eingebenen bzw. geänderten Daten
  204.      *
  205.      * @access public
  206.      * @author Kay Koch, <kay.koch@gmx.de>
  207.      * @param void 
  208.      * @return boolean 
  209.      */
  210.     public function checkData($data{
  211.         $returnValue= (bool) false;
  212.         // section -64--88-122--2--62c31de:1048594e50f:-7fef begin
  213.         try {
  214.             if (!src_tools_CHECK :: checkID($data['see_id']))
  215.                 throw new Exception("19,Seename");
  216.             if (!isset($data['datum']or empty($data['datum']) ){
  217.                 if (empty ($data['tag']or empty ($data['monat']or empty ($data['jahr']))
  218.                     throw new Exception("49,Datum");
  219.                 $data['datum'src_tools_TIME::formatDate($data['tag'],$data['monat'],$data['jahr']);
  220.             }
  221.             if (!src_tools_CHECK :: checkDatum($data['datum'])) // YYYY-MM-TT
  222.                 throw new Exception("51,Datum");
  223.             $see_id $data['see_id'];
  224.             if (!($data['datum'>= $this->oSeen->$see_id->saisonStartOR !($data['datum'<= $this->oSeen->$see_id->saisonEnde))
  225.                 throw new Exception("110,Datum");
  226.             $returnValuetrue;
  227.         catch (Exception $e{
  228.             $messageexplode(","$e->getMessage());
  229.             $this->errorMsg"<b>[" $message[1"] : </b>" src_tools_ERROR :: getErrTxt($message[0]);
  230.             $this->errorsrc_tools_TEMPLATE :: getTemplate('error'$this);
  231.         }
  232.         // section -64--88-122--2--62c31de:1048594e50f:-7fef end
  233.  
  234.         return (bool) $returnValue;
  235.     }
  236. /**
  237.  *
  238.  * Erstellt eine HTML-Teil mit allen Uhrzeiten
  239.  * und den freien Plätzen (incl. evtl. Nachttauchen)
  240.  *
  241.  * @author kaykoch
  242.  * @access public
  243.  * @since 1 - 27.02.2007
  244.  * @param array $arrValues 2-D-Array mit aktuellen [0] und maximalen [1] Werten eines Tages
  245.  * @return string HTML Ausgabe
  246.  *
  247.  */
  248. public function makeRows ($arrValues,$arrNTG=""{
  249.     $returnValue="";
  250.     $rowTpl src_tools_TEMPLATE :: getTemplate("admin_" $this->pageTemplate . "_input_row");
  251.     $see_id $arrValues[0]['see_id'];
  252.     // See kann nur Ganztägig gebucht werden
  253.     if ($this->oSeen->$see_id->buchbarProTag){
  254.         $sumTag $arrValues[0]['sumTag'];
  255.         $arrValues[0array('sumTag'=>$sumTag);
  256.         $startTime "a";
  257.         $endTime "z";
  258.     }else{
  259.         $startTime $this->oSeen->$see_id->getStartTime($arrValues[0]['datum']);
  260.         $endTime $this->oSeen->$see_id->getEndTime($arrValues[0]['datum']);
  261.         unset ($arrValues[0]['datum']);
  262.         unset ($arrValues[0]['see_id']);
  263.         unset ($arrValues[0]['sumTag']);
  264.     }
  265.     // Es gibt zusätzlich Nachttauchen
  266.     if (!empty($arrNTG)){
  267.         foreach ($arrNTG as $key=>$ntgValue// NTG-Array durchlaufen
  268.             if (isset($arrValues[1][$key])) // Nur die Felder mit Uhrzeit als Schlüssel
  269.                 $arrValues[1][$key$ntgValue// Maximaler Wert ist der Wert des NTGs
  270.         $endTime $arrNTG['uhrzeitEnde'];
  271.     }
  272.     // Für jede Zeitangabe wird ein PullDownMenu erstellt
  273.     foreach ($arrValues[0as $key=>$value){
  274.         if ($key<$startTime OR $key>$endTime)
  275.             continue;
  276.         $hourOptionList src_tools_MULTI::getNrOL($value,$arrValues[1][$key]);
  277.         $returnValue .=sprintf($rowTpl$key$key $hourOptionList);
  278.  
  279.     }
  280.     return $returnValue;
  281. }
  282.  
  283.  
  284.     /**
  285.      * Konstruktor
  286.      *
  287.      * erstellt ein Obejkt der zu beabeitenden Klassen
  288.      * list alle erlaubten Datenbankschlüssel ein
  289.      * liest das Template
  290.      *
  291.      * @access public
  292.      * @author Kay Koch, <kay.koch@gmx.de>
  293.      * @param string 
  294.      * @param int 
  295.      * @param date 
  296.      * @return void 
  297.      */
  298.     public function __construct($token$data=null{
  299.         // section -64--88-122--2-3ef144c5:103f62d89fa:-7f98 begin
  300.         parent :: __construct($token);
  301.         $this->oNFnew src_foundation_tables_NOCHFREI();
  302.         $this->setStartParameters($this$this->oNF);
  303.         $this->data $data;
  304.         // section -64--88-122--2-3ef144c5:103f62d89fa:-7f98 end
  305.     }
  306.  
  307. /* end of class src_foundation_admin_ADMINNACHTTERMINE */
  308. ?>

Documentation generated on Sat, 24 Mar 2007 09:58:45 +0100 by phpDocumentor 1.3.1