-
Notifications
You must be signed in to change notification settings - Fork 11
/
PREMIS.php
64 lines (43 loc) · 1.85 KB
/
PREMIS.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Class to build PREMIS events.
*
* @author Richard Wincewicz
*/
class PREMIS {
public $identifierType = NULL;
public $identifierValue = NULL;
public $type = NULL;
public $date = NULL;
public $outcome = NULL;
public $outcomeDetail = NULL;
function __construct() {
$this->date = date("c");
}
function build() {
$premis_xml = new DOMDocument();
$event = $premis_xml->createElementNS("info:lc/xmlns/premis-v2", 'event');
$identifier = $premis_xml->createElement('eventIdentifier');
$identifier_type = $premis_xml->createElement('eventIdentifierType', $this->identifierType);
$identifier->appendChild($identifier_type);
$identifier_value = $premis_xml->createElement('eventIdentifierValue', $this->identifierValue);
$identifier->appendChild($identifier_value);
$event->appendChild($identifier);
$event_type = $premis_xml->createElement('eventType', $this->type);
$event->appendChild($event_type);
$event_date = $premis_xml->createElement('eventDateTime', $this->date);
$event->appendChild($event_date);
$outcome_information = $premis_xml->createElement('eventOutcomeInformation');
$outcome = $premis_xml->createElement('eventOutcome', $this->outcome);
$outcome_information->appendChild($outcome);
$outcome_detail = $premis_xml->createElement('eventOutcomeDetail');
$outcome_detail_note = $premis_xml->createElement('eventOutcomeDetailNote', $this->outcomeDetail);
$outcome_detail->appendChild($outcome_detail_note);
$outcome_information->appendChild($outcome_detail);
$event->appendChild($outcome_information);
$premis_xml->appendChild($event);
$event->setAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation", "info:lc/xmlns/premis-v2 http://www.loc.gov/standards/premis/premis.xsd");
return $premis_xml->saveXML();
}
}
?>