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

Classes

  • cGuiBackendHelpbox
  • cGuiFileOverview
  • cGuiFoldingRow
  • cGuiList
  • cGuiMenu
  • cGuiNavigation
  • cGuiNotification
  • cGuiObjectPager
  • cGuiPage
  • cGuiScrollList
  • cGuiSourceEditor
  • cGuiTableForm
  • cGuiTree
  • cPager
  • cTemplate
  • cTree
  • cTreeItem
  • NoteLink
  • NoteList
  • NoteListItem
  • NoteView
  • TODOLink
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * A class to render helpful information next to a form element
  5:  *
  6:  * @package Core
  7:  * @subpackage GUI
  8:  * @version SVN Revision $Rev:$
  9:  *
 10:  * @author Mischa Holz
 11:  * @copyright four for business AG <www.4fb.de>
 12:  * @license http://www.contenido.org/license/LIZENZ.txt
 13:  * @link http://www.4fb.de
 14:  * @link http://www.contenido.org
 15:  */
 16: 
 17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 18: 
 19: /**
 20:  * Class cGuilBackendHelpbox.
 21:  * Renders a little helpbox to display information next to a form element
 22:  *
 23:  * @package Core
 24:  * @subpackage GUI
 25:  */
 26: class cGuiBackendHelpbox {
 27: 
 28:     /**
 29:      * Text that will appear in the tooltip.
 30:      *
 31:      * @var string
 32:      */
 33:     protected $helpText;
 34: 
 35:     /**
 36:      *
 37:      * @var string
 38:      */
 39:     protected $imageURL;
 40: 
 41:     /**
 42:      * Basic constructor.
 43:      * Assigns a help text
 44:      *
 45:      * @param string $helpText
 46:      *         the text that will appear in the tooltip
 47:      * @param string $imageURL [optional]
 48:      *         This image will be used for the tooltip
 49:      */
 50:     public function __construct($helpText, $imageURL = '') {
 51:         $this->setHelpText($helpText);
 52:         $this->setImageURL($imageURL);
 53:     }
 54: 
 55:     /**
 56:      * Set the help text to a new value
 57:      *
 58:      * @param string $helpText
 59:      *         the text that will appear in the tooltip
 60:      */
 61:     public function setHelpText($helpText) {
 62:         $this->helpText = $helpText;
 63:     }
 64: 
 65:     /**
 66:      * Set the image for the tooltip
 67:      *
 68:      * @param string $imageURL
 69:      *         the image file
 70:      */
 71:     public function setImageURL($imageURL) {
 72:         $this->imageURL = $imageURL;
 73:     }
 74: 
 75:     /**
 76:      * Render the helpbox.
 77:      * Please make sure that the atooltip.jquery.js and the
 78:      * atooltip.css are embedded on the site
 79:      *
 80:      * @param string $returnAsString [optional]
 81:      *         if true the rendered button will be returned.
 82:      *         Otherwise it will be echoed
 83:      * @return string|NULL
 84:      *         rendered button or nothing if it's been printed
 85:      */
 86:     public function render($returnAsString = true) {
 87:         $id = md5(rand()) . "-Info";
 88: 
 89:         $style = '';
 90:         if ($this->imageURL != '') {
 91:             $style = 'style="background: transparent url(' . $this->imageURL . ') no-repeat;"';
 92:         }
 93: 
 94:         $ret = "<a " . $style . " href='javascript://' id='" . $id . "-link' title='" . i18n("More information") . "' class='i-link infoButton'></a>";
 95:         $ret .= "<div id='" . $id . "' style='display: none;'>" . $this->helpText . "</div>";
 96: 
 97:         if ($returnAsString) {
 98:             return $ret;
 99:         } else {
100:             echo ($ret);
101:             return NULL;
102:         }
103:     }
104: }
105: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0