[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/framework/template/tags/form/ -> label.tag.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_TAG
   8  * @version $Id: label.tag.php,v 1.20 2004/11/18 04:22:48 jeffmoore Exp $
   9  * @see http://www.w3.org/TR/html4/interact/forms.html
  10  */
  11  
  12  /**
  13  * Register the tag
  14  */
  15  $taginfo =& new TagInfo('label', 'LabelTag');
  16  $taginfo->setCompilerAttributes(array('errorclass', 'errorstyle'));
  17  $taginfo->setDefaultLocation(LOCATION_CLIENT);
  18  $taginfo->setKnownParent('FormTag');
  19  TagDictionary::registerTag($taginfo, __FILE__);
  20  
  21  /**
  22  * Compile time component for building runtime form labels
  23  * @see http://wact.sourceforge.net/index.php/LabelTag
  24  * @access protected
  25  * @package WACT_TAG
  26  */
  27  class LabelTag extends ServerTagComponentTag {
  28      /**
  29      * File to include at runtime
  30      * @var string path to runtime component relative to WACT_ROOT
  31      * @access private
  32      */
  33      var $runtimeIncludeFile = '/template/components/form/form.inc.php';
  34  
  35      /**
  36      * Name of runtime component class
  37      * @var string
  38      * @access private
  39      */
  40      var $runtimeComponentName = 'LabelComponent';
  41  
  42      /**
  43      * @return void
  44      * @access protected
  45      */
  46  	function CheckNestingLevel() {
  47          if ($this->findParentByClass('LabelTag')) {
  48              RaiseError('compiler', 'BADSELFNESTING', array(
  49                  'tag' => $this->tag,
  50                  'file' => $this->SourceFile,
  51                  'line' => $this->StartingLineNo));
  52          }
  53          if (!$this->findParentByClass('FormTag')) {
  54              RaiseError('compiler', 'MISSINGENCLOSURE', array(
  55                  'tag' => $this->tag,
  56                  'EnclosingTag' => 'form',
  57                  'file' => $this->SourceFile,
  58                  'line' => $this->StartingLineNo));
  59          }
  60      }
  61  
  62      /**
  63      * @param CodeWriter
  64      * @return void
  65      * @access protected
  66      */
  67  	function generateConstructor(&$code) {
  68          parent::generateConstructor($code);
  69          if ($this->hasAttribute('errorclass')) {
  70              $code->writePHP($this->getComponentRefCode() . '->errorclass = ');
  71              $code->writePHPLiteral($this->getAttribute('errorclass'));
  72              $code->writePHP(';');
  73          }
  74          if ($this->hasAttribute('errorstyle')) {
  75              $code->writePHP($this->getComponentRefCode() . '->errorstyle = ');
  76              $code->writePHPLiteral($this->getAttribute('errorstyle'));
  77              $code->writePHP(';');
  78          }
  79      }
  80  }
  81  ?>


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