1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
16:
17: 18: 19: 20: 21: 22:
23: class cVersionModule extends cVersion {
24:
25: 26: 27: 28: 29:
30: public $sModType;
31:
32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48:
49: public function __construct($iIdMod, $aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame) {
50:
51: parent::__construct($aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame);
52:
53:
54: $this->sType = 'module';
55: $this->iIdentity = $iIdMod;
56:
57: $this->prune();
58: $this->initRevisions();
59: $this->_storeModuleInformation();
60: }
61:
62: 63: 64: 65:
66: protected function _storeModuleInformation() {
67:
68: $iIdMod = cSecurity::toInteger($this->iIdentity);
69: $oModule = new cApiModule($iIdMod);
70:
71:
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:
83: $oModuleHandler = new cModuleHandler($iIdMod);
84: $this->setData('CodeOutput', conHtmlSpecialChars($oModuleHandler->readOutput()));
85: $this->setData('CodeInput', conHtmlSpecialChars($oModuleHandler->readInput()));
86: }
87:
88: 89: 90: 91: 92: 93: 94: 95:
96: public function initXmlReader($sPath) {
97: $aResult = array();
98: if ($sPath != '') {
99:
100: $sXML = simplexml_load_file($sPath);
101:
102: if ($sXML) {
103: foreach ($sXML->body as $oBodyValues) {
104:
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: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 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: