source: admin-center/trunk/fuentes/admin-center.install/usr/share/admin-center/moduleManager.php @ 2898

Last change on this file since 2898 was 2898, checked in by joamuran, 3 years ago

new release. read changelog

File size: 2.8 KB
Line 
1<?php
2if(!session_id()) session_start();
3
4$action=$_POST["action"];
5
6switch ($action) {
7  case 'getModuleInfo':
8    getModuleInfo($_POST["module"]);
9    break;
10  case 'getModuleLayout':
11    getModuleLayout($_POST["id"], $_POST["filename"], $_POST["help"], $_POST["iscomponentof"], $_POST["banner"]);
12    break;
13
14  case 'getModuleList':
15    getModuleList();
16    break;
17
18  default:
19    # code...
20    break;
21}
22
23function getModuleList(){
24  header('Content-type: application/json');
25  header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
26  header("Cache-Control: post-check=0, pre-check=0", false);
27  header("Pragma: no-cache");
28
29  $modules=array_diff(scandir("modules"), array('..', '.'));
30  echo(json_encode($modules));
31}
32
33function getModuleInfo($module){
34  header('Content-type: application/json');
35  header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
36  header("Cache-Control: post-check=0, pre-check=0", false);
37  header("Pragma: no-cache");
38
39  $moduleInfo=array();
40  $moduleInfo['info']=$_SESSION['modules'][$module];
41
42  // Reading css files list
43  $styles=array_diff(scandir("modules/$module/src/css"), array('..', '.'));
44
45
46  foreach ($styles as $key=>$value)
47    $styles[$key]="modules/$module/src/css/$value";
48
49  $moduleInfo['styles']=$styles;
50
51  // Reading js files list
52  $scripts=array_diff(scandir("modules/$module/src/js"), array('..', '.'));
53  foreach ($scripts as $key=>$value)
54    $scripts[$key]="modules/$module/src/js/$value";
55
56  $moduleInfo['scripts']=$scripts;
57
58  echo(json_encode($moduleInfo));
59}
60
61function getModuleLayout($id, $filename, $help, $iscomopnentof, $banner){
62  header('Content-type: text/html');
63  header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
64  header("Cache-Control: post-check=0, pre-check=0", false);
65  header("Pragma: no-cache");
66 
67
68  echo "<div class='moduleWindow' id='$id' banner='$banner'>";
69  if ($help) echo "<div class='adminCenterHelper' help='$help' module='$id' parent='$iscomopnentof' title='Help'>
70              <div class='adminCenterHelperQuestion'>?</div>
71              <div i18n class='adminCenterHelperDescription'>Help</div>
72                </div>";
73    require($filename);
74  echo "</div>";
75};
76
77
78//require("modules/$module/src/main.html");
79// Adding submodules
80
81
82
83/*
84function importModuleContent($modules, $components){
85
86  echo "<div class='moduleWindow' id='info' style='display: block'>";
87    require("info.php");
88  echo "</div>";
89
90  foreach ($modules as $module){
91    echo "<div class='moduleWindow' id='$module'>";
92      //require("modules/$module/src/main.html");
93      // LOADMODULE
94    echo "</div>";
95    // Loading  components in module
96    }
97
98    foreach ($components as $component){
99      echo "<div class='moduleWindow' id='$component[0]'>";
100        //require($component['1']);
101
102      echo "</div>";
103    }
104}
105*/
106?>
Note: See TracBrowser for help on using the repository browser.