KT_atom_server.default_dms_services.inc.php
2.29 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
<?php
/**
* AtomPub Service: fulltree
*
* Returns a full tree listing starting at the root document
* Tree structure obtained by referencing parent id
*
*/
class KT_atom_service_fulltree extends KT_atom_service {
public function GET_action(){
//Create a new response feed
$feed=new KT_atom_ResponseFeed_GET(KT_APP_BASE_URI);
//Invoke the KtAPI to get detail about the referenced document
$tree=KT_atom_service_helper::getFullTree();
//Create the atom response feed
foreach($tree as $item){
$id=$item['id'];
$entry=$feed->newEntry();
$feed->newField('id',$id,$entry);
foreach($item as $property=>$value){
$feed->newField($property,$value,$entry);
}
}
//Expose the responseFeed
$this->responseFeed=$feed;
}
public function DELETE_action(){
$feed = new KT_atom_ResponseFeed_DELETE();
$this->responseFeed=$feed;
}
}
/**
* AtomPub Service: folder
*
* Returns detail on a particular folder
*
*/
class KT_atom_service_folder extends KT_atom_service {
public function GET_action(){
//Create a new response feed
$feed=new KT_atom_responseFeed(KT_APP_BASE_URI);
//Invoke the KtAPI to get detail about the referenced document
$folderDetail=KT_atom_service_helper::getFolderDetail($this->params[0]?$this->params[0]:1);
//Create the atom response feed
$entry=$feed->newEntry();
foreach($folderDetail as $property=>$value){
$feed->newField($property,$value,$entry);
}
//Expose the responseFeed
$this->responseFeed=$feed;
}
}
/**
* AtomPub Service: document
*
* Returns detail on a particular document
*
*/
class KT_atom_service_document extends KT_atom_service {
public function GET_action(){
//Create a new response feed
$feed=new KT_atom_responseFeed(KT_APP_BASE_URI);
//Invoke the KtAPI to get detail about the referenced document
$docDetail=KT_atom_service_helper::getDocumentDetail($this->params[0]);
//Create the atom response feed
$entry=$feed->newEntry();
foreach($docDetail['results'] as $property=>$value){
$feed->newField($property,$value,$entry);
}
//Add a downloaduri field manually
$feed->newField('downloaduri',urlencode(KT_APP_SYSTEM_URI.'/action.php?kt_path_info=ktcore.actions.document.view&fDocumentId='.$docDetail['results']['document_id']),$entry);
//Expose the responseFeed
$this->responseFeed=$feed;
}
}
?>