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

Source for file AdminManageSite.php

Documentation is available at AdminManageSite.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 iniziale di modifica di un sito. Da qui si possono
  33.  * modificare i componenti aggiuntivi selezionati oppure accedere alle pagine
  34.  * di modifica/cancellazione di articoli, notizie, sezioni e homepage.
  35.  * 
  36.  * @package  MCMS
  37.  * @version  2
  38.  * @author   Silvio Moioli <silvio at moioli dot net>
  39.  */
  40. class AdminManageSite extends AdminPage
  41. {
  42.     /** @var Engine l'oggetto per la comunicazione al Database */
  43.     var $engine = null;
  44.     /** @var Author l'autore che accede a questa pagina */
  45.     var $author = null;
  46.     /** @var Site il sito da modificare */
  47.     var $site = null;
  48.     
  49.     /**
  50.      * Costruttore di default
  51.      *
  52.      * @param Engine $engine l'oggetto per la comunicazione al Database
  53.      * @param Author $author l'autore che accede a questa pagina
  54.      * @param Site $site il sito da modificare
  55.      * @see AdminPage
  56.      */
  57.     function AdminManageSite($author$site)
  58.     {
  59.         parent::AdminPage();
  60.         $this->author=$author;
  61.         $this->site=$site;
  62.         $this->engine=$author->getEngine();
  63.     }
  64.     
  65.     /**
  66.      * Ritorna il titolo (in XHTML) di questa pagina.
  67.      *
  68.      * @return string una stringa XHTML rappresentante il titolo della pagina
  69.      * @see Compilable
  70.      */
  71.     function getTitle()
  72.     {
  73.         $authorID $this->author->getID();
  74.         
  75.         $title a("do.php?goTo=AdminMain&amp;authorID=$authorID",
  76.             "Il Progettista")." > ".$this->site->getShortURL();
  77.         
  78.         return $title;
  79.     }
  80.     
  81.     /**
  82.      * Ritorna un array di stringhe XHTML relative al menu (barra di navigazione)
  83.      * di questa pagina.
  84.      *
  85.      * @return array vettore di stringhe XHTML rappresentante il menu della pagina
  86.      * @see Compilable
  87.      */
  88.     function getMenuEntries()
  89.     {
  90.         $authorID $this->author->getID();
  91.         $siteID $this->site->getID();
  92.     
  93.         $menuEntries array(p(a("do.php?goTo=AdminMain&amp;".
  94.             "authorID=$authorID""Torna alla pagina principale del Progettista").
  95.             br().a("../index$siteID.html""Vedi il tuo sito!")));
  96.         
  97.         return $menuEntries;
  98.     }
  99.     
  100.     /**
  101.      * Ritorna il contenuto (XHTML) del corpo di questa pagina.
  102.      *
  103.      * @return string la stringa XHTML rappresentante il corpo della pagina
  104.      * @see Compilable
  105.      */
  106.     function getContents()
  107.     {
  108.         $authorID $this->author->getID();
  109.         $siteID $this->site->getID();
  110.         
  111.         $contents h1("Gestisci il sito ".a("../index$siteID.html",
  112.             $this->site->getShortURL())).
  113.             p("Il tuo sito &egrave; gi&agrave; online ".
  114.             a("../index$siteID.html","qui").br().
  115.             "Da questa pagina, puoi gestire il contenuto del tuo sito.").
  116.             h2("Notizie (in prima pagina)").
  117.             unorderedList(array(
  118.                 "Vuoi ".a("do.php?authorID=$authorID&amp;siteID=$siteID&amp;".
  119.                 "goTo=AdminEditNews&amp;mode=new","aggiungere la notizia del giorno?"),
  120.                 "Vuoi ".a("do.php?goTo=AdminListNews&amp;authorID=$authorID&amp;".
  121.                 "siteID=$siteID",
  122.                 "modificare o cancellare le notizie pi&ugrave; vecchie?"),
  123.             )).
  124.             h2("Articoli (nel resto del sito)").
  125.             unorderedList(array(
  126.                 "Vuoi ".a("do.php?goTo=AdminEditArticle&amp;".
  127.                 "authorID=$authorID&amp;siteID=$siteID&amp;mode=new",
  128.                 "aggiungere un nuovo articolo?"),
  129.                 "Vuoi ".a("do.php?goTo=AdminListArticles&amp;".
  130.                 "authorID=$authorID&amp;siteID=$siteID",
  131.                 "modificare o cancellare un vecchio articolo?")
  132.             ));
  133.             
  134.         $homepage $this->site->getHomepage();
  135.         $homepageAuthor $homepage->getAuthor();
  136.         $homepageAuthorID $homepageAuthor->getID();
  137.         if ($this->author->getID(== $homepageAuthorID){
  138.             //sezioni
  139.             $contents .= h2("Sezioni (contenitori di articoli)").
  140.                 unorderedList(array(
  141.                     "Vuoi ".a("do.php?goTo=AdminEditCategory&amp;".
  142.                     "authorID=$authorID&amp;siteID=$siteID&amp;mode=new",
  143.                     "una nuova sezione per i tuoi articoli?"),
  144.                     "Vuoi ".a("do.php?goTo=AdminListCategories&amp;".
  145.                     "authorID=$authorID&amp;siteID=$siteID&amp;mode=edit",
  146.                     "modificare o cancellare le sezioni?")
  147.                 ));
  148.             //homepage
  149.             $contents .= h2("Homepage").
  150.                 unorderedList(array("Vuoi ".
  151.                 a("do.php?goTo=AdminEditHomepage&amp;authorID=$authorID".
  152.                 "&amp;siteID=$siteID","ritoccare la pagina iniziale del sito?")));
  153.             //componenti aggiuntivi
  154.             $contents .= h2("Componenti aggiuntivi del sito");
  155.             $components $this->engine->getComponents();
  156.             $componentNames array();
  157.             foreach($components as $i{
  158.                 $componentNames[get_class($i);
  159.             }
  160.             $activated $this->site->getComponents();
  161.             $activatedNames array();
  162.             foreach($activated as $i{
  163.                 $activatedNames[get_class($i);
  164.             }
  165.             //Creo la lista di checkboxes
  166.             $cont 0;
  167.             $checks array();
  168.             foreach($components as $i{
  169.                 $activated false;
  170.                 //Se è già attivato, segno la checkbox
  171.                 if (in_array($componentNames[$cont]$activatedNames)) {
  172.                     $activated true;
  173.                 }
  174.                 $checks []checkbox("component".$componentNames[$cont],$activated).
  175.                     $i->getName();
  176.                 $cont++;
  177.             }
  178.             $formContents unorderedList($checks).submit("Cambia");
  179.             $contents .= form("do.php?goTo=AdminManageSite&amp;".
  180.                 "siteID=$siteID&amp;authorID=$authorID&amp;action=editComponents",
  181.                 "POST",$formContents);
  182.         }
  183.         else {
  184.             $contents .= h2("Sezioni (contenitori di articoli)").
  185.                 p("Non puoi modificare le sezioni degli articoli se non sei il ".
  186.                 b("fondatore")." del sito.").
  187.                 h2("Homepage").p("Non puoi modificare la pagina iniziale se non
  188.                 sei il ".b("fondatore")." del sito.").
  189.                 h2("Componenti aggiuntivi del sito").p("Non puoi modificarli se
  190.                 non sei il ".b("fondatore")." del sito.");
  191.         }
  192.         
  193.         return $contents;
  194.     }
  195. }
  196. ?>

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