update script to IServ2 complained about rooms that did not exist in the current...
[iserv-mod-room-reservation.git] / inc / mod_roomReservationPage.inc
1 <?php
2 /**
3 * @file mod_roomReservationPage.inc
4 * A generic page class
5 * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
6 * @date 24.06.2008
7 *
8 * Copyright © 2007 Roland Hieber
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 * THE SOFTWARE.
27 */
28
29 require_once("mod_room-reservation/mod_roomReservationConfig.inc");
30
31 /** @todo document */
32 abstract class mod_roomReservationPage {
33 /** (mod_roomReservationConfig) Reference to the configuration object */
34 protected $oCfg;
35 /** (string) Page title for PageBlue() */
36 protected $strTitle;
37 /** (string) Title icon for PageBlue() */
38 protected $strIcon;
39
40 /***************************************************************************/
41 /**
42 * @name Constructor
43 * @{
44 * Constructor
45 * @param $oCfg (reference to mod_roomReservationConfig) Reference to the
46 * configuration
47 * @return mod_roomReservationPage
48 */
49 function __construct(mod_roomReservationConfig &$oCfg) {
50 $this->oCfg = $oCfg;
51
52 $this->processRequestVariables();
53 }
54
55 /***************************************************************************/
56 /**
57 * @}
58 * @name Initialization
59 * @{
60 */
61
62 /**
63 * Process the REQUEST variables and preset the some variables. Override
64 * this function to process GET and POST parameters.
65 * @return void
66 */
67 protected function processRequestVariables() { }
68
69 /***************************************************************************/
70 /**
71 * @}
72 * @name Access to attributes
73 * @{
74 */
75
76 /**
77 * Set the page title
78 * @param $str (string)
79 * @return void
80 */
81 public function setTitle($str) { $this->strTitle = $str; }
82
83 /**
84 * Set the title icon
85 * @param $str (string)
86 * @return void
87 */
88 public function setIcon($str) { $this->strIcon = $str; }
89
90 /**
91 * Get the page title
92 * @return string
93 */
94 public function getTitle() { return $this->strTitle; }
95
96 /**
97 * Get the title icon
98 * @return string
99 */
100 public function getIcon() { return $this->strIcon; }
101
102 /***************************************************************************/
103 /**
104 * @}
105 * @name Output
106 * @{
107 */
108
109 /**
110 * Show the beginning of the page.
111 * @return void
112 */
113 protected function beginShow() {
114 html_header("<style type='text/css'>\n".rrGetCss()."\n</style>\n");
115 PageBlue(q($this->getTitle()), $this->getIcon());
116
117 // print error messages from the configuration
118 if($s = trim($this->oCfg->getMessages()) != "") {
119 printf("<p class='err'>%s</p>\n", nl2br(q($s)));
120 }
121 }
122
123 /**
124 * Show the beginning of the page. Override this function to print your
125 * HTML code.
126 * @return void
127 */
128 protected abstract function doShow();
129
130 /**
131 * Show the end of the page.
132 * @return void
133 */
134 protected function endShow() {
135 _PageBlue();
136 }
137
138 /**
139 * Show the full page. You don't need to override this function. Instead,
140 * override doShow().
141 * @return void
142 */
143 public function show() {
144 $this->beginShow();
145 $this->doShow();
146 $this->endShow();
147 }
148
149 }
150 ?>
This page took 0.06056 seconds and 5 git commands to generate.