Project

General

Profile

« Previous | Next » 

Revision ce374c81

Added by Andreas Kohlbecker over 9 years ago

restoring cdm_dataportal.bibliography.theme from svn rev=16459 (lost changes during merge and reintegration to trunk)

View differences:

7.x/modules/cdm_dataportal/theme/cdm_dataportal.bibliography.theme
97 97
  $outTemp = array ();
98 98
  foreach ($references as $reference) {
99 99
    $referenceString = '';
100
    $isAuthorEmpty = false;
101
    $isTitleEmpty = false;
102
    $isDateEmpty = false;
103
    $isPublisherEmpty = false;
104 100
    $reference_type = isset($reference->citation->type) ? $reference->citation->type : '';
105 101
    switch ($reference_type) {
106 102
      case "Journal":
......
134 130
            }
135 131
          }
136 132
        }
137
        else if (!empty($reference->citation->authorTeam->titleCache) && $reference->citation->authorTeam->titleCache != "-empty team-") {
133
        else {
138 134
          $referenceString .= $reference->citation->authorTeam->titleCache;
139 135
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? " " : ". ");
140 136
        }
141
        else {
142
          $isAuthorEmpty = true;
143
        }
144 137
        /*
145 138
        else {
146 139
          $referenceString .= $teamMember->lastname . ", " . $teamMember->firstname . " ";
......
150 143
          $referenceString .= substr($reference->citation->datePublished->start, 0, 4);
151 144
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
152 145
        }
153
        else {
154
          $isDateEmpty = true;
155
        }
156
        if (!empty($reference->citation->title)) {
157
          $referenceString .= $reference->citation->title;
158
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
159
        } else {
160
          $isTitleEmpty = true;
161
        }
162
        if (!empty($reference->citation->publisher)) {
163
          $referenceString .= $reference->citation->publisher;
164
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
165
        } else {
166
          $isPublisherEmpty = true;
167
        }
168
        if($isPublisherEmpty || $isAuthorEmpty || $isDateEmpty || $isTitleEmpty) {
169
          $referenceString = $reference->citation->titleCache;
170
        }
171

  
146
        $referenceString .= $reference->citation->title . ". " . $reference->citation->publisher;
147
        $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
172 148
        $referenceString .= "</li>";
173 149
        break;
174 150

  
175 151
      case "Article":
176 152
        $referenceString .= "<li class=\"descriptionText DescriptionElement\">";
177
        $stagingReferenceString = "";
178 153
        $numberOfTeamMembers = 0;
179 154
        if(!empty($reference->citation->authorTeam->teamMembers)) {
180 155
          $numberOfTeamMembers = count($reference->citation->authorTeam->teamMembers);
......
184 159
          foreach ($reference->citation->authorTeam->teamMembers as $teamMember) {
185 160
            if (!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
186 161
              if ($currentRecord == 1) {
187
                $stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
162
                $referenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
188 163
              }
189 164
              elseif ($numberOfTeamMembers != $currentRecord) {
190
                $stagingReferenceString .= " , " . $teamMember->lastname . ", " . $teamMember->firstname;
165
                $referenceString .= " , " . $teamMember->lastname . ", " . $teamMember->firstname;
191 166
              }
192 167
              else {
193
                $stagingReferenceString .= " & " . $teamMember->lastname . ", " . $teamMember->firstname;
194
                $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? ' ' : ". ");
168
                $referenceString .= " & " . $teamMember->lastname . ", " . $teamMember->firstname;
169
                $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? ' ' : ". ");
195 170
              }
196 171
              $currentRecord += 1;
197 172
            }
198 173
            else {
199 174
              if ($numberOfTeamMembers != $currentRecord) {
200
                $stagingReferenceString .= $teamMember->titleCache. " & ";
175
                $referenceString .= $teamMember->titleCache . " & ";
201 176
              }
202 177
              else {
203
                $stagingReferenceString .= $teamMember->titleCache;
204
                $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? ' ' : ". ");
178
                $referenceString .= $teamMember->titleCache;
179
                $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? ' ' : ". ");
205 180
              }
206 181
              $currentRecord += 1;
207 182
            }
208 183
          }
209 184
        }
210
        else if (!empty($reference->citation->authorTeam->titleCache) && $reference->citation->authorTeam->titleCache != "-empty team-") {
211
          $stagingReferenceString .= $reference->citation->authorTeam->titleCache;
212
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");
213
        }
214 185
        else {
215
           $isAuthorEmpty = true;
186
          $referenceString .= $reference->citation->authorTeam->titleCache;
187
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? " " : ". ");
216 188
        }
217 189
        /*
218 190
        else {
219
          $stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname . " ";
191
          $referenceString .= $teamMember->lastname . ", " . $teamMember->firstname . " ";
220 192
        }
221 193
        */
