Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cHTML
  • cHTMLAlignmentTable
  • cHTMLArticle
  • cHTMLAside
  • cHTMLAudio
  • cHTMLButton
  • cHTMLCanvas
  • cHTMLCheckbox
  • cHTMLContentElement
  • cHTMLDiv
  • cHTMLFieldset
  • cHTMLFooter
  • cHTMLForm
  • cHTMLFormElement
  • cHTMLHeader
  • cHTMLHgroup
  • cHTMLHiddenField
  • cHTMLIFrame
  • cHTMLImage
  • cHTMLLabel
  • cHTMLLegend
  • cHTMLLink
  • cHTMLList
  • cHTMLListItem
  • cHTMLNav
  • cHTMLOptgroup
  • cHTMLOptionElement
  • cHTMLParagraph
  • cHTMLPasswordbox
  • cHTMLRadiobutton
  • cHTMLScript
  • cHTMLSection
  • cHTMLSelectElement
  • cHTMLSpan
  • cHTMLTable
  • cHTMLTableBody
  • cHTMLTableData
  • cHTMLTableHead
  • cHTMLTableHeader
  • cHTMLTableRow
  • cHTMLTextarea
  • cHTMLTextbox
  • cHTMLTime
  • cHTMLUpload
  • cHTMLVideo
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the cHTMLFormElement class.
  4:  *
  5:  * @package Core
  6:  * @subpackage GUI_HTML
  7:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @author Simon Sprankel
 10:  * @copyright four for business AG <www.4fb.de>
 11:  * @license http://www.contenido.org/license/LIZENZ.txt
 12:  * @link http://www.4fb.de
 13:  * @link http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * cHTMLFormElement class represents a form element.
 20:  *
 21:  * @package Core
 22:  * @subpackage GUI_HTML
 23:  */
 24: class cHTMLFormElement extends cHTML {
 25: 
 26:     /**
 27:      * Constructor.
 28:      * This is a generic form element, where
 29:      * specific elements should be inherited from this class.
 30:      *
 31:      * @param string $name Name of the element
 32:      * @param string $id ID of the element
 33:      * @param string $disabled Item disabled flag (non-empty to set disabled)
 34:      * @param string $tabindex Tab index for form elements
 35:      * @param string $accesskey Key to access the field
 36:      * @param string $class CSS class name to set
 37:      */
 38:     public function __construct($name = '',
 39:                                 $id = '',
 40:                                 $disabled = '',
 41:                                 $tabindex = '',
 42:                                 $accesskey = '',
 43:                                 $class = 'text_medium',
 44:                                 $class = ''
 45:     ) {
 46: 
 47:         parent::__construct();
 48: 
 49:         $this->updateAttribute('name', $name);
 50: 
 51:         if (is_string($id) && !empty($id)) {
 52:             $this->updateAttribute('id', $id);
 53:         }
 54: 
 55:         $this->_tag = 'input';
 56: 
 57:         $this->setClass($class);
 58:         $this->setDisabled($disabled);
 59:         $this->setTabindex($tabindex);
 60:         $this->setAccessKey($accesskey);
 61: 
 62:     }
 63: 
 64:     /**
 65:      * Sets the "disabled" attribute of an element.
 66:      * User Agents
 67:      * usually are showing the element as "greyed-out".
 68:      *
 69:      * Example:
 70:      * $obj->setDisabled('disabled');
 71:      * $obj->setDisabled('');
 72:      *
 73:      * The first example sets the disabled flag, the second one
 74:      * removes the disabled flag.
 75:      *
 76:      * @param string $disabled Sets the disabled-flag if non-empty
 77:      * @return cHTMLFormElement $this
 78:      */
 79:     public function setDisabled($disabled) {
 80:         if (empty($disabled)) {
 81:             $this->removeAttribute('disabled');
 82:         } else {
 83:             $this->updateAttribute('disabled', 'disabled');
 84:         }
 85: 
 86:         return $this;
 87:     }
 88: 
 89:     /**
 90:      * Sets the tab index for this element.
 91:      * The tab
 92:      * index needs to be numeric, bigger than 0 and smaller than 32767.
 93:      *
 94:      * @param int $tabindex Desired tab index
 95:      * @return cHTMLFormElement $this
 96:      */
 97:     public function setTabindex($tabindex) {
 98:         if (is_numeric($tabindex) && $tabindex >= 0 && $tabindex <= 32767) {
 99:             $this->updateAttribute('tabindex', $tabindex);
100:         }
101: 
102:         return $this;
103:     }
104: 
105:     /**
106:      * Sets the access key for this element.
107:      *
108:      * @param string $accesskey The length of the access key. May be A-Z and
109:      *        0-9.
110:      * @return cHTMLFormElement $this
111:      */
112:     public function setAccessKey($accesskey) {
113:         if ((strlen($accesskey) == 1) && isAlphanumeric($accesskey)) {
114:             $this->updateAttribute('accesskey', $accesskey);
115:         } else {
116:             $this->removeAttribute('accesskey');
117:         }
118: 
119:         return $this;
120:     }
121: 
122: }
123: 
CMS CONTENIDO 4.9.3 API documentation generated by ApiGen 2.8.0