Overview

Packages

  • Auth
  • Config
  • Controller
  • Date
  • Db
  • Feed
    • Abstract
    • Writers
  • File
    • Decorator
  • Form
    • Element
  • Image
  • Log
    • Writer
  • Net
    • Exception
  • None
  • PHP
  • PHPMailer
  • Session
  • Util
  • Validate
    • Validator
  • Zend
    • Registry

Classes

  • Form_Element_AutoCompleter
  • Form_Element_Checkbox
  • Form_Element_Colorpicker
  • Form_Element_Date
  • Form_Element_DatePicker
  • Form_Element_Email
  • Form_Element_File
  • Form_Element_Hidden
  • Form_Element_Html
  • Form_Element_Ip
  • Form_Element_Mac
  • Form_Element_Multi
  • Form_Element_NumericStepper
  • Form_Element_Password
  • Form_Element_Radio
  • Form_Element_Select
  • Form_Element_Slider
  • Form_Element_Submit
  • Form_Element_Text
  • Form_Element_Textarea
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Pry Framework
  4:  *
  5:  * LICENSE
  6:  *
  7:  * This source file is subject to the new BSD license that is bundled
  8:  * with this package in the file LICENSE.txt.
  9:  * 
 10:  * @version $Revision: 276 $
 11:  */
 12: 
 13: /**
 14:  * Element Textarea
 15:  * @category Pry
 16:  * @package Form
 17:  * @subpackage Form_Element
 18:  * @version 1.0.7 
 19:  * @author Olivier ROGER <oroger.fr>
 20:  */
 21: class Form_Element_Textarea extends Form_Field
 22: {
 23:     /**
 24:      * Constructeur
 25:      *
 26:      * @param string $nom
 27:      * @param Form_Form $form
 28:      * @access public
 29:      */
 30:     public function __construct($nom,$form)
 31:     {
 32:         parent::__construct($nom,$form);
 33:         $this->attrs['name'] = $nom;
 34:     }
 35:     
 36:     /**
 37:      * Défini le nombre de colonne
 38:      *
 39:      * @param int $val
 40:      * @access public
 41:      * @return Form_Element_Textarea
 42:      */
 43:     public function cols($val)
 44:     {
 45:         if(ctype_digit((string)$val) && $val>0)
 46:             $this->attrs['cols'] = $val;
 47:         else
 48:             unset($this->attrs['cols']);
 49:         return $this;
 50:     }
 51:     
 52:     /**
 53:      * Défini le nombre de ligne
 54:      *
 55:      * @param int $val
 56:      * @access public
 57:      * @return Form_Element_Textarea
 58:      */
 59:     public function rows($val)
 60:     {
 61:         if(ctype_digit((string)$val) && $val>0)
 62:             $this->attrs['rows'] = $val;
 63:         else
 64:             unset($this->attrs['rows']);
 65:         return $this;
 66:     }
 67:     
 68:     /**
 69:      * Ecrit l'objet
 70:      *
 71:      * @access public
 72:      * @return string
 73:      */
 74:     public function __toString()
 75:     {
 76:         $css = $this->cssClass();
 77:         $label='';  
 78:         if(!empty($this->label))
 79:         {
 80:             $label = "\t".'<label for="'.$this->attrs['id'].'" class="'.$this->cssLabel.'">'.$this->label.'</label>'."\n";
 81:             if($this->labelNewLine)
 82:                 $label.="\t".'<br />'."\n";
 83:         }
 84:         $attributs = $this->attrsToString();
 85:         //Posted value ou value par défaut
 86:         $value = $this->form->getPostedvalue($this->attrs['name']);
 87:         if(empty($value))
 88:             $value = $this->value;
 89:         
 90:         $error = '';
 91:         if(!is_null($this->errorMsg))
 92:         {
 93:             $error='<span class="'.$this->errorClass.'">'.$this->errorMsg.'</span><br />';
 94:         }
 95:         
 96:         $field = "\t".'<textarea '.$css.' '.$attributs.'>'.htmlspecialchars($value).'</textarea>'."\n";
 97:         if(!empty($this->info))
 98:             $field.="\t".'<img src="'.$this->imgInfo.'" id="'.$this->attrs['name'].'_tooltip" class="form_tooltip" title="'.$this->info.'" alt="" style="cursor:help;" />';
 99:         if($this->fieldNewLine)
100:             $field.='<br />';
101:         return $label.$field.$error;
102:     }
103: }
104:  ?>
Pry Framework API documentation generated by ApiGen 2.6.1