Source for file class.BREVETS.php

Documentation is available at class.BREVETS.php

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

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