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: 30:
31: public $sModType;
32:
33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43:
44: public function __construct($iIdMod, $aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame) {
45:
46: parent::__construct($aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame);
47:
48:
49: $this->sType = 'module';
50:
51: $this->iIdentity = $iIdMod;
52:
53: $this->prune();
54:
55: $this->initRevisions();
56:
57: $this->_storeModuleInformation();
58: }
59:
60: protected function _storeModuleInformation() {
61: $iIdMod = cSecurity::toInteger($this->iIdentity);
62:
63: $oModule = new cApiModule($iIdMod);
64:
65:
66: $this->setData('Name', $oModule->getField('name'));
67: $this->setData('Type', $oModule->getField('type'));
68: $this->setData('Error', $oModule->getField('error'));
69: $this->setData('Description', $oModule->getField('description'));
70: $this->setData('Deletable', $oModule->getField('deletable'));
71: $this->setData('Template', $oModule->getField('template'));
72: $this->setData('Static', $oModule->getField('static'));
73: $this->setData('PackageGuid', $oModule->getField('package_guid'));
74: $this->setData('PackageData', $oModule->getField('package_data'));
75:
76:
77: $oModuleHandler = new cModuleHandler($iIdMod);
78: $this->setData('CodeOutput', conHtmlSpecialChars($oModuleHandler->readOutput()));
79: $this->setData('CodeInput', conHtmlSpecialChars($oModuleHandler->readInput()));
80: }
81:
82: 83: 84: 85: 86: 87: 88:
89: public function initXmlReader($sPath) {
90: $aResult = array();
91: if ($sPath != '') {
92:
93: $sXML = simplexml_load_file($sPath);
94:
95: if ($sXML) {
96: foreach ($sXML->body as $oBodyValues) {
97:
98: $aResult['name'] = $oBodyValues->Name;
99: $aResult['desc'] = $oBodyValues->Description;
100: $aResult['code_input'] = htmlspecialchars_decode($oBodyValues->CodeInput);
101: $aResult['code_output'] = htmlspecialchars_decode($oBodyValues->CodeOutput);
102: }
103: }
104: }
105:
106: return $aResult;
107: }
108:
109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122:
123: public function renderReloadScript($sArea, $iIdModule, $sess) {
124: $sReloadScript = "<script type=\"text/javascript\">
125: var left_bottom = top.content.left.left_bottom;
126: if (left_bottom) {
127: var href = '" . $sess->url("main.php?area=$sArea&frame=2&idmod=$iIdModule") . "';
128: left_bottom.location.href = href;
129: }
130: </script>";
131: return $sReloadScript;
132: }
133:
134: }
135: