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
    • SIWECOS
    • 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:      *         CONTENIDO database object
 43:      * @param int    $iClient
 44:      * @param object $sArea
 45:      * @param int    $iFrame
 46:      *
 47:      * @throws cInvalidArgumentException
 48:      */
 49:     public function __construct($iIdMod, $aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame) {
 50:         // Set globals in main class
 51:         parent::__construct($aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame);
 52: 
 53:         // folder layout
 54:         $this->sType = 'module';
 55:         $this->iIdentity = $iIdMod;
 56: 
 57:         $this->prune();
 58:         $this->initRevisions();
 59:         $this->_storeModuleInformation();
 60:     }
 61: 
 62:     /**
 63:      *
 64:      * @throws cInvalidArgumentException
 65:      */
 66:     protected function _storeModuleInformation() {
 67: 
 68:         $iIdMod = cSecurity::toInteger($this->iIdentity);
 69:         $oModule = new cApiModule($iIdMod);
 70: 
 71:         // create body node of XML file
 72:         $this->setData('Name', $oModule->getField('name'));
 73:         $this->setData('Type', $oModule->getField('type'));
 74:         $this->setData('Error', $oModule->getField('error'));
 75:         $this->setData('Description', $oModule->getField('description'));
 76:         $this->setData('Deletable', $oModule->getField('deletable'));
 77:         $this->setData('Template', $oModule->getField('template'));
 78:         $this->setData('Static', $oModule->getField('static'));
 79:         $this->setData('PackageGuid', $oModule->getField('package_guid'));
 80:         $this->setData('PackageData', $oModule->getField('package_data'));
 81: 
 82:         // retrieve module code from files
 83:         $oModuleHandler = new cModuleHandler($iIdMod);
 84:         $this->setData('CodeOutput', conHtmlSpecialChars($oModuleHandler->readOutput()));
 85:         $this->setData('CodeInput', conHtmlSpecialChars($oModuleHandler->readInput()));
 86:     }
 87: 
 88:     /**
 89:      * This function read an xml file nodes
 90:      *
 91:      * @param string $sPath
 92:      *         Path to file
 93:      * @return array
 94:      *         returns array width this four nodes
 95:      */
 96:     public function initXmlReader($sPath) {
 97:         $aResult = array();
 98:         if ($sPath != '') {
 99:             // Output this xml file
100:             $sXML = simplexml_load_file($sPath);
101: 
102:             if ($sXML) {
103:                 foreach ($sXML->body as $oBodyValues) {
104:                     // if choose xml file read value an set it
105:                     $aResult['name'] = $oBodyValues->Name;
106:                     $aResult['desc'] = $oBodyValues->Description;
107:                     $aResult['code_input'] = htmlspecialchars_decode($oBodyValues->CodeInput);
108:                     $aResult['code_output'] = htmlspecialchars_decode($oBodyValues->CodeOutput);
109:                 }
110:             }
111:         }
112: 
113:         return $aResult;
114:     }
115: 
116:     /**
117:      * Function returns javascript which refreshes CONTENIDO frames for file
118:      * list an subnavigation. This is necessary, if filenames where changed,
119:      * when a history entry is restored.
120:      *
121:      * @param string $sArea
122:      *         name of CONTENIDO area in which this procedure should be done
123:      * @param int $iIdModule
124:      *         Id of module
125:      * @param cSession $sess
126:      *         CONTENIDO session object
127:      * @return string
128:      *         Javascript for refreshing left_bottom frame
129:      */
130:     public function renderReloadScript($sArea, $iIdModule, cSession $sess) {
131:         $urlLeftBottom = $sess->url("main.php?area=$sArea&frame=2&idmod=$iIdModule");
132:         $sReloadScript = <<<JS
133: <script type="text/javascript">
134: (function(Con, $) {
135:     var frame = Con.getFrame('left_bottom');
136:     if (frame) {
137:         frame.location.href = '{$urlLeftBottom}';
138:     }
139: })(Con, Con.$);
140: </script>
141: JS;
142:         return $sReloadScript;
143:     }
144: 
145: }
146: 
CMS CONTENIDO 4.10.1 API documentation generated by ApiGen 2.8.0