ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSoapInstallationInfoXMLWriter.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
6include_once "./Services/Xml/classes/class.ilXmlWriter.php";
7
9{
10 private $exportAdvMDDefs = false;
11 private $exportUDFDefs = false;
12
21 {
22 parent::ilXmlWriter();
23 }
24
30 public function setSettings($settings) {
31 $this->settings = $settings;
32 }
33
34 public function start()
35 {
36 $this->__buildHeader();
38 $this->xmlStartTag("Clients");
39 }
40
41 public function addClient ($client) {
42 if (is_object($client))
43 {
44 $this->__buildClient ($client);
45 }
46
47 }
48
49 public function end() {
50 $this->xmlEndTag("Clients");
51 $this->__buildFooter();
52
53 }
54
55 public function getXML()
56 {
57 return $this->xmlDumpMem(FALSE);
58 }
59
60 private function __buildHeader()
61 {
62 // we have to build the http path here since this request is client independent!
63 $httpPath = ilSoapFunctions::buildHTTPPath();
64 $this->xmlSetDtdDef("<!DOCTYPE Installation PUBLIC \"-//ILIAS//DTD Group//EN\" \"".$httpPath ."/xml/ilias_client_3_10.dtd\">");
65 $this->xmlSetGenCmt("Export of ILIAS clients.");
66 $this->xmlHeader();
67 $this->xmlStartTag("Installation",
68 array (
69 "version" => ILIAS_VERSION,
70 "path" => $httpPath,
71 ));
72
73 return true;
74 }
75
76 private function __buildFooter()
77 {
78 $this->xmlEndTag('Installation');
79 }
80
86 private function __buildClient($setting)
87 {
88 // determine skins/styles
89 $skin_styles = array();
90 include_once("./Services/Style/classes/class.ilStyleDefinition.php");
91 $styleDefinition = new ilStyleDefinition();
92 include_once("./Services/Style/classes/class.ilObjStyleSettings.php");
93 $templates = $styleDefinition->getAllTemplates();
94
95 if (is_array($templates))
96 {
97
98 foreach($templates as $template)
99 {
100 // get styles information of template
101 $styleDef =& new ilStyleDefinition($template["id"]);
102 $styleDef->startParsing();
103 $styles = $styleDef->getStyles();
104
105 foreach($styles as $style)
106 {
107 if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"],$style["id"]))
108 {
109 continue;
110 }
111 $skin_styles [] = $template["id"].":".$style["id"];
112 }
113 }
114 }
115 // timezones
116 include_once('Services/Calendar/classes/class.ilTimeZone.php');
117
118
119 $this->xmlStartTag("Client",
120 array(
121 "inst_id" => $setting->get("inst_id"),
122 "id" => $setting->clientid,
123 "enabled" => $setting->access == 1 ? "TRUE" : "FALSE",
124 "default_lang" => $setting->language,
125
126 ));
127 $this->xmlEndTag("Client");
128
129 return;
130
131
132 // END here due to security reasons.
133
134
135
136 $auth_modes = ilAuthUtils::_getActiveAuthModes();
137 $auth_mode_default = strtoupper(ilAuthUtils::_getAuthModeName(array_shift($auth_modes)));
138 $auth_mode_names = array();
139 foreach ($auth_modes as $mode) {
140 $auth_mode_names[] = strtoupper(ilAuthUtils::_getAuthModeName($mode));
141 }
142
143
144 $this->xmlElement ("Name", null, $setting->get("inst_name"));
145 $this->xmlElement ("Description", null, $setting->description);
146 $this->xmlElement ("Institution", null, $setting->get("inst_institution"));
147 $this->xmlStartTag("Responsible");
148 $this->xmlElement ("Firstname", null, $setting->get("admin_firstname"));
149 $this->xmlElement ("Lastname", null, $setting->get("admin_lastname"));
150 $this->xmlElement ("Title", null, $setting->get("admin_title"));
151 $this->xmlElement ("Institution", null, $setting->get("admin_institution"));
152 $this->xmlElement ("Position", null, $setting->get("admin_position"));
153 $this->xmlElement ("Email", null, $setting->get("admin_email"));
154 $this->xmlElement ("Street ", null, $setting->get("admin_street"));
155 $this->xmlElement ("ZipCode ", null, $setting->get("admin_zipcode"));
156 $this->xmlElement ("City", null, $setting->get("admin_city"));
157 $this->xmlElement ("Country", null, $setting->get("admin_country"));
158 $this->xmlElement ("Phone", null, $setting->get("admin_phone"));
159 $this->xmlEndTag("Responsible");
160 $this->xmlStartTag("Settings");
161 $this->xmlElement("Setting", array("key" => "error_recipient"), $setting->get("error_recipient"));
162 $this->xmlElement("Setting", array("key" => "feedback_recipient"), $setting->get("feedback_recipient"));
163 $this->xmlElement("Setting", array("key" => "session_expiration"), $setting->session);
164 $this->xmlElement("Setting", array("key" => "soap_enabled"), $setting->get("soap_user_administration"));
165 $this->xmlElement("Setting", array("key" => "authentication_methods"), join(",", $auth_mode_names));
166 $this->xmlElement("Setting", array("key" => "authentication_default_method"), $auth_mode_default);
167 $this->xmlElement("Setting", array("key" => "skins"), join(",", $skin_styles));
168 $this->xmlElement("Setting", array("key" => "default_skin"), $setting->default_skin_style);
169 $this->xmlElement("Setting", array("key" => "default_timezone"), ilTimeZone::_getDefaultTimeZone());
170 $this->xmlElement("Setting", array("key" => "default_hits_per_page"), $setting->default_hits_per_page);
171 $this->xmlElement("Setting", array("key" => "default_show_users_online"), $setting->default_show_users_online);
172 $this->xmlEndTag("Settings");
173
174 if ($this->exportAdvMDDefs)
175 {
176 // create advanced meta data record xml
177 include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
178 include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php';
179
180 $record_ids = array();
182
183 foreach($record_types as $type) {
185 foreach ($records as $record){
186 $record_ids [] = $record->getRecordId();
187 }
188 }
189 $record_ids = array_unique($record_ids);
190 $this->xmlStartTag('AdvancedMetaDataRecords');
191
192 if (count($record_ids) > 0)
193 {
194 foreach($record_ids as $record_id)
195 {
196 $record_obj = ilAdvancedMDRecord::_getInstanceByrecordId($record_id);
197 $record_obj->toXML($this);
198 }
199 }
200 $this->xmlEndTag('AdvancedMetaDataRecords');
201 }
202
203 if ($this->exportUDFDefs)
204 {
205 // create user defined fields record xml
206 include_once ("./Services/User/classes/class.ilUserDefinedFields.php");
207 $udf_data = & ilUserDefinedFields::_newInstance();
208 $udf_data->addToXML($this);
209 }
210
211
212 $this->xmlEndTag("Client");
213 }
214
215 private function __buildInstallationInfo()
216 {
217 $this->xmlStartTag("Settings");
218 $this->xmlElement("Setting", array("key" => "default_client"), $GLOBALS['ilIliasIniFile']->readVariable("clients","default"));
219 #$this->xmlElement("Setting", array("key" => "post_max_size"), ilSoapAdministration::return_bytes(ini_get("post_max_size")));
220 #$this->xmlElement("Setting", array("key" => "upload_max_filesize"), ilSoapAdministration::return_bytes(ini_get("upload_max_filesize")));
221 $this->xmlEndTag("Settings");
222 }
223
229 public function setExportAdvancedMetaDataDefinitions ($value) {
230 $this->exportAdvMDDefs = $value ? true : false;
231 }
232
233
239 public function setExportUDFDefinitions ($value)
240 {
241 $this->exportUDFDefs = $value ? true: false;
242 }
243
244}
245
246?>
readVariable($a_group, $a_var_name)
reads a single variable from a group @access public
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="", $a_only_optional=false)
Get activated records by object type.
static _getAssignableObjectTypes($a_include_text=false)
Get assignable object type.
static _getAuthModeName($a_auth_key)
_lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
static buildHTTPPath()
builds http path if no client is available
setExportAdvancedMetaDataDefinitions($value)
write access, if set to true advanced meta data definitions will be exported s well
setSettings($settings)
write access to property settings
setExportUDFDefinitions($value)
write access, if set to true, user defined field definitions will be exported as well
parses the template.xml that defines all styles of the current template
static _getDefaultTimeZone()
Calculate and set default time zone.
XML writer class.
xmlEndTag($tag)
Writes an endtag.
xmlDumpMem($format=TRUE)
Returns xml document from memory.
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlHeader()
Writes xml header @access public.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
$style
Definition: example_012.php:70
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
const ILIAS_VERSION
$records
Definition: simple_test.php:17