3 require_once(
'workspace.php');
35 function __construct($sac_theurl, $sac_newstatus, $sac_thexml =
'') {
37 $this->sac_url = $sac_theurl;
40 $this->sac_status = $sac_newstatus;
43 $this->sac_xml = $sac_thexml;
46 switch($this->sac_status) {
48 $this->sac_statusmessage =
"OK";
51 $this->sac_statusmessage =
"Unauthorized";
54 $this->sac_statusmessage =
"Service document not found";
57 $this->sac_statusmessage =
"Unknown error (status code " . $this->sac_status .
")";
62 if ($sac_thexml !=
'') {
63 $sac_xml = @
new SimpleXMLElement($sac_thexml);
64 $sac_ns =
$sac_xml->getNamespaces(
true);
65 if (!isset($sac_ns[
'sword'])) $sac_ns[
'sword'] =
'http://purl.org/net/sword/terms/';
66 $this->sac_version =
$sac_xml->children($sac_ns[
'sword'])->version;
67 $this->sac_verbose =
$sac_xml->children($sac_ns[
'sword'])->verbose;
68 $this->sac_noop =
$sac_xml->children($sac_ns[
'sword'])->noOp;
69 $this->sac_maxuploadsize =
$sac_xml->children($sac_ns[
'sword'])->maxUploadSize;
72 $sac_ws = @
$sac_xml->children($sac_ns[
'app'])->workspace;
73 foreach ($sac_ws as $sac_workspace) {
74 $sac_newworkspace =
new Workspace($sac_workspace->children($sac_ns[
'atom'])->title);
75 $sac_newworkspace->buildhierarchy(@$sac_workspace->children($sac_ns[
'app']), $sac_ns);
76 $this->sac_workspaces[] = $sac_newworkspace;
82 print
" - Version: " . $this->sac_version .
"\n";
83 if (!empty($this->sac_verbose)) print
" - Supports Verbose: " . $this->sac_verbose .
"\n";
84 if (!empty($this->sac_noop)) print
" - Supports NoOp: " . $this->sac_noop .
"\n";
85 print
" - Maximum uplaod size: ";
86 if (!empty($this->sac_maxuploadsize)) {
87 print $this->sac_maxuploadsize .
" kB\n";
92 foreach ($this->sac_workspaces as $workspace) {
93 $wstitle = $workspace->sac_workspacetitle;
94 echo
" - Workspace: ".$wstitle.
"\n";
95 $collections = $workspace->sac_collections;
96 foreach ($collections as $collection) {
97 $ctitle = $collection->sac_colltitle;
98 echo
" - Collection: " . $ctitle .
" (" . $collection->sac_href .
")\n";
99 if (count($collection->sac_accept) > 0) {
100 foreach ($collection->sac_accept as $accept) {
101 echo
" - Accepts: " . $accept .
"\n";
104 if (count($collection->sac_acceptalternative) > 0) {
105 foreach ($collection->sac_acceptalternative as $accept) {
106 echo
" - Accepts: " . $accept .
" alternative='multipart-related'\n";
109 if (count($collection->sac_acceptpackaging) > 0) {
110 foreach ($collection->sac_acceptpackaging as $acceptpackaging => $q) {
111 echo
" - Accepted packaging format: " . $acceptpackaging .
" (q=" . $q .
")\n";
114 if (!empty($collection->sac_collpolicy)) {
115 echo
" - Collection Policy: " . $collection->sac_collpolicy .
"\n";
117 echo
" - Collection abstract: " . $collection->sac_abstract .
"\n";
118 $mediation =
"false";
119 if ($collection->sac_mediation ==
true) { $mediation =
"true"; }
120 echo
" - Mediation: " . $mediation .
"\n";
121 if (!empty($collection->sac_service)) {
122 echo
" - Service document: " . $collection->sac_service .
"\n";