1: <?php
  2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14: 
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18:  19:  20:  21:  22:  23: 
 24: class cVersionModule extends cVersion {
 25: 
 26:      27:  28: 
 29:     public $sModType;
 30: 
 31:      32:  33:  34:  35:  36:  37:  38:  39:  40:  41: 
 42:     public function __construct($iIdMod, $aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame) {
 43:         
 44:         parent::__construct($aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame);
 45: 
 46:         
 47:         $this->sType = 'module';
 48: 
 49:         $this->iIdentity = $iIdMod;
 50: 
 51:         $this->prune();
 52: 
 53:         $this->initRevisions();
 54: 
 55:         $this->_storeModuleInformation();
 56:     }
 57: 
 58:     protected function _storeModuleInformation() {
 59:         $iIdMod = cSecurity::toInteger($this->iIdentity);
 60: 
 61:         $oModule = new cApiModule($iIdMod);
 62: 
 63:         
 64:         $this->setData('Name', $oModule->getField('name'));
 65:         $this->setData('Type', $oModule->getField('type'));
 66:         $this->setData('Error', $oModule->getField('error'));
 67:         $this->setData('Description', $oModule->getField('description'));
 68:         $this->setData('Deletable', $oModule->getField('deletable'));
 69:         $this->setData('Template', $oModule->getField('template'));
 70:         $this->setData('Static', $oModule->getField('static'));
 71:         $this->setData('PackageGuid', $oModule->getField('package_guid'));
 72:         $this->setData('PackageData', $oModule->getField('package_data'));
 73: 
 74:         
 75:         $oModuleHandler = new cModuleHandler($iIdMod);
 76:         $this->setData('CodeOutput', conHtmlSpecialChars($oModuleHandler->readOutput()));
 77:         $this->setData('CodeInput', conHtmlSpecialChars($oModuleHandler->readInput()));
 78:     }
 79: 
 80:      81:  82:  83:  84:  85:  86: 
 87:     public function initXmlReader($sPath) {
 88:         $aResult = array();
 89:         if ($sPath != '') {
 90:             
 91:             $sXML = simplexml_load_file($sPath);
 92: 
 93:             if ($sXML) {
 94:                 foreach ($sXML->body as $oBodyValues) {
 95:                     
 96:                     $aResult['name'] = $oBodyValues->Name;
 97:                     $aResult['desc'] = $oBodyValues->Description;
 98:                     $aResult['code_input'] = htmlspecialchars_decode($oBodyValues->CodeInput);
 99:                     $aResult['code_output'] = htmlspecialchars_decode($oBodyValues->CodeOutput);
100:                 }
101:             }
102:         }
103: 
104:         return $aResult;
105:     }
106: 
107:     108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 
121:     public function renderReloadScript($sArea, $iIdModule, $sess) {
122:         $urlLeftBottom = $sess->url("main.php?area=$sArea&frame=2&idmod=$iIdModule");
123:         $sReloadScript = <<<JS
124: <script type="text/javascript">
125: (function(Con, $) {
126:     var frame = Con.getFrame('left_bottom');
127:     if (frame) {
128:         frame.location.href = '{$urlLeftBottom}';
129:     }
130: })(Con, Con.$);
131: </script>
132: JS;
133:         return $sReloadScript;
134:     }
135: 
136: }
137: