Cnz_Html
[ class tree: Cnz_Html ] [ index: Cnz_Html ] [ all elements ]

Source for file Item.php

Documentation is available at Item.php

  1. <?php
  2. /**
  3.  * CNZ Framework
  4.  *
  5.  * A Framework for Creating and Using Complex Web Elements
  6.  *
  7.  * The purpose of this framework is to provide a library of high-level objects
  8.  * to facilitate common HTML coding tasks, such as menus, tables, and forms.
  9.  * The intent is to reduce repetitive HTML coding as much as possible, replacing
  10.  * it with a combination of configuration files and style sheets with
  11.  * standardized naming conventions.
  12.  *
  13.  * This framework is built on and requires the
  14.  * {@link http://framework.zend.com/ Zend Framework}.
  15.  *
  16.  * @category   Cnz
  17.  * @package    Cnz_Html
  18.  * @subpackage Menu
  19.  *
  20.  * @author    Lyle Frost <lfrost@cnz.com>
  21.  * @copyright Copyright (c) 2006-2007 Citadel Network <{@link http://www.citadelnetwork.com/}>
  22.  * @filesource
  23.  * @license   http://www.citadelnetwork.com/license/cnzframework New BSD License
  24.  * @version   $Id: Item.php 27 2007-07-19 18:47:54Z lfrost $
  25.  */
  26.  
  27. /**
  28.  * Required classes.
  29.  *
  30.  * @ignore
  31.  */
  32. Zend_Loader::loadClass('Cnz_Html_Element');
  33.  
  34. /**
  35.  * HTML Menu Item class
  36.  *
  37.  * This class is probably not useful directly.  It could be an inner class
  38.  * of Html_Menu, if PHP supported inner classes.
  39.  *
  40.  * @category   Cnz
  41.  * @package    Cnz_Html
  42.  * @subpackage Menu
  43.  */
  44. {
  45.     /**#@+ @var string */
  46.     private    $text        NULL;
  47.     private    $link        NULL;
  48.     /**#@-*/
  49.  
  50.     /* Methods ===========================================================*/
  51.  
  52.     /**
  53.      * @param array   $options         Common options
  54.      * @param boolean $customStyleFlag Custom styles
  55.      */
  56.     public function __construct($options NULL$text$link)
  57.     {
  58.         parent::__construct($options);
  59.         $this->text $text;
  60.         $this->link $link;
  61.     }
  62.  
  63.     /**
  64.      * @param  string $style Value for outermost style attribute
  65.      * @return void 
  66.      */
  67.     public function display($style NULL)
  68.     {
  69.         $is Cnz_Html::getIndentString();
  70.         $indent Cnz_Html::indentGenerate();
  71.  
  72.         if (isset($this->link&& !empty($this->link))
  73.         {
  74.             echo $indent'<li class = "'$this->genStyles()'">';
  75.             echo '<a class = "'$this->genStyles()'" href = "'$this->link '">'$this->text'</a></li>'"\n";
  76.         }
  77.         else
  78.         {
  79.             Cnz_Html::indentDec();
  80.             $indent Cnz_Html::indentGenerate();
  81.             echo $indent'</ul>'"\n";
  82.             echo $indent'<hr class = "'$this->genStyles()'"';
  83.             if (Cnz_Html::isXhtml())
  84.             {
  85.                 echo '/';
  86.             }
  87.             echo '>'"\n";
  88.             echo $indent'<ul class = "'$this->genStyles()'">'"\n";
  89.             Cnz_Html::indentInc();
  90.         }
  91.         return;
  92.     }
  93. }

Documentation generated on Thu, 19 Jul 2007 15:02:12 -0400 by phpDocumentor 1.4.0RC2