defaultTemplate.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /*******************************************************************************
00004  * Aliro - the modern, accessible content management system
00005  *
00006  * Aliro is open source software, free to use, and licensed under GPL.
00007  * You can find the full licence at http://www.gnu.org/copyleft/gpl.html GNU/GPL
00008  *
00009  * The author freely draws attention to the fact that Aliro derives from Mambo,
00010  * software that is controlled by the Mambo Foundation.  However, this section
00011  * of code is totally new.  If it should contain any fragments that are similar
00012  * to Mambo, please bear in mind (1) there are only so many ways to do things
00013  * and (2) the author of Aliro is also the author and copyright owner for large
00014  * parts of Mambo 4.6.
00015  *
00016  * Tribute should be paid to all the developers who took Mambo to the stage
00017  * it had reached at the time Aliro was created.  It is a feature rich system
00018  * that contains a good deal of innovation.
00019  *
00020  * Your attention is also drawn to the fact that Aliro relies on other items of
00021  * open source software, which is very much in the spirit of open source.  Aliro
00022  * wishes to give credit to those items of code.  Please refer to
00023  * http://aliro.org/credits for details.  The credits are not included within
00024  * the Aliro package simply to avoid providing a marker that allows hackers to
00025  * identify the system.
00026  *
00027  * Copyright in this code is strictly reserved by its author, Martin Brampton.
00028  * If it seems appropriate, the copyright will be vested in the Aliro Organisation
00029  * at a suitable time.
00030  *
00031  * Copyright (c) 2007 Martin Brampton
00032  *
00033  * http://aliro.org
00034  *
00035  * counterpoint@aliro.org
00036  *
00037  * The default template is a rudimentary template with no CSS that causes output to be
00038  * displayed to the browser.  It will not look good, but it means that Aliro continues
00039  * to be functional even if all templates are uninstalled.
00040  *
00041  */
00042 
00043 class defaultTemplate extends aliroUserTemplateBase implements ifAliroTemplate {
00044     // Options are 'xhtml_10_trans', 'xhtml_10_strict' or 'xhtml_11'
00045     protected $doctype = 'xhtml_10_trans';
00046     // Formal name of this template
00047     protected $tname = '.';
00048     // File name of CSS file, relative to the template
00049     protected $cssname = 'default.css';
00050 
00051     public function __construct () {
00052         // Define screen areas
00053         $this->areas = array (
00054         array ('position' => 'main',        'min' => 519, 'max' => 519, 'style' => 1),
00055         array ('position' => 'topmenu',     'min' => 519, 'max' => 519, 'style' => 1),
00056         array ('position' => 'navigation',  'min' => 200, 'max' => 200, 'style' => 'Side'),
00057         array ('position' => 'searchbox',   'min' => 259, 'max' => 259, 'style' => 0),
00058         array ('position' => 'feature1',    'min' => 259, 'max' => 259, 'style' => 0),
00059         array ('position' => 'feature2',    'min' => 200, 'max' => 200, 'style' => 0),
00060         array ('position' => 'newsflash',   'min' => 200, 'max' => 200, 'style' => 'Side'),
00061         array ('position' => 'extra',       'min' => 200, 'max' => 200, 'style' => 'Side'),
00062         array ('position' => 'banner',      'min' => 468, 'max' => 468, 'style' => 0),
00063         array ('position' => 'debug',       'min' => 400, 'max' => 400, 'style' => 1)
00064         );
00065         // All the Aliro error levels must have matching colour classes, with definitions in the CSS
00066         $this->colours = array (
00067         _ALIRO_ERROR_FATAL => 'fatalcolour',
00068         _ALIRO_ERROR_SEVERE => 'severecolour',
00069         _ALIRO_ERROR_WARN => 'warncolour',
00070         _ALIRO_ERROR_INFORM => 'informcolour'
00071         );
00072         parent::__construct();
00073     }
00074 
00075     // Define the default module position
00076     public static function defaultModulePosition () {
00077         return 'extra';
00078     }
00079     
00080     // Return the screen area used for the main body
00081     public function mainScreenBox () {
00082         return $this->screenarea['main'];
00083     }
00084 
00085 
00086     // These "style" methods are invoked by the module handler as modules are processed
00087     // Their function is to place any required HTML around the content created by the module
00088     // The digit on the end relates to the style number for a screen area
00089     public function moduleStyle0 ($moduleclass_sfx, $title, $content) {
00090         $html =  "<table cellpadding=\"0\" cellspacing=\"0\" class=\"moduletable$moduleclass_sfx\">";
00091         if ($title) $html .= '<tr><th valign="top">'.$title.'</th></tr>';
00092         $html .= '<tr><td>';
00093         $html .= $content;
00094         $html .= '</td></tr></table>';
00095         return $html;
00096     }
00097 
00098     public function moduleStyle1 ($moduleclass_sfx, $title, $content) {
00099         return $content;
00100     }
00101     
00102     public function moduleStyleSide ($moduleclass_sfx, $title, $content) {
00103         if ($title) return <<<WITH_TITLE
00104         
00105                 <li><h2>$title</h2>
00106                     $content
00107                 </li>
00108                 
00109 WITH_TITLE;
00110 
00111         else return <<<NO_TITLE
00112         
00113             <li>
00114                 $content
00115             </li>
00116             
00117 NO_TITLE;
00118 
00119     }
00120 
00121     // HTML for the feature1 and feature1 areas is conditional on there being anything in either area
00122     private function makeFeatures () {
00123         if ($this->screenarea['feature1']->countModules() >= 1 OR $this->screenarea['feature2']->countModules() >= 1 ) {
00124             $html = <<<FEATURES
00125 
00126                         <div id="content_top_wrapper">
00127                             <!-- start content top 1.  -->
00128                             <div id="content_top1">
00129                             {$this->screenarea['feature1']->getData()}
00130                             </div>
00131                             <!-- end content top 1 -->
00132                             <!-- start content top 2.  -->
00133                             <div id="content_top2">
00134                             {$this->screenarea['feature2']->getData()}
00135                             </div>
00136                             <!-- end content top 2 -->
00137                         </div>
00138 
00139 FEATURES;
00140         }
00141         else $html = '';
00142         return $html;
00143     }
00144 
00145     // HTML for banners is conditional on there being any banner modules present
00146     private function makeBanner () {
00147         if ($this->screenarea['banner']->countModules() >= 1) {
00148             $html = <<<BANNER
00149 
00150                     <!-- start banner.  -->
00151                     <div id="banner">
00152                     {$this->screenarea['banner']->getData()}
00153                     </div>
00154                     <!-- end banner. -->
00155 
00156 BANNER;
00157         }
00158         else $html = '';
00159         return $html;
00160     }
00161 
00162     public function render () {
00163         // Create the page
00164         echo <<<PAGE_HTML
00165 {$this->header ()}
00166 
00167 <body class="aliroDefault">
00168     <div id="headerwrapper">
00169         <div id="header">
00170             <div id="logo">
00171                 <h1><a href="$this->live_site">$this->sitename</a></h1>
00172                 <h2><a href="http://www.aliro.org">powered by Aliro</a></h2>
00173             </div>
00174             {$this->screenarea['topmenu']->getData()}
00175         </div>
00176     </div>
00177     <!-- end #headerwrapper -->
00178     <div id="page">
00179         <!-- start sidebar1 -->
00180         <div id="sidebar1" class="sidebar">
00181             <ul>
00182                 <li id="search">
00183                     {$this->screenarea['searchbox']->getData()}
00184                 </li>
00185                 {$this->screenarea['navigation']->getData()}
00186             </ul>
00187         </div>
00188         <!-- end sidebar1 -->
00189 
00190         <!-- start content -->
00191         <div id="content">
00192             <div id="pathway">
00193                 {$this->pathway->makePathway()}
00194             </div>
00195             {$this->errorMessage()}
00196             <div class="post">
00197                 <!-- start features -->
00198                 {$this->makeFeatures()}
00199                 <!-- end features -->
00200                 <div id="maincontent">
00201                     {$this->mainBody()}
00202                     {$this->makeBanner()}
00203                 </div>
00204             </div>
00205         </div>
00206         <!-- end content -->
00207 
00208         <!-- start sidebar2 -->
00209         <div id="sidebar2" class="sidebar">
00210             <ul>
00211                 {$this->screenarea['newsflash']->getData()}
00212                 {$this->screenarea['extra']->getData()}
00213             </ul>
00214         </div>
00215         <!-- end sidebar2 -->
00216 
00217     <div style="clear: both;">&nbsp;</div>
00218     </div>
00219     <!-- end page -->
00220     <div id="footer">
00221         <p class="legal">&copy;2008 All Rights Reserved.</p>
00222         <p class="credit">Based on a design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a></p>
00223         {$this->version->footer()}
00224     </div>  
00225     {$this->debugOutput()}
00226 </body>
00227 </html>
00228 
00229 PAGE_HTML;
00230 
00231     }
00232 
00233 }

Generated on Thu Apr 17 13:03:27 2008 for ALIRO by  doxygen 1.5.5