Source for file class.STUNDENAUSWAHL.php

Documentation is available at class.STUNDENAUSWAHL.php

  1. <?php
  2. /**
  3.  * erstellt die HTML_Seite zur Stundenauswahl
  4.  *
  5.  * @author Kay Koch
  6.  * @package src
  7.  * @since 15.12.04
  8.  * @subpackage foundation_user
  9.  * @version 1
  10.  */
  11. if (version_compare(PHP_VERSION'5')) {
  12.    die('This file was generated for PHP 5');
  13. }
  14. /**
  15.  * Basisklasse der ausführenden Klassen
  16.  * Stellt Methoden und Eigenschaften zur Ein- und Ausgabe über das Webinterface
  17.  * Verfügung
  18.  *
  19.  * @author Kay Koch
  20.  * @since 15.12.04
  21.  * @version 1
  22.  */
  23. require_once ('src/foundation/user/class.PARENTUSER.php');
  24. /* user defined includes */
  25. // section -64--88-122--2-1328c7a:100b87cbb1c:-7fd5-includes begin
  26. // section -64--88-122--2-1328c7a:100b87cbb1c:-7fd5-includes end
  27. /* user defined constants */
  28. // section -64--88-122--2-1328c7a:100b87cbb1c:-7fd5-constants begin
  29. // section -64--88-122--2-1328c7a:100b87cbb1c:-7fd5-constants end
  30. /**
  31.  * erstellt die HTML_Seite zur Stundenauswahl
  32.  *
  33.  * @access public
  34.  * @author Kay Koch
  35.  * @package src
  36.  * @since 15.12.04
  37.  * @subpackage foundation_user
  38.  * @version 1
  39.  */
  40.    // --- ATTRIBUTES ---
  41.       /**
  42.     * @var src_foundation_tables_BUCHUNGEN Objekt der Tabellenklasse Buchungen
  43.     * @access private
  44.     */
  45.    private $oBuchungen null;
  46.  
  47.    /**
  48.     * @var src_foundation_tables_NACHTTERMINE Objekt der Tabellenklasse Nachttermine
  49.     * @access private
  50.     */
  51.    private $oNightdive null;
  52.  
  53.    /**
  54.     * @var string datum das aktuelle Datum
  55.     * @access private
  56.     */
  57.    private $datum '';
  58.  
  59.    /**
  60.     * @var int see_id die aktuelle See_id
  61.     * @access private
  62.     */
  63.    private $see_id '';
  64.  
  65.    /**
  66.     * @var $arrTableTemplate Feld mit Zellen-Templates für die HTML-Ausgabe
  67.     * @access private
  68.     */
  69.    private $arrTableTemplate array ();
  70.  
  71.    // --- OPERATIONS ---
  72.       /**
  73.     * erstellt die HTML_Seite zur Stundenauswahl zum See mit der übergebenen ID
  74.     * den übergebenen Tg
  75.     *
  76.     * @access private
  77.     * @author Kay Koch, <kay.koch@gmx.de>
  78.     * @return void 
  79.     */
  80.    private function makePage({
  81.       // section -64--88-122--2-1328c7a:100b87cbb1c:-7fb6 begin
  82.       $this->arrBlockedBuchungen $this->oBuchungen->getBlockedBuchungen($this->datum);
  83.       // lesen der freien Plätze aus NOCHFREI und erstellen von Reihen für die HTML-Tabelle
  84.       $this->timeSchedule $this->prepareRows($this->oNF->getUsedPerHour($this->datum));
  85.       // Datum für überschrift der Tabelle
  86.       $this->date src_tools_TIME :: sqlT2realT($this->datum"%A - %d. %B %Y");
  87.       // Variablen in Vorlage einfügen
  88.       $content src_tools_TEMPLATE :: getTemplate('stundenauswahl'$this);
  89.       // Ausgabe der Seite
  90.       $this->printPage($content);
  91.       // section -64--88-122--2-1328c7a:100b87cbb1c:-7fb6 end
  92.    }
  93.  
  94.    /**
  95.     *  initialisiert die Tagauswahl
  96.     * die Seitenerstellung ein
  97.     *
  98.     * @access public
  99.     * @author Kay Koch, <kay.koch@gmx.de>
  100.     * @param int 
  101.     * @param date 
  102.     * @return void 
  103.     */
  104.    public function __construct($data{
  105.       // section -64--88-122--2-1328c7a:101ce91d1f9:-7ff3 begin
  106.       $this->see_id = isset ($data['see_id']$data['see_id'"";
  107.       $this->datum = isset ($data['datum']$data['datum'"";
  108.       src_tools_CHECK :: checkID($this->see_idtrue);
  109.       src_tools_CHECK :: checkDatum($this->datumtrue);
  110.       parent :: __construct();
  111.       src_foundation_tables_PARENTTABLES :: setSea($this->see_id);
  112.       $this->oBuchungen new src_foundation_tables_BUCHUNGEN();
  113.       $this->oNightdive new src_foundation_tables_NACHTTERMINE();
  114.       $this->oNightdive->setParams($this->see_id$this->datum);
  115.       $this->prepareRowTemplates();
  116.       $this->makePage();
  117.       // section -64--88-122--2-1328c7a:101ce91d1f9:-7ff3 end
  118.    }
  119.  
  120.    /**
  121.     * erstellt die Zeilen zur Ausgabe
  122.     *
  123.     * Dargestellt wird der Zeitraum, indem eine Eingabe erlaubt ist, und die aktuelle Woche
  124.     *
  125.     * @access private
  126.     * @author Kay Koch, <kay.koch@gmx.de>
  127.     * @param array 
  128.     * @return string 
  129.     */
  130.    private function prepareRows($arrPlaces{
  131.       $returnValue = (string) '';
  132.       // section -64--88-122--2-1a4ded3:10245af4f0d:-7ffe begin
  133.       try {
  134.          $cTd "";
  135.          $cTh "";
  136.          $i 0;
  137.          // Befindet sich das aktuelle Datum innerhalb des erlaubten Bereiches
  138.          $isInDate src_foundation_tables_PARENTTABLES :: getSea()->checkDiveRange($this->datumsrc_foundation_tables_PARENTTABLES :: getFlags()->lastBackupDatefalse);
  139.          foreach ($arrPlaces['rest'as $hour => $v// durchlaufen aller Werte
  140.             $cTh .= sprintf($this->arrTableTemplate['th']$hour)// Kopfzeile wird erstellt
  141.             $info $this->checkSpecials($hour)// Infos zu BLockaden bzw. Nachtauchgängen
  142.             if (!$isInDate// aktuelle Woche-> keine anmeldung mehr erlaubt
  143.                $cTd .= sprintf($this->arrTableTemplate['td_old']$v$info);
  144.             else // Anmeldung erlubt
  145.                if ($v 1// Es ist mehr als 1 Platz vorhanden
  146.                   $witdh $v $arrPlaces['max'][$hour90// Prozentangabe für Bild
  147.                   $cTd .= sprintf($this->arrTableTemplate['td_Y']$hour$v$info$witdh);
  148.                else // Es sind keine Plätze vorhanden
  149.                   $cTd .= sprintf($this->arrTableTemplate['td_N']$info);
  150.                }
  151.             $i++;
  152.             if (($i 5== 0// maximal 5 Angaben pro Zeile, anschließend Zeilenumbruch
  153.                $returnValue .= "<tr>\n$cTh</tr>\n<tr>\n$cTd</tr>\n<tr>$this->arrTableTemplate['nl'"</tr>\n";
  154.                $cTd "";
  155.                $cTh "";
  156.             }
  157.          }
  158.          // Vervollständigen der letzten Zeile
  159.          if (($i 5!= 0)
  160.             $returnValue .= "<tr>$cTh</tr>\n<tr>$cTd</tr>\n<tr>$this->arrTableTemplate['nl'"</tr>\n";
  161.       catch (Exception $e{
  162.          src_tools_ERROR :: setError($e__METHOD__);
  163.       }
  164.       // section -64--88-122--2-1a4ded3:10245af4f0d:-7ffe end
  165.       return (string) $returnValue;
  166.    }
  167.  
  168.    /**
  169.     * liefert ein Feld mit Vorlagen für HTML- Zellen
  170.     * [nl]: leere Zelle
  171.     * [td_old]: Zelle ohne link zur Anmeldung aber mit Anzahl freier Plätze; CSS-Style: schedule_old
  172.     * [td_Y]: vollständige Zelle mit Link; CSS-Style: schedule
  173.     * [td_N]: Zelle mit 0 freien Plätzen; CSS-Style: schedule
  174.     * [th]: Kopfzelle; CSS-Style: schedule
  175.     * [img_N]: IMG Tag mit Icon zum Nachtauchen
  176.     * [img_B]: IMG Tag mit Icon zu Blockade
  177.     *[img_N]: IMG Tag mit Icon zum Nachtauchen
  178.     * @access private
  179.     * @author Kay Koch, <kay.koch@gmx.de>
  180.     * @param int 
  181.     * @return array 
  182.     */
  183.    private function prepareRowTemplates({
  184.       // section -64--88-0-1-1e1be92:104b436ad08:-7ff7 begin
  185.       // leere Zeile (nl)
  186.       $this->arrTableTemplate['nl'"\n\t<td colspan='5' style='font-size:5px;'>&nbsp;</td>\n";
  187.       // Zeile mit abgelaufenen Terminen
  188.       $this->arrTableTemplate['td_old'"\t<td class ='schedule_old' style='width:20%%;'>\n\t\t%s Plätze</a>%s<br>\n\t\t<img vspace='3' src='images/old.gif' width='90%%' height='8' border='1' alt=''>\n\t</td>\n";
  189.       // Zeile mit freien Plätzen (td_Y)
  190.       $this->arrTableTemplate['td_Y'"\t<td class ='schedulestyle='width:20%%;'>\n\t\t<a href='index.php5?action=eingabe&todo=show&data[see_id]=$this->see_id&data[datum]=$this->datum&data[stunde]=%s'>%s Plätze</a>%s<br>\n\t\t<img vspace='3' src='images/green.gifwidth='%s%%' height='8' border='1' alt=''>\n\t</td>\n";
  191.       // Zeile mit keinen freien Plätzen (td_N)
  192.       $this->arrTableTemplate['td_N'"\t<td class ='schedule'>0 Plätze%s<br>\n\t\t<img vspace='3' src='images/red.gif' width='90%%' height='8' border='1' alt=''></td>";
  193.       // Kopfzeile (th)
  194.       $this->arrTableTemplate['th'"\t<th class ='schedule'>%s</th>\n";
  195.       // Bild zum Nachttauchen
  196.       $this->arrTableTemplate['img_N'"&nbsp;<img  src='images/nachttauchen.gif' width='15' height='15' border='0' title='%s'>";
  197.       // Bild zur Blockade
  198.       $this->arrTableTemplate['img_B'"&nbsp;<img onmouseover=\"showMessageByInfo('%s')\" onmouseout=\"hideMessage('message1')\" src='images/blockade.gif' width='15' height='15' border='0' >";
  199.       // section -64--88-0-1-1e1be92:104b436ad08:-7ff7 end
  200.    }
  201.  
  202.    /**
  203.     * überprüft ob während der aktuellen Stunde eine Reservierung vorlegt
  204.     * liefert eine HTML Zellenerweiterung mit einem entsprechenden Icon
  205.     * @access private
  206.     * @author Kay Koch, <kay.koch@gmx.de>
  207.     * @param string $stunde zu überprüfende Stunde
  208.     * @return string HTML Zelle
  209.     */
  210.    private function checkSpecials($stunde{
  211.       $returnValue = (string) '';
  212.       // section -64--88-0-1-1328c7a:103fb536c78:-7fef begin
  213.       $info "";
  214.       if (isset ($this->arrBlockedBuchungen[$this->see_id][$this->datum][$stunde])) {
  215.          foreach ($this->arrBlockedBuchungen[$this->see_id][$this->datum][$stundeas $buchung{
  216.             $info[$buchung['name'" (" $buchung['anzahl'" Plätze)";
  217.          }
  218.          $returnValue .= sprintf($this->arrTableTemplate['img_B']implode("; "array_unique($info)));
  219.       }
  220.       if ($this->oNightdive->isNightDive($stunde)) {
  221.          $returnValue .= sprintf($this->arrTableTemplate['img_N']"Nachtauchgang");
  222.       }
  223.       // section -64--88-0-1-1328c7a:103fb536c78:-7fef end
  224.       return (string) $returnValue;
  225.    }
  226. /* end of class src_foundation_user_STUNDENAUSWAHL */
  227. ?>

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