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
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SIWECOS
    • 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 cHTMLTextbox class.
  5:  *
  6:  * @package Core
  7:  * @subpackage GUI_HTML
  8:  * @author Simon Sprankel
  9:  * @copyright four for business AG <www.4fb.de>
 10:  * @license http://www.contenido.org/license/LIZENZ.txt
 11:  * @link http://www.4fb.de
 12:  * @link http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: /**
 18:  * cHTMLTextbox class represents a textbox.
 19:  *
 20:  * @package Core
 21:  * @subpackage GUI_HTML
 22:  */
 23: class cHTMLTextbox extends cHTMLFormElement {
 24: 
 25:     /**
 26:      * Constructor to create an instance of this class.
 27:      *
 28:      * Creates an HTML text box.
 29:      *
 30:      * If no additional parameters are specified, the default width is
 31:      * 20 units.
 32:      *
 33:      * @param string $name
 34:      *         Name of the element
 35:      * @param string $initvalue [optional]
 36:      *         Initial value of the box
 37:      * @param int $width [optional]
 38:      *         width of the text box
 39:      * @param int $maxlength [optional]
 40:      *         maximum input length of the box
 41:      * @param string $id [optional]
 42:      *         ID of the element
 43:      * @param string $disabled [optional]
 44:      *         Item disabled flag (non-empty to set disabled)
 45:      * @param string $tabindex [optional]
 46:      *         Tab index for form elements
 47:      * @param string $accesskey [optional]
 48:      *         Key to access the field
 49:      * @param string $class [optional]
 50:      *         the class of this element
 51:      */
 52:     public function __construct(
 53:         $name, $initvalue = '', $width = '', $maxlength = '', $id = '',
 54:         $disabled = false, $tabindex = NULL, $accesskey = '', $class = ''
 55:     ) {
 56: 
 57:         parent::__construct($name, $id, $disabled, $tabindex, $accesskey);
 58: 
 59:         $this->_tag = 'input';
 60:         $this->_contentlessTag = true;
 61:         $this->setValue($initvalue);
 62: 
 63:         $this->setWidth($width);
 64:         $this->setMaxLength($maxlength);
 65: 
 66:         $this->updateAttribute('type', 'text');
 67:         $this->setClass($class);
 68:     }
 69: 
 70:     /**
 71:      * Sets the width of the text box.
 72:      *
 73:      * @param int $width
 74:      *         width of the text box
 75:      * @return cHTMLTextbox
 76:      *         $this for chaining
 77:      */
 78:     public function setWidth($width) {
 79:         $width = intval($width);
 80: 
 81:         if ($width <= 0) {
 82:             $width = 50;
 83:         }
 84: 
 85:         return $this->updateAttribute('size', $width);
 86:     }
 87: 
 88:     /**
 89:      * Sets the maximum input length of the text box.
 90:      *
 91:      * @param int $maxlen
 92:      *         maximum input length
 93:      * @return cHTMLTextbox
 94:      *         $this for chaining
 95:      */
 96:     public function setMaxLength($maxlen) {
 97:         $maxlen = intval($maxlen);
 98: 
 99:         if ($maxlen <= 0) {
100:             return $this->removeAttribute('maxlength');
101:         } else {
102:             return $this->updateAttribute('maxlength', $maxlen);
103:         }
104:     }
105: 
106:     /**
107:      * Sets the initial value of the text box.
108:      *
109:      * @param string $value
110:      *         Initial value
111:      * @return cHTMLTextbox
112:      *         $this for chaining
113:      */
114:     public function setValue($value) {
115:         return $this->updateAttribute('value', $value);
116:     }
117: 
118: }
119: 
CMS CONTENIDO 4.10.1 API documentation generated by ApiGen 2.8.0