ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilSoapInstallationInfoXMLWriter Class Reference
+ Inheritance diagram for ilSoapInstallationInfoXMLWriter:
+ Collaboration diagram for ilSoapInstallationInfoXMLWriter:

Public Member Functions

 setSettings (array $settings)
 
 start ()
 
 addClient (string $client_directory)
 
 end ()
 
 getXML ()
 
- Public Member Functions inherited from ilXmlWriter
 __construct (string $version="1.0", string $outEnc="utf-8", string $inEnc="utf-8")
 
 xmlSetDtdDef (string $dtdDef)
 Sets dtd definition. More...
 
 xmlSetGenCmt (string $genCmt)
 Sets generated comment. More...
 
 xmlFormatData (string $data)
 Indents text for better reading. More...
 
 xmlHeader ()
 Writes xml header. More...
 
 xmlStartTag (string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
 Writes a starttag. More...
 
 xmlEndTag (string $tag)
 Writes an endtag. More...
 
 xmlData (string $data, bool $encode=true, bool $escape=true)
 Writes data. More...
 
 xmlElement (string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile (string $file, bool $format=true)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem (bool $format=true)
 Returns xml document from memory. More...
 
 appendXML (string $a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr More...
 

Protected Attributes

array $settings = []
 

Private Member Functions

 buildHeader ()
 
 buildFooter ()
 
 buildClient (string $client_directory)
 
 buildInstallationInfo ()
 

Detailed Description

Definition at line 6 of file class.ilSoapInstallationInfoXMLWriter.php.

Member Function Documentation

◆ addClient()

ilSoapInstallationInfoXMLWriter::addClient ( string  $client_directory)

Definition at line 22 of file class.ilSoapInstallationInfoXMLWriter.php.

References buildClient().

22  : bool
23  {
24  return $this->buildClient($client_directory);
25  }
+ Here is the call graph for this function:

◆ buildClient()

ilSoapInstallationInfoXMLWriter::buildClient ( string  $client_directory)
private

Definition at line 59 of file class.ilSoapInstallationInfoXMLWriter.php.

References $client_id, $DIC, $ilDB, $settings, ilDBWrapperFactory\getWrapper(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by addClient().

59  : bool
60  {
61  global $DIC;
62 
63  $ini_file = "./" . $client_directory . "/client.ini.php";
64 
65  // get settings from ini file
66 
67  $ilClientIniFile = new ilIniFile($ini_file);
68  $ilClientIniFile->read();
69  if ($ilClientIniFile->ERROR !== "") {
70  return false;
71  }
72  $client_id = $ilClientIniFile->readVariable('client', 'name');
73  if ($ilClientIniFile->variableExists('client', 'expose')) {
74  $client_expose = $ilClientIniFile->readVariable('client', 'expose');
75  if ($client_expose === "0") {
76  return false;
77  }
78  }
79 
80  // build dsn of database connection and connect
82  $ilClientIniFile->readVariable("db", "type")
83  );
84  $ilDB->initFromIniFile($ilClientIniFile);
85  if ($ilDB->connect(true)) {
86  unset($DIC['ilDB']);
87  $DIC['ilDB'] = $ilDB;
88 
89 
90  $settings = new ilSetting();
91  unset($DIC["ilSetting"]);
92  $DIC["ilSetting"] = $settings;
93 
94  // workaround to determine http path of client
95  define("IL_INST_ID", (int) $settings->get("inst_id", '0'));
96 
97  $this->xmlStartTag(
98  "Client",
99  [
100  "inst_id" => $settings->get("inst_id"),
101  "id" => basename($client_directory),
102  'enabled' => $ilClientIniFile->readVariable("client", "access") ? "TRUE" : "FALSE",
103  "default_lang" => $ilClientIniFile->readVariable("language", "default")
104  ]
105  );
106  $this->xmlEndTag("Client");
107  }
108  return true;
109  }
static getWrapper(string $a_type)
xmlEndTag(string $tag)
Writes an endtag.
global $DIC
Definition: shib_login.php:25
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
$client_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFooter()

ilSoapInstallationInfoXMLWriter::buildFooter ( )
private

Definition at line 54 of file class.ilSoapInstallationInfoXMLWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by end().

54  : void
55  {
56  $this->xmlEndTag('Installation');
57  }
xmlEndTag(string $tag)
Writes an endtag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeader()

ilSoapInstallationInfoXMLWriter::buildHeader ( )
private

Definition at line 38 of file class.ilSoapInstallationInfoXMLWriter.php.

References ilSoapFunctions\buildHTTPPath(), ILIAS_VERSION, ilXmlWriter\xmlHeader(), ilXmlWriter\xmlSetDtdDef(), ilXmlWriter\xmlSetGenCmt(), and ilXmlWriter\xmlStartTag().

Referenced by start().

38  : void
39  {
40  // we have to build the http path here since this request is client independent!
41  $httpPath = ilSoapFunctions::buildHTTPPath();
42  $this->xmlSetDtdDef("<!DOCTYPE Installation PUBLIC \"-//ILIAS//DTD InstallationInfo//EN\" \"" . $httpPath . "/components/ILIAS/Export/xml/ilias_installation_info_5_3.dtd\">");
43  $this->xmlSetGenCmt("Export of ILIAS clients.");
44  $this->xmlHeader();
45  $this->xmlStartTag(
46  "Installation",
47  array(
48  "version" => ILIAS_VERSION,
49  "path" => $httpPath,
50  )
51  );
52  }
xmlSetGenCmt(string $genCmt)
Sets generated comment.
const ILIAS_VERSION
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.
xmlHeader()
Writes xml header.
static buildHTTPPath(bool $use_module_depending_path=true)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildInstallationInfo()

ilSoapInstallationInfoXMLWriter::buildInstallationInfo ( )
private

Definition at line 111 of file class.ilSoapInstallationInfoXMLWriter.php.

References $GLOBALS, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

111  : void
112  {
113  $this->xmlStartTag("Settings");
114  $this->xmlElement(
115  "Setting",
116  array("key" => "default_client"),
117  $GLOBALS['DIC']['ilIliasIniFile']->readVariable("clients", "default")
118  );
119  $this->xmlEndTag("Settings");
120  }
xmlEndTag(string $tag)
Writes an endtag.
$GLOBALS["DIC"]
Definition: wac.php:30
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end()

ilSoapInstallationInfoXMLWriter::end ( )

Definition at line 27 of file class.ilSoapInstallationInfoXMLWriter.php.

References buildFooter(), and ilXmlWriter\xmlEndTag().

27  : void
28  {
29  $this->xmlEndTag("Clients");
30  $this->buildFooter();
31  }
xmlEndTag(string $tag)
Writes an endtag.
+ Here is the call graph for this function:

◆ getXML()

ilSoapInstallationInfoXMLWriter::getXML ( )

Definition at line 33 of file class.ilSoapInstallationInfoXMLWriter.php.

References ilXmlWriter\xmlDumpMem().

33  : string
34  {
35  return $this->xmlDumpMem(false);
36  }
xmlDumpMem(bool $format=true)
Returns xml document from memory.
+ Here is the call graph for this function:

◆ setSettings()

ilSoapInstallationInfoXMLWriter::setSettings ( array  $settings)

Definition at line 10 of file class.ilSoapInstallationInfoXMLWriter.php.

References $settings, and ILIAS\Repository\settings().

+ Here is the call graph for this function:

◆ start()

ilSoapInstallationInfoXMLWriter::start ( )

Definition at line 15 of file class.ilSoapInstallationInfoXMLWriter.php.

References buildHeader(), buildInstallationInfo(), and ilXmlWriter\xmlStartTag().

15  : void
16  {
17  $this->buildHeader();
18  $this->buildInstallationInfo();
19  $this->xmlStartTag("Clients");
20  }
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
+ Here is the call graph for this function:

Field Documentation

◆ $settings

array ilSoapInstallationInfoXMLWriter::$settings = []
protected

Definition at line 8 of file class.ilSoapInstallationInfoXMLWriter.php.

Referenced by buildClient(), and setSettings().


The documentation for this class was generated from the following file: