Open Journal Systems  3.3.0
workspace.php
1 <?php
2 
3 require_once('collection.php');
4 require_once("utils.php");
5 
6 class Workspace {
7 
8  // The title of the workspace
10 
11  // Collections in the workspace
13 
14  // Construct a new workspace by passing in a title
15  function __construct($sac_newworkspacetitle) {
16  // Store the title
17  $this->sac_workspacetitle = $sac_newworkspacetitle;
18  }
19 
20  // Build the collection hierarchy
21  function buildhierarchy($sac_colls, $sac_ns) {
22  // Build the collections
23  foreach ($sac_colls as $sac_collection) {
24  // Create the new collection object
25  $sac_newcollection = new Collection(sac_clean($sac_collection->children($sac_ns['atom'])->title));
26 
27  // The location of the service document
28  $href = $sac_collection->xpath("@href");
29  $sac_newcollection->sac_href = $href[0]['href'];
30 
31  // An array of the accepted deposit types
32  foreach ($sac_collection->accept as $sac_accept) {
33  if ($sac_accept->attributes()->alternate == 'multipart-related') {
34  $sac_newcollection->sac_acceptalternative[] = $sac_accept;
35  } else {
36  $sac_newcollection->sac_accept[] = $sac_accept;
37  }
38  }
39 
40  // An array of the accepted packages
41  $sac_collection->registerXPathNamespace('sword', 'http://purl.org/net/sword/terms/');
42  foreach ($sac_collection->xpath("sword:acceptPackaging") as $sac_acceptpackaging) {
43  $sac_newcollection->addAcceptPackaging($sac_acceptpackaging[0]);
44  }
45 
46  // Add the collection policy
47  $sac_newcollection->sac_collpolicy = sac_clean($sac_collection->children($sac_ns['sword'])->collectionPolicy);
48 
49  // Add the collection abstract
50  // Check if dcterms is in the known namespaces. If not, might not be an abstract
51  if (array_key_exists('dcterms', $sac_ns)) {
52  $sac_newcollection->sac_abstract = sac_clean($sac_collection->children($sac_ns['dcterms'])->abstract);
53  }
54 
55  // Find out if mediation is allowed
56  if ($sac_collection->children($sac_ns['sword'])->mediation == 'true') {
57  $sac_newcollection->sac_mediation = true;
58  } else {
59  $sac_newcollection->sac_mediation = false;
60  }
61 
62  // Add a nested service document if there is one
63  $sac_newcollection->sac_service = sac_clean($sac_collection->children($sac_ns['sword'])->service);
64 
65  // Add to the collections in this workspace
66  $this->sac_collections[] = $sac_newcollection;
67  }
68  }
69 }
70 
71 ?>
Workspace\$sac_workspacetitle
$sac_workspacetitle
Definition: workspace.php:9
Workspace\buildhierarchy
buildhierarchy($sac_colls, $sac_ns)
Definition: workspace.php:21
Workspace\$sac_collections
$sac_collections
Definition: workspace.php:12
Collection
Definition: collection.php:5
Workspace
Definition: workspace.php:6
Workspace\__construct
__construct($sac_newworkspacetitle)
Definition: workspace.php:15