00001 <?php
00002
00003 include 'includes/base_page.inc.php';
00004
00022 function base_page_install()
00023 {
00024 $info['name'] = 'base_page';
00025 $info['title'] = 'Base class for pages';
00026 $info['description'] = 'All different kinds of pages depend on this '.
00027 'class.';
00028 $info['has_admin'] = 0;
00029 $info['enabled'] = 1;
00030 set_module_info($info);
00031
00032 $basemodules = get_entry('config','base_modules');
00033 ListAdd('base_page', $basemodules);
00034 set_entry('config', 'base_modules', $basemodules);
00035
00036 set_entry('config', 'tl_merge', 'n');
00037 set_entry('config', 'tr_merge', 'n');
00038 set_entry('config', 'bl_merge', 'n');
00039 set_entry('config', 'br_merge', 'n');
00040 set_entry('config', 'is_toprow', 'y');
00041 set_entry('config', 'is_bottomrow', 'y');
00042 set_entry('config', 'is_leftcol', 'y');
00043 set_entry('config', 'is_rightcol', 'y');
00044 set_entry('config', 'tl_showifmerged', 'y');
00045 set_entry('config', 'tc_showifmerged', 'y');
00046 set_entry('config', 'tr_showifmerged', 'y');
00047 set_entry('config', 'ml_showifmerged', 'y');
00048 set_entry('config', 'mr_showifmerged', 'y');
00049 set_entry('config', 'bl_showifmerged', 'y');
00050 set_entry('config', 'bc_showifmerged', 'y');
00051 set_entry('config', 'br_showifmerged', 'y');
00052 set_entry('config', 'leftcol_size', '20');
00053
00054 set_entry('config', 'rightcol_size', '20');
00055 set_entry('config', 'total_width', '96');
00056 set_entry('config', 'summary_length', '100');
00057 set_entry('lang', 'read_more', 'Read more...');
00058 set_entry('lang', 'back', 'Back...');
00059
00060 module_installed();
00061 }
00062
00072 function base_page_uninstall($preserve_data)
00073 {
00074 delete_module('base_page');
00075
00076 $basemodules = get_entry('config','base_modules');
00077 ListDel('base_page', $basemodules);
00078 set_entry('config', 'base_modules', $basemodules);
00079
00080 if (!$preserve_data)
00081 {
00082 delete_entry('config', 'tl_merge');
00083 delete_entry('config', 'tr_merge');
00084 delete_entry('config', 'bl_merge');
00085 delete_entry('config', 'br_merge');
00086 delete_entry('config', 'is_toprow');
00087 delete_entry('config', 'is_bottomrow');
00088 delete_entry('config', 'is_leftcol');
00089 delete_entry('config', 'is_rightcol');
00090 delete_entry('config', 'tl_showifmerged');
00091 delete_entry('config', 'tc_showifmerged');
00092 delete_entry('config', 'tr_showifmerged');
00093 delete_entry('config', 'ml_showifmerged');
00094 delete_entry('config', 'mr_showifmerged');
00095 delete_entry('config', 'bl_showifmerged');
00096 delete_entry('config', 'bc_showifmerged');
00097 delete_entry('config', 'br_showifmerged');
00098 delete_entry('config', 'leftcol_size');
00099 delete_entry('config', 'rightcol_size');
00100 delete_entry('config', 'total_width');
00101 delete_entry('config', 'summary_length');
00102
00103 delete_entry('lang', 'read_more');
00104 delete_entry('lang', 'back');
00105 }
00106 }
00107
00119 function get_page()
00120 {
00121 global $pageType, $ptFound;
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 get_entry('config', 'is_leftcol') == 'y'
00133 ? $leftcol_size = get_entry('config', 'leftcol_size')
00134 : $leftcol_size = 0;
00135 get_entry('config', 'is_rightcol') == 'y'
00136 ? $rightcol_size = get_entry('config', 'rightcol_size')
00137 : $rightcol_size = 0;
00138 $centrecol_size = 100 - ($leftcol_size + $rightcol_size);
00139 $total_width = get_entry('config', 'total_width');
00140
00141 print "\n<div style=\"text-align: center\">\n<table class='main_table' width='$total_width%'>\n";
00142
00143 if (get_entry('config', 'is_toprow') != 'n')
00144 {
00145 print "<tr class='t_row'>\n";
00146
00147 if (get_entry('config', 'is_leftcol') != 'n')
00148 {
00149 $colspan = Ibase_page_getColSpan('tl');
00150 $rowspan = Ibase_page_getRowSpan('tl');
00151
00152 if ($colspan > 1 AND $rowspan > 1)
00153 die (
00154 'Critical error: colspan and rowspan are both > 1 ' .
00155 'in the top-left cell.');
00156
00157 print "\t<td class='tl_cell' colspan='$colspan' rowspan='$rowspan'";
00158
00159 if ($colspan == 1)
00160 print " style=\"width: $leftcol_size%\"";
00161 print ">\n";
00162
00163 if (Ibase_page_doShowData('tl'))
00164 CallHooks('tl_cell');
00165
00166
00167 if ($colspan > 1 AND Ibase_page_doShowData('tc'))
00168 CallHooks('tc_cell');
00169 if ($colspan == 3 AND Ibase_page_doShowData('tr'))
00170 CallHooks('tr_cell');
00171
00172
00173 if ($rowspan > 1 AND Ibase_page_doShowData('ml'))
00174 CallHooks('ml_cell');
00175 if ($rowspan == 3 AND Ibase_page_doShowData('bl'))
00176 CallHooks('bl_cell');
00177 print "\t</td>\n";
00178 }
00179
00180 $colspan = Ibase_page_getColSpan('tc');
00181
00182 if ($colspan > 0)
00183 {
00184 print "\t<td class='tc_cell' colspan='$colspan'";
00185 if ($colspan == 1)
00186 print " style=\"width: $centrecol_size%\"";
00187 print ">\n";
00188
00189 if (Ibase_page_doShowData('tc'))
00190 CallHooks('tc_cell');
00191 if ($colspan == 2 AND Ibase_page_doShowData('tr'))
00192 CallHooks('tr_cell');
00193 print "\t</td>\n";
00194 }
00195
00196 if (Ibase_page_getColSpan('tr') > 0 AND get_entry('config', 'is_rightcol'))
00197 {
00198 print "\t<td class='tr_cell'";
00199 if ($colspan == 1)
00200 print " style=\"width: $rightcol_size%\"";
00201 print ">\n";
00202
00203 if (Ibase_page_doShowData('tr'))
00204 CallHooks('tr_cell');
00205 print "\t</td>\n";
00206 }
00207 print "</tr>\n";
00208 }
00209 print "<tr class='m_row'>\n";
00210
00211 $rowspan = Ibase_page_getRowSpan('ml');
00212 if ($rowspan > 0 AND get_entry('config', 'is_leftcol'))
00213 {
00214 print " <td class='ml_cell' rowspan='$rowspan'";
00215 if ($colspan == 1)
00216 print " style=\"width: $leftcol_size%\"";
00217 print ">\n";
00218 if (Ibase_page_doShowData('ml'))
00219 CallHooks('ml_cell');
00220 if ($rowspan == 2 AND Ibase_page_doShowData('bl'))
00221 CallHooks('bl_cell');
00222 print "\t</td>\n";
00223 }
00224
00225 print "\t<td style=\"width: $centrecol_size\%\" class='mc_cell'>\n";
00226 print "<div style=\"text-align: center\">\n";
00227 $_REQUEST['pt'] == ''
00228 ? $pageType = 'normal'
00229 : $pageType = $_REQUEST['pt'];
00230 $ptFound = false;
00231 CallHooks('content');
00232 if ($ptFound == false)
00233 {
00234 ?>
00235 <h1>Critical error</h1>
00236 Unknown page type: <?php echo $pageType; ?>
00237 <?php
00238 }
00239 print "\t</div>\n</td>\n";
00240
00241 $rowspan = Ibase_page_getRowSpan('mr');
00242 if ($rowspan > 0 AND get_entry('config', 'is_rightcol'))
00243 {
00244 print "\t<td class='mr_cell' rowspan='$rowspan'";
00245 if ($colspan == 1)
00246 print " style=\"width: $rightcol_size%\"";
00247 print ">\n";
00248
00249 if (Ibase_page_doShowData('mr'))
00250 CallHooks('mr_cell');
00251 if ($rowspan == 2 AND Ibase_page_doShowData('br'))
00252 CallHooks('br_cell');
00253 print "\t</td>\n";
00254 }
00255 print "</tr>\n";
00256 if (get_entry('config', 'is_bottomrow') != 'n')
00257 {
00258 print "<tr class='b_row'>\n";
00259
00260 $colspan = Ibase_page_getColSpan('bl');
00261 if ($colspan > 0 AND get_entry('config', 'is_leftcol'))
00262 {
00263 print "\t<td class='bl_cell' colspan='$colspan'";
00264 if ($colspan == 1)
00265 print " style=\"width: $leftcol_size%\"";
00266 print ">\n";
00267
00268 if (Ibase_page_doShowData('bl'))
00269 CallHooks('bl_cell');
00270 if ($colspan > 1 AND Ibase_page_doShowData('bc'))
00271 CallHooks('bc_cell');
00272 if ($colspan == 3 AND Ibase_page_doShowData('br'))
00273 CallHooks('br_cell');
00274 print "\t</td>\n";
00275 }
00276
00277 $colspan = Ibase_page_GetColSpan('bc');
00278 if ($colspan > 0)
00279 {
00280 print "\t<td class='bc_cell' colspan='$colspan'";
00281 if ($colspan == 1)
00282 print " style=\"width: $centrecol_size%\"";
00283 print ">\n";
00284
00285 if (Ibase_page_doShowData('bc'))
00286 CallHooks('bc_cell');
00287 if ($colspan == 2 AND Ibase_page_doShowData('br'))
00288 CallHooks('br_cell');
00289 print "\t</td>\n";
00290 }
00291
00292 $colspan = Ibase_page_getColSpan('mr');
00293 $rowspan = Ibase_page_getRowSpan('mr');
00294 if ($colspan == 1 AND $rowspan == 1 AND get_entry('config', 'is_rightcol'))
00295 {
00296 print "\t<td class='br_cell'";
00297 if ($colspan == 1)
00298 print " style=\"width: $rightcol_size%\"";
00299 print ">\n";
00300
00301 if (Ibase_page_doShowData('br'))
00302 CallHooks('br_cell');
00303 print "\t</td>\n";
00304 }
00305 print "</tr>\n";
00306 }
00307 print "</table>\n</div>";
00308 }
00309 ?>