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 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:      */
42:     public function __construct($name, $title = '', $id = '', $disabled = false, $tabindex = NULL, $accesskey = '', $mode = 'submit', $class = '') {
43:         parent::__construct($name, $id, $disabled, $tabindex, $accesskey);
44:         $this->_tag = 'input';
45:         $this->_contentlessTag = true;
46:         $this->setTitle($title);
47:         $this->setMode($mode);
48:         $this->setClass($class);
49:     }
50: 
51:     /**
52:      * Sets the title (caption) for the button
53:      *
54:      * @param string $title The title to set
55:      * @return cHTMLButton $this
56:      */
57:     public function setTitle($title) {
58:         $this->updateAttribute('value', $title);
59: 
60:         return $this;
61:     }
62: 
63:     /**
64:      * Sets the mode (submit or reset) for the button
65:      *
66:      * @param string $mode Either 'submit', 'reset' or 'image'.
67:      * @return cHTMLButton $this
68:      */
69:     public function setMode($mode) {
70:         $modes = array(
71:             'submit',
72:             'reset',
73:             'image',
74:             'button'
75:         );
76:         if (in_array($mode, $modes)) {
77:             $this->updateAttribute('type', $mode);
78:         }
79: 
80:         return $this;
81:     }
82: 
83:     /**
84:      * Set the image src if mode type is "image"
85:      *
86:      * @param string $mode Image path.
87:      * @return cHTMLButton $this
88:      */
89:     public function setImageSource($src) {
90:         $this->setMode('image');
91:         return $this->updateAttribute('src', $src);
92:     }
93: 
94: }
95: 
CMS CONTENIDO 4.9.4 API documentation generated by ApiGen 2.8.0