[ PHPXref.com ] [ Generated: Sun Jul 20 20:29:46 2008 ] [ Swat 0.1.8 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/Swat/ -> SwatToolbar.php (source)

   1  <?php
   2  
   3  require_once  'Swat/SwatContainer.php';
   4  require_once  'Swat/SwatHtmlTag.php';
   5  
   6  /**
   7   * A toolbar container for a group of related {@link SwatToolLink} objects
   8   *
   9   * @package   Swat
  10   * @copyright 2005-2006 silverorange
  11   * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
  12   */
  13  class SwatToolbar extends SwatContainer
  14  {
  15      /**
  16       * Creates a new toolbar
  17       *
  18       * @param string $id a non-visible unique id for this widget.
  19       *
  20       * @see SwatWidget::__construct()
  21       */
  22  	public function __construct($id = null)
  23      {
  24          parent::__construct($id);
  25  
  26          $this->addStyleSheet('swat/styles/swat-toolbar.css');
  27      }
  28  
  29      /**
  30       * Displays this toolbar as an unordered list with each sub-item
  31       * as a list item
  32       */
  33  	public function display()
  34      {
  35          if (!$this->visible)
  36              return;
  37  
  38          $toolbar_ul = new SwatHtmlTag('ul');
  39          $toolbar_ul->class = 'swat-toolbar';
  40  
  41          $toolbar_ul->open();
  42  
  43          foreach ($this->children as &$child) {
  44              echo '<li>';
  45              $child->display();
  46              echo '</li>';
  47          }
  48  
  49          $toolbar_ul->close();
  50      }
  51  
  52      /**
  53       * Sets the value of all {@link SwatToolLink} objects within this toolbar
  54       *
  55       * This is usually more convenient than setting all the values by hand
  56       * if the values are dynamic.
  57       *
  58       * @param string $value
  59       */
  60  	public function setToolLinkValues($value)
  61      {
  62          foreach ($this->getDescendants('SwatToolLink') as $tool)
  63              $tool->value = $value;
  64      }
  65  }
  66  
  67  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]