Source for file class.ADMINSEE.php

Documentation is available at class.ADMINSEE.php

  1. <?php
  2.  
  3. /**
  4.  * Verwaltet die Adminitration der Datenbanktabelle 'seen'
  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-66879486:104007981a3:-7f99-includes begin
  33. // section -64--88-122--2-66879486:104007981a3:-7f99-includes end
  34.  
  35. /* user defined constants */
  36. // section -64--88-122--2-66879486:104007981a3:-7f99-constants begin
  37. // section -64--88-122--2-66879486:104007981a3:-7f99-constants end
  38.  
  39. /**
  40.  * Verwaltet die Adminitration der Datenbanktabelle 'seen'
  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 SEEN 
  55.      */
  56.     private $oSEEN null;
  57.  
  58.     /**
  59.      * Array mit den Feldnamen der aktuellen Datebank
  60.      *
  61.      * @access protected
  62.      * @var array 
  63.      */
  64.     protected $arrKeys = array ();
  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->oSeen->unsetParams();
  90.             $arrTmp $this->oSeen->getRow();
  91.             foreach ($arrTmp as $this->tmp{
  92.                 $this->aktivitaet $this->getBoolName($this->tmp->isActive);
  93.                 $this->ansprechpartner $this->tmp->oAnsprechpartner->name ", " $this->tmp->oAnsprechpartner->vorname;
  94.                 $this->vorOrtKontakt $this->tmp->oVorOrtKontakt->name ", " $this->tmp->oVorOrtKontakt->vorname;
  95.                 $this->data $this->tmp->all;
  96.                 $this->rows .= src_tools_TEMPLATE :: getTemplate("admin_" $this->pageTemplate . "_row"$this);
  97.             }
  98.             $this->makePage("admin_" $this->pageTemplate);
  99.         }
  100.         // section -64--88-122--2--6176e79b:103fa06a375:-7fad end
  101.     }
  102.  
  103.     /**
  104.      * liefert ein Formular zur Änderung bzw. Neueingabe eines Datensatzes
  105.      *
  106.      * Wenn die Tabellenspezifischen Parameter vorhergesetzt wurden wird der
  107.      * Datensatz ausgegeben. Ansonsten erscheint ein leeres Formular
  108.      *
  109.      * @access public
  110.      * @author Kay Koch, <kay.koch@gmx.de>
  111.      * @return void 
  112.      */
  113.     public function change({
  114.         // section -64--88-122--2--6176e79b:103fa06a375:-7fa9 begin
  115.         if ($this->loginOK{
  116.             if ((!empty ($this->oSeen->see_id))) {
  117.                 $this->todo "update";
  118.                 $this->data $this->oSeen->getRow();
  119.                 $vok_id $this->data->oVorOrtKontakt->kontakt_id;
  120.                 $ap_id $this->data->oAnsprechpartner->kontakt_id;
  121.                 $bpt $this->data->buchbarProTag;
  122.                 $akt $this->data->isActive;
  123.                 $this->data $this->data->all;
  124.             else {
  125.                 $this->todo "insert";
  126.                 $vok_id "";
  127.                 $ap_id "";
  128.                 $bpt "";
  129.                 $akt "";
  130.             }
  131.             $oKontakt new src_foundation_tables_KONTAKTE();
  132.             $this->isActiveOL $this->getBoolOptionLIst($akt);
  133.             $this->vorOrtKontaktOL $oKontakt->getOptionList($vok_id);
  134.             $this->ansprechpartnerOL $oKontakt->getOptionList($ap_id);
  135.             $this->buchbarProTagOL $this->getBoolOptionLIst($bpt);
  136.             $this->makePage("admin_" $this->pageTemplate . "_input");
  137.         }
  138.         // section -64--88-122--2--6176e79b:103fa06a375:-7fa9 end
  139.     }
  140.  
  141.     /**
  142.      * Aktualisiert den vorher durch setzen der Parameter ausgewählten
  143.      *
  144.      * Die Neuen Daten befinden sich im Übergabefeld $data
  145.      *
  146.      * @access public
  147.      * @author Kay Koch, <kay.koch@gmx.de>
  148.      * @param array 
  149.      * @return void 
  150.      */
  151.     public function update($data{
  152.         // section -64--88-122--2--6176e79b:103fa06a375:-7f83 begin
  153.         if ($this->loginOK{
  154.             if ($this->checkData($data)) {
  155.                 $this->oSeen->updateRow($data);
  156.                 $this->show();
  157.             else
  158.                 $this->change();
  159.         }
  160.         // section -64--88-122--2--6176e79b:103fa06a375:-7f83 end
  161.     }
  162.  
  163.     /**
  164.      * Löscht den Datensatz der vorher durch Parameter ausgewählt wurde
  165.      *
  166.      * @access public
  167.      * @author Kay Koch, <kay.koch@gmx.de>
  168.      * @return void 
  169.      */
  170.     public function delete({
  171.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7f begin
  172.         if ($this->loginOK{
  173.             $oMaxfrei new src_foundation_tables_MAXFREI();
  174.             $oMaxfrei->setParams($this->oSeen->see_id);
  175.             $oMaxfrei->deleteRow();
  176.             $oPermit new src_foundation_tables_BEFUGNISSE;
  177.             $oPermit->setParams($this->oSeen->see_id);
  178.             $oPermit->deleteRow();
  179.             $oBlocks new src_foundation_tables_BLOCKADEN;
  180.             $oBlocks->setParams($this->oSeen->see_id);
  181.             $oBlocks->deleteRow();
  182.             $oNT new src_foundation_tables_NACHTTERMINE;
  183.             $oNT->setParams($this->oSeen->see_id);
  184.             $oNT->deleteRow();
  185.             $oNF new src_foundation_tables_NOCHFREI;
  186.             $oNF->deleteEntriesFromSea($this->oSeen->see_id);
  187.             $this->oSeen->deleteRow();
  188.             $this->show();
  189.         }
  190.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7f end
  191.     }
  192.  
  193.     /**
  194.      * Fügt einen neuen Datensatz mit den Werten des Übergabeparameter $data
  195.      *
  196.      * @access public
  197.      * @author Kay Koch, <kay.koch@gmx.de>
  198.      * @param array 
  199.      * @return void 
  200.      */
  201.     public function insert($data{
  202.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7d begin
  203.         if ($this->loginOK{
  204.             if ($this->checkData($data)) {
  205.                 if ($this->oSeen->insertRow($data)) {
  206.                     $oMaxfrei new src_foundation_tables_MAXFREI();
  207.                     $oMaxfrei->setParams($this->oSeen->see_id);
  208.                     $oMaxfrei->insertRow($data);
  209.                     $oPermit new src_foundation_tables_BEFUGNISSE;
  210.                     $oPermit->setParams($this->oSeen->see_id);
  211.                     $oPermit->insertRow($data);
  212.                     $oNF new src_foundation_tables_NOCHFREI;
  213.                 }
  214.                 $this->show();
  215.             else {
  216.                 $this->data $data;
  217.                 $this->change();
  218.             }
  219.         }
  220.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7d end
  221.     }
  222.  
  223.     /**
  224.      * überprüft die Korrektheit der eingebenen bzw. geänderten Daten
  225.      *
  226.      * @access public
  227.      * @author Kay Koch, <kay.koch@gmx.de>
  228.      * @param void 
  229.      * @return boolean 
  230.      */
  231.     public function checkData(&$data{
  232.         $returnValue = (bool) false;
  233.  
  234.         // section -64--88-122--2--62c31de:1048594e50f:-7fef begin
  235.         try {
  236.             if (!src_tools_CHECK :: checkName($data['name']))
  237.                 throw new Exception("20,Name");
  238.             if (!src_tools_CHECK :: checkBool($data['isActive']))
  239.                 throw new Exception("19,Aktiv");
  240.             if (!src_tools_CHECK :: checkID($data['vorOrtKontakt_id']))
  241.                 throw new Exception("19,Kontakt am See");
  242.             if (!src_tools_CHECK :: checkID($data['ansprechpartner_id']))
  243.                 throw new Exception("19,Kontakt beim LVST");
  244.             if (!src_tools_CHECK :: checkBool($data['buchbarProTag']))
  245.                 throw new Exception("19,Ganztägig");
  246.             if (!src_tools_CHECK :: checkAnzahl($data['maxPerOrder'])) // nur Zahlen
  247.                 throw new Exception("50,Max");
  248.             if (!src_tools_CHECK :: checkAnzahl($data['wochenImVorraus'])) // nur Zahlen
  249.                 throw new Exception("50,Wochen");
  250.             if (!src_tools_CHECK :: checkDatum($data['saisonStart'])) // YYYY-MM-TT
  251.                 throw new Exception("51,Saison Start");
  252.             if (!src_tools_CHECK :: checkDatum($data['saisonEnde'])) // YYYY-MM-TT
  253.                 throw new Exception("51,Saison Ende");
  254.             if (!src_tools_CHECK :: checkHour($data['uhrzeitBeginnWoche'])) // hh:mm:ss
  255.                 throw new Exception("52,Tauchbeginn [Mo-Fr]");
  256.             if (!src_tools_CHECK :: checkHour($data['uhrzeitEndeWoche'])) // hh:mm:ss
  257.                 throw new Exception("52,Tauchende [Mo-Fr]");
  258.             if (!src_tools_CHECK :: checkHour($data['uhrzeitBeginnWochenende'])) // hh:mm:ss
  259.                 throw new Exception("52,Tauchbeginn [Sa-So]");
  260.             if (!src_tools_CHECK :: checkHour($data['uhrzeitEndeWochenende'])) // hh:mm:ss
  261.                 throw new Exception("52,Tauchende [Sa-So]");
  262.             if (!src_tools_CHECK :: checkHtml($data['info'])) // hh:mm:ss
  263.                 throw new Exception("53,Infoseite");
  264.             $returnValue true;
  265.         catch (Exception $e{
  266.             $message explode(","$e->getMessage());
  267.             $this->errorMsg "<b>[" $message[1"] : </b>" src_tools_ERROR :: getErrTxt($message[0]);
  268.             $this->error src_tools_TEMPLATE :: getTemplate('error'$this);
  269.         }
  270.         // section -64--88-122--2--62c31de:1048594e50f:-7fef end
  271.  
  272.         return (bool) $returnValue;
  273.     }
  274.  
  275.     /**
  276.      * Konstruktor
  277.      *
  278.      * erstellt ein Obejkt der zu beabeitenden Klassen
  279.      * list alle erlaubten Datenbankschlüssel ein
  280.      * liest das Template
  281.      *
  282.      * @access public
  283.      * @author Kay Koch, <kay.koch@gmx.de>
  284.      * @param string 
  285.      * @param int 
  286.      * @return void 
  287.      */
  288.     public function __construct($token$see_id 0{
  289.         // section -64--88-122--2-66879486:104007981a3:-7f84 begin
  290.         parent :: __construct($token$see_id);
  291.         $this->see_id $see_id;
  292.         $this->oSeen->setParams($see_id);
  293.         $this->setStartParameters($this$this->oSeen);
  294.         // section -64--88-122--2-66879486:104007981a3:-7f84 end
  295.     }
  296.  
  297. /* end of class src_foundation_admin_ADMINSEE */
  298. ?>

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