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
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  1: <?php
  2: /**
  3:  * This file contains the cHTMLRadiobutton 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:  * cHTMLRadiobutton class represents a radio button.
 20:  *
 21:  * @package Core
 22:  * @subpackage GUI_HTML
 23:  */
 24: class cHTMLRadiobutton extends cHTMLFormElement {
 25: 
 26:     /**
 27:      * Values for the check box
 28:      *
 29:      * @var string
 30:      */
 31:     protected $_value;
 32: 
 33:     /**
 34:      * The text for the corresponding label
 35:      *
 36:      * @var string
 37:      */
 38:     protected $_labelText;
 39: 
 40:     /**
 41:      * Constructor.
 42:      * Creates an HTML radio button element.
 43:      *
 44:      * @param string $name Name of the element
 45:      * @param string $value Value of the radio button
 46:      * @param string $id ID of the element
 47:      * @param bool $checked Is element checked?
 48:      * @param string $disabled Item disabled flag (non-empty to set disabled)
 49:      * @param string $tabindex Tab index for form elements
 50:      * @param string $accesskey Key to access the field
 51:      * @param string $class the class of this element
 52:      */
 53:     public function __construct($name, $value, $id = '', $checked = false, $disabled = false, $tabindex = NULL, $accesskey = '', $class = '') {
 54:         parent::__construct($name, $id, $disabled, $tabindex, $accesskey);
 55:         $this->_tag = 'input';
 56:         $this->_value = $value;
 57:         $this->_contentlessTag = true;
 58: 
 59:         $this->setChecked($checked);
 60:         $this->updateAttribute('type', 'radio');
 61:         $this->updateAttribute('value', $value);
 62:         $this->setClass($class);
 63:     }
 64: 
 65:     /**
 66:      * Sets the checked flag.
 67:      *
 68:      * @param bool $checked If true, the "checked" attribute will be assigned.
 69:      * @return cHTMLRadiobutton $this
 70:      */
 71:     public function setChecked($checked) {
 72:         if ($checked == true) {
 73:             return $this->updateAttribute('checked', 'checked');
 74:         } else {
 75:             return $this->removeAttribute('checked');
 76:         }
 77:     }
 78: 
 79:     /**
 80:      * Sets a custom label text
 81:      *
 82:      * @param string $text Text to display
 83:      * @return cHTMLRadiobutton $this
 84:      */
 85:     public function setLabelText($text) {
 86:         $this->_labelText = $text;
 87: 
 88:         return $this;
 89:     }
 90: 
 91:     /**
 92:      * Renders the option element.
 93:      * Note:
 94:      *
 95:      * If this element has an ID, the value (which equals the text displayed)
 96:      * will be rendered as seperate HTML label, if not, it will be displayed
 97:      * as regular text. Displaying the value can be turned off via the
 98:      * parameter.
 99:      *
100:      * @param bool $renderlabel If true, renders a label
101:      * @return string Rendered HTML
102:      */
103:     public function toHtml($renderLabel = true) {
104:         $attributes = $this->getAttributes(true);
105: 
106:         if ($renderLabel == false) {
107:             return $this->fillSkeleton($attributes);
108:         }
109: 
110:         $id = $this->getAttribute('id');
111: 
112:         $renderedLabel = '';
113: 
114:         if ($id != '') {
115:             $label = new cHTMLLabel($this->_value, $this->getAttribute('id'));
116: 
117:             if ($this->_labelText != '') {
118:                 $label->text = $this->_labelText;
119:             }
120: 
121:             $renderedLabel = $label->toHtml();
122:         } else {
123:             $renderedLabel = $this->_value;
124:         }
125: 
126:         return $this->fillSkeleton($attributes) . $renderedLabel;
127:     }
128: 
129: }
130: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen