Source for file class.ADMINKONTAKTE.php

Documentation is available at class.ADMINKONTAKTE.php

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

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