-
Notifications
You must be signed in to change notification settings - Fork 8
/
SwordStatement.inc.php
39 lines (35 loc) · 1.21 KB
/
SwordStatement.inc.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
<?php
/**
* @file SwordStatement.inc.php
*
* Copyright (c) 2014-2020 Simon Fraser University
* Copyright (c) 2003-2020 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file LICENSE.
*
* @class SwordStatement
* @ingroup plugins_gateways_swordserver
*
* @brief Sword gateway plugin
*/
class SwordStatement extends DOMDocument {
/**
* Constructor.
* @param $data array
*/
function __construct($data) {
parent::__construct();
$root = $this->createElementNS('http://www.w3.org/2005/Atom', 'feed');
$this->appendChild($root);
$root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:sword', 'http://purl.org/net/sword/terms/');
$category = $this->createElement('category', $data['state']);
$root->appendChild($category);
$category->setAttribute('scheme', "http://purl.org/net/sword/terms/state");
$category->setAttribute('term', 'statement');
$category->setAttribute('label', "Sword Statement");
$state = $this->createElement('sword:state');
$state->setAttribute('href', $data['state_href']);
$stateDescription = $this->createElement('sword:stateDescription', $data['state_description']);
$state->appendChild($stateDescription);
$root->appendChild($state);
}
}