222 194
        if (!empty($reference->citation->datePublished->start)) {
223
          $stagingReferenceString .= substr($reference->citation->datePublished->start,0,4);
224
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
225
        }
226
        else {
227
          $isDateEmpty = true;
195
          $referenceString .= substr($reference->citation->datePublished->start, 0, 4);
196
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
228 197
        }
229 198
        if (!empty($reference->citation->title)) {
230
          $stagingReferenceString .= $reference->citation->title;
231
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
232
        } else {
233
          $isTitleEmpty = true;
199
          $referenceString .= $reference->citation->title . ". ";
234 200
        }
235 201
        if (!empty($reference->citation->publisher)) {
236
          $stagingReferenceString .= $reference->citation->publisher;
237
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
238
        } else {
239
          $isPublisherEmpty = true;
240
        }
241
        if($isPublisherEmpty || $isAuthorEmpty || $isDateEmpty || $isTitleEmpty) {
242
          $stagingReferenceString = $reference->citation->titleCache;
202
          $referenceString .= $reference->citation->publisher;
243 203
        }
244
        $referenceString .= $stagingReferenceString;
204
        $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
245 205
        $referenceString .= "</li>";
246 206
        break;
247 207

  
248 208
      case "Book":
249 209
        $referenceString .= "<li class=\"descriptionText DescriptionElement\">";
250
        $stagingReferenceString = "";
251
        $numberOfTeamMembers = 0;
252 210
        if (!empty($reference->citation->authorTeam->teamMembers)) {
253
    	  $numberOfTeamMembers = count($reference->citation->authorTeam->teamMembers);
254
    	}
211
          $numberOfTeamMembers = count($reference->citation->authorTeam->teamMembers);
212
        }
255 213
        $currentRecord = 1;
256 214
        $isCitationTitleCache = FALSE;
