1
|
<?php
|
2
|
|
3
|
defined('_JEXEC') or die('Access denied');
|
4
|
|
5
|
jimport('joomla.factory');
|
6
|
jimport('joomla.methods');
|
7
|
|
8
|
if ($this -> layout == OpenAireViewPublications :: HTML) {
|
9
|
JFactory :: getDocument() -> setMimeEncoding('text/html'); ?>
|
10
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
11
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
12
|
<head>
|
13
|
<style type="text/css">
|
14
|
<!--
|
15
|
td {
|
16
|
border: 1px solid black;
|
17
|
}
|
18
|
-->
|
19
|
</style>
|
20
|
<title><?php JText :: printf('PUBLICATIONS_OF_PROJECT_S_S_S_', htmlspecialchars($this -> project -> title), htmlspecialchars($this -> project -> acronym), htmlspecialchars($this -> project -> call)); ?></title>
|
21
|
</head>
|
22
|
<body>
|
23
|
<h1><?php JText :: printf('PUBLICATIONS_OF_PROJECT_S_S_S_', htmlspecialchars($this -> project -> title), htmlspecialchars($this -> project -> acronym), htmlspecialchars($this -> project -> call)); ?></h1>
|
24
|
<?php if ($this -> publications === NULL) { ?>
|
25
|
<h2><?php echo(JText :: _('ERROR_RETRIEVING_PROJECT_PUBLICATIONS')); ?></h2>
|
26
|
<?php } else if ($this -> publications == NULL) { ?>
|
27
|
<h2><?php echo(JText :: _('NO_PROJECT_PUBLICATIONS_FOUND')); ?></h2>
|
28
|
<?php } else { ?>
|
29
|
<h2><?php JText :: printf('N_PUBLICATIONS', count($this -> publications)); ?></h2>
|
30
|
<table>
|
31
|
<thead>
|
32
|
<tr>
|
33
|
<th><?php echo(JText :: _('TITLE')); ?></th>
|
34
|
<th><?php echo(JText :: _('AUTHORS')); ?></th>
|
35
|
<th><?php echo(JText :: _('PUBLICATION_YEAR')); ?></th>
|
36
|
<th><?php echo(JText :: _('PERMANENT_IDENTIFIER')); ?></th>
|
37
|
<th><?php echo(JText :: _('ACCESS_MODE')); ?></th>
|
38
|
</tr>
|
39
|
</thead>
|
40
|
<tbody>
|
41
|
<?php foreach ($this -> publications as $publication) { ?>
|
42
|
<tr>
|
43
|
<td><?php echo(htmlspecialchars($publication -> title)); ?></td>
|
44
|
<td><?php echo(htmlspecialchars(implode('; ', array_filter(array_map(function ($author) {return (($author == NULL) || ((($author -> lastName == NULL) || ($author -> firstName == NULL)) && ($author -> fullName == NULL))) ? '' : ((($author -> lastName == NULL) || ($author -> firstName == NULL)) ? $author -> fullName : ($author -> lastName . ' ' . $author -> firstName));}, $publication -> authors))))); ?></td>
|
45
|
<td><?php echo(($publication -> year == NULL) ? '' : htmlspecialchars($publication -> year)); ?></td>
|
46
|
<td><?php echo(!empty($publication -> datasources) ? ('<a target="_blank" href="' . htmlspecialchars($publication -> datasources[0] -> url) . '">' . htmlspecialchars($publication -> datasources[0] -> url) . '</a>') : ''); ?></td>
|
47
|
<td><?php echo(htmlspecialchars($publication -> accessMode)); ?></td>
|
48
|
</tr>
|
49
|
<?php } ?>
|
50
|
</tbody>
|
51
|
</table>
|
52
|
<?php } ?>
|
53
|
</body>
|
54
|
</html>
|
55
|
<?php } else {
|
56
|
header('Content-Disposition: attachment; filename="'. $this -> project -> acronym . ' (' . $this -> project -> call . ').csv"');
|
57
|
JFactory :: getDocument() -> setMimeEncoding('text/csv');
|
58
|
echo('"' . str_replace('"', '""', JText :: _('TITLE')) . '","' . str_replace('"', '""', JText :: _('AUTHORS')) . '","' . str_replace('"', '""', JText :: _('PUBLICATION_YEAR')) . '","' . str_replace('"', '""', JText :: _('PERMANENT_IDENTIFIER')) . "\"\n");
|
59
|
if ($this -> publications != NULL) {
|
60
|
foreach ($this -> publications as $publication) {
|
61
|
echo('"' .
|
62
|
str_replace('"', '""', preg_replace('/\s+/', ' ', str_replace("\n", ' ', $publication -> title))) . '","' .
|
63
|
str_replace('"', '""', preg_replace('/\s+/', ' ', str_replace("\n", ' ', implode('; ', array_filter(array_map(function ($author) {return (($author == NULL) || ((($author -> lastName == NULL) || ($author -> firstName == NULL)) && ($author -> fullName == NULL))) ? '' : ((($author -> lastName == NULL) || ($author -> firstName == NULL)) ? $author -> fullName : ($auhtor -> lastName . ' ' . $author -> firstName));}, $publication -> authors)))))) . '","' .
|
64
|
str_replace('"', '""', preg_replace('/\s+/', ' ', str_replace("\n", ' ', ($publication -> year == NULL) ? '' : $publication -> year))) . '","' .
|
65
|
str_replace('"', '""', preg_replace('/\s+/', ' ', str_replace("\n", ' ', !empty($publication -> datasources) ? $publication -> datasources[0] -> url : ''))) . '","' .
|
66
|
str_replace('"', '""', preg_replace('/\s+/', ' ', str_replace("\n", ' ', ($publication -> accessMode == NULL) ? '' : $publication -> accessMode))). "\"\n");
|
67
|
}
|
68
|
}
|
69
|
}
|
70
|
|