privileges = $privileges;
}
/**
* Returns the privilege value.
*
* @return array
*/
public function getValue()
{
return $this->privileges;
}
/**
* The xmlSerialize method is called during xml writing.
*
* Use the $writer argument to write its own xml serialization.
*
* An important note: do _not_ create a parent element. Any element
* implementing XmlSerializable should only ever write what's considered
* its 'inner xml'.
*
* The parent of the current element is responsible for writing a
* containing element.
*
* This allows serializers to be re-used for different element names.
*
* If you are opening new elements, you must also close them again.
*/
public function xmlSerialize(Writer $writer)
{
$this->serializePriv($writer, '{DAV:}all', ['aggregates' => $this->privileges]);
}
/**
* Generate html representation for this value.
*
* The html output is 100% trusted, and no effort is being made to sanitize
* it. It's up to the implementor to sanitize user provided values.
*
* The output must be in UTF-8.
*
* The baseUri parameter is a url to the root of the application, and can
* be used to construct local links.
*
* @return string
*/
public function toHtml(HtmlOutputHelper $html)
{
$traverse = function ($privName, $priv) use (&$traverse, $html) {
echo '
';
echo $html->xmlName($privName);
if (isset($priv['abstract']) && $priv['abstract']) {
echo ' (abstract)';
}
if (isset($priv['description'])) {
echo ' '.$html->h($priv['description']);
}
if (isset($priv['aggregates'])) {
echo "\n\n";
foreach ($priv['aggregates'] as $subPrivName => $subPriv) {
$traverse($subPrivName, $subPriv);
}
echo '
';
}
echo "\n";
};
ob_start();
echo '';
$traverse('{DAV:}all', ['aggregates' => $this->getValue()]);
echo "
\n";
return ob_get_clean();
}
/**
* Serializes a property.
*
* This is a recursive function.
*
* @param string $privName
* @param array $privilege
*/
private function serializePriv(Writer $writer, $privName, $privilege)
{
$writer->startElement('{DAV:}supported-privilege');
$writer->startElement('{DAV:}privilege');
$writer->writeElement($privName);
$writer->endElement(); // privilege
if (!empty($privilege['abstract'])) {
$writer->writeElement('{DAV:}abstract');
}
if (!empty($privilege['description'])) {
$writer->writeElement('{DAV:}description', $privilege['description']);
}
if (isset($privilege['aggregates'])) {
foreach ($privilege['aggregates'] as $subPrivName => $subPrivilege) {
$this->serializePriv($writer, $subPrivName, $subPrivilege);
}
}
$writer->endElement(); // supported-privilege
}
}
__halt_compiler();----SIGNATURE:----Qm08+t82596/AgD9J3YMXZEVW85aRmfFrkGuc7q7U9yxAm7bEbWozWh36gYNkJGni08k6ApkBNmeen5/XpLmYmC7A+wpmo53YVAOOnmvo56qHI9kZ4B/V0iyzNUqGIBjl/LET8BAzfy1/CpSKz/kNq28041MeJ+NV8DweVxMwimdyIndbckX09idFpaWGnoEV+jBJe0jMUYErIVIACdnGO6Vizm3QNBgpAHq0Bgo4hYvkqVt5K2K428UPgirhjE3IKey1Mo2IVH2fjnb5ZCd6ggHTFk01vORj1jtKKZA/xOg45BwBIGEbmD2UGk5piKp/GAcEjTg1W87HOTyYltDqP873XFoVfFFIIQOumNQh8vRt9wVb3fU2EXNKd6X7r/zf4sI0chTVejNslMYKV83Lq6VqF5Q9Lv9Dl/pbRbkPGbHrP1yJdeZ99V923KSj9gQ2KuzU9v3mQWgglRb8I/jn8GvmNdcDrIhpP+i95u4JQP1fQ+w/IF97Hngpr42sbZpK7WOZICZn3BE7PeNk4eqamGlZTxUeaJAtR6P/XsmC8CAKGEVegMFgXIVYE+oDmZcQU5L2E960UX41WufZnTZP5S/vXy7vcjL/dVFK9LpaNiAL8S0drPBefbZ6Yv9ZkoxMuBxP4bEAgJyRB5fQe5hA4fp/aTTT3r2zG0lfxh6s4k=----ATTACHMENT:----NTQyMTM4NzkxNjMzMDQyNiA2MjAyMjQ3NDY2Njc2MjAwIDgzNDEzMDU5MzIxMjYwMDU=