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
    • NavigationMain
    • 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:      * @return void
 38:      */
 39:     public function __construct($name = '', $id = '', $disabled = '', $tabindex = '', $accesskey = '', $class = 'text_medium', $class = '') {
 40:         parent::__construct();
 41: 
 42:         $this->updateAttribute('name', $name);
 43: 
 44:         if (is_string($id) && !empty($id)) {
 45:             $this->updateAttribute('id', $id);
 46:         }
 47: 
 48:         $this->_tag = 'input';
 49: 
 50:         $this->setClass($class);
 51:         $this->setDisabled($disabled);
 52:         $this->setTabindex($tabindex);
 53:         $this->setAccessKey($accesskey);
 54:     }
 55: 
 56:     /**
 57:      * Sets the "disabled" attribute of an element.
 58:      * User Agents
 59:      * usually are showing the element as "greyed-out".
 60:      *
 61:      * Example:
 62:      * $obj->setDisabled('disabled');
 63:      * $obj->setDisabled('');
 64:      *
 65:      * The first example sets the disabled flag, the second one
 66:      * removes the disabled flag.
 67:      *
 68:      * @param string $disabled Sets the disabled-flag if non-empty
 69:      * @return cHTMLFormElement $this
 70:      */
 71:     public function setDisabled($disabled) {
 72:         if (empty($disabled)) {
 73:             $this->removeAttribute('disabled');
 74:         } else {
 75:             $this->updateAttribute('disabled', 'disabled');
 76:         }
 77: 
 78:         return $this;
 79:     }
 80: 
 81:     /**
 82:      * Sets the tab index for this element.
 83:      * The tab
 84:      * index needs to be numeric, bigger than 0 and smaller than 32767.
 85:      *
 86:      * @param int $tabindex Desired tab index
 87:      * @return cHTMLFormElement $this
 88:      */
 89:     public function setTabindex($tabindex) {
 90:         if (is_numeric($tabindex) && $tabindex >= 0 && $tabindex <= 32767) {
 91:             $this->updateAttribute('tabindex', $tabindex);
 92:         }
 93: 
 94:         return $this;
 95:     }
 96: 
 97:     /**
 98:      * Sets the access key for this element.
 99:      *
100:      * @param string $accesskey The length of the access key. May be A-Z and
101:      *        0-9.
102:      * @return cHTMLFormElement $this
103:      */
104:     public function setAccessKey($accesskey) {
105:         if ((strlen($accesskey) == 1) && isAlphanumeric($accesskey)) {
106:             $this->updateAttribute('accesskey', $accesskey);
107:         } else {
108:             $this->removeAttribute('accesskey');
109:         }
110: 
111:         return $this;
112:     }
113: 
114: }
115: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0