[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/framework/template/compiler/ -> serverdatacomponent.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_TEMPLATE
   8  * @version $Id: serverdatacomponent.inc.php,v 1.13 2004/11/12 21:25:06 jeffmoore Exp $
   9  */
  10  //--------------------------------------------------------------------------------
  11  /**
  12  * include parent class
  13  */
  14  require_once WACT_ROOT . 'template/compiler/servercomponent.inc.php';
  15  /**
  16  * Server tag component tags are ServerComponentTags which also correspond to
  17  * an HTML tag. Makes it easier to implement instead of extending from the
  18  * ServerComponentTag class
  19  * @see http://wact.sourceforge.net/index.php/ServerTagComponentTag
  20  * @access public
  21  * @abstract
  22  * @package WACT_TEMPLATE
  23  */
  24  class ServerDataComponentTag extends ServerComponentTag {
  25  
  26      var $DataSourceReferenceVariable;
  27  
  28      /**
  29      * Calls the parent preGenerate() method then writes
  30      * "$DataSpace->prepare();" to the compiled template.
  31      * @param CodeWriter
  32      * @return void
  33      * @access protected
  34      */
  35  	function preGenerate(&$code) {
  36          parent::preGenerate($code);
  37          
  38          if ($this->hasAttribute('from')) {
  39              $code->writePHP($this->getComponentRefCode() . '->registerDataSource(');
  40              $parent_datasource =& $this->getParentDataSource();
  41              $code->writePHP('Template::_dereference(' . $parent_datasource->getDataSourceRefCode() . ',');
  42              $code->writePHPLIteral($this->getAttribute('from'));
  43              $code->writePHP('));');
  44          }
  45          
  46          $code->writePHP($this->getComponentRefCode() . '->prepare();');
  47  
  48          $this->DataSourceReferenceVariable = $code->getTempVariable();
  49          $code->writePHP('$' . $this->DataSourceReferenceVariable . '=&' . $this->getComponentRefCode() . '->_datasource;');
  50      }
  51  
  52      /**
  53      * @return ListListTag this instance
  54      * @access protected
  55      */
  56      function &getDataSource() {
  57          return $this;
  58      }
  59  
  60      /**
  61      * @return string PHP runtime variable reference to component
  62      * @access protected
  63      */
  64  	function getDataSourceRefCode() {
  65          return '$' . $this->DataSourceReferenceVariable;
  66      }
  67  
  68      /**
  69      * @return Boolean Indicating whether or not this component is a DataSource
  70      */
  71  	function isDataSource() {
  72          return TRUE;
  73      }
  74  
  75  }
  76  ?>


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