MCMS
[ class tree: MCMS ] [ index: MCMS ] [ all elements ]

Source for file UserPage.php

Documentation is available at UserPage.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | MCMS: a PHP Content Management System for creating accessible sites. |
  5. // | Copyright (C) 2005  Silvio Moioli                                    |
  6. // |                                                                      |
  7. // | This program is free software; you can redistribute it and/or modify |
  8. // | it under the terms of the GNU General Public License as published by |
  9. // | the Free Software Foundation; either version 2 of the License, or    |
  10. // | (at your option) any later version.                                  |
  11. // |                                                                      |
  12. // | This program is distributed in the hope that it will be useful,      |
  13. // | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
  14. // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
  15. // | GNU General Public License for more details.                         |
  16. // |                                                                      |
  17. // | You should have received a copy of the GNU General Public License    |
  18. // | along with this program; if not, write to the Free Software          |
  19. // | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 |
  20. // +----------------------------------------------------------------------+
  21. // | Authors: Silvio Moioli <silvio at moioli dot net> www.moioli.net     |
  22. // +----------------------------------------------------------------------+
  23. //
  24. //$Id:
  25.  
  26. require_once $_SERVER["DOCUMENT_ROOT"]."/admin/lib/view/Savable.php";
  27. require_once $_SERVER["DOCUMENT_ROOT"]."/admin/lib/view/Tagger.php";
  28.  
  29. /**
  30.  * Classe astratta che rappresenta una pagina del sito creato.
  31.  * Puņ essere salvata su un file (implementa Savable) e i plugin
  32.  * (sottoclassi di Component) possono esservi applicati.
  33.  * 
  34.  */
  35. /*abstract*/ class UserPage extends Savable
  36. {
  37.     /** @var Site il sito a cui questa pagina appartiene */
  38.     var $site = null;
  39.     /** @var string i caratteri ammessi nel nome di un file */
  40.     var $allowedFileChars = 
  41.         'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_';
  42.     
  43.     /**
  44.      * Costruttore di default
  45.      *
  46.      * @param Site $site il sito a cui questa pagina appartiene
  47.      */
  48.     function UserPage($site)
  49.     {
  50.         parent::Compilable();
  51.         $this->site=$site;
  52.     }
  53.     
  54.     /**
  55.      * Ritorna il sito a cui questa pagina appartiene.
  56.      *
  57.      * @return Site il sito a cui questa pagina appartiene.
  58.      */
  59.     function getSite()
  60.     {
  61.         return $this->site;
  62.     }
  63.      
  64.     /**
  65.      * Le pagine di finali usano un template unico.
  66.      *
  67.      * @return string il nome del file del template
  68.      */
  69.     function getTemplate()
  70.     {
  71.         return "userTemplate.tpl";
  72.     }
  73.     
  74.     /**
  75.      * I plugin vengono applicati indistintamente a tutte le pagine del sito finale.
  76.      *
  77.      * @return un array di Components
  78.      * @see Compilable
  79.      */
  80.     function getComponents()
  81.     {
  82.         return $this->site->getComponents();
  83.     }
  84.  
  85.     /**
  86.      * Ritorna una stringa con i soli caratteri ammessi in un nome di file.
  87.      */
  88.     function fileName($fullName){
  89.         $result '';
  90.         for($i=0$i<strlen($fullName);$i++){
  91.             if(strpos($this->allowedFileChars,$fullName[$i])===false){
  92.                 $result .='_';
  93.             }
  94.             else{
  95.                 $result .=$fullName[$i];
  96.             }
  97.         }
  98.         return $result;
  99.     }
  100. }
  101. ?>

Documentation generated on Wed, 26 Jul 2006 21:45:01 +0200 by phpDocumentor 1.3.0RC6