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

Source for file AdminEditCategory.php

Documentation is available at AdminEditCategory.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 aggiunta/modifica di una sezione. E' possibile cambiare
  33.  * il nome o la descrizione della sezione.
  34.  * 
  35.  * @package  MCMS
  36.  * @version  2
  37.  * @author   Silvio Moioli <silvio at moioli dot net>
  38.  */
  39. class AdminEditCategory 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 la sezione da modificare o aggiungere */
  44.     var $site = null;
  45.     /** @var Category la sezione da modificare, null se è un nuovo articolo */
  46.     var $category = null;
  47.     /** @var string "new" se si aggiunge una nuova sezione "edit" altrimenti */
  48.     var $mode = "new";
  49.     
  50.     /** @var string nome proposto all'utente per questa sezione */
  51.     var $defaultName = "Varie";
  52.     /** @var string descrizione proposta all'utente per questa sezione */
  53.     var $defaultDescription = "Tutto qui";
  54.     
  55.     /**
  56.      * Costruttore standard.
  57.      *
  58.      * @see AdminPage
  59.      * @param Author l'autore che accede a questa pagina
  60.      * @param Site il sito a cui appartiene l'articolo da modificare o aggiungere
  61.      * @param bool true se Javascript è in uso per la modifica dell'XHTML
  62.      */
  63.     function AdminEditCategory($author$site$category$mode)
  64.     {
  65.         parent::AdminPage();
  66.         $this->author=$author;    
  67.         $this->site=$site;
  68.         $this->category=$category;
  69.         $this->mode=$mode;
  70.         
  71.         if ($mode == "edit"{
  72.             $this->defaultName = $this->category->getName();
  73.             $this->defaultDescription = $this->category->getDescription();
  74.          }
  75.     }
  76.     
  77.     /**
  78.      * Cambia il nome proposto all'utente per questa sezione
  79.      *
  80.      * @param string $defaultName il nuovo titolo
  81.      */
  82.     function setDefaultName($defaultName){
  83.         $this->defaultName = $defaultName;
  84.     }
  85.     
  86.     /**
  87.      * Cambia la descrizione proposta all'utente per questa sezione
  88.      *
  89.      * @param string $defaultDescription la nuova descrizione
  90.      */
  91.     function setDefaultDescription($defaultDescription){
  92.         $this->defaultDescription = $defaultDescription;
  93.     }
  94.    
  95.     /**
  96.      * Ritorna il titolo (in XHTML) di questa pagina.
  97.      *
  98.      * @return string una stringa XHTML rappresentante il titolo della pagina
  99.      * @see Compilable
  100.      */
  101.     function getTitle()
  102.     {
  103.         $authorID $this->author->getID();
  104.         $siteID $this->site->getID();
  105.         
  106.         $title a("do.php?goTo=AdminMain&amp;authorID=$authorID",
  107.             "Il Progettista")." > ".
  108.             a("do.php?goTo=AdminManageSite&amp;authorID=$authorID&amp;".
  109.             "siteID=$siteID",$this->site->getShortURL())." > ".
  110.             a("do.php?goTo=AdminListCategories&amp;authorID=$authorID&amp;".
  111.             "siteID=$siteID","Sezioni")." > $this->defaultName";
  112.  
  113.         return $title;
  114.     }
  115.     
  116.     /**
  117.      * Ritorna un array di stringhe XHTML relative al menu (barra di navigazione)
  118.      * di questa pagina.
  119.      *
  120.      * @return array vettore di stringhe XHTML rappresentante il menu della pagina
  121.      * @see Compilable
  122.      */
  123.     function getMenuEntries()
  124.     {
  125.         $authorID $this->author->getID();
  126.         $siteID $this->site->getID();
  127.         
  128.         $menuEntries array(p(a("do.php?goTo=AdminManageSite&amp;".
  129.             "siteID=$siteID&amp;authorID=$authorID",
  130.             "Annulla e torna alla gestione del sito").br().
  131.             a("do.php?goTo=AdminListCategories&amp;siteID=$siteID&amp;".
  132.             "authorID=$authorID","Annulla e torna alla gestione delle sezioni")));
  133.             
  134.         return $menuEntries;
  135.     }
  136.     
  137.     /**
  138.      * Ritorna il contenuto (XHTML) del corpo di questa pagina.
  139.      *
  140.      * @return string la stringa XHTML rappresentante il corpo della pagina
  141.      * @see Compilable
  142.      */
  143.     function getContents()
  144.     {
  145.         $authorID $this->author->getID();
  146.         $siteID $this->site->getID();
  147.         $categoryID 0;
  148.         $action "addCategory";
  149.         if ($this->mode ==  "edit"{
  150.             $categoryID $this->category->getID();
  151.             $action "editCategory";
  152.         }
  153.  
  154.         $contents h1("Dettagli della sezione").
  155.             p("Da questa pagina puoi modificare i dettagli relativi alla sezione.".
  156.             br().
  157.             form("do.php?goTo=AdminListCategories&amp;action=$action&amp;".
  158.             "authorID=$authorID&amp;siteID=$siteID&amp;categoryID=$categoryID&amp;".
  159.             "mode=$this->mode",
  160.             "POST",
  161.             
  162.             "Nome della sezione: ".input("text","name",$this->defaultName).br().
  163.             "Descrizione della sezione: ".input("text","description",
  164.             $this->defaultDescription).br().
  165.             "Quando hai finito, clicca sul bottone qui sotto:".br().
  166.             submit()
  167.             ));
  168.         
  169.         return $contents;
  170.     }
  171. }
  172. ?>

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