Source for file class.VERBAENDE.php

Documentation is available at class.VERBAENDE.php

  1. <?php
  2.  
  3.  
  4. /**
  5.  * Stellt die Verbindung zur Tabelle 'verbaende' her
  6.  *
  7.  * Verwaltet die Verbaende +
  8.  * ID1: offen
  9.  * ID2: VDST
  10.  *
  11.  * @author Kay Koch, <kay.koch@gmx.de>
  12.  * @package src
  13.  * @subpackage foundation_tables
  14.  */
  15.  
  16. if (version_compare(PHP_VERSION'5')) {
  17.     die('This file was generated for PHP 5');
  18. }
  19.  
  20. /**
  21.  * Basisklasse aller Klassen mit Datenbankzugriff.
  22.  *
  23.  * stellt Methoden und Objekte zur Fehlermeldung und zum Datenbankzugriff zur
  24.  *
  25.  * @author Kay Koch
  26.  * @since 1.12.04
  27.  * @version 1.1
  28.  */
  29. require_once('src/foundation/tables/class.PARENTTABLES.php');
  30.  
  31. /**
  32.  * Interface für die Klassen zur Manipulation der Datenbanktabellen
  33.  *
  34.  * @author Kay Koch, <kay.koch@gmx.de>
  35.  */
  36. require_once('src/interfaces/interface.TABLEINTERFACE.php');
  37.  
  38. /* user defined includes */
  39. // section -64--88-122--2-651443c0:1046f70e203:-7fcf-includes begin
  40. // section -64--88-122--2-651443c0:1046f70e203:-7fcf-includes end
  41.  
  42. /* user defined constants */
  43. // section -64--88-122--2-651443c0:1046f70e203:-7fcf-constants begin
  44. define('_JEDER_''00');
  45. define('_VDST_''99');
  46. // section -64--88-122--2-651443c0:1046f70e203:-7fcf-constants end
  47.  
  48. /**
  49.  * Stellt die Verbindung zur Tabelle 'verbaende' her
  50.  *
  51.  * Verwaltet die Verbaende +
  52.  * ID1: offen
  53.  * ID2: VDST
  54.  *
  55.  * @access public
  56.  * @author Kay Koch, <kay.koch@gmx.de>
  57.  * @package src
  58.  * @subpackage foundation_tables
  59.  */
  60.         implements src_interfaces_TABLEINTERFACE
  61. {
  62.     // --- ATTRIBUTES ---
  63.  
  64.     
  65.     /**
  66.      * Beinhaltet den Datenbanknamen (verbaende)
  67.      *
  68.      * @access protected
  69.      * @var string 
  70.      */
  71.     protected $dbTableName = 'verbaende';
  72.  
  73.     /**
  74.      * array mit allen Verbänden
  75.      *
  76.      * @access private
  77.      * @var array 
  78.      */
  79.     private static $data array();
  80.  
  81.     /**
  82.      * aktuelle Verband ID
  83.      *
  84.      * @access public
  85.      * @var int 
  86.      */
  87.     public $verband_nr = 0;
  88.  
  89.     // --- OPERATIONS ---
  90.  
  91.     
  92.     /**
  93.      * liefert einen (mehrere) Datensatz die durch setzen ser Parameter
  94.      * werden
  95.      *
  96.      * @access public
  97.      * @author Kay Koch, <kay.koch@gmx.de>
  98.      * @return array 
  99.      */
  100.     public function getRow()
  101.     {
  102.         $returnValue array();
  103.  
  104.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7fab begin
  105.         if (!empty($this->verband_nr))
  106.             $returnValue self::$data[$this->verband_nr];
  107.         else
  108.             $returnValue self::$data;
  109.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7fab end
  110.  
  111.         return (array) $returnValue;
  112.     }
  113.  
  114.     /**
  115.      * veranlasst ein Update
  116.      *
  117.      * @access public
  118.      * @author Kay Koch, <kay.koch@gmx.de>
  119.      * @param array 
  120.      * @return boolean 
  121.      */
  122.     public function updateRow($data)
  123.     {
  124.         $returnValue = (bool) false;
  125.  
  126.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7fa9 begin
  127.         try {
  128.             $sql "UPDATE IGNORE $this->dbTableName
  129.                     SET name = '$data['name'"',
  130.                         verband_nr = '" $data['verband_nr'"'
  131.                     WHERE verband_nr= '$this->verband_nr";
  132.             if (!$this->update($sql))
  133.                 throw new Exception ();
  134.             $this->updateData();
  135.             $returnValue true;
  136.         }
  137.         catch (Exception $e{
  138.         }
  139.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7fa9 end
  140.  
  141.         return (bool) $returnValue;
  142.     }
  143.  
  144.     /**
  145.      * fügt einen neuen Datensatz ein
  146.      *
  147.      * @access public
  148.      * @author Kay Koch, <kay.koch@gmx.de>
  149.      * @param array 
  150.      * @return boolean 
  151.      */
  152.     public function insertRow($data)
  153.     {
  154.         $returnValue = (bool) false;
  155.  
  156.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7fa6 begin
  157.         try {
  158.             $sql "INSERT IGNORE INTO $this->dbTableName
  159.                     SET verband_nr = '$data['verband_nr'"',
  160.                         name = '" $data['name'"'";
  161.             if (!$this->insert($sql))
  162.                 throw new Exception ();
  163.             $this->updateData();
  164.             $returnValue true;
  165.         }
  166.         catch (Exception $e{
  167.         }
  168.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7fa6 end
  169.  
  170.         return (bool) $returnValue;
  171.     }
  172.  
  173.     /**
  174.      * löscht einen Datensatz
  175.      *
  176.      * @access public
  177.      * @author Kay Koch, <kay.koch@gmx.de>
  178.      * @return boolean 
  179.      */
  180.     public function deleteRow()
  181.     {
  182.         $returnValue = (bool) false;
  183.  
  184.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7f9e begin
  185.         try {
  186.             $sql "DELETE FROM $this->dbTableName WHERE verband_nr = '$this->verband_nr";
  187.             if (!$this->delete($sql))
  188.                 throw new Exception ();
  189.             $this->updateData();
  190.             $returnValue true;
  191.         }
  192.         catch (Exception $e{;
  193.         }
  194.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7f9e end
  195.  
  196.         return (bool) $returnValue;
  197.     }
  198.  
  199.     /**
  200.      * aktualisiert die Daten im gegenwertigen Objekt
  201.      *
  202.      * @access public
  203.      * @author Kay Koch, <kay.koch@gmx.de>
  204.      * @return boolean 
  205.      */
  206.     public function updateData()
  207.     {
  208.         $returnValue = (bool) false;
  209.  
  210.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7f9c begin
  211.         $sql "SELECT * FROM  $this->dbTableName ORDER by verband_nr ASC";
  212.         self::$data $this->select($sqltrue"verband_nr");
  213.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7f9c end
  214.  
  215.         return (bool) $returnValue;
  216.     }
  217.  
  218.     /**
  219.      * löscht die Parameter, die den gegenwärtigen Datensatz identifizieren
  220.      *
  221.      * @access public
  222.      * @author Kay Koch, <kay.koch@gmx.de>
  223.      * @return void 
  224.      */
  225.     public function unsetParams()
  226.     {
  227.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7f97 begin
  228.         unset($this->verband_nr);
  229.         // section -64--88-122--2--3d9a0b58:1040f000f1b:-7f97 end
  230.     }
  231.  
  232.     /**
  233.      * Konstuctor
  234.      *
  235.      * lädt alle Verbände
  236.      *
  237.      * @access public
  238.      * @author Kay Koch, <kay.koch@gmx.de>
  239.      * @return void 
  240.      */
  241.     public function __construct()
  242.     {
  243.         // section -64--88-122--2-651443c0:1046f70e203:-7fcb begin
  244.         parent::__construct();
  245.         if (empty(self::$data)) {
  246.             $this->updateData();
  247.         }
  248.         // section -64--88-122--2-651443c0:1046f70e203:-7fcb end
  249.     }
  250.  
  251.     /**
  252.      * setzt die Daten für die aktuelle Bearbeitung
  253.      *
  254.      * @access public
  255.      * @author Kay Koch, <kay.koch@gmx.de>
  256.      * @param int 
  257.      * @return void 
  258.      */
  259.     public function setParams($verein_nr)
  260.     {
  261.         // section -64--88-122--2-651443c0:1046f70e203:-7fc9 begin
  262.         $this->verband_nr = substr($verein_nr02);
  263.         // section -64--88-122--2-651443c0:1046f70e203:-7fc9 end
  264.     }
  265.  
  266.     /**
  267.      * liefert eine Optionslist mit allen Verbänden
  268.      *
  269.      * @access public
  270.      * @author Kay Koch, <kay.koch@gmx.de>
  271.      * @param int 
  272.      * @return string 
  273.      */
  274.     public function getOptionList($index 0)
  275.     {
  276.         $returnValue = (string) '';
  277.  
  278.         // section -64--88-122--2-651443c0:1046f70e203:-7fb7 begin
  279.         foreach (self::$data as $arrTmp{
  280.             $selected ($arrTmp['verband_nr'== $index"SELECTED" "";
  281.             $returnValue .= "<option $selected value='$arrTmp['verband_nr'"'>" $arrTmp['name'"</option>\n";
  282.         }
  283.         // section -64--88-122--2-651443c0:1046f70e203:-7fb7 end
  284.  
  285.         return (string) $returnValue;
  286.     }
  287.  
  288.  
  289.     /**
  290.      * liefert den Inhalt eines Feldes mit Namen Index aus den Vereinen
  291.      *
  292.      * @access public
  293.      * @author Kay Koch, <kay.koch@gmx.de>
  294.      * @param string 
  295.      * @return string 
  296.      */
  297.     private function __get ($index)
  298.     {
  299.         $returnValue = (string) '';
  300.         //
  301.         try {
  302.             if (isset(self::$data[$this->verband_nr][$index]))
  303.                 $returnValue self::$data[$this->verband_nr][$index];
  304.         }
  305.         catch (Exception $e{
  306.             src_tools_ERROR::setError($e__METHOD__);
  307.         }
  308.           //
  309.         return ($returnValue);
  310.     }
  311.  
  312.     /**
  313.      * liefert die Konstanten IDs
  314.      *
  315.      * [1]: offen
  316.      * [2]: LVST
  317.      *
  318.      * @access public
  319.      * @author Kay Koch, <kay.koch@gmx.de>
  320.      * @return array 
  321.      */
  322.     public function getConstants()
  323.     {
  324.         $returnValue array();
  325.  
  326.         // section -64--88-122--2-4192cb24:1047709aeea:-7ff7 begin
  327.         $returnValue[0_JEDER_;
  328.         $returnValue[1_VDST_;
  329.         // section -64--88-122--2-4192cb24:1047709aeea:-7ff7 end
  330.  
  331.         return (array) $returnValue;
  332.     }
  333.  
  334.     /**
  335.      * Überprpüft ob ein Verband existiert
  336.      *
  337.      * @access public
  338.      * @author Kay Koch, <kay.koch@gmx.de>
  339.      * @param string 
  340.      * @return boolean 
  341.      */
  342.     public function verbandExists($vereinNr)
  343.     {
  344.         $returnValue = (bool) false;
  345.  
  346.         // section -64--88-122--2-4192cb24:1047709aeea:-7ff5 begin
  347.         $verband_nr substr($vereinNr02);
  348.         foreach(self::$data as $key => $row{
  349.             if ($verband_nr == $row['verband_nr']{
  350.                 $returnValue true;
  351.                 break;
  352.             }
  353.         }
  354.         // section -64--88-122--2-4192cb24:1047709aeea:-7ff5 end
  355.  
  356.         return (bool) $returnValue;
  357.     }
  358.  
  359. /* end of class src_foundation_tables_VERBAENDE */
  360.  
  361. ?>

Documentation generated on Sat, 24 Mar 2007 10:00:12 +0100 by phpDocumentor 1.3.1