Source for file class.PARENTADMIN.php

Documentation is available at class.PARENTADMIN.php

  1. <?php
  2.  
  3. /**
  4.  * Parentklasse zur Administration der Tabellen
  5.  *
  6.  * @author Kay Koch, <kay.koch@gmx.de>
  7.  * @package src
  8.  * @subpackage foundation_admin
  9.  */
  10.  
  11. if (version_compare(PHP_VERSION'5')) {
  12.     die('This file was generated for PHP 5');
  13. }
  14.  
  15. /**
  16.  * Interface für alle Klassen, die direkt aus dem Natz angesprochen werden
  17.  *
  18.  * @author Kay Koch, <kay.koch@gmx.de>
  19.  */
  20. require_once ('src/interfaces/interface.HTMLINTERFACE.php');
  21.  
  22. /* user defined includes */
  23. // section -64--88-122--2--759b93b2:10397a7591b:-7fdf-includes begin
  24. // section -64--88-122--2--759b93b2:10397a7591b:-7fdf-includes end
  25.  
  26. /* user defined constants */
  27. // section -64--88-122--2--759b93b2:10397a7591b:-7fdf-constants begin
  28. // section -64--88-122--2--759b93b2:10397a7591b:-7fdf-constants end
  29.  
  30. /**
  31.  * Parentklasse zur Administration der Tabellen
  32.  *
  33.  * @access public
  34.  * @author Kay Koch, <kay.koch@gmx.de>
  35.  * @package src
  36.  * @subpackage foundation_admin
  37.  */
  38. class src_foundation_admin_PARENTADMIN implements src_interfaces_HTMLINTERFACE {
  39.     // --- ATTRIBUTES ---
  40.  
  41.     
  42.     /**
  43.      * Flag zur Bearbeitungsgenehmigung
  44.      *
  45.      * @access protected
  46.      * @var boolean 
  47.      */
  48.     protected $loginOK = false;
  49.  
  50.     /**
  51.      * Name des Arrays in dem die Token gespeichert werden
  52.      *
  53.      * @access private
  54.      * @var array 
  55.      */
  56.     private $arrToken array ();
  57.  
  58.     /**
  59.      * Name der aktuellen Tabelle, die bearbeitet wird
  60.      *
  61.      * @access private
  62.      * @var string 
  63.      */
  64.     //public $title = '';
  65.  
  66.     
  67.     /**
  68.      * Obeject der Klasse Seen
  69.      *
  70.      * @access protected
  71.      * @var SEEN 
  72.      */
  73.     protected $oSeen = null;
  74.  
  75.     /**
  76.      * Objekt der Klasse Kontakte
  77.      *
  78.      * @access protected
  79.      * @var $oKotakte 
  80.      */
  81.     protected $oKontakte = null;
  82.     // --- OPERATIONS ---
  83.  
  84.     
  85.     /**
  86.      * gibt die Seite aus
  87.      *
  88.      * @access public
  89.      * @author Kay Koch, <kay.koch@gmx.de>
  90.      * @param string 
  91.      * @param boolean 
  92.      * @return void 
  93.      */
  94.     public function printPage($content$noHeader false{
  95.         // section -64--88-122--2-3f9fc877:104611dccfe:-7fce begin
  96.         $this->header ($noHeader"" $this->makeHeader();
  97.         // umspeichern des Inhaltes um sie im aktuellen Objekt verfügbar zu machen
  98.         $this->content1 $content;
  99.         // Header und Content in der Hauptvorlage verbinden
  100.         $page src_tools_TEMPLATE :: getTemplate('admin_main'$this);
  101.         // Ausgabe der Seite
  102.         print $page;
  103.         // section -64--88-122--2-3f9fc877:104611dccfe:-7fce end
  104.     }
  105.  
  106.     /**
  107.      * erstellt enn Header
  108.      *
  109.      * @access public
  110.      * @author Kay Koch, <kay.koch@gmx.de>
  111.      * @return string 
  112.      */
  113.     public function makeHeader({
  114.         $returnValue = (string) '';
  115.  
  116.         // section -64--88-122--2-3f9fc877:104611dccfe:-7fcc begin
  117.         // Headerinformationen in Vorlge schreiben lassen
  118.         $returnValue src_tools_TEMPLATE :: getTemplate('admin_header'$this);
  119.         // section -64--88-122--2-3f9fc877:104611dccfe:-7fcc end
  120.  
  121.         return (string) $returnValue;
  122.     }
  123.  
  124.     /**
  125.      * Short description of method makeFooter
  126.      *
  127.      * @access public
  128.      * @author Kay Koch, <kay.koch@gmx.de>
  129.      * @return string 
  130.      */
  131.     public function makeFooter({
  132.         $returnValue = (string) '';
  133.  
  134.         // section -64--88-0-1--1e6707e3:1048f065750:-7fdb begin
  135.         // section -64--88-0-1--1e6707e3:1048f065750:-7fdb end
  136.  
  137.         return (string) $returnValue;
  138.     }
  139.  
  140.     /**
  141.      * Konstruktor
  142.      *
  143.      * überprüft anhand des Übergabeparameters $_token die Anmeldung
  144.      *
  145.      * @access public
  146.      * @author Kay Koch, <kay.koch@gmx.de>
  147.      * @param string 
  148.      * @return void 
  149.      */
  150.     public function __construct($token ''{
  151.         // section -64--88-122--2--759b93b2:10397a7591b:-7fdd begin
  152.         try {
  153.             if (empty ($tokenOR !src_tools_TOKEN :: tokenIsOK($token)) {
  154.                 $this->showRequestPage();
  155.             else {
  156.                 $this->arrToken src_tools_TOKEN :: getArrToken($token);
  157.                 $this->hiddenToken $this->arrToken['POST'];
  158.                 $this->oKontakte = new src_foundation_tables_KONTAKTE();
  159.                 $this->oSeen = new src_foundation_tables_SEEN(true);
  160.                 $this->token $this->arrToken['GET'];
  161.                 $this->loginOK = true;
  162.             }
  163.         catch (Exception $e{
  164.             src_tools_ERROR :: setError($e__METHOD__);
  165.         }
  166.         // section -64--88-122--2--759b93b2:10397a7591b:-7fdd end
  167.     }
  168.  
  169.     /**
  170.      * erstellt die HTML_Seite zur Bearbeitung der Kontakte
  171.      *
  172.      * @access protected
  173.      * @author Kay Koch, <kay.koch@gmx.de>
  174.      * @param string 
  175.      * @return void 
  176.      */
  177.     protected function makePage($tpl{
  178.         // section -64--88-122--2--759b93b2:10397a7591b:-7fd5 begin
  179.         // Formatieren der Ausgabe
  180.         $content src_tools_TEMPLATE :: getTemplate($tpl$this);
  181.         // Ausgabe der Seite
  182.         $this->printPage($content);
  183.         // section -64--88-122--2--759b93b2:10397a7591b:-7fd5 end
  184.     }
  185.  
  186.     /**
  187.      * überprüft Benutzernemen und Passwort
  188.      *
  189.      * @access private
  190.      * @author Kay Koch, <kay.koch@gmx.de>
  191.      * @param string 
  192.      * @param string 
  193.      * @return boolean 
  194.      */
  195.     private function checkPWD($login$pwd{
  196.         $returnValue = (bool) false;
  197.         // section -64--88-122--2--759b93b2:10397a7591b:-7fcd begin
  198.         $this->oKontakte;
  199.         if ($this->oKontakte->isAdmin($login$pwd)) {
  200.             $this->loginOK = true;
  201.             $returnValue true;
  202.         }
  203.         // section -64--88-122--2--759b93b2:10397a7591b:-7fcd end
  204.         return (bool) $returnValue;
  205.     }
  206.  
  207.     /**
  208.      * erstellt die EIingabemaske zur Anmeldung
  209.      *
  210.      * @access public
  211.      * @author Kay Koch, <kay.koch@gmx.de>
  212.      * @return void 
  213.      */
  214.     public function showRequestPage({
  215.         // section -64--88-122--2--759b93b2:10397a7591b:-7fc9 begin
  216.         $this->arrToken src_tools_TOKEN :: getArrToken();
  217.         $this->hiddenToken $this->arrToken['POST'];
  218.         $content src_tools_TEMPLATE :: getTemplate('admin_login'$this);
  219.         $this->printPage($contenttrue);
  220.         // section -64--88-122--2--759b93b2:10397a7591b:-7fc9 end
  221.     }
  222.  
  223.     /**
  224.      * erstellt die Startseite
  225.      *
  226.      * @access private
  227.      * @author Kay Koch, <kay.koch@gmx.de>
  228.      * @return void 
  229.      */
  230.     private function showAdminPage({
  231.         // section -64--88-122--2--759b93b2:10397a7591b:-7fc5 begin
  232.         if ($this->loginOK)
  233.             $this->makePage("admin_intro");
  234.         // section -64--88-122--2--759b93b2:10397a7591b:-7fc5 end
  235.     }
  236.  
  237.     /**
  238.      * beendet die Session und veranlasst die Anmeldung
  239.      *
  240.      * @access public
  241.      * @author Kay Koch, <kay.koch@gmx.de>
  242.      * @return void 
  243.      */
  244.     public function logout({
  245.         // section -64--88-122--2--759b93b2:10397a7591b:-7fb4 begin
  246.         src_tools_TOKEN :: endSession();
  247.         $this->showRequestPage();
  248.         // section -64--88-122--2--759b93b2:10397a7591b:-7fb4 end
  249.     }
  250.  
  251.     /**
  252.      * Ändert das Passwort
  253.      *
  254.      * @access public
  255.      * @author Kay Koch, <kay.koch@gmx.de>
  256.      * @param array 
  257.      * @return void 
  258.      */
  259.     public function changePWD($data null{
  260.         // section -64--88-122--2--55b78af2:103c6aa601f:-7fb0 begin
  261.         try {
  262.             $this->error "";
  263.             if (!$this->loginOK)
  264.                 $this->showRequestPage();
  265.             if (!isset ($data))
  266.                 throw new Exception("");
  267.             if (empty ($data['login']))
  268.                 throw new Exception("");
  269.             if (empty ($data['newpwd1']OR empty ($data['newpwd2']))
  270.                 throw new Exception(106);
  271.             if (!($data['newpwd1'== $data['newpwd2']))
  272.                 throw new Exception(107);
  273.             if ($data['newpwd1'== $data['pwd'])
  274.                 throw new Exception(108);
  275.             $kontakt new src_foundation_tables_KONTAKT();
  276.             if (!$kontakt->setPWD($data['login']$data['pwd']$data['newpwd1']))
  277.                 throw new Exception(109);
  278.             $this->showAdminPage();
  279.         catch (Exception $e{
  280.             if ($e->getMessage(!= ""{
  281.                 $this->errorMsg src_tools_ERROR :: getErrTxt($e->getMessage());
  282.                 $this->error src_tools_TEMPLATE :: getTemplate("error"$this);
  283.             }
  284.             $this->makePage("admin_changePWD");
  285.         }
  286.         // section -64--88-122--2--55b78af2:103c6aa601f:-7fb0 end
  287.     }
  288.  
  289.     /**
  290.      * überprüft die Übergabeparameter zum Einloggen und führt dieses durch
  291.      *
  292.      * @access public
  293.      * @author Kay Koch, <kay.koch@gmx.de>
  294.      * @param string 
  295.      * @param string 
  296.      * @return void 
  297.      */
  298.     public function login($login$pwd{
  299.         // section -64--88-122--2-501b4c2c:104388b59c9:-7fd3 begin
  300.         try {
  301.             if (!src_tools_CHECK :: checkPWD($pwdtrue))
  302.                 throw new Exception("pwd-falsch");
  303.             if (!src_tools_CHECK :: checkName($logintrue))
  304.                 throw new Exception("name");
  305.             if (!$this->checkPWD($login$pwd))
  306.                 throw new Exception("pwd");
  307.             $this->showAdminPage();
  308.         catch (Exception $e{
  309.             $this->showRequestPage();
  310.         }
  311.         // section -64--88-122--2-501b4c2c:104388b59c9:-7fd3 end
  312.     }
  313.  
  314.     /**
  315.      * liefert ein Optionlist aus Ja und Nein
  316.      *
  317.      * @access protected
  318.      * @author Kay Koch, <kay.koch@gmx.de>
  319.      * @param string 
  320.      * @return string 
  321.      */
  322.     protected function getBoolOptionLIst($index ''{
  323.         $returnValue = (string) '';
  324.  
  325.         // section -64--88-122--2-339007d5:1043cd4e8c9:-7f92 begin
  326.         if ($index)
  327.             $returnValue "<option selected value=1>Ja</option>\n <option  value=0>Nein</option>";
  328.         else
  329.             $returnValue "<option value=1>Ja</option>\n <option selected value=0>Nein</option>";
  330.         // section -64--88-122--2-339007d5:1043cd4e8c9:-7f92 end
  331.  
  332.         return (string) $returnValue;
  333.     }
  334.     /** liefert das Objekt oSeen
  335.      *
  336.      * @access public
  337.      * @author Kay Koch, <kay.koch@gmx.de>
  338.      * @return src_foundation_tables_SEEN 
  339.      */
  340.     public function getSeen($id=""{
  341.         $returnValue (empty($id))?$this->oSeen$this->oSeen->$id;
  342.         return $returnValue;
  343.     }
  344.  
  345.     /**
  346.      * liefert Ja bzw Nein für einen boolschen Wert
  347.      *
  348.      * @access protected
  349.      * @author Kay Koch, <kay.koch@gmx.de>
  350.      * @param boolean 
  351.      * @return string 
  352.      */
  353.     protected function getBoolName($index{
  354.         $returnValue = (string) '';
  355.  
  356.         // section -64--88-122--2-7471698e:1046ab3b89c:-7fe0 begin
  357.         $returnValue ($index == "1""Ja" "Nein";
  358.         // section -64--88-122--2-7471698e:1046ab3b89c:-7fe0 end
  359.  
  360.         return (string) $returnValue;
  361.     }
  362.     protected function setStartParameters($o$oTable{
  363.         //
  364.         $o->action $oTable->getTableName();
  365.         $o->arrKeys $oTable->getArrKeys();
  366.         foreach ($o->arrKeys as $key)
  367.             $o->data[$key"";
  368.         $o->pageTemplate $oTable->getTableName();
  369.         $o->title strtoupper($o->pageTemplate);
  370.         $o->error "";
  371.         //
  372.     }
  373.     public function restart($todo{
  374.         //
  375.         try {
  376.             $this->error "";
  377.             if (!$this->loginOK)
  378.                 $this->showRequestPage();
  379.             if (empty ($todo))
  380.                 $this->makePage("admin_restart");
  381.             if (!empty ($todoAND $todo == "totalrestart"){
  382.                 $oNochfrei new src_foundation_tables_NOCHFREI();
  383.                 // Alle freien Plätze werden neu angelegt
  384.                 $oNochfrei->insertNewEntries();
  385.                 // Blockaden und Nachttermine werden neu eingelesen
  386.                  $oNochfrei->insertSpecials();
  387.                 $this->showAdminPage();
  388.             }
  389.         catch (Exception $e{
  390.             if ($e->getMessage(!= ""{
  391.                 $this->errorMsg src_tools_ERROR :: getErrTxt($e->getMessage());
  392.                 $this->error src_tools_TEMPLATE :: getTemplate("error"$this);
  393.             }
  394.         }
  395.     }
  396. /* end of class src_foundation_admin_PARENTADMIN */
  397. ?>

Documentation generated on Sat, 24 Mar 2007 09:59:45 +0100 by phpDocumentor 1.3.1