Source for file class.ADMINVEREINE.php

Documentation is available at class.ADMINVEREINE.php

  1. <?php
  2.  
  3.  
  4. /**
  5.  * Verwaltet die Adminitration der Datenbanktabelle 'vereine'
  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-651443c0:1046f70e203:-7fe8-includes begin
  34. // section -64--88-122--2-651443c0:1046f70e203:-7fe8-includes end
  35.  
  36. /* user defined constants */
  37. // section -64--88-122--2-651443c0:1046f70e203:-7fe8-constants begin
  38. // section -64--88-122--2-651443c0:1046f70e203:-7fe8-constants end
  39.  
  40. /**
  41.  * Verwaltet die Adminitration der Datenbanktabelle 'vereine'
  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 VEREINE 
  58.      */
  59.     private $oVerein null;
  60.  
  61.     /**
  62.      * Array mit den Feldnamen der aktuellen Datebank
  63.      *
  64.      * @access protected
  65.      * @var array 
  66.      */
  67.     protected $arKeys = 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->rows "";
  93.             $this->oVerein->unsetParams();
  94.             $arrTmp $this->oVerein->getRow();
  95.             foreach($arrTmp as $verband_nr => $arrVerband{
  96.                 $this->oVerband->setParams($verband_nr);
  97.                 $this->verband $this->oVerband->name;
  98.                 foreach ($arrVerband as $this->data){
  99.                     $this->rows .= src_tools_TEMPLATE::getTemplate("admin_" $this->pageTemplate . "_row"$this);
  100.                 }
  101.             }
  102.             $this->makePage("admin_" $this->pageTemplate);
  103.         }
  104.         // section -64--88-122--2--6176e79b:103fa06a375:-7fad end
  105.     }
  106.  
  107.     /**
  108.      * liefert ein Formular zur Änderung bzw. Neueingabe eines Datensatzes
  109.      *
  110.      * Wenn die Tabellenspezifischen Parameter vorhergesetzt wurden wird der
  111.      * Datensatz ausgegeben. Ansonsten erscheint ein leeres Formular
  112.      *
  113.      * @access public
  114.      * @author Kay Koch, <kay.koch@gmx.de>
  115.      * @return void 
  116.      */
  117.     public function change()
  118.     {
  119.         // section -64--88-122--2--6176e79b:103fa06a375:-7fa9 begin
  120.         if ($this->loginOK{
  121.             if ((!empty($this->oVerein->verein_nr))) {
  122.                 $this->todo "update";
  123.                 $this->data $this->oVerein->getRow();
  124.                 $this->verbandOL $this->oVerband->getOptionList($this->oVerein->verband_nr);
  125.             else {
  126.                 $this->todo "insert";
  127.                 $this->verbandOL $this->oVerband->getOptionList();
  128.             }
  129.             $this->makePage("admin_" $this->pageTemplate . "_input");
  130.         }
  131.         // section -64--88-122--2--6176e79b:103fa06a375:-7fa9 end
  132.     }
  133.  
  134.     /**
  135.      * Aktualisieet den vorher durch setzen der Parameter ausgewählten
  136.      *
  137.      * Die Neuen Daten befinden sich im Übergabefeld $data
  138.      *
  139.      * @access public
  140.      * @author Kay Koch, <kay.koch@gmx.de>
  141.      * @param array 
  142.      * @return void 
  143.      */
  144.     public function update($data)
  145.     {
  146.         // section -64--88-122--2--6176e79b:103fa06a375:-7f83 begin
  147.       if ($this->loginOK{
  148.             if ($this->checkData($data)) {
  149.                 $this->oVerein->updateRow($data);
  150.                 $this->show();
  151.             else
  152.                 $this->change();
  153.         }
  154.         // section -64--88-122--2--6176e79b:103fa06a375:-7f83 end
  155.     }
  156.  
  157.     /**
  158.      * Löscht den Datensatz der vorher durch Parameter ausgewählt wurde
  159.      *
  160.      * @access public
  161.      * @author Kay Koch, <kay.koch@gmx.de>
  162.      * @return void 
  163.      */
  164.     public function delete()
  165.     {
  166.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7f begin
  167.         if ($this->loginOK{
  168.             $this->oVerein->deleteRow();
  169.             $this->show();
  170.         }
  171.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7f end
  172.     }
  173.  
  174.     /**
  175.      * Fügt einen neuen datensatz mit den Werten des Übergabeparameter $data
  176.      *
  177.      * @access public
  178.      * @author Kay Koch, <kay.koch@gmx.de>
  179.      * @param array 
  180.      * @return void 
  181.      */
  182.     public function insert($data)
  183.     {
  184.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7d begin
  185.         if ($this->loginOK{
  186.             if ($this->checkData($data)) {
  187.                 $this->oVerein->insertRow($data);
  188.                 $this->show();
  189.             else{
  190.                 $this->data $data;
  191.                 $this->change();
  192.             }
  193.         }
  194.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7d end
  195.     }
  196.  
  197.     /**
  198.      * überprüft die Korrektheit der eingebenen bzw. geänderten Daten
  199.      *
  200.      * @access public
  201.      * @author Kay Koch, <kay.koch@gmx.de>
  202.      * @param void 
  203.      * @return boolean 
  204.      */
  205.     public function checkData(&$data)
  206.     {
  207.         $returnValue = (bool) false;
  208.  
  209.         // section -64--88-122--2--62c31de:1048594e50f:-7fef begin
  210.         try {
  211.             if (!src_tools_CHECK::checkName($data['name']))
  212.                 throw new Exception ("20,Name");
  213.             if (!src_tools_CHECK::checkVnum_small ($data['verein_nr'])) // xxxx
  214.                 throw new Exception ("43,Vereinsnummer");
  215.             $returnValue true;
  216.         }
  217.         catch (Exception $e{
  218.             $message explode(","$e->getMessage());
  219.             $this->errorMsg "<b>[" $message[1"] : </b>" src_tools_ERROR::getErrTxt($message[0]);
  220.             $this->error src_tools_TEMPLATE::getTemplate('error'$this);
  221.         }
  222.         // section -64--88-122--2--62c31de:1048594e50f:-7fef end
  223.  
  224.         return (bool) $returnValue;
  225.     }
  226.  
  227.     /**
  228.      * Konstruktor
  229.      *
  230.      * erstellt ein Obejkt der zu beabeitenden Klassen
  231.      * list alle erlaubten Datenbankschlüssel ein
  232.      * liest das Template
  233.      *
  234.      * @access public
  235.      * @author Kay Koch, <kay.koch@gmx.de>
  236.      * @param string 
  237.      * @param int 
  238.      * @return void 
  239.      */
  240.     public function __construct($token$verein_nr)
  241.     {
  242.         // section -64--88-122--2-651443c0:1046f70e203:-7fde begin
  243.         parent::__construct($token);
  244.         $this->oVerein new src_foundation_tables_VEREINE();
  245.         $this->oVerein->setParams($verein_nr);
  246.         $this->oVerband new src_foundation_tables_VERBAENDE();
  247.         $this->setStartParameters ($this,$this->oVerein);
  248.         // section -64--88-122--2-651443c0:1046f70e203:-7fde end
  249.     }
  250.  
  251. /* end of class src_foundation_admin_ADMINVEREINE */
  252.  
  253. ?>

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