Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • 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: /**
  4:  * This file contains the cHTMLFormElement class.
  5:  *
  6:  * @package Core
  7:  * @subpackage GUI_HTML
  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 to create an instance of this class.
 28:      *
 29:      * This is a generic form element, where specific elements should be
 30:      * inherited from this class.
 31:      *
 32:      * @param string $name [optional]
 33:      *         Name of the element
 34:      * @param string $id [optional]
 35:      *         ID of the element
 36:      * @param string $disabled [optional]
 37:      *         Item disabled flag (non-empty to set disabled)
 38:      * @param string $tabindex [optional]
 39:      *         Tab index for form elements
 40:      * @param string $accesskey [optional]
 41:      *         Key to access the field
 42:      * @param string $class [optional]
 43:      *         CSS class name to set
 44:      */
 45:     public function __construct(
 46:         $name = '', $id = '', $disabled = '', $tabindex = '', $accesskey = '',
 47:         $class = 'text_medium'
 48:     ) {
 49: 
 50:         parent::__construct();
 51: 
 52:         $this->updateAttribute('name', $name);
 53: 
 54:         if (is_string($id) && !empty($id)) {
 55:             $this->updateAttribute('id', $id);
 56:         }
 57: 
 58:         $this->_tag = 'input';
 59: 
 60:         $this->setClass($class);
 61:         $this->setDisabled($disabled);
 62:         $this->setTabindex($tabindex);
 63:         $this->setAccessKey($accesskey);
 64: 
 65:     }
 66: 
 67:     /**
 68:      * Sets the "disabled" attribute of an element.
 69:      * User Agents
 70:      * usually are showing the element as "greyed-out".
 71:      *
 72:      * Example:
 73:      * $obj->setDisabled('disabled');
 74:      * $obj->setDisabled('');
 75:      *
 76:      * The first example sets the disabled flag, the second one
 77:      * removes the disabled flag.
 78:      *
 79:      * @param string $disabled
 80:      *         Sets the disabled-flag if non-empty
 81:      * @return cHTMLFormElement
 82:      *         $this for chaining
 83:      */
 84:     public function setDisabled($disabled) {
 85:         if (empty($disabled)) {
 86:             $this->removeAttribute('disabled');
 87:         } else {
 88:             $this->updateAttribute('disabled', 'disabled');
 89:         }
 90: 
 91:         return $this;
 92:     }
 93: 
 94:     /**
 95:      * Sets the tab index for this element.
 96:      * The tab
 97:      * index needs to be numeric, bigger than 0 and smaller than 32767.
 98:      *
 99:      * @param int $tabindex
100:      *         Desired tab index
101:      * @return cHTMLFormElement
102:      *         $this for chaining
103:      */
104:     public function setTabindex($tabindex) {
105:         if (is_numeric($tabindex) && $tabindex >= 0 && $tabindex <= 32767) {
106:             $this->updateAttribute('tabindex', $tabindex);
107:         }
108: 
109:         return $this;
110:     }
111: 
112:     /**
113:      * Sets the access key for this element.
114:      *
115:      * @param string $accesskey
116:      *         The length of the access key. May be A-Z and 0-9.
117:      * @return cHTMLFormElement
118:      *         $this for chaining
119:      */
120:     public function setAccessKey($accesskey) {
121:         if ((strlen($accesskey) == 1) && cString::isAlphanumeric($accesskey)) {
122:             $this->updateAttribute('accesskey', $accesskey);
123:         } else {
124:             $this->removeAttribute('accesskey');
125:         }
126: 
127:         return $this;
128:     }
129: 
130: }
131: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0