-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkbEntry.php
More file actions
78 lines (73 loc) · 2.81 KB
/
kbEntry.php
File metadata and controls
78 lines (73 loc) · 2.81 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
<?php
/*
* Representation of a KB Entry record deserialized from JSON.
* Created by terrywbrady at OCLC Developer House 2014.
*/
class kbEntry extends oclcData {
public $title;
public $entry_uid;
public $entry_status;
public $bkey;
public $collection_uid;
public $collection_name;
public $provider_uid;
public $provider_name;
public $oclcnum;
public $isbn;
public $publisher;
public $coverage;
public $coverage_enum;
public function __construct($json_entry) {
$this->title = $this->getJson($json_entry,'title');
$this->entry_uid = $this->getJson($json_entry,'kb:entry_uid');
$this->entry_status = $this->getJson($json_entry,'kb:entry_status');
$this->bkey = $this->getJson($json_entry,'kb:bkey');
$this->collection_uid = $this->getJson($json_entry,'kb:collection_uid');
$this->collection_name = $this->getJson($json_entry,'kb:collection_name');
$this->provider_uid = $this->getJson($json_entry,'kb:provider_uid');
$this->provider_name = $this->getJson($json_entry,'kb:provider_name');
$this->oclcnum = $this->getJson($json_entry,'kb:oclcnum');
$this->isbn = $this->getJson($json_entry,'kb:isbn');
$this->publisher = $this->getJson($json_entry,'kb:publisher');
$this->coverage = $this->getJson($json_entry,'kb:coverage');
$this->coverage_enum = $this->getJson($json_entry,'kb:coverage_enum');
}
public static function getEntries($json_entries) {
$entries = array();
foreach($json_entries as $v) {
$entry = new kbEntry($v);
$entries[$entry->entry_uid] = $entry;
}
return $entries;
}
public static function getTableHeader() {
return array(
new oclcDataAttr("title", "Title", true),
new oclcDataAttr("entry_uid", "Entry UID", true),
new oclcDataAttr("entry_status", "Entry Status"),
new oclcDataAttr("bkey", "BKey"),
new oclcDataAttr("collection_uid", "Collection UID"),
new oclcDataAttr("collection_name", "Collection Name", true),
new oclcDataAttr("provider_uid", "Provider UID"),
new oclcDataAttr("provider_name", "Provider Name", true),
new oclcDataAttr("oclcnum", "OCLC number", true),
new oclcDataAttr("isbn", "ISBN", true),
new oclcDataAttr("publisher", "Publisher", true),
new oclcDataAttr("coverage", "Coverage"),
new oclcDataAttr("coverage_enum", "Coverage Enum"),
);
}
public function getLinkOptions($key) {
if ($key == "entry_uid") {
return array("mode" => "entryUid", "uid" => "{$this->collection_uid},{$this->entry_uid}");
}
if ($key == "collection_name") {
return array("mode" => "collectionUid", "uid" => $this->collection_uid);
}
if ($key == "provider_name") {
return array("mode" => "providerUid", "uid" => $this->provider_uid);
}
return array();
}
}
?>