[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wact/src/tags/core/ -> set.tag.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  
  10  require_once 'limb/wact/src/compiler/property/WactConstantProperty.class.php';
  11  
  12  /**

  13   * Sets a property in the runtime DataSource, according the attributes of this

  14   * tag at compile time.

  15   * @tag core:SET

  16   * @forbid_end_tag

  17   * @package wact
  18   * @version $Id: set.tag.php 5945 2007-06-06 08:31:43Z pachanga $
  19   */
  20  class WactCoreSetTag extends WactCompilerTag
  21  {
  22    function preParse()
  23    {
  24      if($this->hasAttribute('runtime') && !$this->getBoolAttribute('runtime'))
  25      {
  26        $DataSource = $this->getDataSource();
  27        foreach(array_keys($this->attributeNodes) as $key)
  28        {
  29          if(!$this->attributeNodes[$key]->isConstant())
  30            continue;
  31  
  32          $name = $this->attributeNodes[$key]->getName();
  33          $property = new WactConstantProperty($this->attributeNodes[$key]->getValue());
  34          $DataSource->registerProperty($name, $property);
  35        }
  36      }
  37    }
  38  
  39    function generateTagContent($code_writer)
  40    {
  41      $ref = $this->getDataSource()->getComponentRefCode();
  42      foreach(array_keys($this->attributeNodes) as $key)
  43      {
  44        $name = $this->attributeNodes[$key]->getName();
  45        $code_writer->writePHP($ref . '->set("' . $name . '", ');
  46        $this->attributeNodes[$key]->generateExpression($code_writer);
  47        $code_writer->writePHP(');');
  48      }
  49    }
  50  }
  51  ?>


Generated: Fri Aug 29 04:49:26 2008 Cross-referenced by PHPXref 0.7