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

  • cContentVersioning
  • cVersion
  • cVersionFile
  • cVersionLayout
  • cVersionModule
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the module version class.
  5:  *
  6:  * @package    Core
  7:  * @subpackage Versioning
  8:  * @author     Bilal Arslan, Timo Trautmann
  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:  * Super class for revision
 19:  *
 20:  * @package    Core
 21:  * @subpackage Versioning
 22:  */
 23: class cVersionModule extends cVersion {
 24: 
 25:     /**
 26:      * Module type.
 27:      *
 28:      * @var string
 29:      */
 30:     public $sModType;
 31: 
 32:     /**
 33:      * Constructor to create an instance of this class.
 34:      *
 35:      * Initializes class variables.
 36:      *
 37:      * @param string $iIdMod
 38:      *         The name of style file
 39:      * @param array $aCfg
 40:      * @param array $aCfgClient
 41:      * @param cDB $oDB
 42:      * @param int $iClient
 43:      * @param object $sArea
 44:      * @param object $iFrame
 45:      */
 46:     public function __construct($iIdMod, $aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame) {
 47:         // Set globals in main class
 48:         parent::__construct($aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame);
 49: 
 50:         // folder layout
 51:         $this->sType = 'module';
 52:         $this->iIdentity = $iIdMod;
 53: 
 54:         $this->prune();
 55:         $this->initRevisions();
 56:         $this->_storeModuleInformation();
 57:     }
 58: 
 59:     /**
 60:      *
 61:      */
 62:     protected function _storeModuleInformation() {
 63: 
 64:         $iIdMod = cSecurity::toInteger($this->iIdentity);
 65:         $oModule = new cApiModule($iIdMod);
 66: 
 67:         // create body node of XML file
 68:         $this->setData('Name', $oModule->getField('name'));
 69:         $this->setData('Type', $oModule->getField('type'));
 70:         $this->setData('Error', $oModule->getField('error'));
 71:         $this->setData('Description', $oModule->getField('description'));
 72:         $this->setData('Deletable', $oModule->getField('deletable'));
 73:         $this->setData('Template', $oModule->getField('template'));
 74:         $this->setData('Static', $oModule->getField('static'));
 75:         $this->setData('PackageGuid', $oModule->getField('package_guid'));
 76:         $this->setData('PackageData', $oModule->getField('package_data'));
 77: 
 78:         // retrieve module code from files
 79:         $oModuleHandler = new cModuleHandler($iIdMod);
 80:         $this->setData('CodeOutput', conHtmlSpecialChars($oModuleHandler->readOutput()));
 81:         $this->setData('CodeInput', conHtmlSpecialChars($oModuleHandler->readInput()));
 82:     }
 83: 
 84:     /**
 85:      * This function read an xml file nodes
 86:      *
 87:      * @param string $sPath
 88:      *         Path to file
 89:      * @return array
 90:      *         returns array width this four nodes
 91:      */
 92:     public function initXmlReader($sPath) {
 93:         $aResult = array();
 94:         if ($sPath != '') {
 95:             // Output this xml file
 96:             $sXML = simplexml_load_file($sPath);
 97: 
 98:             if ($sXML) {
 99:                 foreach ($sXML->body as $oBodyValues) {
100:                     // if choose xml file read value an set it
101:                     $aResult['name'] = $oBodyValues->Name;
102:                     $aResult['desc'] = $oBodyValues->Description;
103:                     $aResult['code_input'] = htmlspecialchars_decode($oBodyValues->CodeInput);
104:                     $aResult['code_output'] = htmlspecialchars_decode($oBodyValues->CodeOutput);
105:                 }
106:             }
107:         }
108: 
109:         return $aResult;
110:     }
111: 
112:     /**
113:      * Function returns javascript which refreshes CONTENIDO frames for file
114:      * list an subnavigation. This is necessary, if filenames where changed,
115:      * when a history entry is restored.
116:      *
117:      * @param string $sArea
118:      *         name of CONTENIDO area in which this procedure should be done
119:      * @param int $iIdModule
120:      *         Id of module
121:      * @param cSession $sess
122:      *         CONTENIDO session object
123:      * @return string
124:      *         Javascript for refreshing left_bottom frame
125:      */
126:     public function renderReloadScript($sArea, $iIdModule, cSession $sess) {
127:         $urlLeftBottom = $sess->url("main.php?area=$sArea&frame=2&idmod=$iIdModule");
128:         $sReloadScript = <<<JS
129: <script type="text/javascript">
130: (function(Con, $) {
131:     var frame = Con.getFrame('left_bottom');
132:     if (frame) {
133:         frame.location.href = '{$urlLeftBottom}';
134:     }
135: })(Con, Con.$);
136: </script>
137: JS;
138:         return $sReloadScript;
139:     }
140: 
141: }
142: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0