ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SupportedReportSet.php
Go to the documentation of this file.
1<?php
2
4
5use Sabre\DAV;
10
25
31 protected $reports = [];
32
43 function __construct($reports = null) {
44
45 if (!is_null($reports))
46 $this->addReport($reports);
47
48 }
49
59 function addReport($report) {
60
61 $report = (array)$report;
62
63 foreach ($report as $r) {
64
65 if (!preg_match('/^{([^}]*)}(.*)$/', $r))
66 throw new DAV\Exception('Reportname must be in clark-notation');
67
68 $this->reports[] = $r;
69
70 }
71
72 }
73
79 function getValue() {
80
81 return $this->reports;
82
83 }
84
91 function has($reportName) {
92
93 return in_array(
94 $reportName,
95 $this->reports
96 );
97
98 }
99
119 function xmlSerialize(Writer $writer) {
120
121 foreach ($this->getValue() as $val) {
122 $writer->startElement('{DAV:}supported-report');
123 $writer->startElement('{DAV:}report');
124 $writer->writeElement($val);
125 $writer->endElement();
126 $writer->endElement();
127 }
128
129 }
130
146
147 return implode(
148 ', ',
149 array_map([$html, 'xmlName'], $this->getValue())
150 );
151
152 }
153
154}
An exception for terminatinating execution or to throw for unit testing.
This class provides a few utility functions for easily generating HTML for the browser plugin.
Main Exception class.
Definition: Exception.php:18
toHtml(HtmlOutputHelper $html)
Generate html representation for this value.
getValue()
Returns the list of supported reports.
has($reportName)
Returns true or false if the property contains a specific report.
addReport($report)
Adds a report to this property.
__construct($reports=null)
Creates the property.
xmlSerialize(Writer $writer)
The xmlSerialize method is called during xml writing.
The XML Writer class.
Definition: Writer.php:31
writeElement($name, $content=null)
Write a full element tag and it's contents.
Definition: Writer.php:189
startElement($name)
Opens a new element.
Definition: Writer.php:121
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79
WebDAV properties that implement this interface are able to generate their own html output for the br...
Definition: HtmlOutput.php:16
Objects implementing XmlSerializable can control how they are represented in Xml.