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

Source for file AdminDropAuthor.php

Documentation is available at AdminDropAuthor.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.  * Chiede una conferma per la cancellazione di un autore o presenta una
  33.  * notifica qualora l'autore stesso non sia al momento cancellabile.
  34.  * 
  35.  * @package  MCMS
  36.  * @version  2
  37.  * @author   Silvio Moioli <silvio at moioli dot net>
  38.  */
  39. class AdminDropAuthor extends AdminPage
  40. {
  41.     /** @var Author l'autore da cancellare */
  42.     var $author = null;
  43.     
  44.     /**
  45.      * Costruttore di default
  46.      *
  47.      * @param Engine l'oggetto per la comunicazione al Database
  48.      * @param Author l'autore da cancellare
  49.      * @see AdminPage
  50.      */
  51.     function AdminDropAuthor($author)
  52.     {
  53.         parent::AdminPage();
  54.         $this->author=$author;
  55.     }
  56.     
  57.     /**
  58.      * Ritorna il titolo (in XHTML) di questa pagina.
  59.      *
  60.      * @return string una stringa XHTML rappresentante il titolo della pagina
  61.      * @see Compilable
  62.      */
  63.     function getTitle()
  64.     {
  65.         $authorID $this->author->getID();
  66.         
  67.         $title a("do.php?goTo=AdminMain&amp;authorID=$authorID",
  68.         "Il Progettista")." > Cancella ".$this->author->getName();
  69.         
  70.         return $title;
  71.     }
  72.     
  73.     /**
  74.      * Ritorna un array di stringhe XHTML relative al menu (barra di navigazione)
  75.      * di questa pagina.
  76.      *
  77.      * @return array vettore di stringhe XHTML rappresentante il menu della pagina
  78.      * @see Compilable
  79.      */
  80.     function getMenuEntries()
  81.     {
  82.         $authorID $this->author->getID();
  83.     
  84.         $menuEntries array(p(a("do.php?goTo=AdminMain&amp;".
  85.         "authorID=$authorID","Torna alla pagina principale del Progettista")));
  86.         
  87.         return $menuEntries;
  88.     }
  89.     
  90.     /**
  91.      * Ritorna il contenuto (XHTML) del corpo di questa pagina.
  92.      *
  93.      * @return string la stringa XHTML rappresentante il corpo della pagina
  94.      * @see Compilable
  95.      */
  96.     function getContents()
  97.     {
  98.         $engine $this->author->getEngine();
  99.         $authorID $this->author->getID();
  100.         $contents "";
  101.         
  102.         if ($engine->isAuthorDroppable($this->author)) {
  103.             $contents h1("Il Progettista sta per cancellare 
  104.                 l&#039;autore!").p("Sei proprio sicuro?".br().
  105.                 form("do.php?goTo=AdminIndex&amp;action=dropAuthor&amp;",
  106.                     "POST",
  107.                     input("hidden","authorID",$authorID).
  108.                     submit("S&igrave;, cancella l'autore!")
  109.                 ).br().
  110.                 h2(a("do.php?goTo=AdminMain&amp;authorID=$authorID",
  111.                 "No, torna alla pagina precedente")));
  112.         }
  113.         else {
  114.             $contents h1("Attenzione! Il Progettista non pu&ograve;
  115.             cancellare un autore se egli/ella ha scritto articoli, fondato siti
  116.             o scritto notizie!").
  117.             p("Se vuoi essere cancellato come autore, devi prima assicurarti che
  118.             tutti gli articoli e notizie che hai scritto e che tutti i siti
  119.             che hai fondato siano cancellati!").
  120.             h2(a("do.php?goTo=AdminMain&amp;authorID=$authorID",
  121.             "Torna alla pagina precedente"));
  122.         }
  123.         
  124.         return $contents;
  125.     }
  126. }
  127.  
  128. ?>

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