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

Source for file Group.php

Documentation is available at Group.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 Form
  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: Group.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_Form_Abstract');
  33.  
  34. /**
  35.  * HTML Form Group class
  36.  *
  37.  * This class automates the creation and display of a field group.
  38.  *
  39.  * Example INI:
  40.  *
  41.  * <pre><samp>
  42.  * item.address.label      = Address
  43.  * item.address.type       = group
  44.  *
  45.  * [HtmlForm-address]
  46.  * <i>Define fields for this group in this section.</i>
  47.  * </samp></pre>
  48.  *
  49.  * @category   Cnz
  50.  * @package    Cnz_Html
  51.  * @subpackage Form
  52.  */
  53. {
  54.     /**#@+ @var    string */
  55.     private $label        NULL;
  56.     /**#@-*/
  57.  
  58.     /* Methods ===========================================================*/
  59.  
  60.     /**
  61.      * Option fields:
  62.      *   none
  63.      *
  64.      * Configuration fields:
  65.      *   label  Label for legend
  66.      *
  67.      * @param  array       $options Options
  68.      * @param  Zend_Config $config  Configuration
  69.      */
  70.     public function __construct(array $options array()Zend_Config $config NULL)
  71.     {
  72.         parent::__construct($options);
  73.         if (isset($config->label)) $this->label $config->label;
  74.         return;
  75.     }
  76.  
  77.     /**
  78.      * @param  string $style Value for outermost style attribute
  79.      * @return void 
  80.      */
  81.     public function display($style NULL)
  82.     {
  83.         $indent Cnz_Html::indentGenerate();
  84.  
  85.         echo $indent'<fieldset class = "'$this->genStyles()'">'"\n";
  86.         Cnz_Html::indentInc();
  87.         $indent Cnz_Html::indentGenerate();
  88.  
  89.         if (!empty($this->label))
  90.         {
  91.             echo $indent'<legend>'$this->label'</legend>'"\n";
  92.         }
  93.         parent::display($style);
  94.  
  95.         Cnz_Html::indentDec();
  96.         $indent Cnz_Html::indentGenerate();
  97.         echo $indent'</fieldset>'"\n";
  98.  
  99.         return;
  100.     }
  101.  
  102.     /**
  103.      * @param  array  $data Form data
  104.      * @return string 
  105.      */
  106.     public function submitString(array $data NULL)
  107.     {
  108.         return $this->label "\n" '========================' "\n" parent::submitString($data);
  109.     }
  110. }

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