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

Source for file Textarea.php

Documentation is available at Textarea.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: Textarea.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_Item');
  33.  
  34. /**
  35.  * HTML Form Textarea class
  36.  *
  37.  * This class automates the creation and display of a textarea field.
  38.  *
  39.  * Example INI:
  40.  *
  41.  * <pre><samp>
  42.  * item.notes.label = Notes
  43.  * item.notes.type  = textarea
  44.  * item.notes.cols  = 40
  45.  * item.notes.rows  = 6
  46.  * </samp></pre>
  47.  *
  48.  * @category   Cnz
  49.  * @package    Cnz_Html
  50.  * @subpackage Form
  51.  */
  52. {
  53.     /**#@+ @var int */
  54.     private $cols    40;
  55.     private $rows    4;
  56.     /**#@-*/
  57.  
  58.     /* Methods ===========================================================*/
  59.  
  60.     /**
  61.      * Option fields:
  62.      *   none
  63.      *
  64.      * Configuration fields:
  65.      *   cols  Number of columns
  66.      *   rows  Number of rows
  67.      *
  68.      * @param  array       $options Options
  69.      * @param  Zend_Config $config  Configuration
  70.      */
  71.     public function __construct(array $options array()Zend_Config $config NULL)
  72.     {
  73.         parent::__construct($options$config);
  74.         if (isset($config->cols)) $this->cols $config->cols;
  75.         if (isset($config->rows)) $this->rows $config->rows;
  76.         return;
  77.     }
  78.  
  79.     /**
  80.      * @param  string $style Value for outermost style attribute
  81.      * @return void 
  82.      */
  83.     public function display($style NULL)
  84.     {
  85.         $is Cnz_Html::getIndentString();
  86.         $indent Cnz_Html::indentGenerate();
  87.  
  88.         echo $indent'<div class = "'$this->genStyles('label')'"><label for = "'$this->genId()'">'$this->label'</label></div>'"\n";
  89.         echo $indent'<div class = "'$this->genStyles('field')'">';
  90.         echo '<textarea cols = "'$this->cols'" id = "'$this->genId()'" name = "'$this->name'" rows = "'$this->rows'">';
  91.         if (!empty($this->initial)) echo htmlentities($this->initial);
  92.         echo '</textarea>';
  93.         echo '</div>'"\n";
  94.  
  95.         return;
  96.     }
  97. }

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