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

Source for file AdminListNews.php

Documentation is available at AdminListNews.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 delle notizie. Viene mostrato un elenco da
  33.  * cui è possibile scegliere di modificare, cancellare o aggiungere notizie al
  34.  * sito.
  35.  * 
  36.  * @package  MCMS
  37.  * @version  2
  38.  * @author   Silvio Moioli <silvio at moioli dot net>
  39.  */
  40. class AdminListNews 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 le notizie */
  45.     var $site = null;
  46.     
  47.     /**
  48.      * Costruttore di default
  49.      *
  50.      * @param Author $author l'autore che accede a questa pagina
  51.      * @param Site $site il sito di cui mostrare le notizie
  52.      * @see AdminPage
  53.      */
  54.     function AdminListNews($author$site)
  55.     {
  56.         parent::AdminPage();
  57.         $this->author=$author;
  58.         $this->site=$site;
  59.     }
  60.     
  61.     /**
  62.      * Ritorna il titolo (in XHTML) di questa pagina.
  63.      *
  64.      * @return string una stringa XHTML rappresentante il titolo della pagina
  65.      * @see Compilable
  66.      */
  67.     function getTitle()
  68.     {
  69.         $authorID $this->author->getID();
  70.         $siteID $this->site->getID();
  71.         
  72.         $title a("do.php?goTo=AdminMain&amp;authorID=$authorID",
  73.             "Il Progettista")." > ".
  74.             a("do.php?goTo=AdminManageSite&amp;authorID=$authorID".
  75.             "&amp;siteID=$siteID",$this->site->getShortURL())." > Notizie";
  76.         
  77.         return $title;
  78.     }
  79.     
  80.     /**
  81.      * Ritorna un array di stringhe XHTML relative al menu (barra di navigazione)
  82.      * di questa pagina.
  83.      *
  84.      * @return array vettore di stringhe XHTML rappresentante il menu della pagina
  85.      * @see Compilable
  86.      */
  87.     function getMenuEntries()
  88.     {
  89.         $authorID $this->author->getID();
  90.         $siteID $this->site->getID();
  91.     
  92.         $menuEntries array(p(a("do.php?goTo=AdminManageSite&amp;".
  93.             "siteID=$siteID&amp;authorID=$authorID","Torna alla gestione del sito").
  94.             br().a("../index$siteID.html""Vedi il tuo sito!")));
  95.         
  96.         return $menuEntries;
  97.     }
  98.     
  99.     /**
  100.      * Ritorna il contenuto (XHTML) del corpo di questa pagina.
  101.      *
  102.      * @return string la stringa XHTML rappresentante il corpo della pagina
  103.      * @see Compilable
  104.      */
  105.     function getContents()
  106.     {
  107.         $authorID $this->author->getID();
  108.         $siteID $this->site->getID();
  109.         
  110.         $contents h1("Le notizie del sito ".a("../index$siteID.html",
  111.         $this->site->getShortURL())).
  112.         p("Da questa pagina puoi gestire le notizie del tuo sito, rimuovendole o
  113.         cambiandole a tuo piacere.".br().
  114.         "Il Progettista consiglia: usare molto le notizie &egrave; 
  115.         di moda ultimamente, specialmente nei Blog.").
  116.         h2(a("do.php?authorID=$authorID&amp;siteID=$siteID&amp;goTo=AdminEditNews".
  117.             "&amp;mode=new""Aggiungi nuova notizia..."));
  118.         
  119.         $newslist $this->site->getNews();
  120.         foreach ($newslist as $i{
  121.             $newsID $i->getID();
  122.             $author $i->getAuthor();
  123.             $newsAuthorID $author->getID();
  124.             $contents .= h2($i->getTitle().", ".$i->getDate());
  125.             if ($this->author->getID(== $newsAuthorID{
  126.                 $contents .= unorderedList(array(
  127.                     a("do.php?goTo=AdminEditNews&amp;authorID=$authorID&amp;".
  128.                     "siteID=$siteID&amp;newsID=$newsID&amp;mode=edit",
  129.                     "Modifica notizia"),
  130.                     a("do.php?goTo=AdminDropNews&amp;authorID=$authorID&amp;".
  131.                     "siteID=$siteID&amp;newsID=$newsID","Cancella notizia")));
  132.             }
  133.             else {
  134.                 $contents .= p("Non puoi modificare questa notizia perch&egrave; ".
  135.                     " non ne sei l&quot;autore.");
  136.             }
  137.         }
  138.         
  139.         return $contents;
  140.     }
  141. }
  142. ?>

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