[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wact/src/tags/pager/ -> paginate.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   * Links a list with a pager

  12   * @tag paginate

  13   * @forbid_end_tag

  14   * @req_const_attributes list with

  15   * @package wact
  16   * @version $Id$
  17   */
  18  class WactPaginateTag extends WactCompilerTag
  19  {
  20    function generateTagContent($code)
  21    {
  22      if(!$list = $this->parent->findUpChild($this->getAttribute('list')))
  23        $this->raiseCompilerError('List tag is not found', array('id' => $this->getAttribute('list')));
  24  
  25      if(!$pager = $this->parent->findUpChild($this->getAttribute('with')))
  26        $this->raiseCompilerError('Pager navigator tag is not found', array('id' => $this->getAttribute('with')));
  27  
  28     $dataset_var = $code->getTempVarRef();
  29  
  30     $code->writePhp($dataset_var . ' = ' . $list->getComponentRefCode()  . '->getDataset();' . "\n");
  31     $code->writePhp($pager->getComponentRefCode() . '->setPagedDataSet(' . $dataset_var  . ');' . "\n");
  32     $code->writePhp($dataset_var . '->paginate(' . $pager->getComponentRefCode()  . '->getStartingItem(), ' .
  33                                                  $pager->getComponentRefCode()  . '->getItemsPerPage());' . "\n");
  34    }
  35  }
  36  
  37  ?>


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