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 notification GUI class.
  4:  *
  5:  * @package          Core
  6:  * @subpackage       GUI
  7:  * @version          SVN Revision $Rev:$
  8:  *
  9:  * @author           Timo Hummel
 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:  * Class for displaying notifications.
 20:  *
 21:  * Usage:
 22:  * <code>
 23:  * // render a error directly
 24:  * $oNotification = new cGuiNotification();
 25:  * $oNotification->displayNotification(
 26:  *     cGuiNotification::LEVEL_ERROR, 'Foobar does not exists'
 27:  * );
 28:  *
 29:  * // assign a notification to a variable
 30:  * $oNotification = new cGuiNotification();
 31:  * $sNotification = $oNotification->displayNotification(
 32:  *     cGuiNotification::LEVEL_NOTIFICATION, 'Hey dude, you did it!'
 33:  * );
 34:  * </code>
 35:  *
 36:  * @package    Core
 37:  * @subpackage GUI
 38:  */
 39: class cGuiNotification {
 40:     /**
 41:      * Error message level
 42:      * @var string
 43:      */
 44:     const LEVEL_ERROR = 'error';
 45: 
 46:     /**
 47:      * Warning message level
 48:      * @var string
 49:      */
 50:     const LEVEL_WARNING = 'warning';
 51: 
 52:     /**
 53:      * Info message level
 54:      * @var string
 55:      */
 56:     const LEVEL_INFO = 'info';
 57: 
 58:     /**
 59:      * Notification message level
 60:      * @var string
 61:      */
 62:     const LEVEL_NOTIFICATION = 'notification';
 63: 
 64:     /**
 65:      * HTML path to images
 66:      * @var string
 67:      */
 68:     protected $_sPathImages;
 69: 
 70:     /**
 71:      * Constructor
 72:      */
 73:     public function __construct() {
 74:         global $cfg;
 75:         $this->_sPathImages = cRegistry::getBackendUrl() . $cfg['path']['images'];
 76:     }
 77: 
 78:     /**
 79:      * Generates message box and returns it back.
 80:      *
 81:      * @param   string  $sLevel  Message level, one of cGuiNotification::LEVEL_* constants
 82:      * @param   string  $sMessage  The message to display
 83:      * @param   int     $iStyle   Flag tp use styles for display or not (feasible 1 or 0)
 84:      * @return  string
 85:      */
 86:     public function returnMessageBox($sLevel, $sMessage, $iStyle = 1) {
 87:         switch ($sLevel) {
 88:             case self::LEVEL_ERROR:
 89:                 $sHead = i18n('Error');
 90:                 $sHeadClass = 'alertbox_error';
 91:                 break;
 92:             case self::LEVEL_WARNING:
 93:                 $sHead = i18n('Warning');
 94:                 $sHeadClass = 'alertbox_warning';
 95:                 break;
 96:             case self::LEVEL_INFO:
 97:                 $sHead = i18n('Info');
 98:                 $sHeadClass = 'alertbox_info';
 99:                 $sMessage = '<span>' . $sMessage . '</span>';
100:                 break;
101:             default:
102:                 $sHead = i18n('Notification');
103:                 $sHeadClass = 'alertbox_notification';
104:                 $sMessage = '<span>' . $sMessage . '</span>';
105:                 break;
106:         }
107: 
108:         if ($iStyle == 1) {
109:             // Box on login page
110:             $sMessageBox =
111:                     '<div class="alertbox ' . $sHeadClass . '_color" id="contenido_notification">' .
112:                     '<h1 class="alertbox_head ' . $sHeadClass . '">' . $sHead . '</h1>' .
113:                     '<div class="alertbox_message">' . $sMessage . '</div>' .
114:                     '</div>';
115:         } else {
116:             // Simple box
117:             $sMessageBox =
118:                     '<div class="alertbox_line ' . $sHeadClass . '_color" id="contenido_notification">' .
119:                     '<h1 class=" alertbox_head ' . $sHeadClass . ' ' . $sHeadClass . '_color">' . $sHead . '</h1>' .
120:                     '<div class="alertbox_message ' . $sHeadClass . '_color">' . $sMessage . '</div>' .
121:                     '</div>';
122:         }
123:         return $sMessageBox;
124:     }
125: 
126:     /**
127:      * Generates message box and returns it back, uses markup with table.
128:      *
129:      * @param   string  $sLevel  Message level, one of cGuiNotification::LEVEL_* constants
130:      * @param   string  $sMessage  The message to display
131:      * @return  string
132:      */
133:     public function returnNotification($sLevel, $sMessage) {
134: 
135:         $oNotifySpan = new cHTMLSpan($sMessage);
136: 
137:         switch ($sLevel) {
138:             case self::LEVEL_ERROR:
139:                 $oNotifySpan->setClass('notify_general notify_error');
140:                 break;
141:             case self::LEVEL_WARNING:
142:                 $oNotifySpan->setClass('notify_general notify_warning');
143:                 break;
144:             case self::LEVEL_INFO:
145:                 $oNotifySpan->setClass('notify_general notify_info');
146:                 break;
147:             default:
148:                 $oNotifySpan->setClass('notify_general notify_default');
149:                 break;
150:         }
151: 
152:         $sNoti = '<div id="contenido_notification">';
153:         $sNoti .= $oNotifySpan->toHTML();
154:         $sNoti .= '</div>';
155: 
156:         return $sNoti;
157:     }
158: 
159:     /**
160:      * Displays small message box directly.
161:      *
162:      * @param   string  $sLevel  Message level, one of cGuiNotification::LEVEL_* constants
163:      * @param   string  $sMessage  The message to display
164:      */
165:     public function displayNotification($sLevel, $sMessage) {
166:         echo $this->returnNotification($sLevel, $sMessage) . '<br>';
167:     }
168: 
169:     /**
170:      * Displays large message box directly.
171:      *
172:      * @param   string  $sLevel  Message level, one of cGuiNotification::LEVEL_* constants
173:      * @param   string  $sMessage  The message to display
174:      * @param   int     $iStyle   Flag tp use styles for display or not (feasible 1 or 0)
175:      */
176:     public function displayMessageBox($sLevel, $sMessage, $iStyle = 1) {
177:         echo $this->returnMessageBox($sLevel, $sMessage, $iStyle) . '<br>';
178:     }
179: 
180: }
181: 
182: ?>
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen