Source for file class.ADMINBREVETS.php

Documentation is available at class.ADMINBREVETS.php

  1. <?php
  2.  
  3.  
  4. /**
  5.  * Verwaltet die Adminitration der Datenbanktabelle 'brevets'
  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:-7fea-includes begin
  34. // section -64--88-122--2-651443c0:1046f70e203:-7fea-includes end
  35.  
  36. /* user defined constants */
  37. // section -64--88-122--2-651443c0:1046f70e203:-7fea-constants begin
  38. // section -64--88-122--2-651443c0:1046f70e203:-7fea-constants end
  39.  
  40. /**
  41.  * Verwaltet die Adminitration der Datenbanktabelle 'brevets'
  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 BREVETS 
  58.      */
  59.     private $oBrevet 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 $pageTemlate = '';
  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->oBrevet->unsetParams();
  94.             $arrTmp $this->oBrevet->getRow();
  95.             foreach($arrTmp as $this->data{
  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.     {
  115.         // section -64--88-122--2--6176e79b:103fa06a375:-7fa9 begin
  116.         if ($this->loginOK{
  117.             if ((!empty($this->oBrevet->brevet_id))) {
  118.                 $this->todo "update";
  119.                 $this->data $this->oBrevet->getRow();
  120.             else {
  121.                 $this->todo "insert";
  122.             }
  123.             $this->makePage("admin_" $this->pageTemplate "_input");
  124.         }
  125.         // section -64--88-122--2--6176e79b:103fa06a375:-7fa9 end
  126.     }
  127.  
  128.     /**
  129.      * Aktualisieet den vorher durch setzen der Parameter ausgewählten
  130.      *
  131.      * Die Neuen Daten befinden sich im Übergabefeld $data
  132.      *
  133.      * @access public
  134.      * @author Kay Koch, <kay.koch@gmx.de>
  135.      * @param array 
  136.      * @return void 
  137.      */
  138.     public function update($data)
  139.     {
  140.         // section -64--88-122--2--6176e79b:103fa06a375:-7f83 begin
  141.         if ($this->loginOK{
  142.             if ($this->checkData($data)) {
  143.                 $this->oBrevet->updateRow($data);
  144.                 $this->show();
  145.             else
  146.                 $this->change();
  147.         }
  148.         // section -64--88-122--2--6176e79b:103fa06a375:-7f83 end
  149.     }
  150.  
  151.     /**
  152.      * Löscht den Datensatz der vorher durch Parameter ausgewählt wurde
  153.      *
  154.      * @access public
  155.      * @author Kay Koch, <kay.koch@gmx.de>
  156.      * @return void 
  157.      */
  158.     public function delete()
  159.     {
  160.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7f begin
  161.         if ($this->loginOK{
  162.             $this->oBrevet->deleteRow();
  163.             $this->show();
  164.         }
  165.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7f end
  166.     }
  167.  
  168.     /**
  169.      * Fügt einen neuen datensatz mit den Werten des Übergabeparameter $data
  170.      *
  171.      * @access public
  172.      * @author Kay Koch, <kay.koch@gmx.de>
  173.      * @param array 
  174.      * @return void 
  175.      */
  176.     public function insert($data)
  177.     {
  178.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7d begin
  179.         if ($this->loginOK{
  180.             if ($this->checkData($data)) {
  181.                 $this->oBrevet->insertRow($data);
  182.                 $this->show();
  183.             else{
  184.                 $this->data $data;
  185.                 $this->change();
  186.             }
  187.         }
  188.         // section -64--88-122--2--6176e79b:103fa06a375:-7f7d end
  189.     }
  190.  
  191.     /**
  192.      * überprüft die Korrektheit der eingebenen bzw. geänderten Daten
  193.      *
  194.      * @access public
  195.      * @author Kay Koch, <kay.koch@gmx.de>
  196.      * @param void 
  197.      * @return boolean 
  198.      */
  199.     public function checkData(&$data)
  200.     {
  201.         $returnValue = (bool) false;
  202.  
  203.         // section -64--88-122--2--62c31de:1048594e50f:-7fef begin
  204.         try {
  205.             if (!src_tools_CHECK::checkBrevet($data['name']))
  206.                 throw new Exception ("56,Name");
  207.             $returnValue true;
  208.         }
  209.         catch (Exception $e{
  210.             $message explode(","$e->getMessage());
  211.             $this->errorMsg "<b>[" $message[1"] : </b>" src_tools_ERROR::getErrTxt($message[0]);
  212.             $this->error src_tools_TEMPLATE::getTemplate('error'$this);
  213.         }
  214.         // section -64--88-122--2--62c31de:1048594e50f:-7fef end
  215.  
  216.         return (bool) $returnValue;
  217.     }
  218.  
  219.     /**
  220.      * Konstruktor
  221.      *
  222.      * erstellt ein Obejkt der zu beabeitenden Klassen
  223.      * list alle erlaubten Datenbankschlüssel ein
  224.      * liest das Template
  225.      *
  226.      * @access public
  227.      * @author Kay Koch, <kay.koch@gmx.de>
  228.      * @param string 
  229.      * @param int 
  230.      * @return void 
  231.      */
  232.     public function __construct($token$brevet_id)
  233.     {
  234.         // section -64--88-122--2-651443c0:1046f70e203:-7fd7 begin
  235.         parent::__construct($token);
  236.         $this->oBrevet new src_foundation_tables_BREVETS();
  237.         $this->oBrevet->setParams($brevet_id);
  238.         $this->brevet_id $brevet_id;
  239.         $this->setStartParameters ($this,$this->oBrevet);
  240.         // section -64--88-122--2-651443c0:1046f70e203:-7fd7 end
  241.     }
  242.  
  243. /* end of class src_foundation_admin_ADMINBREVETS */
  244.  
  245. ?>

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