ILIAS  release_7 Revision v7.30-3-g800a261c036
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
20 public function __construct()
21 {
23 }
24
30 public function setSettings($settings)
31 {
32 $this->settings = $settings;
33 }
34
35 public function start()
36 {
37 $this->__buildHeader();
39 $this->xmlStartTag("Clients");
40 }
41
42 public function addClient($client)
43 {
44 if (is_object($client)) {
45 $this->__buildClient($client);
46 }
47 }
48
49 public function end()
50 {
51 $this->xmlEndTag("Clients");
52 $this->__buildFooter();
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!
64 $this->xmlSetDtdDef("<!DOCTYPE Installation PUBLIC \"-//ILIAS//DTD InstallationInfo//EN\" \"" . $httpPath . "/xml/ilias_installation_info_5_3.dtd\">");
65 $this->xmlSetGenCmt("Export of ILIAS clients.");
66 $this->xmlHeader();
67 $this->xmlStartTag(
68 "Installation",
69 array(
70 "version" => ILIAS_VERSION,
71 "path" => $httpPath,
72 )
73 );
74
75 return true;
76 }
77
78 private function __buildFooter()
79 {
80 $this->xmlEndTag('Installation');
81 }
82
88 private function __buildClient($setting)
89 {
90 // determine skins/styles
91 $skin_styles = array();
92 include_once("./Services/Style/System/classes/class.ilStyleDefinition.php");
93 $skins = ilStyleDefinition::getAllSkins();
94
95 if (is_array($skins)) {
96 foreach ($skins as $skin) {
97 foreach ($skin->getStyles() as $style) {
98 include_once("./Services/Style/System/classes/class.ilSystemStyleSettings.php");
99 if (!ilSystemStyleSettings::_lookupActivatedStyle($skin->getId(), $style->getId())) {
100 continue;
101 }
102 $skin_styles [] = $skin->getId() . ":" . $style->getId();
103 }
104 }
105 }
106
107 // timezones
108 include_once('Services/Calendar/classes/class.ilTimeZone.php');
109
110
111 $this->xmlStartTag(
112 "Client",
113 array(
114 "inst_id" => $setting->get("inst_id"),
115 "id" => $setting->clientid,
116 "enabled" => $setting->access == 1 ? "TRUE" : "FALSE",
117 "default_lang" => $setting->language,
118
119 )
120 );
121 $this->xmlEndTag("Client");
122
123 return;
124
125
126 // END here due to security reasons.
127
128
129
130 $auth_modes = ilAuthUtils::_getActiveAuthModes();
131 $auth_mode_default = strtoupper(ilAuthUtils::_getAuthModeName(array_shift($auth_modes)));
132 $auth_mode_names = array();
133 foreach ($auth_modes as $mode) {
134 $auth_mode_names[] = strtoupper(ilAuthUtils::_getAuthModeName($mode));
135 }
136
137
138 $this->xmlElement("Name", null, $setting->get("inst_name"));
139 $this->xmlElement("Description", null, $setting->description);
140 $this->xmlElement("Institution", null, $setting->get("inst_institution"));
141 $this->xmlStartTag("Responsible");
142 $this->xmlElement("Firstname", null, $setting->get("admin_firstname"));
143 $this->xmlElement("Lastname", null, $setting->get("admin_lastname"));
144 $this->xmlElement("Title", null, $setting->get("admin_title"));
145 $this->xmlElement("Institution", null, $setting->get("admin_institution"));
146 $this->xmlElement("Position", null, $setting->get("admin_position"));
147 $this->xmlElement("Email", null, $setting->get("admin_email"));
148 $this->xmlElement("Street ", null, $setting->get("admin_street"));
149 $this->xmlElement("ZipCode ", null, $setting->get("admin_zipcode"));
150 $this->xmlElement("City", null, $setting->get("admin_city"));
151 $this->xmlElement("Country", null, $setting->get("admin_country"));
152 $this->xmlElement("Phone", null, $setting->get("admin_phone"));
153 $this->xmlEndTag("Responsible");
154 $this->xmlStartTag("Settings");
155 $this->xmlElement("Setting", array("key" => "error_recipient"), $setting->get("error_recipient"));
156 $this->xmlElement("Setting", array("key" => "feedback_recipient"), $setting->get("feedback_recipient"));
157 $this->xmlElement("Setting", array("key" => "session_expiration"), $setting->session);
158 $this->xmlElement("Setting", array("key" => "soap_enabled"), $setting->get("soap_user_administration"));
159 $this->xmlElement("Setting", array("key" => "authentication_methods"), join(",", $auth_mode_names));
160 $this->xmlElement("Setting", array("key" => "authentication_default_method"), $auth_mode_default);
161 $this->xmlElement("Setting", array("key" => "skins"), join(",", $skin_styles));
162 $this->xmlElement("Setting", array("key" => "default_skin"), $setting->default_skin_style);
163 $this->xmlElement("Setting", array("key" => "default_timezone"), ilTimeZone::_getDefaultTimeZone());
164 $this->xmlElement("Setting", array("key" => "default_hits_per_page"), $setting->default_hits_per_page);
165 $this->xmlElement("Setting", array("key" => "default_show_users_online"), $setting->default_show_users_online);
166 $this->xmlEndTag("Settings");
167
168 if ($this->exportAdvMDDefs) {
169 // create advanced meta data record xml
170 include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
171 include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php';
172
173 $record_ids = array();
175
176 foreach ($record_types as $type_info) {
177 $type = $type_info['obj_type'];
179 foreach ($records as $record) {
180 $record_ids [] = $record->getRecordId();
181 }
182 }
183 $record_ids = array_unique($record_ids);
184 $this->xmlStartTag('AdvancedMetaDataRecords');
185
186 if (count($record_ids) > 0) {
187 foreach ($record_ids as $record_id) {
188 $record_obj = ilAdvancedMDRecord::_getInstanceByrecordId($record_id);
189 $record_obj->toXML($this);
190 }
191 }
192 $this->xmlEndTag('AdvancedMetaDataRecords');
193 }
194
195 if ($this->exportUDFDefs) {
196 // create user defined fields record xml
197 include_once("./Services/User/classes/class.ilUserDefinedFields.php");
199 $udf_data->addToXML($this);
200 }
201
202
203 $this->xmlEndTag("Client");
204 }
205
206 private function __buildInstallationInfo()
207 {
208 $this->xmlStartTag("Settings");
209 $this->xmlElement("Setting", array("key" => "default_client"), $GLOBALS['DIC']['ilIliasIniFile']->readVariable("clients", "default"));
210 #$this->xmlElement("Setting", array("key" => "post_max_size"), ilSoapAdministration::return_bytes(ini_get("post_max_size")));
211 #$this->xmlElement("Setting", array("key" => "upload_max_filesize"), ilSoapAdministration::return_bytes(ini_get("upload_max_filesize")));
212 $this->xmlEndTag("Settings");
213 }
214
221 {
222 $this->exportAdvMDDefs = $value ? true : false;
223 }
224
225
231 public function setExportUDFDefinitions($value)
232 {
233 $this->exportUDFDefs = $value ? true: false;
234 }
235}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
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 _getActiveAuthModes()
static _getAuthModeName($a_auth_key)
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
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
static _getDefaultTimeZone()
Calculate and set default time zone.
XML writer class.
xmlEndTag($tag)
Writes an endtag.
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlDumpMem($format=true)
Returns xml document from memory.
xmlHeader()
Writes xml header @access public.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
if($_SERVER['argc']< 4) $client
Definition: cron.php:12
const ILIAS_VERSION
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$type
settings()
Definition: settings.php:2