-
Notifications
You must be signed in to change notification settings - Fork 33
/
single-documento_pubblico.php
397 lines (362 loc) · 24 KB
/
single-documento_pubblico.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
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
<?php
/**
* Documento pubblico template file
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Design_Comuni_Italia
*/
global $uo_id, $inline;
get_header();
?>
<main>
<?php
while ( have_posts() ) :
the_post();
$user_can_view_post = dci_members_can_user_view_post(get_current_user_id(), $post->ID);
//$prefix= '_dci_documento_pubblico_';
$identificativo = dci_get_meta("identificativo");
$numero_protocollo = dci_get_meta("numero_protocollo");
$data_protocollo = dci_get_meta("data_protocollo");
$tipo_documento = wp_get_post_terms( $post->ID, array( 'tipi_documento', 'tipi_doc_albo_pretorio' ) );
$descrizione_breve = dci_get_meta("descrizione_breve");
$url_documento = dci_get_meta("url_documento");
$file_documento = dci_get_meta("file_documento");
$descrizione = dci_get_wysiwyg_field("descrizione_estesa");
$ufficio_responsabile = dci_get_meta("ufficio_responsabile");
$autori = dci_get_meta("autori");
$formati = dci_get_wysiwyg_field("formati");
$licenza = wp_get_post_terms( $post->ID, array( 'licenze' ) );
$servizi = dci_get_meta("servizi");
$data_inizio = dci_get_meta("data_inizio");
$data_fine = dci_get_meta("data_fine");
$dataset = dci_get_meta("dataset");
$more_info = dci_get_wysiwyg_field("ulteriori_informazioni");
$riferimenti_normativi = dci_get_wysiwyg_field("riferimenti_normativi");
$documenti_collegati = dci_get_meta("documenti_collegati");
?>
<div class="container" id="main-container">
<div class="row">
<div class="col px-lg-4">
<?php get_template_part("template-parts/common/breadcrumb"); ?>
</div>
</div>
<div class="row">
<div class="col-lg-8 px-lg-4 py-lg-2">
<h1><?php the_title(); ?></h1>
<h2 class="visually-hidden">Dettagli del documento</h2>
<?php if($numero_protocollo) { ?>
<h4>Protocollo <?= $numero_protocollo ?> del <?= $data_protocollo ?></h4>
<?php } ?>
<p>
<?php echo $descrizione_breve; ?>
</p>
</div>
<div class="col-lg-3 offset-lg-1">
<?php
$inline = true;
get_template_part('template-parts/single/actions');
?>
</div>
</div>
</div><!-- ./main-container -->
<div class="container">
<div class="row border-top border-light row-column-border row-column-menu-left">
<aside class="col-lg-3">
<div class="cmp-navscroll sticky-top" aria-labelledby="accordion-title-one">
<nav class="navbar it-navscroll-wrapper navbar-expand-lg" aria-label="Indice della pagina" data-bs-navscroll>
<div class="navbar-custom" id="navbarNavProgress">
<div class="menu-wrapper">
<div class="link-list-wrapper">
<div class="accordion">
<div class="accordion-item">
<span class="accordion-header" id="accordion-title-one">
<button
class="accordion-button pb-10 px-3 text-uppercase"
type="button"
aria-controls="collapse-one"
aria-expanded="true"
data-bs-toggle="collapse"
data-bs-target="#collapse-one"
>INDICE DELLA PAGINA
<svg class="icon icon-sm icon-primary align-top">
<use xlink:href="#it-expand"></use>
</svg>
</button>
</span>
<div class="progress">
<div class="progress-bar it-navscroll-progressbar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div id="collapse-one" class="accordion-collapse collapse show" role="region" aria-labelledby="accordion-title-one">
<div class="accordion-body">
<ul class="link-list" data-element="page-index">
<?php if( $descrizione) { ?>
<li class="nav-item">
<a class="nav-link" href="#descrizione">
<span>Descrizione</span>
</a>
</li>
<?php } ?>
<?php if( $url_documento || $file_documento ) { ?>
<li class="nav-item">
<a class="nav-link" href="#documento">
<span>Documento</span>
</a>
</li>
<?php } ?>
<li class="nav-item">
<a class="nav-link" href="#ufficio_responsabile">
<span>Ufficio responsabile</span>
</a>
</li>
<?php if( $autori) { ?>
<li class="nav-item">
<a class="nav-link" href="#autore">
<span>Autore/i</span>
</a>
</li>
<?php } ?>
<li class="nav-item">
<a class="nav-link" href="#formati_disponibili">
<span>Formati disponibili</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#licenza_distribuzione">
<span>Licenza di distribuzione</span>
</a>
</li>
<?php if( $servizi && count($servizi) ) { ?>
<li class="nav-item">
<a class="nav-link" href="#servizi">
<span>Servizi collegati</span>
</a>
</li>
<?php } ?>
<?php if( $data_inizio) { ?>
<li class="nav-item">
<a class="nav-link" href="#data_inizio">
<span>Data inizio</span>
</a>
</li>
<?php } ?>
<?php if( $data_fine) { ?>
<li class="nav-item">
<a class="nav-link" href="#data_fine">
<span>Data fine</span>
</a>
</li>
<?php } ?>
<?php if( $dataset && count($dataset) ) { ?>
<li class="nav-item">
<a class="nav-link" href="#dataset">
<span>Dataset</span>
</a>
</li>
<?php } ?>
<?php if( $more_info) { ?>
<li class="nav-item">
<a class="nav-link" href="#ulteriori_informazioni">
<span>Ulteriori informazioni</span>
</a>
</li>
<?php } ?>
<?php if( $riferimenti_normativi) { ?>
<li class="nav-item">
<a class="nav-link" href="#riferimenti_normativi">
<span>Riferimenti normativi</span>
</a>
</li>
<?php } ?>
<?php if( is_array($documenti_collegati) && count($documenti_collegati) ) { ?>
<li class="nav-item">
<a class="nav-link" href="#documenti_collegati">
<span>Documenti collegati</span>
</a>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</nav>
</div>
</aside>
<div class="col-12 col-lg-9">
<div class="it-page-sections-container">
<?php if( $descrizione) { ?>
<section id="descrizione" class="it-page-section mb-5">
<h4>Descrizione</h4>
<div class="richtext-wrapper lora">
<?php echo $descrizione; ?>
</div>
</section>
<?php } ?>
<?php if( $url_documento || $file_documento ) { ?>
<section id="documento" class="it-page-section mb-5">
<h4>Documento</h4>
<div class="card-wrapper card-teaser-wrapper card-teaser-wrapper-equal">
<?php
if ( $file_documento ) {
$documento_id = attachment_url_to_postid($file_documento);
$documento = get_post($documento_id);
?>
<div class="card card-teaser shadow-sm p-4 mt-3 rounded border border-light flex-nowrap">
<svg class="icon" aria-hidden="true">
<use
xlink:href="#it-clip"
></use>
</svg>
<div class="card-body">
<h5 class="card-title">
<a class="text-decoration-none" href="<?php echo $file_documento; ?>" aria-label="Scarica il documento <?php echo $documento->post_title; ?>" title="Scarica il documento <?php echo $documento->post_title; ?>">
<?php echo $documento->post_title; ?> (<?php echo getFileSizeAndFormat($file_documento);?>)
</a>
</h5>
</div>
</div>
<?php }
if ( $url_documento ) { ?>
<div class="card card-teaser shadow-sm p-4 mt-3 rounded border border-light flex-nowrap">
<svg class="icon" aria-hidden="true">
<use
xlink:href="#it-clip"
></use>
</svg>
<div class="card-body">
<h5 class="card-title">
<a class="text-decoration-none" href="<?php echo $url_documento; ?>" aria-label="Scarica il documento" title="Scarica il documento">
Scarica il documento
</a>
</h5>
</div>
</div>
<?php } ?>
</div><!-- ./card-wrapper -->
</section>
<?php } ?>
<section id="ufficio_responsabile" class="it-page-section mb-5">
<h4>Ufficio responsabile</h4>
<div class="card-wrapper card-teaser-wrapper card-teaser-wrapper-equal">
<?php foreach ($ufficio_responsabile as $uo_id) {
$with_border = true;
get_template_part("template-parts/unita-organizzativa/card");
} ?>
</div>
</section>
<?php if ($autori && is_array($autori) && count($autori)) { ?>
<section id="autore" class="it-page-section mb-5">
<h4>Autore/i</h4>
<div class="card-wrapper card-teaser-wrapper card-teaser-wrapper-equal">
<?php foreach ($autori as $persona_id) { ?>
<div class="card card-teaser shadow-sm p-4 mt-3 rounded border border-light flex-nowrap">
<?php get_template_part("template-parts/persona/card"); ?>
</div>
<?php } ?>
</div>
</section>
<?php } ?>
<?php if ($formati) { ?>
<section id="formati_disponibili" class="it-page-section mb-5">
<h4>Formati disponibili</h4>
<div class="richtext-wrapper lora">
<?php echo $formati ?>
</div>
</section>
<?php } ?>
<?php if ($licenza) { ?>
<section id="licenza_distribuzione" class="it-page-section mb-5">
<h4>Licenza distribuzione</h4>
<div class="richtext-wrapper lora">
<?php foreach($licenza as $tipo) {
echo $tipo->name;
} ?>
</div>
</section>
<?php } ?>
<?php if ($servizi && is_array($servizi) && count($servizi)>0 ) { ?>
<section id="servizi" class="it-page-section mb-5">
<h4>Servizi collegati</h4>
<div class="row">
<div class="col-12 col-sm-8">
<?php foreach ($servizi as $servizio_id) {
$servizio = get_post($servizio_id);
$with_border = true;
get_template_part("template-parts/servizio/card");
} ?>
</div>
</div>
</section>
<?php } ?>
<?php if ($data_inizio) { ?>
<section id="data_inizio" class="it-page-section mb-5">
<h4>Data inizio</h4>
<div class="richtext-wrapper lora">
<?php
echo date_i18n('j F Y', strtotime($data_inizio));
?>
</div>
</section>
<?php } ?>
<?php if ($data_fine) { ?>
<section id="data_fine" class="it-page-section mb-5">
<h4>Data fine</h4>
<div class="richtext-wrapper lora">
<?php
echo date_i18n('j F Y', strtotime($data_fine));
?>
</div>
</section>
<?php } ?>
<?php if ( $more_info ) { ?>
<section id="ulteriori_informazioni" class="it-page-section mb-5">
<h4>Ulteriori informazioni</h4>
<div class="richtext-wrapper lora">
<?php echo $more_info ?>
</div>
</section>
<?php } ?>
<?php if ( $riferimenti_normativi ) { ?>
<section id="riferimenti_normativi" class="it-page-section mb-5">
<h4>Riferimenti normativi</h4>
<div class="richtext-wrapper lora">
<?php echo $riferimenti_normativi ?>
</div>
</section>
<?php } ?>
<?php if( is_array($documenti_collegati) && count($documenti_collegati) ) { ?>
<section id="documenti_collegati" class="it-page-section mb-5">
<h4>Documenti collegati</h4>
<div class="card-wrapper card-teaser-wrapper card-teaser-wrapper-equal">
<?php foreach ($documenti_collegati as $documento_id) {
$documento = get_post($documento_id);
$with_border = true;
get_template_part("template-parts/documento/card");
} ?>
</div>
</section>
<?php } ?>
</div><!-- /it-page-sections-container -->
<div>
<?php get_template_part('template-parts/single/page_bottom'); ?>
</div>
</div><!-- ./col-12 col-9 -->
</div><!-- ./row border-top border-light row-column-border row-column-menu-left -->
</div><!-- ./container -->
<?php get_template_part("template-parts/common/valuta-servizio"); ?>
<?php get_template_part("template-parts/common/assistenza-contatti"); ?>
<?php
endwhile; // End of the loop.
?>
</main>
<script>
const descText = document.querySelector('#descrizione')?.closest('article').innerText;
const wordsNumber = descText.split(' ').length
document.querySelector('#readingTime').innerHTML = `${Math.ceil(wordsNumber / 200)} min`;
</script>
<?php
get_footer();