forked from italia/design-scuole-wordpress-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-documento.php
executable file
·338 lines (316 loc) · 22.5 KB
/
single-documento.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
<?php
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package Design_Scuole_Italia
*/
global $post, $autore, $gallery, $licenza, $struttura, $servizio;
get_template_part("template-parts/single/related-posts", $args = array( "post", "events", "circolari" ));
get_header();
$user_can_view_post = dsi_members_can_user_view_post(get_current_user_id(), $post->ID);
?>
<main id="main-container" class="main-container redbrown">
<?php get_template_part( "template-parts/common/breadcrumb" ); ?>
<?php while ( have_posts() ) : the_post();
set_views($post->ID);
$image_url = get_the_post_thumbnail_url( $post, "item-gallery" );
$autore = get_user_by( "ID", $post->post_author );
$gallery = dsi_get_meta( "gallery" );
$file_documenti = dsi_get_meta( "file_documenti" );
$licenza = dsi_get_meta( "licenza" );
$servizi_collegati = dsi_get_meta( "servizi_collegati" );
// $link_servizi_collegati = dsi_get_meta( "link_servizi_collegati" );
$timeline = dsi_get_meta( "timeline" );
$ufficio = dsi_get_meta( "ufficio" );
$numerazione_albo = dsi_get_meta( "numerazione_albo" );
$altre_info = dsi_get_meta("altre_info");
$protocollo = dsi_get_meta("protocollo");
$riferimenti_normativi = dsi_get_meta("riferimenti_normativi");
?>
<section class="section bg-white py-2 py-lg-3 py-xl-5">
<div class="container">
<div class="row variable-gutters">
<div class="col-12 col-sm-3 col-lg-2 d-none d-sm-block">
<div class="section-thumb mx-3">
<?php
if(has_post_thumbnail($post)) {
the_post_thumbnail("item-thumb");
}else{
?>
<img src="<?php echo get_template_directory_uri(); ?>/assets/placeholders/logo-service.png" alt="">
<?php } ?>
</div><!-- /section-thumb -->
</div><!-- /col-lg-2 -->
<div class="col-12 col-sm-9 col-lg-5 col-md-8">
<div class="section-title">
<?php if(dsi_is_albo($post) && $numerazione_albo){ ?>
<small class="h6 text-redbrown"><?php echo $numerazione_albo; ?></small>
<?php } ?>
<h1 class="h2 mb-3"><?php the_title(); ?></h1>
<p><?php echo dsi_get_meta( "descrizione" ); ?></p>
</div><!-- /title-section -->
<!-- <div class="article-description-mobile">
</div>-->
</div><!-- /col-lg-5 col-md-8 -->
<div class="col-lg-3 col-md-4 offset-lg-1">
<?php get_template_part( "template-parts/single/actions" ); ?>
<?php
$badgeclass = "badge-outline-redbrown";
get_template_part( "template-parts/common/badges-argomenti" ); ?>
</div><!-- /col-lg-3 col-md-4 offset-lg-1 -->
</div><!-- /row -->
</div><!-- /container -->
</section><!-- /section -->
<?php get_template_part("template-parts/header/status"); ?>
<section class="section bg-white">
<div class="container container-border-top">
<div class="row variable-gutters">
<?php if($user_can_view_post): ?>
<div class="col-lg-3 col-md-4 aside-border px-0">
<aside class="aside-main aside-sticky">
<div class="aside-title">
<a class="toggle-link-list" data-toggle="collapse" href="#lista-paragrafi"
role="button" aria-expanded="true" aria-controls="lista-paragrafi" aria-label="apri/chiudi indice della pagina">
<span><?php _e( "Indice della pagina", "design_scuole_italia" ); ?></span>
<svg class="icon icon-toggle svg-arrow-down-small">
<use xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="#svg-arrow-down-small"></use>
</svg>
</a>
</div>
<div id="lista-paragrafi" class="link-list-wrapper collapse show">
<ul class="link-list">
<li>
<a class="list-item scroll-anchor-offset" href="#art-par-descrizione"
title="Vai al paragrafo <?php _e( "Descrizione", "design_scuole_italia" ); ?>"><?php _e( "Descrizione", "design_scuole_italia" ); ?></a>
</li>
<?php if ( is_array( $file_documenti ) && count( $file_documenti ) > 0 ) { ?>
<li>
<a class="list-item scroll-anchor-offset" href="#art-par-documento"
title="Vai al paragrafo <?php _e( "Il Documento", "design_scuole_italia" ); ?>"><?php echo _n( 'Il Documento', 'I Documenti', count( $file_documenti ), 'design_scuole_italia' ); ?></a>
</li>
<?php }
if ( is_array( $servizi_collegati ) && count($servizi_collegati) > 0 ) { ?>
<li>
<a class="list-item scroll-anchor-offset" href="#art-par-servizio"
title="Vai al paragrafo <?php _e( "Servizi collegati", "design_scuole_italia" ); ?>"><?php _e( "Servizi collegati", "design_scuole_italia" ); ?></a>
</li>
<?php }
if ( is_array( $timeline ) && count( $timeline ) > 0 ) { ?>
<li>
<a class="list-item scroll-anchor-offset" href="#art-par-tempi"
title="Vai al paragrafo <?php _e( "Tempi e scadenze", "design_scuole_italia" ); ?>"><?php _e( "Tempi e scadenze", "design_scuole_italia" ); ?></a>
</li>
<?php }
if ( is_array( $ufficio ) && count( $ufficio ) > 0 ) { ?>
<li>
<a class="list-item scroll-anchor-offset" href="#art-par-contatti"
title="Vai al paragrafo <?php _e( "Contatti", "design_scuole_italia" ); ?>"><?php _e( "Contatti", "design_scuole_italia" ); ?></a>
</li>
<?php } ?>
<?php if(($altre_info != "") || ($protocollo != "") || ($riferimenti_normativi != "")) { ?>
<li>
<a class="list-item scroll-anchor-offset" href="#art-par-info"
title="Vai al paragrafo <?php _e( "Ulteriori informazioni", "design_scuole_italia" ); ?>"><?php _e( "Ulteriori informazioni", "design_scuole_italia" ); ?></a>
</li>
<?php } ?>
<?php if (is_array($posts_array) && count( $posts_array ) ) { ?>
<li>
<a class="list-item scroll-anchor-offset" href="#art-par-correlati"
title="Vai al paragrafo <?php _e("Circolari, notizie, eventi correlati", "design_scuole_italia"); ?>"><?php _e("Circolari, notizie, eventi correlati", "design_scuole_italia"); ?></a>
</li>
<?php } ?>
</ul>
</div>
</aside>
</div>
<div class="col-lg-8 col-md-8 offset-lg-1 pt84">
<article class="article-wrapper">
<h2 class="h4" id="art-par-descrizione"><?php _e( "Descrizione", "design_scuole_italia" ); ?></h2>
<div class="row variable-gutters">
<div class="col-lg-9">
<div class="article-description-nomove wysiwig-text">
<?php the_content(); ?>
</div><!-- /article-description -->
</div><!-- /col-lg-9 -->
</div><!-- /row -->
<div class="row variable-gutters mb-4">
<div class="col-lg-12">
<?php if ( is_array( $gallery ) && count( $gallery ) > 0 ) { ?>
<div class="it-carousel-wrapper simple-two-carousel splide" data-bs-carousel-splide>
<div class="splide__track">
<ul class="splide__list">
<?php get_template_part( "template-parts/single/gallery", $post->post_type ); ?>
</ul>
</div><!-- /carousel-simple -->
</div>
<?php }
$autori = dsi_get_meta( "autori" );
if ( is_array( $autori ) && count( $autori ) > 0 ) {
?>
<h3 class="h6"><?php _e( "Autori", "design_scuole_italia" ); ?></h3>
<div class="card-deck card-deck-spaced mb-2">
<?php
foreach ( $autori as $idutente ) {
$autore = get_user_by( "ID", $idutente );
?>
<div class="card card-bg card-avatar rounded">
<a href="<?php echo get_author_posts_url( $autore->ID); ?>">
<div class="card-body">
<?php get_template_part( "template-parts/autore/card" ); ?>
</div>
</a>
</div><!-- /card card-bg card-avatar rounded -->
<?php
}
?>
</div><!-- /card-deck -->
<?php
}
?>
</div><!-- /col-lg-9 -->
</div><!-- /row -->
<?php if ( is_array( $file_documenti ) && count( $file_documenti ) > 0 ) { ?>
<h3 class="h6" id="art-par-documento"><?php _e("Allegati", "design_scuole_italia"); ?></h3>
<?php
if (dsi_is_albo($post) && $post->post_status == "annullato") {
?>
<div class="row variable-gutters mb-4">
<div class="col-lg-12">
<h5 class="text-redbrown"><?php _e("Allegati non disponibili - Albo Annullato", "design_scuole_italia"); ?></h5>
</div>
</div>
<?php
} else {
?>
<div class="row variable-gutters mb-4">
<div class="col-lg-12">
<div class="card-deck card-deck-spaced">
<?php global $idfile, $nomefile;
if (is_array($file_documenti) && count($file_documenti) > 0) {
foreach ($file_documenti as $idfile => $nomefile) {
get_template_part("template-parts/documento/file");
}
}
?>
</div><!-- /card-deck card-deck-spaced -->
</div><!-- /col-lg-12 -->
</div><!-- /row -->
<?php
}
}
if ( is_array( $servizi_collegati ) && count($servizi_collegati) > 0 ) { ?>
<h2 class="h4" id="art-par-servizio"><?php _e( "Servizi collegati", "design_scuole_italia" ); ?></h2>
<div class="row variable-gutters mb-4">
<div class="col-lg-12">
<div class="card-deck card-deck-spaced">
<?php foreach ($servizi_collegati as $idservizio){
$servizio = get_post($idservizio);
get_template_part("template-parts/servizio/card");
} ?>
</div><!-- /card-deck card-deck-spaced -->
</div><!-- /col-lg-12 -->
</div><!-- /row -->
<?php
}
if ( is_array( $timeline ) && count( $timeline ) > 0 ) {
?>
<h2 class="h4" id="art-par-tempi"><?php _e( "Tempi e scadenze", "design_scuole_italia" ); ?></h2>
<div class="row variable-gutters">
<div class="col-lg-9">
<div class="calendar-vertical mb-5">
<?php
foreach ( $timeline as $item ) {
?>
<div class="calendar-date">
<div class="calendar-date-day">
<small><?php echo date_i18n( "Y", strtotime( $item["data_timeline"] ) ); ?></small>
<p><?php echo date_i18n( "d", strtotime( $item["data_timeline"] ) ); ?></p>
<small><b><?php echo date_i18n( "M", strtotime( $item["data_timeline"] ) ); ?></b></small>
</div><!-- /calendar-date-day -->
<div class="calendar-date-description rounded">
<div class="calendar-date-description-content">
<p><?php echo $item["titolo_timeline"] ?></p>
</div><!-- /calendar-date-description-content -->
</div><!-- /calendar-date-description -->
</div><!-- /calendar-date -->
<?php } ?>
</div><!-- /calendar-vertical -->
</div><!-- /col-lg-9 -->
</div><!-- /row -->
<?php
}
if ( is_array( $ufficio ) && count( $ufficio ) > 0 ) { ?>
<h2 class="h4" id="art-par-contatti"><?php _e( "Contatti", "design_scuole_italia" ); ?></h2>
<div class="h6"><?php _e( "Ufficio responsabile del documento", "design_scuole_italia" ); ?></div>
<div class="row variable-gutters mb-4">
<div class="col-lg-12">
<div class="card-deck card-deck-spaced">
<?php
foreach ( $ufficio as $id_struttura ) {
$struttura = get_post($id_struttura);
get_template_part("template-parts/struttura/card");
}
?>
</div><!-- /card-deck card-deck-spaced -->
</div><!-- /col-lg-12 -->
</div><!-- /row -->
<?php }
if(($altre_info != "") || ($protocollo != "") || ($riferimenti_normativi != "")) {
?>
<h2 class="h4" id="art-par-info"><?php _e("Ulteriori informazioni", "design_scuole_italia"); ?></h2>
<div class="row variable-gutters mb-4">
<div class="col-lg-9">
<?php
if ($altre_info) echo "<p>" . $altre_info . "</p>";
if ($protocollo) {
echo "<p>";
_e("Protocollo: ", "design_scuole_italia");
echo "<strong>" . $protocollo . "</strong>";
$data_protocollo = dsi_get_meta("data_protocollo");
if ($data_protocollo) {
_e(" del ", "design_scuole_italia");
echo "<strong>" . $data_protocollo . "</strong>";
}
echo "</p>";
}
if ($riferimenti_normativi) {
?>
<div class="h6"><?php _e("Riferimenti normativi", "design_scuole_italia"); ?></div>
<div class="card card-bg bg-color rounded">
<div class="card-body">
<?php
echo $riferimenti_normativi;
?>
</div>
</div>
<?php
}
?>
</div><!-- /col-lg-9 -->
</div><!-- /row -->
<?php
}
?>
<div class="row variable-gutters">
<div class="col-lg-9">
<?php get_template_part( "template-parts/single/bottom" ); ?>
</div><!-- /col-lg-9 -->
</div><!-- /row -->
</article>
</div><!-- /col-lg-8 -->
<?php else: ?>
<div class="col-lg-12 p-5 m-5 text-center font-weight-bold wysiwig-text">
<?php the_content(); ?>
</div>
<?php endif; ?>
</div><!-- /row -->
</div><!-- /container -->
</section>
<?php get_template_part( "template-parts/single/more-posts" ); ?>
<?php endwhile; // End of the loop. ?>
</main><!-- #main -->
<?php
get_footer();