-
Notifications
You must be signed in to change notification settings - Fork 1
/
single-articles.php
executable file
·339 lines (302 loc) · 14.3 KB
/
single-articles.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<?php
if (isset($_GET['galley']) && $_GET['galley'] == 'print') {
get_template_part('article', 'print');
return;
} elseif (isset($_GET['galley']) && $_GET['galley'] == 'index') {
get_template_part('article', 'index');
return;
} elseif (isset($_GET['galley']) && $_GET['galley'] == 'citations') {
get_template_part('article', 'citations');
return;
} elseif (isset($_GET['galley']) && $_GET['galley'] == 'references') {
get_template_part('article', 'find-references');
return;
} elseif (isset($_GET['galley']) && $_GET['galley'] == 'mail') {
get_template_part('article', 'mail');
return;
}
?>
<?php get_header(); ?>
<!---->
<!--vol date of pub-->
<!--title if not present-->
<!--authors-->
<!--views-->
<!--Abstract-->
<!--Paynow-->
<!--Content-->
<!------------------->
<!--Manuscript Editor-->
<!--Peer Reviewer-->
<!------------------->
<!--Comment box-->
<!--comments-->
<!------------------->
<!--Recommended Articles-->
<div class="row article-wrapper">
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
$issue = get_post_meta(get_the_ID(), 'xml_issue', true);
$volume = get_post_meta(get_the_ID(), 'xml_volume', true);
$postId = get_post_meta(get_the_ID(), 'articles', true);
$t_post = get_post($postId);
?>
<?php if (isset($_GET['galley']) && $_GET['galley'] == 'html') { ?>
<div id="html-article" class="col-md-10 col-sm-12">
<div id="article-header-label">
<div id="article-header-left-details">
<span id="article-volume-label"><?php echo "Vol " . $volume . ", Issue " . $issue; ?></span>
<span id="red-oval"></span>
<span id="article-date-of-publication">Date of Publication: <?php
$publish_date = get_post_meta($t_post->ID, 'article_pub_date', true);
echo date("F d, Y", strtotime($publish_date)); ?></span>
</div>
<?php if (get_field('doi')) { ?>
<span id="article-doi"> DOI: <a href="<?php the_field('doi_link'); ?>" id="article-doi-link"
><?php the_field('doi_link'); ?></a>
</span>
<?php } ?>
</div>
<div class="article_count_container">
<img src="<?php echo THEME_URL; ?>/images/icons/View.svg" class="viewIcon">
<div class="lds-ellipsis" id="place-holder"><p id="article_count"></p>
<div></div>
</div>
<div style="margin-left: 3px;">Views</div>
<div>, PDF Downloads:</div>
<div class="lds-ellipsis" id="pdf-place-holder"><p id="pdfDownloadCount"></p>
<div></div>
</div>
</div>
<!-- If article is an old article if id < $articleCutoffId then just put the content and show authors at bottom-->
<div class="singleContentArticle oldArticles"
style="margin-top: 100px"><?php the_content(); ?></div>
<!--Paynow-->
<!------------------->
<div class="article-separator"></div>
<div class="author-section-bottom">
<div class="blockTitle"> About the Authors</div>
<?php
$authors = get_post_meta(get_the_ID(), 'authors', true);
if (!empty($authors)) {
foreach ($authors as $key => $author) { ?>
<div class="authorBio">
<div>
<div>
<em><?php echo $author['first_name'] . ' ' . $author['middle_name'] . ' ' . $author['last_name'] ?></em>
<?php if (array_key_exists("email", $author)){ ?>
<a href="mailto:<?php echo $author['email']; ?>">
(<?php echo $author['email']; ?>)</a></div>
<?php } else echo ""; ?>
<div class="author-subtext"><?php echo $author['biography']; ?></div>
<div class="author-subtext"><?php echo $author['affiliation']; ?></div>
</div>
</div>
<?php
}
} ?>
</div>
<!--Manuscript Editor-->
<?php
$peersArray = [];
$peers = get_post_meta(get_the_ID(), 'peers', true);
if ($peers) {
foreach ($peers as $key => $peer) {
$peersArray[$key] = $peer['name'];
}
}
$peerNames = implode(', ', $peersArray);
?>
<?php if (get_field('manuscript_editor') || !empty($peerNames)) {
echo "<div class=\"article-separator\"></div>";
} ?>
<?php if (get_field('manuscript_editor')) { ?>
<div class="manuscript-editor">Manuscript Editor: <span
class="manuscript-editor-name"><?php the_field('manuscript_editor'); ?></span></div>
<?php } ?>
<?php if (!empty($peerNames)) { ?>
<div class="peer-reviewer">Peer Reviewers:
<span class="peer-reviewer-name"><?php echo $peerNames ?></span>
</div>
<?php } ?>
<div class="article-separator"></div>
<!--Peer Reviewer-->
<!------------------->
</div>
<!-- End of bottom Author Section-->
<?php } else { ?>
<div id="html-article" class="col-md-10 col-sm-12">
<div id="article-header-label">
<div id="article-header-left-details">
<span id="article-volume-label"><?php echo "Vol " . $volume . ", Issue " . $issue; ?></span>
<span id="red-oval"></span>
<span id="article-date-of-publication">Date of Publication: <?php
$publish_date = get_post_meta($t_post->ID, 'article_pub_date', true);
echo date("F d, Y", strtotime($publish_date)); ?></span>
</div>
<?php if (get_field('doi')) { ?>
<span id="article-doi"> DOI: <a href="<?php the_field('doi_link'); ?>" id="article-doi-link"
><?php the_field('doi_link'); ?></a>
</span>
<?php } ?>
</div>
<div class="article_count_container">
<img src="<?php echo THEME_URL; ?>/images/icons/View.svg" class="viewIcon">
<div class="lds-ellipsis" id="place-holder"><p id="article_count"></p>
<div></div>
</div>
<div style="margin-left: 3px;">Views</div>
<div>, PDF Downloads:</div>
<div class="lds-ellipsis" id="pdf-place-holder"><p id="pdfDownloadCount"></p>
<div></div>
</div>
</div>
<h2 class="article-category"> <?php
$article_category = get_the_category($postId);
if(count($article_category)>1 && $article_category[0]->name =='Research Articles'){
$catname=$article_category[1]->name;
}else{
$catname = $article_category[0]->name;
}
echo $catname;
?> </h2>
<?php $keyword = get_post_meta($post->ID, 'my_keywords'); ?>
<!-- <div>Keywords: --><?php //print_r($keyword) ?><!--</div>-->
<div id="articleTitle"><h3><?php echo get_the_title(); ?></h3></div>
<div style="display: flex">
</div>
<div id="authorString">
<em>
<?php
$authors = get_post_meta(get_the_ID(), 'authors', true);
$out = array();
if (!empty($authors)) {
foreach ($authors as $key => $author) {
$author_name = $author['first_name'] . ' ' . $author['middle_name'] . ' ' . $author['last_name'];
?>
<div class="author-name"
id="<?php echo $author['first_name'] . "-" . $author['last_name']; ?>">
<?php echo $author_name; ?>
</div>
<script>
createAuthorTooltip('<?php echo json_encode($author);?>');
</script>
<?php
}
}
?>
</em>
</div>
<div id="article-abstract-wrapper">
<div id="abstract-label">Abstract:</div>
<em> <div id="article-abstract"><?php echo get_the_excerpt(); ?></div></em>
</div>
<div>
<p></br> Copyright and license </br>
©Indian Journal of Medical Ethics 2022: Open Access and Distributed under the Creative Commons license ( <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/"> <span
style="text-decoration: underline;color:blue">CC BY-NC-ND 4.0</span></a>),</br> which permits only non-commercial and non-modified sharing in any medium, provided the original author(s) and source are credited.
</p>
</div>
<div class="article-separator"></div>
<div id="articleFullText">
<h4>Full Text</h4>
<a class="file" href="<?php echo add_query_arg('galley', 'html', get_permalink(get_the_ID())); ?>">HTML</a>
<?php $pdf_file = get_post_meta(get_the_ID(), 'pdf_file', true); ?>
<?php if (!empty($pdf_file)) { ?>
<span>|</span>
<a href="<?php echo $pdf_file ?>"
class="file" target="_blank"
onclick="ga('send', 'event','pdf', 'downloads', 'pdf downloads', 0,{'nonInteraction': 1})">
PDF</a><br>
<?php } ?>
</div>
</div>
<?php } ?>
<?php } ?>
<?php } ?>
<div id="sidebar" class="col-md-2">
<div class="block" id="articleToolsInContent">
<div class="addthis_container">
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="addthis_inline_share_toolbox"></div>
</div>
<div id="article-tools-title">Article Tools:</div>
<?php
$pdf_file = get_post_meta(get_the_ID(), 'pdf_file', true);
if ($pdf_file) { ?>
<div class="articleToolItem">
<img src="<?php echo THEME_URL; ?>/images/article-tool-icons/Download_PDF.svg"
class="articleToolIcon">
<a href="<?php echo $pdf_file ?>"
class="article-tool-item-name" target="_blank"
onclick="ga('send', 'event','pdf', 'downloads', 'pdf downloads', 0,{'nonInteraction': 1}); showSupportModal('<?php echo get_permalink(get_the_ID()); ?>') ">
Download PDF</a><br>
</div>
<?php } ?>
<div class="articleToolItem">
<img src="<?php echo THEME_URL; ?>/images/article-tool-icons/Print_article.svg" class="articleToolIcon">
<a
target="_blank"
class="article-tool-item-name"
href="<?php echo add_query_arg('galley', 'print', get_permalink(get_the_ID())); ?>">Print
this article</a>
</div>
<div class="articleToolItem">
<img src="<?php echo THEME_URL; ?>/images/article-tool-icons/Indexing_metadata.svg"
class="articleToolIcon"> <a href="#"
class="article-tool-item-name"
onclick="window.open('<?php echo add_query_arg('galley', 'index', get_permalink(get_the_ID())); ?>','_blank')">Indexing
metadata</a><br>
</div>
<div class="articleToolItem">
<img src="<?php echo THEME_URL; ?>/images/article-tool-icons/How_to_cite_item.svg"
class="articleToolIcon"> <a
class="article-tool-item-name"
href="<?php echo add_query_arg('galley', 'citations', get_permalink(get_the_ID())); ?>"
target="_blank">How to cite item</a><br>
</div>
<div class="articleToolItem">
<img src="<?php echo THEME_URL; ?>/images/article-tool-icons/Finding_references.svg"
class="articleToolIcon"> <a
class="article-tool-item-name"
href="<?php echo add_query_arg('galley', 'references', get_permalink(get_the_ID())); ?>"
target="_blank">Finding References</a>
</div>
<div class="articleToolItem">
<img src="<?php echo THEME_URL; ?>/images/article-tool-icons/Post_comment.svg" class="articleToolIcon">
<a href="#comments" class="article-tool-item-name">Post a Comment</a>
</div>
</div>
</div>
<?php
comments_template();
?>
<?php if (get_post_type() == 'page') the_content(); ?>
</div>
<?php get_footer(); ?>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5d1b0148a07aaf99"></script>
<script>
jQuery(document).ready(function ($) {
$.urlParam = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null) {
return null;
}
return decodeURI(results[1]) || 0;
}
if ($.urlParam('galley') === 'html') {
showSupportModal('<?php echo get_permalink(get_the_ID()); ?>');
}
let post_slug = "<?php echo $slug = get_post_field('post_name', get_post()); ?>";
url = "/ArticleCountAPI/article_count_api.php?article_name=" + post_slug;
$.get(url, function (data) {
$(".result").html(data);
document.getElementById('place-holder').classList.remove('lds-ellipsis');
document.getElementById('article_count').innerText = JSON.parse(data).pageView;
document.getElementById('pdf-place-holder').classList.remove('lds-ellipsis');
document.getElementById('pdfDownloadCount').innerText = JSON.parse(data).pdfView;
});
});
</script>