forked from RRZE-Webteam/fau-cris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcris-generic-examples.php
98 lines (82 loc) · 2.96 KB
/
cris-generic-examples.php
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
<?php
/*
* Examples for using the generic CRIS web service access.
*/
require_once( './includes/Publikationen.php' );
include('cris-generic.php');
$publ = new CRIS_publications();
/*
* Define filter. You may pass an array or a instance of CRIS_filter to a
* CRIS_publications instance. For list of operators see class constructor.
*/
$filter = array(
// 2012-2014
"publyear__ge" => 2012,
"publyear__lt" => 2015,
// request only publications that are created at FAU
"FAU Publikation__eq" => "yes",
);
// request organisation's publications
// EAM: 140965, Inf5: 142477
$res = $publ->by_orga_id(142477, $filter);
// merge multiple organisations (e.g. chair & single professorship)
//$res = $publ->by_orga_id(array(142534, 142526), $filter);
// request publications for person
// Hornegger: 163324, Trinczek: 162826, Bodendorf: 163536
//$res = $publ->by_pers_id(162826);
// request publications of multiple distinct authors (not: get cooperations)
//$res = $publ->by_pers_id(array(162826, 163536));
// filter may be used:
//$res = $publ->by_pers_id(162826, $filter);
// direct (filter makes no sense)
//$res = $publ->by_id(36722);
// request multiple publications
//$res = $publ->by_id(array(36722, 1042922));
// For use on websites you may want to reformat the unsorted publication list.
// group by year + sort by title inside each year
//$formatter = new CRIS_formatter("publyear", SORT_ASC, "cftitle", SORT_ASC);
// group by year + sort by publication date inside each
//$formatter = new CRIS_formatter("publyear", SORT_ASC, "virtualdate", SORT_DESC);
// Grouping by user-defined list of publication types need this list *sigh*
// If any value occurs that is not listed here, it will be put at the end.
$o = array(
"journal article",
"conference contribution",
"other",
"article in edited volumes",
);
// sort inside each group by ...
// ... year
//$formatter = new CRIS_formatter("publication type", $o, "publyear", SORT_ASC);
// ... first author
$formatter = new CRIS_formatter("publication type", $o, "relauthors", SORT_ASC);
// ... title
//$formatter = new CRIS_formatter("publication type", $o, "cftitle", SORT_ASC);
$data = $formatter->execute($res);
// just displaying formatted data
foreach ($data as $group => $publs) {
printf("%s\n", $group);
foreach ($publs as $p) {
printf(
"%7d - %s %s\n",
$p->ID,
$p->attributes["publyear"],
$p->attributes["cftitle"]
);
}
}
// quotion link example
$publ = new CRIS_publications();
$res = $publ->by_id(array(36722, 1036431));
$p = $res[36722];
$p->insert_quotation_links();
print_r(array(
$p->attributes["quotationapa"], $p->attributes["quotationapalink"],
$p->attributes["quotationmla"], $p->attributes["quotationmlalink"]
));
$p = $res[1036431];
$p->insert_quotation_links();
print_r(array(
$p->attributes["quotationapa"], $p->attributes["quotationapalink"],
$p->attributes["quotationmla"], $p->attributes["quotationmlalink"]
));