Source for file class.ADMINFLAGS.php

Documentation is available at class.ADMINFLAGS.php

  1. <?php
  2.  
  3.  
  4. /**
  5.  * Verwaltet die Adminitration der Datenbanktabelle 'flags'
  6.  *
  7.  * @author Kay Koch, <kay.koch@gmx.de>
  8.  * @package src
  9.  * @subpackage foundation_admin
  10.  */
  11.  
  12. if (version_compare(PHP_VERSION'5')) {
  13.     die('This file was generated for PHP 5');
  14. }
  15.  
  16. /**
  17.  * Parentklasse zur Administration der Tabellen
  18.  *
  19.  * @author Kay Koch, <kay.koch@gmx.de>
  20.  */
  21. require_once('src/foundation/admin/class.PARENTADMIN.php');
  22.  
  23. /**
  24.  * Interface zur Administration der Datenbank
  25.  *
  26.  * @author Kay Koch
  27.  * @since 06.2005
  28.  * @version 1.0
  29.  */
  30. require_once('src/interfaces/interface.ADMININTERFACE.php');
  31.  
  32. /* user defined includes */
  33. // section -64--88-122--2--49bf02f4:103b2814a7e:-7fb1-includes begin
  34. // section -64--88-122--2--49bf02f4:103b2814a7e:-7fb1-includes end
  35.  
  36. /* user defined constants */
  37. // section -64--88-122--2--49bf02f4:103b2814a7e:-7fb1-constants begin
  38. // section -64--88-122--2--49bf02f4:103b2814a7e:-7fb1-constants end
  39.  
  40. /**
  41.  * Verwaltet die Adminitration der Datenbanktabelle 'flags'
  42.  *
  43.  * @access public
  44.  * @author Kay Koch, <kay.koch@gmx.de>
  45.  * @package src
  46.  * @subpackage foundation_admin
  47.  */
  48.         implements src_interfaces_ADMININTERFACE
  49. {
  50.     // --- ATTRIBUTES ---
  51.  
  52.     
  53.     /**
  54.      * Objekt der aktellen Datenbankklasse
  55.      *
  56.      * @access private
  57.      * @var FLAGS 
  58.      */
  59.     private $oFlags null;
  60.  
  61.     /**
  62.      * Array mit den Feldnamen der aktuellen Datebank
  63.      *
  64.      * @access protected
  65.      * @var array 
  66.      */
  67.     protected $arrKeys = array();
  68.  
  69.     /**
  70.      * Name des Haupttemplates
  71.      *
  72.      * @access protected
  73.      * @var string 
  74.      */
  75.     protected $pageTemplate = '';
  76.  
  77.     // --- OPERATIONS ---
  78.  
  79.     
  80.     /**
  81.      * zeigt alle Einträge einer Tabelle
  82.      *
  83.      * @access public
  84.      * @author Kay Koch, <kay.koch@gmx.de>
  85.      * @return void 
  86.      */
  87.     public function show()
  88.     {
  89.         // section -64--88-122--2--6176e79b:103fa06a375:-7fad begin
  90.         if ($this->loginOK{
  91.             $this->todo "change";
  92.             $this->data $this->oFlags->getRow();
  93.             $oKontakt new src_foundation_tables_KONTAKTE();
  94.             $this->realLastBackupDate src_tools_TIME::sqlT2realT($this->data['lastBackupDate']"%A - %d. %B %Y");
  95.             $this->realLastDaycheckDate src_tools_TIME::sqlT2realT($this->data['lastDaycheckDate']"%A - %d. %B %Y");
  96.             $this->realDayOfChange src_tools_TIME::dayNr2dayName($this->data['dayOfChange']);
  97.             $oKontakt->setParams($this->data['admin_id']);
  98.             $this->admin $oKontakt->name", " $oKontakt->vorname;
  99.             $oKontakt->setParams($this->data['lvstResp_id']);
  100.             $this->lvst $oKontakt->name ", " $oKontakt->vorname;
  101.             $this->shortinfo =  substr($this->data['info']020)."...";
  102.             $this->error=$this->getBoolName($this->data['isError']);
  103.             $this->rows src_tools_TEMPLATE::getTemplate("admin_" $this->pageTemplate . "_row"$this);
  104.             $this->makePage("admin_" $this->pageTemplate);
  105.         }
  106.         // section -64--88-122--2--6176e79b:103fa06a375:-7fad end
  107.     }
  108.  
  109.     /**
  110.      * liefert ein Formular zur Änderung bzw. Neueingabe eines Datensatzes
  111.      *
  112.      * Wenn die Tabellenspezifischen Parameter vorhergesetzt wurden wird der
  113.      * Datensatz ausgegeben. Ansonsten erscheint ein leeres Formular
  114.      *
  115.      * @access public
  116.      * @author Kay Koch, <kay.koch@gmx.de>
  117.      * @return void 
  118.      */
  119.     public function change()
  120.     {
  121.         // section -64--88-122--2--6176e79b:103fa06a375:-7fa9 begin
  122.         if ($this->loginOK{
  123.             $this->todo "update";
  124.             $this->data $this->oFlags->getRow();
  125.             $oKontakt new src_foundation_tables_KONTAKTE();
  126.             $this->dayOfChangeOL src_tools_TIME::getWeekOL($this->data['dayOfChange']);
  127.             $this->adminOL $oKontakt->getOptionList($this->data['admin_id']);
  128.             $this->lvstOL $oKontakt->getOptionList($this->data['lvstResp_id']);
  129.             $this->realLastBackupDate src_tools_TIME::sqlT2realT($this->data['lastBackupDate']"%A - %d. %B %Y");
  130.             $this->realLastDaycheckDate src_tools_TIME::sqlT2realT($this->data['lastDaycheckDate']"%A - %d. %B %Y");
  131.             $this->info $this->data['info'];
  132.             $this->errorOL$this->getBoolOptionLIst($this->data['isError']);
  133.             $this->makePage("admin_" $this->pageTemplate . "_input");
  134.         }
  135.         // section -64--88-122--2--6176e79b:103fa06a375:-7fa9 end
  136.     }
  137.  
  138.     /**
  139.      * Aktualisieet den vorher durch setzen der Parameter ausgewählten
  140.      *
  141.      * Die Neuen Daten befinden sich im Übergabefeld $data
  142.      *
  143.      * @access public
  144.      * @author Kay Koch, <kay.koch@gmx.de>
  145.      * @param array 
  146.      * @return void 
  147.      */
  148.     public function update($data)
  149.     {
  150.         // section -64--88-122--2--6176e79b:103fa06a375:-7f83 begin
  151.         if ($this->loginOK{
  152.             if ($this->checkData($data)) {
  153.                 $this->oFlags->updateRow($data);
  154.                 $this->show();
  155.             else
  156.                 $this->change();
  157.         }
  158.         // section -64--88-122--2--6176e79b:103fa06a375:-7f83 end
  159.     }
  160.  
  161.     /**
  162.      * Löscht den Datensatz der vorher durch Parameter ausgewählt wurde
  163.      *
  164.      * @access public
  165.      * @author Kay Koch, <kay.koch@gmx.de>
  166.      * @return void 
  167.      */
  168.     public function delete()
  169.     {
  170.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7f begin
  171.         if ($this->loginOK{
  172.             $this->oFlags->deleteRow();
  173.             $this->show();
  174.         }
  175.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7f end
  176.     }
  177.  
  178.     /**
  179.      * Fügt einen neuen datensatz mit den Werten des Übergabeparameter $data
  180.      *
  181.      * @access public
  182.      * @author Kay Koch, <kay.koch@gmx.de>
  183.      * @param array 
  184.      * @return void 
  185.      */
  186.     public function insert($data)
  187.     {
  188.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7d begin
  189.         if ($this->loginOK{
  190.             if ($this->checkData($data)) {
  191.                 $this->oFlags->insertRow($data);
  192.                 $this->show();
  193.             else{
  194.                 $this->data $data;
  195.                 $this->change();
  196.             }
  197.         }
  198.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7d end
  199.     }
  200.  
  201.     /**
  202.      * überprüft die Korrektheit der eingebenen bzw. geänderten Daten
  203.      *
  204.      * @access public
  205.      * @author Kay Koch, <kay.koch@gmx.de>
  206.      * @param void 
  207.      * @return boolean 
  208.      */
  209.     public function checkData(&$data)
  210.     {
  211.         $returnValue = (bool) false;
  212.  
  213.         // section -64--88-122--2--62c31de:1048594e50f:-7fef begin
  214.         try {
  215.             if (!src_tools_CHECK::checkID ($data['dayOfChange']))
  216.                 throw new Exception ("19,Wochentag");
  217.             if (!src_tools_CHECK::checkHour($data['timeOfChange'])) // hh:mm:ss
  218.                 throw new Exception ("52,Uhrzeit");
  219.             if (!src_tools_CHECK::checkFloat($data['prizePerPerson']))
  220.                 throw new Exception ("54,Preis");
  221.             if (!src_tools_CHECK::checkID ($data['lvstResp_id']))
  222.                 throw new Exception ("19,LVST");
  223.             if (!src_tools_CHECK::checkID ($data['admin_id']))
  224.                 throw new Exception ("19,Administrator");
  225.             $returnValue true;
  226.         }
  227.         catch (Exception $e{
  228.             $message explode(","$e->getMessage());
  229.             $this->errorMsg "<b>[" $message[1"] : </b>" src_tools_ERROR::getErrTxt($message[0]);
  230.             $this->error src_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.      * Konstruktor
  239.      *
  240.      * erstellt ein Obejkt der zu beabeitenden Klassen
  241.      * list alle erlaubten Datenbankschlüssel ein
  242.      * liest das Template
  243.      *
  244.      * @access public
  245.      * @author Kay Koch, <kay.koch@gmx.de>
  246.      * @param string 
  247.      * @return void 
  248.      */
  249.     public function __construct($token)
  250.     {
  251.         // section -64--88-122--2--49bf02f4:103b2814a7e:-7fac begin
  252.         parent::__construct($token);
  253.         $this->oFlags new src_foundation_tables_FLAGS();
  254.         $this->setStartParameters ($this,$this->oFlags);
  255.         $this->newYear "";
  256.         // section -64--88-122--2--49bf02f4:103b2814a7e:-7fac end
  257.     }
  258.  
  259. /* end of class src_foundation_admin_ADMINFLAGS */
  260.  
  261. ?>

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