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 cHTMLOptionElement 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:  * cHTMLOptionElement class represents a select option element.
 20:  *
 21:  * @package Core
 22:  * @subpackage GUI_HTML
 23:  */
 24: class cHTMLOptionElement extends cHTMLFormElement {
 25: 
 26:     /**
 27:      * Title to display
 28:      *
 29:      * @var string
 30:      */
 31:     protected $_title;
 32: 
 33:     /**
 34:      * Constructor.
 35:      * Creates an HTML option element.
 36:      *
 37:      * @param string $title Displayed title of the element
 38:      * @param string $value Value of the option
 39:      * @param bool $selected If true, element is selected
 40:      * @param bool $disabled If true, element is disabled
 41:      * @param string $class the class of this element
 42:      */
 43:     public function __construct($title, $value, $selected = false, $disabled = false, $class = '') {
 44:         cHTML::__construct();
 45:         $this->_tag = 'option';
 46:         $this->_title = $title;
 47: 
 48:         $this->updateAttribute('value', $value);
 49:         $this->_contentlessTag = false;
 50: 
 51:         $this->setSelected($selected);
 52:         $this->setDisabled($disabled);
 53:         $this->setClass($class);
 54:     }
 55: 
 56:     /**
 57:      * Sets the selected flag
 58:      *
 59:      * @param bool $selected If true, adds the "selected" attribute
 60:      * @return cHTMLOptionElement $this
 61:      */
 62:     public function setSelected($selected) {
 63:         if ($selected == true) {
 64:             return $this->updateAttribute('selected', 'selected');
 65:         } else {
 66:             return $this->removeAttribute('selected');
 67:         }
 68:     }
 69: 
 70:     /**
 71:      * Checks whether this option element is selected.
 72:      *
 73:      * @return bool whether this option element is selected
 74:      */
 75:     public function isSelected() {
 76:         return $this->getAttribute('selected') === 'selected';
 77:     }
 78: 
 79:     /**
 80:      * Sets the disabled flag
 81:      *
 82:      * @param bool $disabled If true, adds the "disabled" attribute
 83:      * @return cHTMLOptionElement $this
 84:      */
 85:     public function setDisabled($disabled) {
 86:         if ($disabled == true) {
 87:             return $this->updateAttribute('disabled', 'disabled');
 88:         } else {
 89:             return $this->removeAttribute('disabled');
 90:         }
 91:     }
 92: 
 93:     /**
 94:      * Renders the option element.
 95:      * Note:
 96:      * the cHTMLSelectElement renders the options by itself.
 97:      *
 98:      * @return string Rendered HTML
 99:      */
100:     public function toHtml() {
101:         $this->_setContent($this->_title);
102: 
103:         return parent::toHTML();
104:     }
105: 
106: }
107: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen