[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wact/src/tags/list/ -> separator.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  /**

  11   * Compile time component for separators in a list

  12   * The tag work depends on it's position.

  13   * You MUST place separator at the END of the list item tag content.

  14   * Default step attribute is 1

  15   * @tag list:SEPARATOR

  16   * @restrict_self_nesting

  17   * @parent_tag_class WactListItemTag

  18   * @package wact
  19   * @version $Id: separator.tag.php 5945 2007-06-06 08:31:43Z pachanga $
  20   */
  21  class WactListSeparatorTag extends WactRuntimeComponentTag
  22  {
  23    protected $runtimeIncludeFile = 'limb/wact/src/components/list/WactListSeparatorComponent.class.php';
  24    protected $runtimeComponentName = 'WactListSeparatorComponent';
  25  
  26    protected $step;
  27  
  28    function preParse($compiler)
  29    {
  30      if($step = $step = $this->getAttribute('every'))
  31        $this->setAttribute('step', $step);
  32  
  33      if ($step = $this->getAttribute('step'))
  34        $this->step = $step;
  35      else
  36        $this->step = 1;
  37  
  38      if ($this->getBoolAttribute('literal'))
  39        return WACT_PARSER_FORBID_PARSING;
  40    }
  41  
  42    function generateTagContent($code)
  43    {
  44      $code->writePhp($this->getComponentRefCode($code) . '->setStep(' . $this->step .');' . "\n");
  45  
  46      $ListList = $this->findParentByClass('WactListListTag');
  47  
  48      $code->writePhp($this->getComponentRefCode($code) . '->next();' . "\n");
  49  
  50      $code->writePhp('if ( ' . $this->getComponentRefCode($code)  . '->shouldDisplay()){'. "\n");
  51  
  52      $code->writePhp($this->getComponentRefCode($code) . '->reset();'. "\n");
  53  
  54      $separators = $this->parent->findChildrenByClass('WactListSeparatorTag');
  55      if(array($separators) && count($separators))
  56      {
  57        foreach($separators as $separator)
  58        {
  59          if($separator->getAttribute('step') < $this->getAttribute('step'))
  60            $code->writePhp($separator->getComponentRefCode($code) . "->skipNext();\n");
  61        }
  62      }
  63  
  64      parent :: generateTagContent($code);
  65  
  66      $code->writePhp('}'. "\n");
  67    }
  68  }
  69  ?>


Generated: Thu Jan 8 04:06:23 2009 Cross-referenced by PHPXref 0.7