[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/framework/view/ -> view.inc.php (source)

   1  <?php
   2  //--------------------------------------------------------------------------------
   3  // Copyright 2003 Procata, Inc.
   4  // Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
   5  //--------------------------------------------------------------------------------
   6  /**
   7  * @package WACT_CONTROLLERS
   8  * @version $Id: view.inc.php,v 1.8 2004/11/12 21:25:12 jeffmoore Exp $
   9  */
  10  //--------------------------------------------------------------------------------
  11  
  12  require_once WACT_ROOT . 'template/template.inc.php';
  13  
  14  /**
  15  * Implements TemplateView pattern. Base View for non-forms
  16  * @abstract
  17  * @package WACT_VIEW
  18  */
  19  class View {
  20  
  21      /**
  22      * @access Protected
  23      * @var Template
  24      */
  25      var $Template;
  26  
  27      /**
  28      * @access Protected
  29      * @var Boolean
  30      */
  31      var $IsSubView = FALSE;
  32      
  33      /**
  34      * @param string filename of template
  35      */
  36      function View($TemplateFile = NULL) {
  37          if (!is_null($TemplateFile)) {
  38              $this->Template =& new Template($TemplateFile);
  39          }
  40      }
  41      
  42      /**
  43      * Turn this View into a sub view in a composite view
  44      * The root component passed represents the portion of the
  45      * CompositeView's Template that this view will manage.
  46      * This component should be a dataspace component unless
  47      * special arrangements are made in subclasses of this
  48      * View class.
  49      * @param object 
  50      */
  51      function makeSubView(&$RootComponent) {
  52          $this->Template =& $RootComponent;
  53          $this->IsSubView = TRUE;
  54      }
  55      
  56      /**
  57      * Transfer values from the dataspace into the Template
  58      * @param object implementing dataspace
  59      * @return void
  60      * @access public
  61      */
  62      function setModel(&$Model) {
  63          $this->Template->registerDataSource($Model);
  64      }
  65  
  66      /**
  67      * Template method provided as a place for subclasses to place
  68      * template manipulation logic.  It is not necessary to 
  69      * call the parent prepare method when this method is overridden.
  70      * @return void
  71      * @access public
  72      */
  73      function prepare() {
  74      }
  75      
  76      /**
  77      * Output the View
  78      * This method will not be called if this View is participating as
  79      * a sub view in a composite view.
  80      * @return void
  81      * @access public
  82      */
  83      function display() {
  84          $this->Template->display();
  85      }
  86  
  87  }
  88  
  89  ?>


Generated: Sun Nov 28 19:36:09 2004 Cross-referenced by PHPXref 0.5