ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
6 include_once "./Services/Xml/classes/class.ilXmlWriter.php";
7 
9 {
10  private $exportAdvMDDefs = false;
11  private $exportUDFDefs = false;
12 
21  {
23  }
24 
30  public function setSettings($settings) {
31  $this->settings = $settings;
32  }
33 
34  public function start()
35  {
36  $this->__buildHeader();
37  $this->__buildInstallationInfo();
38  $this->xmlStartTag("Clients");
39  }
40 
41  public function addClient ($client, $add_details) {
42  if (is_object($client))
43  {
44  $this->__buildClient ($client, $add_details);
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_installation_info_4_3.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 
87  private function __buildClient($setting, $add_details) {
88  $auth_modes = ilAuthUtils::_getActiveAuthModes();
89  $auth_mode_default = strtoupper(ilAuthUtils::_getAuthModeName(array_shift($auth_modes)));
90  $auth_mode_names = array();
91  foreach ($auth_modes as $mode) {
92  $auth_mode_names[] = strtoupper(ilAuthUtils::_getAuthModeName($mode));
93  }
94  // determine skins/styles
95  $skin_styles = array();
96  include_once("./Services/Style/classes/class.ilStyleDefinition.php");
97  $styleDefinition = new ilStyleDefinition();
98  include_once("./Services/Style/classes/class.ilObjStyleSettings.php");
99  $templates = $styleDefinition->getAllTemplates();
100 
101  if (is_array($templates))
102  {
103 
104  foreach($templates as $template)
105  {
106  // get styles information of template
107  $styleDef =& new ilStyleDefinition($template["id"]);
108  $styleDef->startParsing();
109  $styles = $styleDef->getStyles();
110 
111  foreach($styles as $style)
112  {
113  if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"],$style["id"]))
114  {
115  continue;
116  }
117  $skin_styles [] = $template["id"].":".$style["id"];
118  }
119  }
120  }
121  // timezones
122  include_once('Services/Calendar/classes/class.ilTimeZone.php');
123 
124 
125  $this->xmlStartTag("Client",
126  array(
127  "inst_id" => $setting->get("inst_id"),
128  "id" => $setting->clientid,
129  "enabled" => $setting->access == 1 ? "TRUE" : "FALSE",
130  "default_lang" => $setting->language,
131 
132  ));
133 
134  if (!$add_details) {
135  $this->xmlEndTag("Client");
136  return;
137 
138  }
139 
140 
141  $this->xmlElement ("Name", null, $setting->get("inst_name"));
142  $this->xmlElement ("Description", null, $setting->description);
143  $this->xmlElement ("Institution", null, $setting->get("inst_institution"));
144 /* $this->xmlStartTag("Responsible");
145  $this->xmlElement ("Firstname", null, $setting->get("admin_firstname"));
146  $this->xmlElement ("Lastname", null, $setting->get("admin_lastname"));
147  $this->xmlElement ("Title", null, $setting->get("admin_title"));
148  $this->xmlElement ("Institution", null, $setting->get("admin_institution"));
149  $this->xmlElement ("Position", null, $setting->get("admin_position"));
150  $this->xmlElement ("Email", null, $setting->get("admin_email"));
151  $this->xmlElement ("Street ", null, $setting->get("admin_street"));
152  $this->xmlElement ("ZipCode ", null, $setting->get("admin_zipcode"));
153  $this->xmlElement ("City", null, $setting->get("admin_city"));
154  $this->xmlElement ("Country", null, $setting->get("admin_country"));
155  $this->xmlElement ("Phone", null, $setting->get("admin_phone"));
156  $this->xmlEndTag("Responsible");*/
157  $this->xmlStartTag("Settings");
158  $this->xmlElement("Setting", array("key" => "error_recipient"), $setting->get("error_recipient"));
159  $this->xmlElement("Setting", array("key" => "feedback_recipient"), $setting->get("feedback_recipient"));
160  $this->xmlElement("Setting", array("key" => "session_expiration"), $setting->session);
161  $this->xmlElement("Setting", array("key" => "soap_enabled"), $setting->get("soap_user_administration"));
162  $this->xmlElement("Setting", array("key" => "authentication_methods"), join(",", $auth_mode_names));
163  $this->xmlElement("Setting", array("key" => "authentication_default_method"), $auth_mode_default);
164  $this->xmlElement("Setting", array("key" => "skins"), join(",", $skin_styles));
165  $this->xmlElement("Setting", array("key" => "default_skin"), $setting->default_skin_style);
166  $this->xmlElement("Setting", array("key" => "default_timezone"), ilTimeZone::_getDefaultTimeZone());
167  $this->xmlElement("Setting", array("key" => "default_hits_per_page"), $setting->default_hits_per_page);
168  $this->xmlElement("Setting", array("key" => "default_show_users_online"), $setting->default_show_users_online);
169  $this->xmlEndTag("Settings");
170 
171  if ($this->exportAdvMDDefs)
172  {
173  // create advanced meta data record xml
174  include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
175  include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php';
176 
177  $record_ids = array();
179 
180  foreach($record_types as $type) {
182  foreach ($records as $record){
183  $record_ids [] = $record->getRecordId();
184  }
185  }
186  $record_ids = array_unique($record_ids);
187  $this->xmlStartTag('AdvancedMetaDataRecords');
188 
189  if (count($record_ids) > 0)
190  {
191  foreach($record_ids as $record_id)
192  {
193  $record_obj = ilAdvancedMDRecord::_getInstanceByrecordId($record_id);
194  $record_obj->toXML($this);
195  }
196  }
197  $this->xmlEndTag('AdvancedMetaDataRecords');
198  }
199 
200  if ($this->exportUDFDefs)
201  {
202  // create user defined fields record xml
203  include_once ("./Services/User/classes/class.ilUserDefinedFields.php");
204  $udf_data = & ilUserDefinedFields::_newInstance();
205  $udf_data->addToXML($this);
206  }
207 
208 
209  $this->xmlEndTag("Client");
210  }
211 
212  private function __buildInstallationInfo()
213  {
214  $this->xmlStartTag("Settings");
215  $this->xmlElement("Setting", array("key" => "default_client"), $GLOBALS['ilIliasIniFile']->readVariable("clients","default"));
216  #$this->xmlElement("Setting", array("key" => "post_max_size"), ilSoapAdministration::return_bytes(ini_get("post_max_size")));
217  #$this->xmlElement("Setting", array("key" => "upload_max_filesize"), ilSoapAdministration::return_bytes(ini_get("upload_max_filesize")));
218  $this->xmlEndTag("Settings");
219  }
220 
226  public function setExportAdvancedMetaDataDefinitions ($value) {
227  $this->exportAdvMDDefs = $value ? true : false;
228  }
229 
230 
236  public function setExportUDFDefinitions ($value)
237  {
238  $this->exportUDFDefs = $value ? true: false;
239  }
240 
241 }
242 
243 ?>