KT_cmis_atom_responseFeed.inc.php
3.17 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
include_once(KT_ATOM_LIB_FOLDER.'KT_atom_responseFeed.inc.php');
class KT_cmis_atom_responseFeed extends KT_atom_responseFeed {
// override and extend as needed
public $workspace = null;
public function __construct($baseURI = NULL, $title = NULL, $link = NULL, $updated = NULL, $author = NULL, $id = NULL)
{
$queryArray = split('/', trim($_SERVER['QUERY_STRING'], '/'));
$this->workspace = strtolower(trim($queryArray[0]));
$this->id = $id;
$this->title = $title;
parent::__construct($baseURI, $title, $link, $updated, $author, $id);
}
protected function constructHeader()
{
$feed = $this->newElement('feed');
// $feed->appendChild($this->newAttr('xmlns','http://www.w3.org/2007/app'));
// $feed->appendChild($this->newAttr('xmlns:atom','http://www.w3.org/2005/Atom'));
$feed->appendChild($this->newAttr('xmlns','http://www.w3.org/2005/Atom'));
$feed->appendChild($this->newAttr('xmlns:cmis','http://docs.oasis-open.org/ns/cmis/core/200901'));
$this->feed = &$feed;
if (!is_null($this->id))
{
$this->newId($this->id, $this->feed);
}
$link = $this->newElement('link');
$link->appendChild($this->newAttr('rel','self'));
$link->appendChild($this->newAttr('href', $this->baseURI . trim($_SERVER['QUERY_STRING'], '/')));
$feed->appendChild($link);
if (!is_null($this->title))
{
$this->feed->appendChild($this->newElement('title', $this->title));
}
$this->DOM->appendChild($this->feed);
}
public function &newId($id, $entry = null)
{
$id = $this->newElement('id', $id);
if(isset($entry))$entry->appendChild($id);
return $id;
}
public function &newField($name = NULL, $value = NULL, &$entry = NULL)
{
$append = false;
if(func_num_args() > 3)
{
$append = ((func_get_arg(3) === true) ? true : false);
}
$field = $this->newElement($name, $value);
if (isset($entry)) $entry->appendChild($field);
else if ($append) $this->feed->appendChild($field);
return $field;
}
function appendChild($element)
{
$this->feed->appendChild($element);
}
/*
public function &newEntry()
{
$entry = $this->newElement('entry');
$this->feed->appendChild($entry);
return $entry;
}
public function &newId($id, $entry = null)
{
$id = $this->newElement('id', $id);
if(isset($entry))$entry->appendChild($id);
return $id;
}
public function &newField($name = NULL, $value = NULL, &$entry = NULL)
{
$append = false;
if(func_num_args() > 3)
{
$append = ((func_get_arg(3) === true) ? true : false);
}
$field = $this->newElement('cmis:' . $name,$value);
if (isset($entry)) $entry->appendChild($field);
else if ($append) $this->feed->appendChild($field);
return $field;
}
*/
}
class KT_cmis_atom_ResponseFeed_GET extends KT_cmis_atom_responseFeed{}
class KT_cmis_atom_ResponseFeed_PUT extends KT_cmis_atom_responseFeed{}
class KT_cmis_atom_ResponseFeed_POST extends KT_cmis_atom_responseFeed{}
class KT_cmis_atom_ResponseFeed_DELETE extends KT_cmis_atom_responseFeed{}
?>