Source for file CMS3_System_SysOutputHandler.php

Documentation is available at CMS3_System_SysOutputHandler.php

  1. <?php
  2. //              (F)
  3. // CMS3 - A Three Content Management System.
  4. // Copyright (C) 2007  Jop... (Jonas F. Jensen).
  5. // 
  6. // This program is free software; you can redistribute it and/or
  7. // modify it under the terms of the GNU General Public License
  8. // as published by the Free Software Foundation; either version 2
  9. // of the License, or (at your option) any later version.
  10. // 
  11. // This program is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. // GNU General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU General Public License
  17. // along with this program; if not, write to the Free Software
  18. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  19.  
  20. /**
  21. *This file defines CMS3_System_SysOutputHandler
  22. *
  23. @package    System
  24. @author    Jonas F. Jensen <jopsen@gmail.com>
  25. @copyright    2007 Jonas F. Jensen.
  26. @license    http://www.gnu.org/licenses/gpl.txt
  27. */
  28.  
  29. /**
  30. *An IEmbedmentOutputHandler implementation for CMS3_System, internal use only
  31. */
  32. class CMS3_System_SysOutputHandler implements IEmbedmentOutputHandler
  33. {
  34.  
  35.  
  36.     /**
  37.     *Body of the processing page
  38.     */
  39.     protected $Body = "";
  40.  
  41.     /**
  42.     *Header of the processing page
  43.     */
  44.     protected $Header = "";
  45.  
  46.     /**
  47.     *BodyList of the processing page
  48.     */
  49.     protected $BodyList = null;
  50.  
  51.  
  52.     /**
  53.      * Data provided by use of this method may be left out if the OutputHandler wishes
  54.      * to print something else the HTML, therefor don't add important information
  55.      * here.
  56.      *
  57.      * @param string line A line you wish to add to the header.
  58.  
  59.      * @return 
  60.      * @access public
  61.      */
  62.     public function ExtentHeader$line ){
  63.         $this->Header .= $line;
  64.     }
  65.  
  66.     /**
  67.      * Set the body if the page, read parameter documentation.
  68.      *
  69.      * @param string body Body of the page, or description of a channel.
  70.  
  71.      * @param array List Parse a list, use this feature if you wish to parse a list. This will also
  72.      *  enable to OutputHandler to print a feed. This parameter is optional, if set the
  73.      *  first parameter will define the description of the channel, and every body and
  74.      *  title in this array will define an entry.
  75.      *  Array layout:
  76.      *  [body,body,...]
  77.      *  or
  78.      *  [[title,body],[title,body],...]
  79.      * @access public
  80.      */
  81.     public function SetBody$body,  $List null ){
  82.         $this->Body = $body;
  83.         $this->BodyList = $List;
  84.     }
  85.      // end of member function SetBody
  86.  
  87.  
  88.     
  89.     /**
  90.     *Gets content ready to be printed
  91.     *
  92.     *This does not include header, only the body content.
  93.     *
  94.     *@return string Content ready for print
  95.     */
  96.     public function GetContent(){
  97.         $Body file_get_contents($this->Owner->GetCMS3Path("data/System/SystemBody.htm");
  98.         $Menu "";
  99.         $Editors $this->Owner->GetImplementations("IProvidesEditor");
  100.         foreach($Editors as $Editor){
  101.             $Menu .= "<a dojoType='FisheyeListItem' onClick=\"document.location = 'CMS3URLSystem/Edit/" $Editor->GetPluginID("';\" href='CMS3URLSystem/Edit/" $Editor->GetPluginID("' iconsrc='" $Editor->GetSystemIcon("' title='" $Editor->GetSystemMenuEntry()  "' caption='" $Editor->GetSystemMenuEntry()  "' ><img border='0' src='" $Editor->GetSystemIcon("' /></a>";
  102.         }
  103.         $Body str_replace("MENUOPTIONS",$Menu ,$Body);
  104.         $Body str_replace("CMS3URL",$this->Owner->GetCMS3URL(,$Body);
  105.         $Body .= "<p>" $this->Body . "</p>";
  106.         if(is_array($this->BodyList)){
  107.             foreach($this->BodyList as $value){
  108.                 if(is_array($value)){
  109.                     $Body .= "<b>" $value[0"</b><br>";
  110.                     $Body .=  $value[1"<br>";
  111.                 }else{
  112.                     $Body .= $value "<br>";
  113.                 }
  114.             }
  115.         }
  116.         return $Body;
  117.     }
  118.  
  119.     /**
  120.     *Gets the header extension
  121.     *
  122.     *@return string Lines to be added to the header
  123.     */
  124.     public function GetHeader(){
  125.         $Header file_get_contents($this->Owner->GetCMS3Path("data/System/SystemHeader.htm");
  126.         $Header str_replace("CMS3URL",$this->Owner->GetCMS3URL(,$Header);
  127.         return $Header $this->Header;
  128.     }
  129.  
  130.  
  131.     /**
  132.     *Const defining the PluginID
  133.     */
  134.     private static $PluginID "System";
  135.  
  136.     /**
  137.     *Referance to the MainClass owning this instance
  138.     */
  139.     protected $Owner = null;
  140.  
  141.     /**
  142.      *
  143.      * @param CMS3_System Owner The CMS3_System that owns this plugin, gives the plugin ability to get data from CMS3_System
  144.      * @access public
  145.      */
  146.     public function Register&$Owner ){
  147.         $this->Owner =$Owner;
  148.     }
  149.  
  150.     /**
  151.      * Gets the pluginID of the plugin.
  152.      *
  153.      * @return string 
  154.      * @access public
  155.      */
  156.     public function GetPluginID){
  157.         return $this->PluginID;
  158.     }
  159.  
  160. }
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172. ?>

Documentation generated on Mon, 30 Apr 2007 01:59:10 +0200 by phpDocumentor 1.3.1