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

  • 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:      * Initialises class attributes and handles store events.
 28:      *
 29:      * @param string $rawSettings
 30:      *         the raw settings in an XML structure or as plaintext
 31:      * @param int $id
 32:      *         ID of the content type, e.g. 3 if CMS_DATE[3] is used
 33:      * @param array $contentTypes
 34:      *         array containing the values of all content types
 35:      */
 36:     public function __construct($rawSettings, $id, array $contentTypes) {
 37: 
 38:         // call parent constructor
 39:         parent::__construct($rawSettings, $id, $contentTypes);
 40: 
 41:         // set props
 42:         $this->_type = 'CMS_HTML';
 43:         $this->_prefix = 'html';
 44: 
 45:     }
 46: 
 47:     /**
 48:      * Generates the code which should be shown if this content type is shown in
 49:      * the frontend.
 50:      *
 51:      * @return string
 52:      *         escaped HTML code which sould be shown if content type is shown in frontend
 53:      */
 54:     public function generateViewCode() {
 55:         return $this->_encodeForOutput($this->_rawSettings);
 56:     }
 57: 
 58:     /**
 59:      * Generates the code which should be shown if this content type is edited.
 60:      *
 61:      * @return string
 62:      *         escaped HTML code which should be shown if content type is edited
 63:      */
 64:     public function generateEditCode() {
 65:         $wysiwygDiv = new cHTMLDiv();
 66: 
 67:         // generate the div ID - format: TYPEWITHOUTCMS_TYPEID_ID
 68:         // important because it is used to save the content accordingly
 69:         $id = str_replace('CMS_', '', $this->_type) . '_';
 70:         $db = cRegistry::getDb();
 71:         $sql = 'SELECT `idtype` FROM `' . $this->_cfg['tab']['type'] . '` WHERE `type`=\'' . $this->_type . '\'';
 72:         $db->query($sql);
 73:         $db->nextRecord();
 74:         $id .= $db->f('idtype') . '_' . $this->_id;
 75:         $wysiwygDiv->setId($id);
 76:         $wysiwygDiv->setClass(htmlentities($this->_type));
 77: 
 78:         $wysiwygDiv->setEvent('Focus', "this.style.border='1px solid #bb5577';");
 79:         $wysiwygDiv->setEvent('Blur', "this.style.border='1px dashed #bfbfbf';");
 80:         $wysiwygDiv->appendStyleDefinitions(array(
 81:             'border' => '1px dashed #bfbfbf',
 82:             'direction' => langGetTextDirection($this->_lang),
 83:             'min-height' => '20px'
 84:         ));
 85:         $wysiwygDiv->updateAttribute('contentEditable', 'true');
 86:         if (strlen($this->_rawSettings) == 0) {
 87:             $wysiwygDiv->setContent('&nbsp;');
 88:         } else {
 89:             $wysiwygDiv->setContent($this->_rawSettings);
 90:         }
 91: 
 92: 
 93:         // construct edit button
 94:         $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);
 95:         $editAnchor = new cHTMLLink('#');
 96:         $editAnchor->setAttribute('onclick', "javascript:Con.Tiny.setContent('" . $this->_idArtLang . "','" . $editLink . "'); return false;");
 97:         $editButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_edithtml.gif');
 98:         $editButton->appendStyleDefinition('margin-right', '2px');
 99:         $editButton->setClass('content_type_zindex');
100:         $editAnchor->setContent($editButton);
101: 
102:         // construct save button
103:         $saveAnchor = new cHTMLLink('#');
104:         $saveAnchor->setAttribute('onclick', "javascript:Con.Tiny.setContent('" . $this->_idArtLang . "', '0'); return false;");
105:         $saveButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_ok.gif');
106:         $saveAnchor->setContent($saveButton);
107: 
108:         return $this->_encodeForOutput($wysiwygDiv->render() . $editAnchor->render() . $saveAnchor->render());
109:     }
110: 
111:     /**
112:      * This content type and its derived types can be edited by a WYSIWYG editor
113:      *
114:      * @return bool
115:      */
116:     public function isWysiwygCompatible() {
117:         return true;
118:     }
119: 
120: }
121: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0