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 help boxes (aka tooltips).
  5:  *
  6:  * @package Core
  7:  * @subpackage GUI
  8:  * @author Mischa Holz
  9:  * @copyright four for business AG <www.4fb.de>
 10:  * @license http://www.contenido.org/license/LIZENZ.txt
 11:  * @link http://www.4fb.de
 12:  * @link http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: /**
 18:  * The class cGuiBackendHelpbox allows to render help boxes
 19:  * (aka tooltips) to be displayed anywhere on a CONTENIDO backend page.
 20:  *
 21:  * These help boxes contain a help text and may optionally contain an
 22:  * image.
 23:  *
 24:  * If using this class please make sure that the atooltip.jquery.js
 25:  * and the atooltip.css are embedded in the pages template.
 26:  *
 27:  * @package Core
 28:  * @subpackage GUI
 29:  */
 30: class cGuiBackendHelpbox {
 31: 
 32:     /**
 33:      * Text that will be displayed in the help box.
 34:      *
 35:      * @var string
 36:      */
 37:     protected $helpText;
 38: 
 39:     /**
 40:      * URL of the image that will appear in the help box.
 41:      *
 42:      * @var string
 43:      */
 44:     protected $imageURL;
 45: 
 46:     /**
 47:      * Constructor to create an instance of this class.
 48:      *
 49:      * Create a new backend help box containing a help text and an
 50:      * optional image URL.
 51:      *
 52:      * @param string $helpText
 53:      *         the text that will appear in the help box
 54:      * @param string $imageURL [optional]
 55:      *         This image will be used for the help box
 56:      */
 57:     public function __construct($helpText, $imageURL = '') {
 58:         $this->setHelpText($helpText);
 59:         $this->setImageURL($imageURL);
 60:     }
 61: 
 62:     /**
 63:      * Set the help text to a new value.
 64:      *
 65:      * @param string $helpText
 66:      *         the text that will appear in the help box
 67:      */
 68:     public function setHelpText($helpText) {
 69:         $this->helpText = $helpText;
 70:     }
 71: 
 72:     /**
 73:      * Set the image for the help box.
 74:      *
 75:      * @param string $imageURL
 76:      *         the image file
 77:      */
 78:     public function setImageURL($imageURL) {
 79:         $this->imageURL = $imageURL;
 80:     }
 81: 
 82:     /**
 83:      * Render the help box.
 84:      *
 85:      * @param string $return [optional]
 86:      *         If true the rendered markup will be returned.
 87:      *         Otherwise it will be echoed.
 88:      * @return string|NULL
 89:      *         rendered markup or NULL if it's been printed
 90:      */
 91:     public function render($return = true) {
 92:         $id = md5(rand()) . "-Info";
 93: 
 94:         $style = '';
 95:         if ($this->imageURL != '') {
 96:             $style = 'style="background: transparent url(' . $this->imageURL . ') no-repeat;"';
 97:         }
 98: 
 99:         $html = "<a " . $style . " href='javascript://' id='" . $id . "-link' title='" . i18n("More information") . "' class='i-link infoButton'></a>";
100:         $html .= "<div id='" . $id . "' style='display: none;'>" . $this->helpText . "</div>";
101: 
102:         if ($return) {
103:             return $html;
104:         } else {
105:             echo $html;
106:             return NULL;
107:         }
108:     }
109: }
110: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0