ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
CurrentUserPrivilegeSet.php
Go to the documentation of this file.
1 <?php
2 
4 
10 
22 
28  private $privileges;
29 
37  function __construct(array $privileges) {
38 
39  $this->privileges = $privileges;
40 
41  }
42 
62  function xmlSerialize(Writer $writer) {
63 
64  foreach ($this->privileges as $privName) {
65 
66  $writer->startElement('{DAV:}privilege');
67  $writer->writeElement($privName);
68  $writer->endElement();
69 
70  }
71 
72 
73  }
74 
82  function has($privilegeName) {
83 
84  return in_array($privilegeName, $this->privileges);
85 
86  }
87 
93  function getValue() {
94 
95  return $this->privileges;
96 
97  }
98 
120  static function xmlDeserialize(Reader $reader) {
121 
122  $result = [];
123 
124  $tree = $reader->parseInnerTree(['{DAV:}privilege' => 'Sabre\\Xml\\Element\\Elements']);
125  foreach ($tree as $element) {
126  if ($element['name'] !== '{DAV:}privilege') {
127  continue;
128  }
129  $result[] = $element['value'][0];
130  }
131  return new self($result);
132 
133  }
134 
150 
151  return implode(
152  ', ',
153  array_map([$html, 'xmlName'], $this->getValue())
154  );
155 
156  }
157 
158 
159 }
parseInnerTree(array $elementMap=null)
Parses all elements below the current element.
Definition: Reader.php:129
$result
static xmlDeserialize(Reader $reader)
The deserialize method is called during xml parsing.
startElement($name)
Opens a new element.
Definition: Writer.php:121
has($privilegeName)
Returns true or false, whether the specified principal appears in the list.
__construct(array $privileges)
Creates the object.
The Reader class expands upon PHP&#39;s built-in XMLReader.
Definition: Reader.php:20
WebDAV properties that implement this interface are able to generate their own html output for the br...
Definition: HtmlOutput.php:16
This is the XML element interface.
Definition: Element.php:18
toHtml(HtmlOutputHelper $html)
Generate html representation for this value.
$html
Definition: example_001.php:87
writeElement($name, $content=null)
Write a full element tag and it&#39;s contents.
Definition: Writer.php:189
xmlSerialize(Writer $writer)
The xmlSerialize method is called during xml writing.
The XML Writer class.
Definition: Writer.php:31
This class provides a few utility functions for easily generating HTML for the browser plugin...