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

Source for file UserMap.php

Documentation is available at UserMap.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/UserPage.php";
  27. require_once $_SERVER["DOCUMENT_ROOT"]."/admin/lib/view/Tagger.php";
  28.  
  29. /**
  30.  * Rappresenta la mappa di navigazione di un sito.
  31.  * 
  32.  * @package  MCMS
  33.  * @version  2
  34.  * @author   Silvio Moioli <silvio at moioli dot net>
  35.  */
  36. class UserMap extends UserPage
  37. {
  38.     /** @var Homepage l'oggetto corrispondente alla home del sito */
  39.     var $homepage = null;
  40.           
  41.     /**
  42.      * Costruttore standard
  43.      *
  44.      * @param Site $site il sito a cui questa pagina appartiene
  45.      * @see AdminPage
  46.      */
  47.     function UserMap($site)
  48.     {
  49.         parent::UserPage($site);
  50.         $this->homepage=$site->getHomepage();
  51.     }
  52.     
  53.     /**
  54.      * Ritorna il titolo (in XHTML) di questa pagina.
  55.      *
  56.      * @return string una stringa XHTML rappresentante il titolo della pagina
  57.      * @see Compilable
  58.      */
  59.     function getTitle()
  60.     {
  61.         return a(UserHomepage::staticGetFileName($this->site),
  62.             $this->homepage->getTitle()." > Mappa del sito");
  63.     }
  64.     
  65.     /**
  66.      * Ritorna una breve descrizione (solo testo) di questa pagina.
  67.      *
  68.      * @return string una stringa rappresentante la descrizione della pagina
  69.      * @see Compilable
  70.      */
  71.     function getDescription()
  72.     {
  73.         return "Mappa del sito ".$this->site->getShortURL();
  74.     }
  75.     
  76.     /**
  77.      * Ritorna un array di stringhe XHTML relative al menu (barra di navigazione)
  78.      * di questa pagina.
  79.      *
  80.      * @return array vettore di stringhe XHTML rappresentante il menu della pagina
  81.      * @see Compilable
  82.      */
  83.     function getMenuEntries()
  84.     {
  85.         return array(p("Torna alla ".a(
  86.             UserHomepage::staticGetFileName($this->site),"homepage")));
  87.     }
  88.     
  89.     /**
  90.      * Ritorna il contenuto (XHTML) del corpo di questa pagina.
  91.      *
  92.      * @return string la stringa XHTML rappresentante il corpo della pagina
  93.      * @see Compilable
  94.      */
  95.     function getContents()
  96.     {
  97.         $site $this->site;
  98.         $siteID $site->getID();
  99.         $homepage $this->homepage;
  100.         $categories $site->getCategories();
  101.                 
  102.         $contents h2(a(
  103.             UserHomepage::staticGetFileName($this->site),
  104.             "Homepage"));
  105.         $contents .= h2("Sezioni e articoli");
  106.         foreach ($categories as $i{
  107.             $id $i->getID();
  108.             $name $i->getName();
  109.             $desc $i->getDescription();
  110.             if ($i->getArticlesCount()>0{
  111.                 $contents .= h3(a(UserCategory::staticGetFileName($i),
  112.                     $name)." - $desc");
  113.                 $articles $i->getArticles();
  114.                 $listContents array();
  115.                 foreach ($articles as $j{
  116.                     $articleID $j->getID();
  117.                     $articleTitle $j->getTitle();
  118.                     $listContents []a(UserArticle::staticGetFileName($j),
  119.                         $articleTitle);
  120.                 }
  121.                 $contents .= unorderedList($listContents);
  122.             }
  123.         }
  124.         $contents .= h2("Notizie");
  125.         $news $site->getNews();
  126.         $newscount 0;
  127.         $listContents array();
  128.         foreach ($news as $i{
  129.             $newsID $i->getID();
  130.             $listContents []a(UserNews::staticGetFileName($this->site)
  131.                 ."#notizia$newsID"$i->getTitle());
  132.         }
  133.         $contents .= unorderedList($listContents);
  134.  
  135.         return $contents;
  136.     }
  137.     
  138.     /**
  139.      * Ritorna una stringa di parole chiave (solo testo, separate da virgole)
  140.      * di questa pagina.
  141.      *
  142.      * @return string la stringa rappresentante le parole chiave della pagina
  143.      * @see Compilable
  144.      */
  145.     function getKeywords()
  146.     {
  147.         return "";
  148.     }
  149.     
  150.     /**
  151.      * Ritorna il nome del file in cui questa pagina deve essere salvata.
  152.      *
  153.      * @return string il nome del file
  154.      * @see Savable
  155.      */
  156.     function getFileName()
  157.     {
  158.         return $this->staticGetFileName($this->site);
  159.     }
  160.     
  161.     /**
  162.      * Versione statica del metodo precedente: ritorna il nome del
  163.      * file in cui questa pagina deve essere salvata.
  164.      *
  165.      * @return string il nome del file
  166.      * @see Savable
  167.      */
  168.     function staticGetFileName($site)
  169.     {
  170.         return "/mappa___".$site->getID().".html";
  171.     }
  172.         
  173.     /**
  174.      * Ritorna il nome del file in cui questa pagina deve essere salvata
  175.      * (versione precedente).
  176.      *
  177.      * @return string il nome del file
  178.      * @see Savable
  179.      */
  180.     function getOldFileName()
  181.     {
  182.         return "map".$this->site->getID().".html";
  183.     }
  184.  
  185. }
  186. ?>

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