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
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cCodeGeneratorAbstract
  • cCodeGeneratorFactory
  • cCodeGeneratorStandard
  • cContentTypeAbstract
  • cContentTypeAbstractTabbed
  • cContentTypeDate
  • cContentTypeFilelist
  • cContentTypeHead
  • cContentTypeHtml
  • cContentTypeHtmlhead
  • cContentTypeImg
  • cContentTypeImgdescr
  • cContentTypeImgeditor
  • cContentTypeLink
  • cContentTypeLinkdescr
  • cContentTypeLinkeditor
  • cContentTypeLinktarget
  • cContentTypeRaw
  • cContentTypeTeaser
  • cContentTypeText
  • cTypeGenerator
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the cContentTypeHtml class.
  5:  *
  6:  * @package Core
  7:  * @subpackage ContentType
  8:  * @author Simon Sprankel
  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:  * Content type CMS_HTML which lets the editor enter HTML with the help of a
 19:  * WYSIWYG editor.
 20:  *
 21:  * @package Core
 22:  * @subpackage ContentType
 23:  */
 24: class cContentTypeHtml extends cContentTypeAbstract {
 25: 
 26:     /**
 27:      * Constructor to create an instance of this class.
 28:      *
 29:      * Initialises class attributes and handles store events.
 30:      *
 31:      * @param string $rawSettings
 32:      *         the raw settings in an XML structure or as plaintext
 33:      * @param int $id
 34:      *         ID of the content type, e.g. 3 if CMS_DATE[3] is used
 35:      * @param array $contentTypes
 36:      *         array containing the values of all content types
 37:      */
 38:     public function __construct($rawSettings, $id, array $contentTypes) {
 39: 
 40:         // call parent constructor
 41:         parent::__construct($rawSettings, $id, $contentTypes);
 42: 
 43:         // set props
 44:         $this->_type = 'CMS_HTML';
 45:         $this->_prefix = 'html';
 46: 
 47:     }
 48: 
 49:     /**
 50:      * Generates the code which should be shown if this content type is shown in
 51:      * the frontend.
 52:      *
 53:      * @return string
 54:      *         escaped HTML code which sould be shown if content type is shown in frontend
 55:      */
 56:     public function generateViewCode() {
 57:         return $this->_encodeForOutput($this->_rawSettings);
 58:     }
 59: 
 60:     /**
 61:      * Generates the code which should be shown if this content type is edited.
 62:      *
 63:      * @return string
 64:      *         escaped HTML code which should be shown if content type is edited
 65:      * @throws cDbException
 66:      */
 67:     public function generateEditCode() {
 68:         $wysiwygDiv = new cHTMLDiv();
 69: 
 70:         // generate the div ID - format: TYPEWITHOUTCMS_TYPEID_ID
 71:         // important because it is used to save the content accordingly
 72:         $id = str_replace('CMS_', '', $this->_type) . '_';
 73:         $db = cRegistry::getDb();
 74:         $sql = 'SELECT `idtype` FROM `' . $this->_cfg['tab']['type'] . '` WHERE `type`=\'' . $this->_type . '\'';
 75:         $db->query($sql);
 76:         $db->nextRecord();
 77:         $id .= $db->f('idtype') . '_' . $this->_id;
 78:         $wysiwygDiv->setID($id);
 79:         $wysiwygDiv->setClass(htmlentities($this->_type));
 80: 
 81:         $wysiwygDiv->setEvent('Focus', "this.style.border='1px solid #bb5577';");
 82:         $wysiwygDiv->setEvent('Blur', "this.style.border='1px dashed #bfbfbf';");
 83:         $wysiwygDiv->appendStyleDefinitions(array(
 84:             'border' => '1px dashed #bfbfbf',
 85:             'direction' => langGetTextDirection($this->_lang),
 86:             'min-height' => '20px'
 87:         ));
 88:         $wysiwygDiv->updateAttribute('contentEditable', 'true');
 89:         if (cString::getStringLength($this->_rawSettings) == 0) {
 90:             $wysiwygDiv->setContent('&nbsp;');
 91:         } else {
 92:             $wysiwygDiv->setContent($this->_rawSettings);
 93:         }
 94: 
 95: 
 96:         // construct edit button
 97:         $editLink = $this->_session->url($this->_cfg['path']['contenido_fullhtml'] . 'external/backendedit/' . 'front_content.php?action=10&idcat=' . $this->_idCat . '&idart=' . $this->_idArt . '&idartlang=' . $this->_idArtLang . '&type=' . $this->_type . '&typenr=' . $this->_id. '&client=' . $this->_client);
 98:         $editAnchor = new cHTMLLink('#');
 99:         $editAnchor->setAttribute('onclick', "javascript:Con.Tiny.setContent('" . $this->_idArtLang . "','" . $editLink . "'); return false;");
100:         $editButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_edithtml.gif');
101:         $editButton->appendStyleDefinition('margin-right', '2px');
102:         $editButton->setClass('content_type_zindex');
103:         $editAnchor->setContent($editButton);
104: 
105:         // construct save button
106:         $saveAnchor = new cHTMLLink('#');
107:         $saveAnchor->setAttribute('onclick', "javascript:Con.Tiny.setContent('" . $this->_idArtLang . "', '0'); return false;");
108:         $saveButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_ok.gif');
109:         $saveAnchor->setContent($saveButton);
110: 
111:         return $this->_encodeForOutput($wysiwygDiv->render() . $editAnchor->render() . $saveAnchor->render());
112:     }
113: 
114:     /**
115:      * This content type and its derived types can be edited by a WYSIWYG editor
116:      *
117:      * @return bool
118:      */
119:     public function isWysiwygCompatible() {
120:         return true;
121:     }
122: 
123: }
124: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0