257 215
        if (!empty($reference->citation->authorTeam->teamMembers) && $reference->citation->authorTeam->titleCache != "-empty team-") {
258 216
          foreach ($reference->citation->authorTeam->teamMembers as $teamMember) {
259
            if(!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
217
            if (!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
260 218
              if ($numberOfTeamMembers != $currentRecord) {
261
                $stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname. " & ";
219
                $referenceString .= $teamMember->lastname . ", " . $teamMember->firstname . " & ";
262 220
              }
263 221
              else {
264
                $stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
265
                $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
222
                $referenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
223
                $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
266 224
              }
267 225
              $currentRecord += 1;
268 226
            }
269 227
            else {
270 228
              if ($numberOfTeamMembers != $currentRecord) {
271
                $stagingReferenceString .= $teamMember->titleCache. " & ";
229
                $referenceString .= $teamMember->titleCache . " & ";
272 230
              }
273 231
              else {
274
                $stagingReferenceString .= $teamMember->titleCache;
275
                $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
232
                $referenceString .= $teamMember->titleCache;
233
                $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
276 234
              }
277 235
              $currentRecord += 1;
278 236
            }
279 237
          }
280

  
281

  
282
        }
283
        else if ($reference->citation->authorTeam->titleCache != "-empty team-"){
284
          $stagingReferenceString .= $reference->citation->authorTeam->titleCache;
285
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
286 238
        }
287
         else {
288
          $isAuthorEmpty  = true;
289
         }
290
        if (!empty($reference->citation->datePublished->start)) {
291
          $stagingReferenceString .= substr($reference->citation->datePublished->start,0,4);
292
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
239
        elseif ($reference->citation->authorTeam->titleCache != "-empty team-") {
240
          $referenceString .= $reference->citation->authorTeam->titleCache;
241
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
293 242
        }
294 243
        else {
295
          $isDateEmpty = true;
244
          $isCitationTitleCache = TRUE;
245
          $referenceString .= $reference->citation->titleCache;
296 246
        }
297
        if (!empty($reference->citation->title)) {
298
          $stagingReferenceString .= $reference->citation->title;
299
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
247
        if (!empty($reference->citation->datePublished->start)) {
248
          $referenceString .= substr($reference->citation->datePublished->start, 0, 4);
249
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
300 250
        }
301
        else {
302
          $isTitleEmpty = true;
251
        if ($isCitationTitleCache == FALSE && !empty($reference->citation->title)) {
252
          $referenceString .= $reference->citation->title;
253
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
303 254
        }
304 255
        if (!empty($reference->citation->publisher)) {
305
          $stagingReferenceString .= $reference->citation->publisher;
306
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
307
        } else {
308
          $isPublisherEmpty = true;
309
        }
310
        if($isPublisherEmpty || $isAuthorEmpty || $isDateEmpty || $isTitleEmpty) {
311
          $stagingReferenceString = $reference->citation->titleCache;
256
          $referenceString .= $reference->citation->publisher;
257
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
312 258
        }
313
        $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
314
        $referenceString .= $stagingReferenceString;
259
        $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
315 260
        $referenceString .= "</li>";
316

  
317 261
        break;
262

  
318 263
      case "BookSection":
319 264
        $referenceString .= "<li class=\"descriptionText DescriptionElement\">";
320
        $stagingReferenceString = "";
321 265
        $numberOfTeamMembers = count($reference->citation->authorTeam->teamMembers);
322 266
        $currentRecord = 1;
323 267
        if (!empty($reference->citation->authorTeam->teamMembers)) {
324 268
          foreach ($reference->citation->authorTeam->teamMembers as $teamMember) {
325
            if(!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
269
            if (!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
326 270
              if ($numberOfTeamMembers != $currentRecord) {
327
                $stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname. " & ";
271
                $referenceString .= $teamMember->lastname . ", " . $teamMember->firstname . " & ";
328 272
              }
329 273
              else {
330
                $stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
331
                $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
274
                $referenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
275
                $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
332 276
              }
333 277
              $currentRecord += 1;
334 278
            }
335 279
            else {
336 280
              if ($numberOfTeamMembers != $currentRecord) {
337
                $stagingReferenceString .= $teamMember->titleCache. " & ";
281
                $referenceString .= $teamMember->titleCache . " & ";
338 282
              }
339 283
              else {
340
                $stagingReferenceString .= $teamMember->titleCache;
341
                $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
284
                $referenceString .= $teamMember->titleCache;
285
                $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
342 286
              }
343 287
              $currentRecord += 1;
344 288
            }
345 289
          }
346
        } else if ($reference->citation->authorTeam->titleCache != "-empty team-") {
347
          $stagingReferenceString .= $reference->citation->authorTeam->titleCache;
348
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
349
        } else {
350
          $isAuthorEmpty = true;
351
        }
352
        if (!empty($reference->citation->inReference->datePublished->start)) {
353
          $stagingReferenceString .= substr($reference->citation->inReference->datePublished->start,0,4);
354
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
355
        } else {
356
          $isDateEmpty = true;
357
        }
358
        if(!empty($reference->citation->title)) {
359
          $stagingReferenceString .= $reference->citation->title;
360
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
361
        }
362
        else {
363
          $isTitleEmpty = true;
364 290
        }
365
        if(!empty($reference->citation->pages)) {
366
          $stagingReferenceString .= "Pages ". $reference->citation->pages;
367
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
368
        }
369
        $stagingReferenceString .= "In ";
291
        $referenceString .= substr($reference->citation->inReference->datePublished->start, 0, 4) . ". " . $reference->citation->title . ". " . "Pages " . $reference->citation->pages . ". In ";
370 292
        $numberOfTeamMembersInReference = count($reference->citation->inReference->authorTeam->teamMembers);
371 293
        $currentRecordinReference = 1;
372 294
        if (!empty($reference->citation->inReference->authorTeam->teamMembers)) {
373 295
          foreach ($reference->citation->inReference->authorTeam->teamMembers as $teamMember) {
374
            if(!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
296
            if (!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
375 297
              if ($numberOfTeamMembers != $currentRecord) {
376
                $stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname. " & ";
298
                $referenceString .= $teamMember->lastname . ", " . $teamMember->firstname . " & ";
377 299
              }
378 300
              else {
379
                $stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
380
                $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
301
                $referenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
302
                $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
381 303
              }
382 304
              $currentRecord += 1;
383 305
            }
384 306
            else {
385 307
              if ($numberOfTeamMembers != $currentRecord) {
386
                $stagingReferenceString .= $teamMember->titleCache. " & ";
308
                $referenceString .= $teamMember->titleCache . " & ";
387 309
              }
388 310
              else {
389
                $stagingReferenceString .= $teamMember->titleCache;
390
                $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
311
                $referenceString .= $teamMember->titleCache;
312
                $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
391 313
              }
392 314
              $currentRecord += 1;
393 315
            }
394 316
          }
395
        } else if($reference->citation->inReference->authorTeam->teamMembers->titleCache != "-empty team-")  {
396
          $stagingReferenceString .= $reference->citation->inReference->authorTeam->teamMembers->titleCache;
397
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
398
        } else {
399
          $isAuthorEmpty = true;
400
        }
401
        if (!empty($reference->citation->inReference->title)) {
402
          $stagingReferenceString .=  $reference->citation->inReference->title;
403
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
404
        } else {
405
          $isTitleEmpty = true;
406
        }
407
        if(!empty($reference->citation->inReference->publisher)) {
408
          $stagingReferenceString .= $reference->citation->inReference->placePublished;
409
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
410
        } else {
411
          $isPublisherEmpty = true;
412 317
        }
413
        if ($isPublisherEmpty || $isAuthorEmpty || $isDateEmpty || $isTitleEmpty) {
414
          $stagingReferenceString = $reference->citation->titleCache;
415
        }
416

  
417
        $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? "" : ". ");
418 318

  
419
        $referenceString .= $stagingReferenceString . "</li>";
319
        $referenceString .= $reference->citation->inReference->title . ". " . $reference->citation->inReference->publisher . ". " . $reference->citation->inReference->placePublished;
320
        $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? "" : ". ");
321
        $referenceString .= "</li>";
420 322
        break;
421 323

  
422

  
423
      case "WebPage" :
324
      case "WebPage":
424 325
        $referenceString .= "<li class=\"descriptionText DescriptionElement\">" . $reference->citation->titleCache . "</li>";
425 326
        break;
426
      case "Generic" :
327

  
328
      case "Generic":
427 329
        $referenceString .= "<li class=\"descriptionText DescriptionElement\">";
428
        $stagingReferenceString = "";
429
        $numberOfTeamMembers = count($reference->citation->authorTeam->teamMembers);
430 330
        $currentRecord = 1;
431 331
        if (!empty($reference->citation->authorTeam->teamMembers)) {
332
          $numberOfTeamMembers = count($reference->citation->authorTeam->teamMembers);
432 333
          foreach ($reference->citation->authorTeam->teamMembers as $teamMember) {
433
            if(!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
334
            if (!empty($teamMember->lastname) && !empty($teamMember->firstname)) {
434 335
              if ($currentRecord == 1) {
435
                $stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
336
                $referenceString .= $teamMember->lastname . ", " . $teamMember->firstname;
436 337
              }
437
              else if ($numberOfTeamMembers != $currentRecord) {
438
                $stagingReferenceString .= " , " . $teamMember->lastname . ", " . $teamMember->firstname;
338
              elseif ($numberOfTeamMembers != $currentRecord) {
339
                $referenceString .= " , " . $teamMember->lastname . ", " . $teamMember->firstname;
439 340
              }
440 341
              else {
441
                $stagingReferenceString .= " & " . $teamMember->lastname . ", " . $teamMember->firstname;
442
                $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? ' ' : ". ");
342
                $referenceString .= " & " . $teamMember->lastname . ", " . $teamMember->firstname;
343
                $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? ' ' : ". ");
443 344
              }
444 345
              $currentRecord += 1;
445 346
            }
446 347
            else {
447 348
              if ($numberOfTeamMembers != $currentRecord) {
448
                $stagingReferenceString .= $teamMember->titleCache. " & ";
349
                $referenceString .= $teamMember->titleCache . " & ";
449 350
              }
450 351
              else {
451
                $stagingReferenceString .= $teamMember->titleCache;
452
                $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? ' ' : ". ");
352
                $referenceString .= $teamMember->titleCache;
353
                $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? ' ' : ". ");
453 354
              }
454 355
              $currentRecord += 1;
455 356
            }
456 357
          }
457 358
        }
458
        else if(!empty($reference->citation->authorTeam->titleCache)) {
459
          $stagingReferenceString .= $reference->citation->authorTeam->titleCache;
460
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");
461
        }
462
        else {
463
          $isAuthorEmpty = true;
464
        }
465
        if(!empty($reference->citation->datePublished->start)){
466
          $stagingReferenceString .= substr($reference->citation->datePublished->start,0,4);
467
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");
468

  
469
        } else {
470
          $isDateEmpty = true;
471
        }
472
        if (!empty($reference->citation->title)) {
473
          $stagingReferenceString .= $reference->citation->title;
474
          $stagingReferenceString .= ((str_endsWith($out, ".") || str_endsWith($out, ". ")) ? " " : ". ");
359
        elseif (!empty($reference->citation->authorTeam->titleCache)) {
360
          $referenceString .= $reference->citation->authorTeam->titleCache;
361
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? " " : ". ");
475 362
        }
476 363
        else {
477
          $isTitleEmpty = true;
478
        }
479
        //TODO remove the resolution of the full title cache IF the other elements are empty
480

  
481
        if (!empty($reference->citation->publisher)) {
482
          $stagingReferenceString .= $reference->citation->publisher;
483
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");
364
          $referenceString .= $reference->citation->titleCache;
365
          $referenceString .= ((str_endsWith($out, ".") || str_endsWith($out, ". ")) ? " " : ". ");
484 366
        }
367
        /*
485 368
        else {
486
          $isPublisherEmpty = true;
487
        }
488

  
489
        if ($isAuthorEmpty || $isTitleEmpty || $isDateEmpty || $isPublisherEmpty) {
490
          $stagingReferenceString = $reference->citation->titleCache;
491
          $stagingReferenceString .= ((str_endsWith($out, ".") || str_endsWith($out, ". ")) ? " " : ". ");
369
          $referenceString .= $teamMember->lastname . ", " . $teamMember->firstname . " ";
492 370
        }
493
        /*else {
494
          $stagingReferenceString .= $teamMember->lastname . ", " . $teamMember->firstname . " ";
495
        }*/
496
        /*if (!empty($reference->citation->datePublished->start)) {
497
          $stagingReferenceString .= substr($reference->citation->datePublished->start,0,4);
498
          $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");
371
        */
372
        if (!empty($reference->citation->datePublished->start)) {
373
          $referenceString .= substr($reference->citation->datePublished->start, 0, 4);
374
          $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? " " : ". ");
499 375
        }
500
        $stagingReferenceString .= $reference->citation->title . ". " . $reference->citation->publisher;
501
        $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") || str_endsWith($stagingReferenceString, ". ")) ? " " : ". ");*/
502
        $stagingReferenceString .= ((str_endsWith($stagingReferenceString, ".") ) ? " " : "");
503
        $referenceString .= $stagingReferenceString;
376
        $referenceString .= $reference->citation->title . ". " . (isset($reference->citation->publisher) ? $reference->citation->publisher : '');
377
        $referenceString .= ((str_endsWith($referenceString, ".") || str_endsWith($referenceString, ". ")) ? " " : ". ");
378
        $referenceString .= ((str_endsWith($referenceString, ".")) ? " " : "");
504 379
        $referenceString .= "</li>";
505 380
        break;
506
      default:
507 381

  
508
        //$author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->citation->uuid);
382
      default:
383
        /*
384
        $author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->citation->uuid);
509 385

  
510
        /*if(!empty($author_team->titleCache)) {
386
        if(!empty($author_team->titleCache)) {
511 387
          $referenceString.= print_r($reference->citation);
512 388
          $referenceString .= '<li class="descriptionText DescriptionElement">' . "<b>" . $reference->citation->title . ":" . "</b>" . $author_team->titleCache .   '</li>';
513 389
        }
......
516 392
        }
517 393
        if ($referenceCitation){
518 394
          $sourceRefs = $referenceCitation;
519
          //$referenceString .= "[titleccache] " . $descriptionElementBiblio->feature->titleCache . "[/titlecache]";
520
          //$referenceString .= "[Class] " . $descriptionElementBiblio->class . "[/class]";
521
          //$referenceString .= "[sourceref]" . $sourceRefs . "[/sourceRef]";
522
        }*/
395
          // $referenceString .= "[titleccache] " . $descriptionElementBiblio->feature->titleCache . "[/titlecache]";
396
          // $referenceString .= "[Class] " . $descriptionElementBiblio->class . "[/class]";
397
          // $referenceString .= "[sourceref]" . $sourceRefs . "[/sourceRef]";
398
        }
399
        */
523 400
        break;
524 401
    }
525 402
    $outTemp[] = $referenceString;
526 403
  }
527 404
  sort($outTemp);
528

  
529
  foreach ($outTemp as $refString) {
405
   foreach ($outTemp as $refString) {
530 406
    $out .= $refString;
531 407
  }
532 408

  
533 409
  $out .= "</ul></div></div>";
534 410
  return $out;
535
}
411
}

Also available in: Unified diff