1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16:
17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
18:
19: 20: 21: 22: 23: 24:
25: class cVersionModule extends cVersion {
26:
27: 28: 29: 30: 31:
32: public $sModType;
33:
34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45:
46: public function __construct($iIdMod, $aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame) {
47:
48: parent::__construct($aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame);
49:
50:
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:
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:
79: $oModuleHandler = new cModuleHandler($iIdMod);
80: $this->setData('CodeOutput', conHtmlSpecialChars($oModuleHandler->readOutput()));
81: $this->setData('CodeInput', conHtmlSpecialChars($oModuleHandler->readInput()));
82: }
83:
84: 85: 86: 87: 88: 89: 90: 91:
92: public function initXmlReader($sPath) {
93: $aResult = array();
94: if ($sPath != '') {
95:
96: $sXML = simplexml_load_file($sPath);
97:
98: if ($sXML) {
99: foreach ($sXML->body as $oBodyValues) {
100:
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: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 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: