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

Source for file AdminEditHomepage.php

Documentation is available at AdminEditHomepage.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. /** Importa la classe di base per l'interfaccia utente (autore) */
  27. require_once $_SERVER["DOCUMENT_ROOT"]."/admin/lib/view/AdminPage.php";
  28. /** Importa la libreria per semplificare l'aggiunta di tag XML */
  29. require_once $_SERVER["DOCUMENT_ROOT"]."/admin/lib/view/Tagger.php";
  30.  
  31. /**
  32.  * Rappresenta la pagina di modifica della homepage del sito.
  33.  * Presenta una finestra per l'input dell'XHTML.
  34.  * 
  35.  * @package  MCMS
  36.  * @version  2
  37.  * @author   Silvio Moioli <silvio at moioli dot net>
  38.  */
  39. class AdminEditHomepage extends AdminPage
  40. {
  41.     /** @var Author l'autore che accede a questa pagina */
  42.     var $author = null;
  43.     /** @var Site il sito a cui appartiene l'articolo da modificare o aggiungere */
  44.     var $site = null;
  45.     /** @var bool true se Javascript è in uso per la modifica dell'XHTML */
  46.     var $javascript = true;
  47.         
  48.     /** @var string motto proposto all'utente per questo sito */
  49.     var $defaultSlogan = "Questo è il mio nuovo sito!";
  50.     /** @var string parole chiave proposte all'utente per questo sito */
  51.     var $defaultKeywords = "parole chiave";
  52.     /** @var string contenuti (XHTML) proposti all'utente per
  53.         l'homepage di questo sito */
  54.  
  55.     var $defaultContents = "Inserisci i tuoi contenuti <b>qui</b>.";
  56.     
  57.     /**
  58.      * Costruttore standard.
  59.      *
  60.      * @see AdminPage
  61.      * @param Author l'autore che accede a questa pagina
  62.      * @param Site il sito a cui appartiene l'articolo da modificare o aggiungere
  63.      * @param bool true se Javascript è in uso per la modifica dell'XHTML
  64.      */
  65.     function AdminEditHomepage($author$site$javascript)
  66.     {
  67.         parent::AdminPage();
  68.         $this->author=$author;    
  69.         $this->site=$site;
  70.         $this->javascript=$javascript;
  71.         
  72.         $homepage $this->site->getHomepage();
  73.         $this->defaultSlogan = $homepage->getSlogan();
  74.         $this->defaultKeywords = $homepage->getKeywords();
  75.         $this->defaultContents = $homepage->getContents();
  76.     }
  77.     
  78.     /**
  79.      * Cambia il motto proposto all'utente per questa notizia
  80.      *
  81.      * @param string $defaultSlogan il nuovo motto
  82.      */
  83.     function setDefaultSlogan($defaultSlogan)
  84.     {
  85.         $this->defaultSlogan = $defaultSlogan;
  86.     }
  87.     
  88.     /**
  89.      * Cambia le parole chiave proposte all'utente per questa notizia
  90.      *
  91.      * @param string $defaultKeywords le nuove parole chiave
  92.      */
  93.     function setDefaultKeywords($defaultKeywords)
  94.     {
  95.         $this->defaultKeywords = $defaultKeywords;
  96.     }
  97.     
  98.     /**
  99.      * Cambia i contenuti (XHTML) proposti all'utente per questa notizia
  100.      *
  101.      * @param string $defaultContents i nuovi contenuti
  102.      */
  103.     function setDefaultContents($defaultContents)
  104.     {
  105.         $this->defaultContents = $defaultContents;
  106.     }
  107.    
  108.     /**
  109.      * Ritorna il titolo (in XHTML) di questa pagina.
  110.      *
  111.      * @return string una stringa XHTML rappresentante il titolo della pagina
  112.      * @see Compilable
  113.      */
  114.     function getTitle()
  115.     {
  116.         $authorID $this->author->getID();
  117.         $siteID $this->site->getID();
  118.         
  119.         $title a("do.php?goTo=AdminMain&amp;authorID=$authorID",
  120.             "Il Progettista")." > ".
  121.             a("do.php?goTo=AdminManageSite&amp;authorID=$authorID&amp;".
  122.             "siteID=$siteID",$this->site->getShortURL())." > Homepage";
  123.  
  124.         return $title;
  125.     }
  126.     
  127.     /**
  128.      * Ritorna un array di stringhe XHTML relative al menu (barra di navigazione)
  129.      * di questa pagina.
  130.      *
  131.      * @return array vettore di stringhe XHTML rappresentante il menu della pagina
  132.      * @see Compilable
  133.      */
  134.     function getMenuEntries()
  135.     {
  136.         $authorID $this->author->getID();
  137.         $siteID $this->site->getID();
  138.         
  139.         $menuEntries array(p(a("do.php?goTo=AdminManageSite&amp;".
  140.             "siteID=$siteID&amp;authorID=$authorID",
  141.             "Annulla e torna alla gestione del sito")));
  142.             
  143.         return $menuEntries;
  144.     }
  145.     
  146.     /**
  147.      * Ritorna il contenuto (XHTML) del corpo di questa pagina.
  148.      *
  149.      * @return string la stringa XHTML rappresentante il corpo della pagina
  150.      * @see Compilable
  151.      */
  152.     function getContents()
  153.     {
  154.         $authorID $this->author->getID();
  155.         $siteID $this->site->getID();
  156.  
  157.         $contents h1("Dettagli della homepage").
  158.         p("Da questa pagina puoi modificare i dettagli relativi alla pagina 
  159.         iniziale del sito. Puoi modificare l&#039;homepage solo se sei il ".
  160.         b("fondatore")." del sito.".br().
  161.         form("do.php?goTo=AdminManageSite&amp;action=editHomepage&amp;".
  162.             "authorID=$authorID&amp;siteID=$siteID""POST",
  163.         
  164.             p("Motto dell&#039;homepage (e del sito): ".
  165.             input("text","slogan",$this->defaultSlogan).br().
  166.             "Parole-chiave dell&#039;homepage (e del sito): ".
  167.             input("text","keywords",$this->defaultKeywords).br().
  168.             HTMLEditor($this->defaultContents$this->javascript).br().
  169.             
  170.             "Quando hai finito, clicca sul bottone qui sotto:".br().
  171.             submit()
  172.         )));
  173.         
  174.         return $contents;
  175.     }
  176. }
  177. ?>

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