1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Bibliography Theming functions.
|
5
|
*
|
6
|
* @copyright
|
7
|
* (C) 2007-2012 EDIT
|
8
|
* European Distributed Institute of Taxonomy
|
9
|
* http://www.e-taxonomy.eu
|
10
|
*
|
11
|
* The contents of this module are subject to the Mozilla
|
12
|
* Public License Version 1.1.
|
13
|
* @see http://www.mozilla.org/MPL/MPL-1.1.html
|
14
|
*/
|
15
|
|
16
|
/**
|
17
|
* Returns html for a bibliography.
|
18
|
*
|
19
|
* Used in the Palmae portal.
|
20
|
*
|
21
|
* @param array $variables
|
22
|
* An associative array containing:
|
23
|
* - descriptionElementsBibliography: the elements to theme for bibliography.
|
24
|
*
|
25
|
* @ingroup themeable
|
26
|
*/
|
27
|
function theme_cdm_descriptionElementBibliography($variables) {
|
28
|
$descriptionElementsBibliography = $variables['descriptionElementsBibliography'];
|
29
|
|
30
|
$listOfReferences = array ();
|
31
|
// $useDescriptions = cdm_ws_get()
|
32
|
$markerTypes['markerTypes'] = UUID_MARKERTYPE_USE;
|
33
|
$useDescriptions = cdm_ws_get(CDM_WS_PORTAL_TAXON_DESCRIPTIONS, substr(strrchr($_GET["q"], '/'), 1), queryString($markerTypes));
|
34
|
// = substr(strrchr($_GET["q"], '/'), 1);
|
35
|
// $descout = print_r($useDescriptions);
|
36
|
foreach ($descriptionElementsBibliography as $descriptionElementsBiblio) {
|
37
|
foreach ($descriptionElementsBiblio as $descriptionElementBiblio) {
|
38
|
if (isset($descriptionElementBiblio->sources) && is_array($descriptionElementBiblio->sources)) {
|
39
|
foreach ($descriptionElementBiblio->sources as $source) {
|
40
|
$isAlreadySelected = FALSE;
|
41
|
if (empty($listOfReferences)) {
|
42
|
$listOfReferences[] = $source;
|
43
|
}
|
44
|
else {
|
45
|
foreach ($listOfReferences as $selectedReference) {
|
46
|
if ($selectedReference->citation->uuid == $source->citation->uuid) {
|
47
|
$isAlreadySelected = TRUE;
|
48
|
}
|
49
|
}
|
50
|
// Add the source in the list of reference/ This is to remove
|
51
|
// duplicates from the Bibliography section.
|
52
|
if (!$isAlreadySelected) {
|
53
|
$listOfReferences[] = $source;
|
54
|
}
|
55
|
}
|
56
|
}
|
57
|
}
|
58
|
}
|
59
|
}
|
60
|
|
61
|
if (!empty($useDescriptions) && is_array($useDescriptions)) {
|
62
|
foreach ($useDescriptions as $useDescription) {
|
63
|
if (is_array($useDescription->sources)) {
|
64
|
foreach ($useDescription->sources as $source) {
|
65
|
$isAlreadySelected = FALSE;
|
66
|
if (empty($listOfReferences)) {
|
67
|
$listOfReferences[] = $source;
|
68
|
}
|
69
|
else {
|
70
|
foreach ($listOfReferences as $selectedReference) {
|
71
|
if ($selectedReference->citation->uuid == $source->citation->uuid) {
|
72
|
$isAlreadySelected = TRUE;
|
73
|
}
|
74
|
}
|
75
|
if (!$isAlreadySelected) {
|
76
|
$listOfReferences[] = $source;
|
77
|
}
|
78
|
}
|
79
|
}
|
80
|
}
|
81
|
}
|
82
|
}
|
83
|
|
84
|
// Call the reference formatting function, it will do the heavy lifting.
|
85
|
$out = formatReference_for_Bibliography($listOfReferences);
|
86
|
return $out;
|
87
|
}
|
88
|
|
89
|
/**
|
90
|
* Formats a reference.
|
91
|
* Comment @WA @todo use ' instead of " where possible.
|
92
|
*
|
93
|
* Used by theme_cdm_descriptionElementBibliography.
|
94
|
*/
|
95
|
function formatReference_for_Bibliography($references) {
|
96
|
$out = '<div id="block-cdm_dataportal-feature-discussion"><a name="bibliography"> </a><H2>Bibliography</H2><div class="content"> <ul class="description">';
|
97
|
$outTemp = array ();
|
98
|
foreach ($references as $reference) {
|
99
|
$referenceString = '';
|
100
|
$isAuthorEmpty = false;
|
101
|
$isTitleEmpty = false;
|
102
|
$isDateEmpty = false;
|
103
|
$isPublisherEmpty = false;
|
104
|
switch ($reference->citation->type) {
|
105
|
case "Journal":
|
106
|
$referenceString .= "<li class=\"descriptionText DescriptionElement\">";
|
107
|
$numberOfTeamMembers = count($reference->citation->authorTeam->teamMembers);
|
108
|
$currentRecord = 1;
|
109
|
if (!empty($reference->citation->authorTeam->teamMembers)) {
|
110
|
foreach ($reference->citation->authorTeam->teamMembers as $teamMember) {
|
111
|
if (!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
|
112
|
if ($currentRecord == 1) {
|
113
|
$referenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
|
114
|
}
|
115
|
elseif ($numberOfTeamMembers != $currentRecord) {
|
116
|
$referenceString .= " , " . $teamMember->lastname . ", " . $teamMember->firstname;
|
117
|
}
|
118
|
else {
|
119
|
$referenceString .= " & " . $teamMember->lastname . ", " . $teamMember->firstname;
|
120
|
$referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? ' ' : ". ");
|
121
|
}
|
122
|
$currentRecord += 1;
|
123
|
}
|
124
|
else {
|
125
|
if ($numberOfTeamMembers != $currentRecord) {
|
126
|
$referenceString .= $teamMember->titleCache . " & ";
|
127
|
}
|
128
|
else {
|
129
|
$referenceString .= $teamMember->titleCache;
|
130
|
$referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? ' ' : ". ");
|
131
|
}
|
132
|
$currentRecord += 1;
|
133
|
}
|
134
|
}
|
135
|
}
|
136
|
else if (!empty($reference->citation->authorTeam->titleCache) && $reference->citation->authorTeam->titleCache != "-empty team-") {
|
137
|
$referenceString .= $reference->citation->authorTeam->titleCache;
|
138
|
$referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? " " : ". ");
|
139
|
}
|
140
|
else {
|
141
|
$isAuthorEmpty = true;
|
142
|
}
|
143
|
/*
|
144
|
else {
|
145
|
$referenceString .= $teamMember->lastname . ", " . $teamMember->firstname . " ";
|
146
|
}
|
147
|
*/
|
148
|
if (!empty($reference->citation->datePublished->start)) {
|
149
|
$referenceString .= substr($reference->citation->datePublished->start, 0, 4);
|
150
|
$referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
|
151
|
}
|
152
|
else {
|
153
|
$isDateEmpty = true;
|
154
|
}
|
155
|
if (!empty($reference->citation->title)) {
|
156
|
$referenceString .= $reference->citation->title;
|
157
|
$referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
|
158
|
} else {
|
159
|
$isTitleEmpty = true;
|
160
|
}
|
161
|
if (!empty($reference->citation->publisher)) {
|
162
|
$referenceString .= $reference->citation->publisher;
|
163
|
$referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
|
164
|
} else {
|
165
|
$isPublisherEmpty = true;
|
166
|
}
|
167
|
if($isPublisherEmpty || $isAuthorEmpty || $isDateEmpty || $isTitleEmpty) {
|
168
|
$referenceString = $reference->citation->titleCache;
|
169
|
}
|
170
|
|
171
|
$referenceString .= "</li>";
|
172
|
break;
|
173
|
|
174
|
case "Article":
|
175
|
$referenceString .= "<li class=\"descriptionText DescriptionElement\">";
|
176
|
$stagingReferenceString = "";
|
177
|
$numberOfTeamMembers = count($reference->citation->authorTeam->teamMembers);
|
178
|
$currentRecord = 1;
|
179
|
if (!empty($reference->citation->authorTeam->teamMembers)) {
|
180
|
foreach ($reference->citation->authorTeam->teamMembers as $teamMember) {
|
181
|
if (!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
|
182
|
if ($currentRecord == 1) {
|
183
|
$stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
|
184
|
}
|
185
|
elseif ($numberOfTeamMembers != $currentRecord) {
|
186
|
$stagingReferenceString .= " , " . $teamMember->lastname . ", " . $teamMember->firstname;
|
187
|
}
|
188
|
else {
|
189
|
$stagingReferenceString .= " & " . $teamMember->lastname . ", " . $teamMember->firstname;
|
190
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? ' ' : ". ");
|
191
|
}
|
192
|
$currentRecord += 1;
|
193
|
}
|
194
|
else {
|
195
|
if ($numberOfTeamMembers != $currentRecord) {
|
196
|
$stagingReferenceString .= $teamMember->titleCache. " & ";
|
197
|
}
|
198
|
else {
|
199
|
$stagingReferenceString .= $teamMember->titleCache;
|
200
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? ' ' : ". ");
|
201
|
}
|
202
|
$currentRecord += 1;
|
203
|
}
|
204
|
}
|
205
|
}
|
206
|
else if (!empty($reference->citation->authorTeam->titleCache) && $reference->citation->authorTeam->titleCache != "-empty team-") {
|
207
|
$stagingReferenceString .= $reference->citation->authorTeam->titleCache;
|
208
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");
|
209
|
}
|
210
|
else {
|
211
|
$isAuthorEmpty = true;
|
212
|
}
|
213
|
/*
|
214
|
else {
|
215
|
$stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname . " ";
|
216
|
}
|
217
|
*/
|
218
|
if (!empty($reference->citation->datePublished->start)) {
|
219
|
$stagingReferenceString .= substr($reference->citation->datePublished->start,0,4);
|
220
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
221
|
}
|
222
|
else {
|
223
|
$isDateEmpty = true;
|
224
|
}
|
225
|
if (!empty($reference->citation->title)) {
|
226
|
$stagingReferenceString .= $reference->citation->title;
|
227
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
228
|
} else {
|
229
|
$isTitleEmpty = true;
|
230
|
}
|
231
|
if (!empty($reference->citation->publisher)) {
|
232
|
$stagingReferenceString .= $reference->citation->publisher;
|
233
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
234
|
} else {
|
235
|
$isPublisherEmpty = true;
|
236
|
}
|
237
|
if($isPublisherEmpty || $isAuthorEmpty || $isDateEmpty || $isTitleEmpty) {
|
238
|
$stagingReferenceString = $reference->citation->titleCache;
|
239
|
}
|
240
|
$referenceString .= $stagingReferenceString;
|
241
|
$referenceString .= "</li>";
|
242
|
break;
|
243
|
|
244
|
case "Book":
|
245
|
$referenceString .= "<li class=\"descriptionText DescriptionElement\">";
|
246
|
$stagingReferenceString = "";
|
247
|
$numberOfTeamMembers = count($reference->citation->authorTeam->teamMembers);
|
248
|
$currentRecord = 1;
|
249
|
if (!empty($reference->citation->authorTeam->teamMembers) && $reference->citation->authorTeam->titleCache != "-empty team-") {
|
250
|
foreach ($reference->citation->authorTeam->teamMembers as $teamMember) {
|
251
|
if(!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
|
252
|
if ($numberOfTeamMembers != $currentRecord) {
|
253
|
$stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname. " & ";
|
254
|
}
|
255
|
else {
|
256
|
$stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
|
257
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
258
|
}
|
259
|
$currentRecord += 1;
|
260
|
}
|
261
|
else {
|
262
|
if ($numberOfTeamMembers != $currentRecord) {
|
263
|
$stagingReferenceString .= $teamMember->titleCache. " & ";
|
264
|
}
|
265
|
else {
|
266
|
$stagingReferenceString .= $teamMember->titleCache;
|
267
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
268
|
}
|
269
|
$currentRecord += 1;
|
270
|
}
|
271
|
}
|
272
|
|
273
|
|
274
|
}
|
275
|
else if ($reference->citation->authorTeam->titleCache != "-empty team-"){
|
276
|
$stagingReferenceString .= $reference->citation->authorTeam->titleCache;
|
277
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
278
|
}
|
279
|
else {
|
280
|
$isAuthorEmpty = true;
|
281
|
}
|
282
|
if (!empty($reference->citation->datePublished->start)) {
|
283
|
$stagingReferenceString .= substr($reference->citation->datePublished->start,0,4);
|
284
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
285
|
}
|
286
|
else {
|
287
|
$isDateEmpty = true;
|
288
|
}
|
289
|
if (!empty($reference->citation->title)) {
|
290
|
$stagingReferenceString .= $reference->citation->title;
|
291
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
292
|
}
|
293
|
else {
|
294
|
$isTitleEmpty = true;
|
295
|
}
|
296
|
if (!empty($reference->citation->publisher)) {
|
297
|
$stagingReferenceString .= $reference->citation->publisher;
|
298
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
299
|
} else {
|
300
|
$isPublisherEmpty = true;
|
301
|
}
|
302
|
if($isPublisherEmpty || $isAuthorEmpty || $isDateEmpty || $isTitleEmpty) {
|
303
|
$stagingReferenceString = $reference->citation->titleCache;
|
304
|
}
|
305
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
306
|
$referenceString .= $stagingReferenceString;
|
307
|
$referenceString .= "</li>";
|
308
|
|
309
|
break;
|
310
|
case "BookSection":
|
311
|
$referenceString .= "<li class=\"descriptionText DescriptionElement\">";
|
312
|
$stagingReferenceString = "";
|
313
|
$numberOfTeamMembers = count($reference->citation->authorTeam->teamMembers);
|
314
|
$currentRecord = 1;
|
315
|
if (!empty($reference->citation->authorTeam->teamMembers)) {
|
316
|
foreach ($reference->citation->authorTeam->teamMembers as $teamMember) {
|
317
|
if(!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
|
318
|
if ($numberOfTeamMembers != $currentRecord) {
|
319
|
$stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname. " & ";
|
320
|
}
|
321
|
else {
|
322
|
$stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
|
323
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
324
|
}
|
325
|
$currentRecord += 1;
|
326
|
}
|
327
|
else {
|
328
|
if ($numberOfTeamMembers != $currentRecord) {
|
329
|
$stagingReferenceString .= $teamMember->titleCache. " & ";
|
330
|
}
|
331
|
else {
|
332
|
$stagingReferenceString .= $teamMember->titleCache;
|
333
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
334
|
}
|
335
|
$currentRecord += 1;
|
336
|
}
|
337
|
}
|
338
|
} else if ($reference->citation->authorTeam->titleCache != "-empty team-") {
|
339
|
$stagingReferenceString .= $reference->citation->authorTeam->titleCache;
|
340
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
341
|
} else {
|
342
|
$isAuthorEmpty = true;
|
343
|
}
|
344
|
if (!empty($reference->citation->inReference->datePublished->start)) {
|
345
|
$stagingReferenceString .= substr($reference->citation->inReference->datePublished->start,0,4);
|
346
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
347
|
} else {
|
348
|
$isDateEmpty = true;
|
349
|
}
|
350
|
if(!empty($reference->citation->title)) {
|
351
|
$stagingReferenceString .= $reference->citation->title;
|
352
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
353
|
}
|
354
|
else {
|
355
|
$isTitleEmpty = true;
|
356
|
}
|
357
|
if(!empty($reference->citation->pages)) {
|
358
|
$stagingReferenceString .= "Pages ". $reference->citation->pages;
|
359
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
360
|
}
|
361
|
$stagingReferenceString .= "In ";
|
362
|
$numberOfTeamMembersInReference = count($reference->citation->inReference->authorTeam->teamMembers);
|
363
|
$currentRecordinReference = 1;
|
364
|
if (!empty($reference->citation->inReference->authorTeam->teamMembers)) {
|
365
|
foreach ($reference->citation->inReference->authorTeam->teamMembers as $teamMember) {
|
366
|
if(!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
|
367
|
if ($numberOfTeamMembers != $currentRecord) {
|
368
|
$stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname. " & ";
|
369
|
}
|
370
|
else {
|
371
|
$stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
|
372
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
373
|
}
|
374
|
$currentRecord += 1;
|
375
|
}
|
376
|
else {
|
377
|
if ($numberOfTeamMembers != $currentRecord) {
|
378
|
$stagingReferenceString .= $teamMember->titleCache. " & ";
|
379
|
}
|
380
|
else {
|
381
|
$stagingReferenceString .= $teamMember->titleCache;
|
382
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
383
|
}
|
384
|
$currentRecord += 1;
|
385
|
}
|
386
|
}
|
387
|
} else if($reference->citation->inReference->authorTeam->teamMembers->titleCache != "-empty team-") {
|
388
|
$stagingReferenceString .= $reference->citation->inReference->authorTeam->teamMembers->titleCache;
|
389
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
390
|
} else {
|
391
|
$isAuthorEmpty = true;
|
392
|
}
|
393
|
if (!empty($reference->citation->inReference->title)) {
|
394
|
$stagingReferenceString .= $reference->citation->inReference->title;
|
395
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
396
|
} else {
|
397
|
$isTitleEmpty = true;
|
398
|
}
|
399
|
if(!empty($reference->citation->inReference->publisher)) {
|
400
|
$stagingReferenceString .= $reference->citation->inReference->placePublished;
|
401
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
402
|
} else {
|
403
|
$isPublisherEmpty = true;
|
404
|
}
|
405
|
if ($isPublisherEmpty || $isAuthorEmpty || $isDateEmpty || $isTitleEmpty) {
|
406
|
$stagingReferenceString = $reference->citation->titleCache;
|
407
|
}
|
408
|
|
409
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
|
410
|
|
411
|
$referenceString .= $stagingReferenceString . "</li>";
|
412
|
break;
|
413
|
|
414
|
|
415
|
case "WebPage" :
|
416
|
$referenceString .= "<li class=\"descriptionText DescriptionElement\">" . $reference->citation->titleCache . "</li>";
|
417
|
break;
|
418
|
case "Generic" :
|
419
|
$referenceString .= "<li class=\"descriptionText DescriptionElement\">";
|
420
|
$stagingReferenceString = "";
|
421
|
$numberOfTeamMembers = count($reference->citation->authorTeam->teamMembers);
|
422
|
$currentRecord = 1;
|
423
|
if (!empty($reference->citation->authorTeam->teamMembers)) {
|
424
|
foreach ($reference->citation->authorTeam->teamMembers as $teamMember) {
|
425
|
if(!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
|
426
|
if ($currentRecord == 1) {
|
427
|
$stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
|
428
|
}
|
429
|
else if ($numberOfTeamMembers != $currentRecord) {
|
430
|
$stagingReferenceString .= " , " . $teamMember->lastname . ", " . $teamMember->firstname;
|
431
|
}
|
432
|
else {
|
433
|
$stagingReferenceString .= " & " . $teamMember->lastname . ", " . $teamMember->firstname;
|
434
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? ' ' : ". ");
|
435
|
}
|
436
|
$currentRecord += 1;
|
437
|
}
|
438
|
else {
|
439
|
if ($numberOfTeamMembers != $currentRecord) {
|
440
|
$stagingReferenceString .= $teamMember->titleCache. " & ";
|
441
|
}
|
442
|
else {
|
443
|
$stagingReferenceString .= $teamMember->titleCache;
|
444
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? ' ' : ". ");
|
445
|
}
|
446
|
$currentRecord += 1;
|
447
|
}
|
448
|
}
|
449
|
}
|
450
|
else if(!empty($reference->citation->authorTeam->titleCache)) {
|
451
|
$stagingReferenceString .= $reference->citation->authorTeam->titleCache;
|
452
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");
|
453
|
}
|
454
|
else {
|
455
|
$isAuthorEmpty = true;
|
456
|
}
|
457
|
if(!empty($reference->citation->datePublished->start)){
|
458
|
$stagingReferenceString .= substr($reference->citation->datePublished->start,0,4);
|
459
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");
|
460
|
|
461
|
} else {
|
462
|
$isDateEmpty = true;
|
463
|
}
|
464
|
if (!empty($reference->citation->title)) {
|
465
|
$stagingReferenceString .= $reference->citation->title;
|
466
|
$stagingReferenceString .= ((str_endsWith($out, ".") || str_endsWith($out, ". ")) ? " " : ". ");
|
467
|
}
|
468
|
else {
|
469
|
$isTitleEmpty = true;
|
470
|
}
|
471
|
//TODO remove the resolution of the full title cache IF the other elements are empty
|
472
|
|
473
|
if (!empty($reference->citation->publisher)) {
|
474
|
$stagingReferenceString .= $reference->citation->publisher;
|
475
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");
|
476
|
}
|
477
|
else {
|
478
|
$isPublisherEmpty = true;
|
479
|
}
|
480
|
|
481
|
if ($isAuthorEmpty || $isTitleEmpty || $isDateEmpty || $isPublisherEmpty) {
|
482
|
$stagingReferenceString = $reference->citation->titleCache;
|
483
|
$stagingReferenceString .= ((str_endsWith($out, ".") || str_endsWith($out, ". ")) ? " " : ". ");
|
484
|
}
|
485
|
/*else {
|
486
|
$stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname . " ";
|
487
|
}*/
|
488
|
/*if (!empty($reference->citation->datePublished->start)) {
|
489
|
$stagingReferenceString .= substr($reference->citation->datePublished->start,0,4);
|
490
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");
|
491
|
}
|
492
|
$stagingReferenceString .= $reference->citation->title . ". " . $reference->citation->publisher;
|
493
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");*/
|
494
|
$stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") ) ? " " : "");
|
495
|
$referenceString .= $stagingReferenceString;
|
496
|
$referenceString .= "</li>";
|
497
|
break;
|
498
|
default:
|
499
|
|
500
|
//$author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->citation->uuid);
|
501
|
|
502
|
/*if(!empty($author_team->titleCache)) {
|
503
|
$referenceString.= print_r($reference->citation);
|
504
|
$referenceString .= '<li class="descriptionText DescriptionElement">' . "<b>" . $reference->citation->title . ":" . "</b>" . $author_team->titleCache . '</li>';
|
505
|
}
|
506
|
else {
|
507
|
$referenceString .= '<li class="descriptionText DescriptionElement">' ."<b>" . $reference->citation->titleCache . "</b>" . '</li>';
|
508
|
}
|
509
|
if ($referenceCitation){
|
510
|
$sourceRefs = $referenceCitation;
|
511
|
//$referenceString .= "[titleccache] " . $descriptionElementBiblio->feature->titleCache . "[/titlecache]";
|
512
|
//$referenceString .= "[Class] " . $descriptionElementBiblio->class . "[/class]";
|
513
|
//$referenceString .= "[sourceref]" . $sourceRefs . "[/sourceRef]";
|
514
|
}*/
|
515
|
break;
|
516
|
}
|
517
|
$outTemp[] = $referenceString;
|
518
|
}
|
519
|
sort($outTemp);
|
520
|
|
521
|
foreach ($outTemp as $refString) {
|
522
|
$out .= $refString;
|
523
|
}
|
524
|
|
525
|
$out .= "</ul></div></div>";
|
526
|
return $out;
|
527
|
}
|