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 cHTMLButton 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:  * cHTMLButton class represents a button.
20:  *
21:  * @package Core
22:  * @subpackage GUI_HTML
23:  */
24: class cHTMLButton extends cHTMLFormElement {
25: 
26:     /**
27:      * Constructor.
28:      * Creates an HTML button.
29:      *
30:      * Creates a submit button by default, can be changed
31:      * using setMode.
32:      *
33:      * @param string $name Name of the element
34:      * @param string $title Title of the button
35:      * @param string $id ID of the element
36:      * @param string $disabled Item disabled flag (non-empty to set disabled)
37:      * @param string $tabindex Tab index for form elements
38:      * @param string $accesskey Key to access the field
39:      * @param string $mode Mode of button
40:      * @param string $class the class of this element
41:      * @return void
42:      */
43:     public function __construct($name, $title = '', $id = '', $disabled = false, $tabindex = null, $accesskey = '', $mode = 'submit', $class = '') {
44:         parent::__construct($name, $id, $disabled, $tabindex, $accesskey);
45:         $this->_tag = 'input';
46:         $this->_contentlessTag = true;
47:         $this->setTitle($title);
48:         $this->setMode($mode);
49:         $this->setClass($class);
50:     }
51: 
52:     /**
53:      * Sets the title (caption) for the button
54:      *
55:      * @param string $title The title to set
56:      * @return cHTMLButton $this
57:      */
58:     public function setTitle($title) {
59:         $this->updateAttribute('value', $title);
60: 
61:         return $this;
62:     }
63: 
64:     /**
65:      * Sets the mode (submit or reset) for the button
66:      *
67:      * @param string $mode Either 'submit', 'reset' or 'image'.
68:      * @return cHTMLButton $this
69:      */
70:     public function setMode($mode) {
71:         $modes = array(
72:             'submit',
73:             'reset',
74:             'image',
75:             'button'
76:         );
77:         if (in_array($mode, $modes)) {
78:             $this->updateAttribute('type', $mode);
79:         }
80: 
81:         return $this;
82:     }
83: 
84:     /**
85:      * Set the image src if mode type is "image"
86:      *
87:      * @param string $mode Image path.
88:      * @return cHTMLButton $this
89:      */
90:     public function setImageSource($src) {
91:         $this->setMode('image');
92:         return $this->updateAttribute('src', $src);
93:     }
94: 
95: }
96: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0