Repository navigation
Expand file tree
/
Copy pathsingle-bi-project.php
More file actions
399 lines (318 loc) · 21.3 KB
/
Copy pathsingle-bi-project.php
File metadata and controls
399 lines (318 loc) · 21.3 KB
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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
<?php get_header();
global $post;
$has_sidebar = 0;
$layout = 'fullpage';
?>
<div class="col-sm-<?php echo 12 - $has_sidebar; ?> <?php echo ($has_sidebar > 0 ? 'col-sm-pull-3' : ''); ?>">
<?php while ( have_posts() ) : the_post(); $postid = get_the_ID();
$country = wp_get_post_terms( $postid, 'country' );
$iso = false;
if ( $country ) {
$iso = get_field( 'iso_code', $country[0] );
}
$fields = get_all_acf_fields_by_group_key( 'group_607ea4d00a9ed', false );
$embargo_date = $fields['who_is_behind_the_project']['embargo_date']['text'];
$today_date = date('Ymd');
$embargo = false;
if( $embargo_date > $today_date ) { $embargo == true; }
$project_statuses = get_the_terms( $postid, 'bi-project-status' );
$project_status = $project_statuses[0]->name;
// echo '<pre>'.print_r($fields, true).'</pre>';
?>
<div class="row">
<div class="col-md-9">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if (get_field('hide_page_title') !== true) : ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<p class="bi-project-status"><?php echo $project_status ?> project</p>
<?php endif; ?>
<?php
$image_id = $fields['additional_information'][' do_you_have_a_picture_you_would_like_to_feature_with_this_project__please_upload_it_here']['text'];
if( $image_id > 0 ) {
echo '<div class="bi-project-featured-image">';
wp_get_attachment_image( $image_id, 'full' );
echo '</div>';
}
?>
<div class="sliding_panel open">
<h2 class="active">General Information</h2>
<div class="panel_content">
<h3>Project description</h3>
<div class="csp"><?php echo $fields['who_is_behind_the_project']['project_description']['text']; ?></div>
</div>
</div>
<div class="sliding_panel">
<?php if( $project_status == 'Pre-registration' ): ?>
<h2>Analysis Plan</h2>
<?php else: ?>
<h2>Detailed information</h2>
<?php endif; ?>
<div class="panel_content" style="display:none;">
<?php if( $project_status == 'Completed' ): ?>
<h3>Final report: Is there a final report presenting the results and conclusions of this project?</h3>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['final_report_is_there_a_final_report_presenting_the_results_and_conclusions_of_this_project']['text']['label']; ?></div>
<?php if( $fields['hypothesis_outcomes_and_analysis']['final_report_is_there_a_final_report_presenting_the_results_and_conclusions_of_this_project']['text']['label'] == 'Yes' ) : ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['final_report_file_wrapper']['text']['please_attach_your_report_here_or_add_a_link_to_the_report']['label'] == 'Attach a file' ) {
$final_report_url = $fields['hypothesis_outcomes_and_analysis']['final_report_file_wrapper']['text']['report_file'];
} else {
$final_report_url = $fields['hypothesis_outcomes_and_analysis']['final_report_file_wrapper']['text']['link_to_the_report'];
}?>
<h3>Final report</h3>
<div class="csp"><a href="<?php echo $final_report_url ?>" target="_blank">See the final report</a></div>
<?php endif; ?>
<?php endif; ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['pre-analysis_plan_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['hypothesis_outcomes_and_analysis']['pre-analysis_plan_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<h3>Pre-analysis plan: Is there a pre-analysis plan associated with this registration?</h3>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['pre-analysis_plan_wrapper']['text']['pre-analysis_plan:_is_there_a_pre-analysis_plan_associated_with_this_registration']; ?></div>
<?php if(
$fields['hypothesis_outcomes_and_analysis']['pre-analysis_file_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['hypothesis_outcomes_and_analysis']['pre-analysis_file_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<?php if ($fields['hypothesis_outcomes_and_analysis']['pre-analysis_file_wrapper']['text']['please_attach_your_pre-analysis_plan']['text'] != '' ) : ?>
<div class="csp"><a href="<?php echo $fields['hypothesis_outcomes_and_analysis']['pre-analysis_file_wrapper']['text'][' please_attach_your_pre-analysis_plan']['text'] ?>" target="_blank">See the Pre-analysis plan</a></div>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['hypothesis_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['hypothesis_outcomes_and_analysis']['hypothesis_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<h3>Hypothesis</h3>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['hypothesis_wrapper']['text']['hypothesis']; ?></div>
<?php endif; ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['test_hypothesis_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['hypothesis_outcomes_and_analysis']['test_hypothesis_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<?php if( $project_status == 'Pre-registration'): ?>
<h3>How hypothesis will be tested</h3>
<?php elseif( $project_status == 'Completed' ): ?>
<h3>How hypothesis was tested</h3>
<?php endif; ?>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['test_hypothesis_wrapper']['text']['how_will_your_hypothesis_be_tested']; ?></div>
<?php endif; ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['dependent_variables_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['hypothesis_outcomes_and_analysis']['dependent_variables_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<h3>Dependent variables</h3>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['dependent_variables_wrapper']['text']['dependent_variables']; ?></div>
<?php endif; ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['analyses_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['hypothesis_outcomes_and_analysis']['analyses_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<h3>Analyses</h3>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['analyses_wrapper']['text']['analyses']; ?></div>
<?php endif; ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['sample_size_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['hypothesis_outcomes_and_analysis']['sample_size_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<h3>Sample Size. How many observations will be collected or what will determine sample size?</h3>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['sample_size_wrapper']['text']['sample_size_how_many_observations_will_be_collected_or_what_will_determine_sample_size']; ?></div>
<?php endif; ?>
<?php if( $project_status == 'Pre-registration'): ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['power_analysis_was_a_power_analysis_conducted_prior_to_data_collection']['text']['label'] != '' ): ?>
<h3>Power analysis. Was a power analysis conducted prior to data collection?</h3>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['power_analysis_was_a_power_analysis_conducted_prior_to_data_collection']['text'] ?></div>
<?php endif; ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['third_party_implement_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['hypothesis_outcomes_and_analysis']['third_party_implement_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<h3>Does a third party implement the intervention or is this a collaboration with another team?</h3>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['third_party_implement_wrapper']['text']['does_a_third_party_implement_the_intervention_or_is_this_a_collaboration_with_another_team']; ?></div>
<?php endif; ?>
<?php endif; ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['data_exclusion']['text'] != '' ): ?>
<h3>Data Exclusion</h3>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['data_exclusion']['text'] ?></div>
<?php endif; ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['treatment_of_missing_data']['text'] != '' ): ?>
<h3>Treatment of Missing Data</h3>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['treatment_of_missing_data']['text'] ?></div>
<?php endif; ?>
<?php if( $project_status == 'Pre-registration'): ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['analysis_codescript']['text'] != '' ): ?>
<h3>Analysis Code/Script</h3>
<div class="csp"><a href="<?php echo $fields['hypothesis_outcomes_and_analysis']['analysis_codescript']['text'] ?>" target="_blank"><?php echo $fields['hypothesis_outcomes_and_analysis']['analysis_codescript']['text'] ?></a></div>
<?php endif; ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['post-commitment_adjustments']['text'] != '' ): ?>
<h3>Post-Commitment Adjustments</h3>
<div class="csp"><?php echo $fields['hypothesis_outcomes_and_analysis']['post-commitment_adjustments']['text'] ?></div>
<?php endif; ?>
<?php endif; ?>
<?php if( $project_status == 'Pre-registration' ): ?>
<?php if( $fields['hypothesis_outcomes_and_analysis']['external_link']['text'] != '' ): ?>
<h3>External link</h3>
<div class="csp"><a href="<?php echo $fields['hypothesis_outcomes_and_analysis']['external_link']['text'] ?>" target="_blank"><?php echo $fields['hypothesis_outcomes_and_analysis']['external_link']['text'] ?></a></div>
<?php endif; ?>
<?php endif; ?>
<?php if( $fields['methods']['results']['text'] != '' ): ?>
<h3>Results</h3>
<div class="csp"><?php echo $fields['methods']['results']['text'] ?></div>
<?php endif; ?>
</div>
</div>
<?php if( $project_status == 'Completed' ): ?>
<div class="sliding_panel">
<h2>Additional information</h2>
<!-- <div class="panel_content" <?php //echo ( $oi == 0 ? '' : 'style="display: none;"' ); ?>> -->
<div class="panel_content" style="display:none;">
<?php if( $fields['additional_information']['third_party_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['additional_information']['third_party_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<h3>Does a third party implement the intervention or is this a collaboration with another team?</h3>
<div class="csp"><?php echo $fields['additional_information']['third_party_wrapper']['text']['does_a_third_party_implement_the_intervention_or_is_this_a_collaboration_with_another_team']; ?></div>
<?php endif; ?>
<?php if( $fields['additional_information']['collaboration_with_another_BI_unit']['text'] != '' ): ?>
<h3>Collaboration with another BI unit</h3>
<div class="csp"><?php echo implode( array_column( $fields['additional_information']['collaboration_with_another_BI_unit']['text'], 'post_title'), ',') ?></span>) ?></div>
<?php endif; ?>
<?php if( $fields['additional_information']['collaboration_with_other_institutions']['text'] != '' ): ?>
<h3>Collaboration with other institutions</h3>
<div class="csp"><?php echo implode( array_column( $fields['additional_information']['collaboration_with_other_institutions']['text'], 'name'), ',') ?></span>) ?></div>
<?php endif; ?>
<?php if( $fields['additional_information']['analysis_codescript']['text'] != '' ): ?>
<h3>Analysis Code/Script</h3>
<div class="csp"><?php echo $fields['additional_information']['analysis_codescript']['text'] ?></div>
<?php endif; ?>
<?php if( $project_status == 'Pre-registration'): ?>
<?php if( $fields['additional_information']['additional_documentation']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['additional_information']['additional_documentation']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<h3>Additional Documentation</h3>
<div class="csp"><?php
foreach ($fields['additional_information']['additional_documentation']['text']['files'] as $file) {
echo '<p><a href="'.$file['file']['url'].'">'.$file['file']['title'].'</a></p>';
}
?></div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
</article>
</div>
<div class="col-md-3 case_study_sidebar">
<div class="cs_sidebar_wrap">
<div class="row">
<?php if ( $iso != '' ) { ?>
<div class="col-xs-4">
<a href="<?php echo get_post_type_archive_link( 'bi-project' ); ?>?_countries=<?php echo $country[0]->slug; ?>" title="<?php echo __( 'All BI project by:', 'opsi' ); ?> <?php echo $country[0]->name; ?>" class="blacklink" target="_blank" >
<img src="<?php echo get_stylesheet_directory_uri().'/images/flags/'.$iso.'.png'; ?>" width="96" height="96" alt="<?php echo $country[0]->name; ?>" class="cs_flag" />
</a>
</div>
<?php } ?>
<?php if ( !empty( $country ) ) { ?>
<div class="col-xs-8 cs_country_name">
<h4>
<a href="<?php echo get_post_type_archive_link( 'bi-project' ); ?>?_countries=<?php echo $country[0]->slug; ?>" title="<?php echo __( 'All BI project by:', 'opsi' ); ?> <?php echo $country[0]->name; ?>" class="blacklink" target="_blank" >
<?php echo $country[0]->name; ?></a>
</h4>
<p class="bi-project-city"><?php echo $fields['who_is_behind_the_project']['city']['text'] ?></p>
</div>
<?php } ?>
</div>
</div>
<div class="cs_sidebar_wrap">
<div class="row">
<div class="col-md-12">
<h4>Who is behind the project?</h4>
<div class="sidebar-generic-wrapper">
<span class="sidebar_label">Institution: </span>
<span class="strong"><?php echo get_term( $fields['who_is_behind_the_project']['institution_wrapper']['text']['institution'] )->name ?></span>
</div>
<div class="sidebar-generic-wrapper">
<span class="sidebar_label">Team: </span>
<span class="strong"><?php echo $fields['who_is_behind_the_project']['unit']['text']->post_title ?></span>
</div>
<?php if( ( $fields['who_is_behind_the_project']['authors_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['who_is_behind_the_project']['authors_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) && $project_status == 'Pre-registration' ) : ?>
<div class="sidebar-generic-wrapper">
<span class="sidebar_label">Authors: </span>
<span class="strong"><?php echo $fields['who_is_behind_the_project']['authors_wrapper']['text']['authors'] ?></span>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="cs_sidebar_wrap">
<div class="row">
<div class="col-md-12">
<h4>Methods</h4>
<div class="sidebar-generic-wrapper">
<span class="sidebar_label">Methodology: </span>
<?php
$method_list = '';
foreach ( $fields['methods']['methodology_wrapper']['text']['methodology'] as $method_item ) {
$method_list .= $method_item->name . ', ';
}
$method_list = rtrim( $method_list, ', ' );
?>
<span class="strong"><?php echo $method_list ?></span>
</div>
<?php if( $fields['methods']['could_you_self-grade_the_strength_of_the_evidence_generated_by_this_study']['text'] > 0 ): ?>
<div class="sidebar-generic-wrapper">
<span class="sidebar_label">Could you self-grade the strength of the evidence generated by this study?</span>
<span class="strong"><?php echo $fields['methods']['could_you_self-grade_the_strength_of_the_evidence_generated_by_this_study']['text'] ?></span>
</div>
<?php endif; ?>
<?php if( $project_status == 'Pre-registration' ): ?>
<div class="sidebar-generic-wrapper">
<span class="sidebar_label">Data collection: Have any data been collected for this project already?</span>
<span class="strong"><?php echo $fields['methods']['data_collection:_have_any_data_been_collected_for_this_project_already']['text'] ?></span>
</div>
<?php endif; ?>
<?php if( $fields['methods']['date_of_start_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['methods']['date_of_start_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<span class="sidebar_label">Date of start: </span>
<span class="strong"><?php echo $fields['methods']['date_of_start_wrapper']['text']['date_of_start']; ?></span>
<?php endif; ?>
</div>
</div>
</div>
<div class="cs_sidebar_wrap">
<div class="row">
<div class="col-md-12">
<h4>What is the project about?</h4>
<div class="sidebar-generic-wrapper">
<span class="sidebar_label">Policy Area: </span>
<?php
$policy_list = '';
foreach ( $fields['who_is_behind_the_project']['policy_area_wrapper']['text']['policy_area'] as $policy_item ) {
$policy_list .= $policy_item->name . ', ';
}
$policy_list = rtrim( $policy_list, ', ' );
?>
<span class="strong"><?php echo $policy_list ?></span>
</div>
<div class="sidebar-generic-wrapper">
<span class="sidebar_label">Topic: </span>
<?php
$topic_list = '';
foreach ( $fields['who_is_behind_the_project']['topic_wrapper']['text']['topic'] as $topic_item ) {
$topic_list .= $topic_item->name . ', ';
}
$topic_list = rtrim( $topic_list, ', ' );
?>
<span class="strong"><?php echo $topic_list ?></span>
</div>
<?php if( $fields['who_is_behind_the_project']['behavioural_tool_wrapper']['text']['include_this_in_the_public_version'] == 'Yes' || ( $fields['who_is_behind_the_project']['behavioural_tool_wrapper']['text']['include_this_in_the_public_version'] == 'Hide until embargo date' && !$embargo ) ) : ?>
<div class="sidebar-generic-wrapper">
<span class="sidebar_label">Behavioural Tool: </span>
<?php
$btool_list = '';
foreach ( $fields['who_is_behind_the_project']['behavioural_tool_wrapper']['text']['behavioural_tool'] as $btool_item ) {
$btool_list .= $btool_item->name . ', ';
}
$btool_list = rtrim( $btool_list, ', ' );
?>
<span class="strong"><?php echo $btool_list ?></span>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="cs_post_meta">
<div class="row">
<div class="col-xs-12">
<span class="strong make-block">
<?php echo __( 'Date published:', 'opsi' ); ?>
</span>
<span class="make-block">
<?php echo get_the_date(); ?>
</span>
</div>
</div>
</div>
<?php if ( !is_user_logged_in() ) { ?>
<div class="cs_sidebar_wrap">
<div class="row">
<div class="col-md-12">
<?php echo do_shortcode('[joinorlogin]'); ?>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php endwhile; ?>
</div>
<?php wp_reset_query(); ?>
<?php get_footer(); ?>