This repository has been archived by the owner on Dec 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModule_XSparrow.class.php
120 lines (93 loc) · 3.55 KB
/
Module_XSparrow.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
* \details © 2011 Open Ximdex Evolution SL [http://www.ximdex.org]
*
* Ximdex a Semantic Content Management System (CMS)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* See the Affero GNU General Public License for more details.
* You should have received a copy of the Affero GNU General Public License
* version 3 along with Ximdex (see LICENSE file).
*
* If not, visit http://gnu.org/licenses/agpl-3.0.html.
*
* @author Ximdex DevTeam <dev@ximdex.com>
* @version $Revision$
*/
ModulesManager::file('/inc/modules/Module.class.php');
ModulesManager::file('/modules/XSparrow/conf/xsparrow.conf');
ModulesManager::file('/modules/XSparrow/inc/Theme.class.php');
ModulesManager::file('/modules/XSparrow/inc/model/XSparrowProject.class.php');
ModulesManager::file('/modules/XSparrow/inc/model/XSparrowRelProjectDocs.class.php');
ModulesManager::file('/modules/XSparrow/BuildParser.class.php');
class Module_XSparrow extends Module {
function Module_XSparrow() {
// Call Module constructor.
parent::Module('XSparrow', dirname(__FILE__));
// Initialization stuff.
}
function install() {
// Install logic.
// get module from ftp, webdav, subversion, etc...?
// need to be extracted?
// extract and copy files to modules location.
// get constructor SQL
$this->loadConstructorSQL("XSparrow.constructor.sql");
$install_ret = parent::install();
//Save all projects
$arrayProjects = XSparrowProjectManager::getAllXSparrowProjects();
foreach ($arrayProjects as $version => $projectsByVersion) {
foreach ($projectsByVersion as $projectName => $projectObject) {
$xsparrowProject = new XSparrowProject();
$xsparrowProject->set("name",$projectName);
$xsparrowProject->set("version", $version);
$xsparrowProject->add();
$idProject = $xsparrowProject->get("idproject");
$servers = $projectObject->getServers();
foreach ($servers as $server) {
$arrayXimDocs = $server->getXimDocs();
foreach ($arrayXimDocs as $ximDoc) {
$relProjectDoc = new XSparrowRelProjectDocs();
$relProjectDoc->set("idproject", $idProject);
$relProjectDoc->set("doc", $ximDoc->__get("name"));
$relProjectDoc->set("description", $ximDoc->__get("description"));
$relProjectDoc->set("relaxng", $ximDoc->__get("templatename"));
$relProjectDoc->set("filepath", $ximDoc->getPath());
$relProjectDoc->add();
}
}
}
}
//Create a temp file for the templates of every projects
//It will ease the theme previews.
$this->buildTempXslForThemes();
}
/**
*For every project build a xsl file in tmp/Xsparrow/ with all the xsl definitions
*/
private function buildTempXslForThemes(){
$arrayThemes = Theme::getAllThemes();
foreach ($arrayThemes as $theme) {
$theme->buildTempResources();
$theme->project->buildCompressFile($theme->_shortname);
echo($theme->_shortname." theme installed\r\n");
}
}
function uninstall() {
// Uninstall logic.
// get destructor SQL
$this->loadDestructorSQL("XSparrow.destructor.sql");
// Uninstall !
parent::uninstall();
}
}
?>