ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SAML2\XML\mdrpi\PublicationInfo Class Reference
+ Collaboration diagram for SAML2\XML\mdrpi\PublicationInfo:

Public Member Functions

 __construct (\DOMElement $xml=null)
 Create/parse a mdrpi:PublicationInfo element. More...
 
 toXML (\DOMElement $parent)
 Convert this element to XML. More...
 

Data Fields

 $publisher
 
 $creationInstant
 
 $publicationId
 
 $UsagePolicy = array()
 

Detailed Description

Definition at line 13 of file PublicationInfo.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\XML\mdrpi\PublicationInfo::__construct ( \DOMElement  $xml = null)

Create/parse a mdrpi:PublicationInfo element.

Parameters
\DOMElement | null$xmlThe XML element we should load.
Exceptions

Definition at line 51 of file PublicationInfo.php.

References $xml, SAML2\Utils\extractLocalizedStrings(), SAML2\XML\mdrpi\Common\NS_MDRPI, and SAML2\Utils\xsDateTimeToTimestamp().

52  {
53  if ($xml === null) {
54  return;
55  }
56 
57  if (!$xml->hasAttribute('publisher')) {
58  throw new \Exception('Missing required attribute "publisher" in mdrpi:PublicationInfo element.');
59  }
60  $this->publisher = $xml->getAttribute('publisher');
61 
62  if ($xml->hasAttribute('creationInstant')) {
63  $this->creationInstant = Utils::xsDateTimeToTimestamp($xml->getAttribute('creationInstant'));
64  }
65 
66  if ($xml->hasAttribute('publicationId')) {
67  $this->publicationId = $xml->getAttribute('publicationId');
68  }
69 
70  $this->UsagePolicy = Utils::extractLocalizedStrings($xml, Common::NS_MDRPI, 'UsagePolicy');
71  }
static extractLocalizedStrings(\DOMElement $parent, $namespaceURI, $localName)
Extract localized strings from a set of nodes.
Definition: Utils.php:580
$xml
Definition: metadata.php:240
static xsDateTimeToTimestamp($time)
This function converts a SAML2 timestamp on the form yyyy-mm-ddThh:mm:ss(.s+)?Z to a UNIX timestamp...
Definition: Utils.php:721
+ Here is the call graph for this function:

Member Function Documentation

◆ toXML()

SAML2\XML\mdrpi\PublicationInfo::toXML ( \DOMElement  $parent)

Convert this element to XML.

Parameters
\DOMElement$parentThe element we should append to.
Returns

Definition at line 79 of file PublicationInfo.php.

References SAML2\Utils\addStrings(), and SAML2\XML\mdrpi\Common\NS_MDRPI.

80  {
81  assert(is_string($this->publisher));
82  assert(is_int($this->creationInstant) || is_null($this->creationInstant));
83  assert(is_string($this->publicationId) || is_null($this->publicationId));
84  assert(is_array($this->UsagePolicy));
85 
86  $doc = $parent->ownerDocument;
87 
88  $e = $doc->createElementNS(Common::NS_MDRPI, 'mdrpi:PublicationInfo');
89  $parent->appendChild($e);
90 
91  $e->setAttribute('publisher', $this->publisher);
92 
93  if ($this->creationInstant !== null) {
94  $e->setAttribute('creationInstant', gmdate('Y-m-d\TH:i:s\Z', $this->creationInstant));
95  }
96 
97  if ($this->publicationId !== null) {
98  $e->setAttribute('publicationId', $this->publicationId);
99  }
100 
101  Utils::addStrings($e, Common::NS_MDRPI, 'mdrpi:UsagePolicy', true, $this->UsagePolicy);
102 
103  return $e;
104  }
static addStrings(\DOMElement $parent, $namespace, $name, $localized, array $values)
Append string elements.
Definition: Utils.php:659
+ Here is the call graph for this function:

Field Documentation

◆ $creationInstant

SAML2\XML\mdrpi\PublicationInfo::$creationInstant

Definition at line 27 of file PublicationInfo.php.

◆ $publicationId

SAML2\XML\mdrpi\PublicationInfo::$publicationId

Definition at line 34 of file PublicationInfo.php.

◆ $publisher

SAML2\XML\mdrpi\PublicationInfo::$publisher

Definition at line 20 of file PublicationInfo.php.

◆ $UsagePolicy

SAML2\XML\mdrpi\PublicationInfo::$UsagePolicy = array()

Definition at line 43 of file PublicationInfo.php.


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