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

Source for file AdminListArticles.php

Documentation is available at AdminListArticles.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 gestione degli articoli. Viene mostrato un elenco da
  33.  * cui è possibile scegliere di modificare, cancellare o aggiungere articoli al
  34.  * sito.
  35.  * 
  36.  * @package  MCMS
  37.  * @version  2
  38.  * @author   Silvio Moioli <silvio at moioli dot net>
  39.  */
  40. class AdminListArticles extends AdminPage
  41. {
  42.     /** @var Author l'autore che accede a questa pagina */
  43.     var $author = null;
  44.     /** @var Site il sito di cui mostrare gli articolo */
  45.     var $site = null;
  46.     
  47.     /**
  48.      * Costruttore di default
  49.      *
  50.      * @see AdminPage
  51.      */
  52.     function AdminListArticles($author$site)
  53.     {
  54.         parent::AdminPage();
  55.         $this->author=$author;
  56.         $this->site=$site;
  57.     }
  58.     
  59.     /**
  60.      * Ritorna il titolo (in XHTML) di questa pagina.
  61.      *
  62.      * @return string una stringa XHTML rappresentante il titolo della pagina
  63.      * @see Compilable
  64.      */
  65.     function getTitle()
  66.     {
  67.         $authorID $this->author->getID();
  68.         $siteID $this->site->getID();
  69.         
  70.         $title a("do.php?goTo=AdminMain&amp;authorID=$authorID",
  71.             "Il Progettista")." > ".a("do.php?goTo=AdminManageSite&amp;".
  72.             "authorID=$authorID&amp;siteID=$siteID",$this->site->getShortURL()).
  73.             " > Articoli";
  74.         return $title;
  75.     }
  76.     
  77.     /**
  78.      * Ritorna un array di stringhe XHTML relative al menu (barra di navigazione)
  79.      * di questa pagina.
  80.      *
  81.      * @return array vettore di stringhe XHTML rappresentante il menu della pagina
  82.      * @see Compilable
  83.      */
  84.     function getMenuEntries()
  85.     {
  86.         $authorID $this->author->getID();
  87.         $siteID $this->site->getID();
  88.     
  89.         $menuEntries array(p(a("do.php?goTo=AdminManageSite&amp;".
  90.             "siteID=$siteID&amp;authorID=$authorID","Torna alla gestione del sito").
  91.             br().a("../index$siteID.html""Vedi il tuo sito!")));
  92.         
  93.         return $menuEntries;
  94.     }
  95.     
  96.     /**
  97.      * Ritorna il contenuto (XHTML) del corpo di questa pagina.
  98.      *
  99.      * @return string la stringa XHTML rappresentante il corpo della pagina
  100.      * @see Compilable
  101.      */
  102.     function getContents()
  103.     {
  104.         $authorID $this->author->getID();
  105.         $siteID $this->site->getID();
  106.         
  107.         $contents h1("Gli articoli del sito ".a("../index$siteID.html",
  108.             $this->site->getShortURL())).
  109.             p("Da questa pagina puoi gestire gli articoli del tuo sito, rimuovendoli, 
  110.             modificandoli o cambiandoli di sezione a tuo piacere.".br().
  111.             "Il Progettista consiglia: articoli ricchi, leggibili e ben organizzati 
  112.             sono alla base di qualsiasi buon sito!").
  113.             h2(a("do.php?goTo=AdminEditArticle&amp;authorID=$authorID&amp;".
  114.             "siteID=$siteID&amp;mode=new","Aggiungi nuovo articolo..."));
  115.         
  116.         $articles $this->site->getArticles();
  117.         foreach ($articles as $i{
  118.             $articleID $i->getID();
  119.             $articleAuthor $i->getAuthor();
  120.             $articleAuthorID $articleAuthor->getID();
  121.             $category $i->getCategory();
  122.             $categoryName $category->getName();
  123.             $contents .= h2($i->getTitle()." nella categoria
  124.                 \"$categoryName\"");
  125.             
  126.             if ($authorID == $articleAuthorID{
  127.                 $contents .= unorderedList(array(
  128.                     a("do.php?goTo=AdminEditArticle&amp;authorID=$authorID&amp;".
  129.                         "siteID=$siteID&amp;articleID=$articleID&amp;mode=edit",
  130.                         "Modifica articolo"),
  131.                     a("do.php?goTo=AdminDropArticle&amp;authorID=$authorID&amp;".
  132.                         "siteID=$siteID&amp;".
  133.                     "articleID=$articleID","Cancella articolo")
  134.                 ));
  135.             }
  136.             else{
  137.                 $contents .= p("Non puoi modificare questo articolo 
  138.                 perch&egrave; non ne sei l'autore.");
  139.             }
  140.         }
  141.         return $contents;
  142.     }   
  143. }
  144. ?>

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