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

Source for file Checkbox.php

Documentation is available at Checkbox.php

  1. <?php
  2. /**
  3.  * Formagic
  4.  *
  5.  * LICENCE
  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.  * It is also available through the world-wide-web at
  10.  * http://formagic.weasle.de/licence.txt
  11.  * If you did not receive a copy of the license and are unable to
  12.  * obtain it through the world-wide-web, please send an email
  13.  * to licence@weasle.de so we can send you a copy immediately.
  14.  *
  15.  * @category    Formagic
  16.  * @package     Item
  17.  * @author      Florian Sonnenburg
  18.  * @copyright   Copyright (c) 2007 Florian Sonnenburg
  19.  * @license     http://formagic.weasle.de/licence.txt     New BSD License
  20.  * @revision    $Revision: 11 $
  21.  */
  22.  
  23. /**
  24.  * Formagic_Item_Checkbox
  25.  *
  26.  * @category    Formagic
  27.  * @package     Item
  28.  * @author      Florian Sonnenburg
  29.  * @copyright   Copyright (c) 2007 Florian Sonnenburg
  30.  * @version $Id: Checkbox.php 11 2007-08-12 20:02:57Z meweasle $
  31.  */
  32.  
  33.     /**
  34.      * Returns HTML representation of checkbox item
  35.      *
  36.      * @see $_isBlocked
  37.      * @return string 
  38.      */
  39.     public function getHtml()
  40.     {
  41.         $val $this->getValue();
  42.         $checked $val 0;
  43.  
  44.         if ($this->_isBlocked{
  45.             $str $checked "[X]" "[_]";
  46.             if ($this->isPostItem{
  47.                 $str .= '<input type="hidden" name="' $this->name . '" value="' $checked '" />';
  48.             }
  49.         else {
  50.             $this->attributes['type''checkbox';
  51.             $this->attributes['name'$this->name;
  52.             $this->attributes['id'$this->id;
  53.             $this->attributes['value''1';
  54.  
  55.             if ($checked{
  56.                 $this->attributes['checked''checked';
  57.             }
  58.  
  59.             $str '<input type="hidden" name="' $this->name . '" value="0" />';
  60.             $str .= '<input' $this->_getAttributeStr(' />';
  61.         }
  62.         return $str;
  63.     }
  64.  
  65. }

Documentation generated on Thu, 23 Aug 2007 00:29:33 +0200 by phpDocumentor 1.4.0