Files
kabano/views/d.poi.view.html

278 lines
12 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="fr">
<? include('blocks/d.head.html'); ?>
<body>
<? include('blocks/d.nav.html'); ?>
<div id="mapid"></div>
<div id="sticky">
<section <?=$poi->is_archive=="t"||$poi->is_public=="f"?'class="archive"':''?>>
<i id="slide-icon" class="fas fa-chevron-up"></i>
<h1 class="flex_line">
<span class="poi-icon-wrapper" data-tooltip="<?=htmlspecialchars($poi_types[$poi->poi_type][4] ?? '')?>">
<img class="poi-icon"
src="<?=$config['rel_root_folder']?>views/img/<?=$poi->poi_type?>.svg"
alt="">
</span>
<span><?=$poi->name?></span>
</h1>
<div class="poi-idcard">
<div class="poi-id-main">
<div class="poi-id-coords">
<span class="poi-id-label">📍 Coordonnées</span>
<a href="geo:<?=$poi->lat?>,<?=$poi->lon?>" class="poi-id-value">
<?=$poi->lat?>, <?=$poi->lon?>
</a>
<?php if ($poi->ele !== null && $poi->ele !== '') { ?>
<span class="poi-id-elev">⛰️ <?=$poi->ele?> m</span>
<?php } ?>
</div>
<div class="poi-id-type">
<span class="poi-id-label">🏷️ Type</span>
<span class="poi-id-value">
<?=$poi_types[$poi->poi_type][1] ?? $poi->poi_type?>
</span>
</div>
</div>
<div class="poi-id-dates">
<span>Créé : <?=$poi->creation_date?></span>
<span>Mis à jour : <?=$poi->update_date?></span>
</div>
</div>
<? if($user->rankIsHigher('premium')) { ?>
<span class="subtitle">
<? if(isset($PoiHistory)) { ?>
<select id="PoiHistory">
<? $i = 0;
foreach ($PoiHistory->objs as $row) { ?>
<option <?=$row->version_id==$poi->version_id?'selected':''?> value="<?=$i?>"><?=$row->is_archive=="f"?'&bull; ':''?><? echo datefmt_format($user->datetimeshort_format,date_create($row->update_date, new DateTimeZone("UTC"))) ?></option>
<? $i++;
} ?>
</select>
<? }
if ($user->rankIsHigher('moderator') && isset($PoiHistory)) { ?>
&mdash;
<? }
if ($user->rankIsHigher("moderator")) { ?>
<a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/edit"><i class="fas fa-pencil-alt"></i> Éditer le point</a> &mdash;
<? if ($poi->is_public == 't') { ?>
<a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/delete"><i class="fas fa-trash"></i> Effacer le point</a>
<? } else { ?>
<a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/restore"><i class="fas fa-eye"></i> Restaurer le point</a>
<? } ?>
<? } ?>
</span>
<? } ?>
<br>
<br>
<?php
$fields = $poi_types[$poi->poi_type][5];
$values = $poi->parameters ?? [];
// Séparer les booléens des autres champs
$bool_fields = [];
$other_fields = [];
foreach ($fields as $key => $label) {
if ($key[0] === 'b') {
$bool_fields[$key] = $label;
} else {
$other_fields[$key] = $label;
}
}
?>
<div id="specific_form" class="view-mode">
<!-- AUTRES CHAMPS (texte, nombre, lien) -->
<?php foreach ($other_fields as $key => $label): ?>
<?php
$value = $values[$key] ?? null;
$type = $key[0];
?>
<div class="field field-<?= $type ?>">
<label><?= $label ?></label>
<?php if ($type === 'n'): ?>
<span class="inline-value"><?= $value !== null ? $value : "<em>—</em>" ?></span>
<?php elseif ($type === 't'): ?>
<div class="field-value">
<?= $value ? nl2br(htmlspecialchars($value)) : "<em>Aucune information.</em>" ?>
</div>
<?php elseif ($type === 'l'): ?>
<span class="inline-value">
<?php if ($value): ?>
<a href="<?= htmlspecialchars($value) ?>" target="_blank"><?= $value ?></a>
<?php else: ?>
<em></em>
<?php endif; ?>
</span>
<?php endif; ?>
</div>
<?php endforeach; ?>
<!-- TABLEAU DES BOOLÉENS -->
<?php if (!empty($bool_fields)): ?>
<div class="bool-grid">
<!-- Ligne des labels -->
<div class="bool-row labels">
<?php foreach ($bool_fields as $key => $label): ?>
<div class="bool-label"><?= $label ?></div>
<?php endforeach; ?>
</div>
<!-- Ligne des valeurs -->
<div class="bool-row values">
<?php foreach ($bool_fields as $key => $label): ?>
<?php
$value = $values[$key] ?? 2;
$icon = [
0 => "<span class='boolean-pill boolean-no'>❌</span>",
1 => "<span class='boolean-pill boolean-maybe'>❓</span>",
2 => "<span class='boolean-pill boolean-yes'>✔️</span>",
-1 => "<span class='boolean-pill boolean-unknown'></span>"
][$value];
?>
<div class="bool-cell">
<?= $icon ?>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
<? if ($poi->is_commentable == 't') { ?>
<div id="new_comment">
<form class="form" action="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/new_comment" method="post">
<div id="new_comment_label" <?=$user->rank=="visitor"?"class='sent' ":""?>>
<? if ($poi->is_archive == "t" || $poi->is_public == "f") { ?>
<p>Impossible de commenter un point non publié</p>
<? } else if ($user->rankIsHigher("registered")) { ?>
<input name="submit" type="submit" value="Envoyer">
<p>Ajouter un nouveau commentaire</p>
<? } else { ?>
<p>Veuillez vous connecter pour ajouter un commentaire</p>
<? } ?>
</div>
<div id="new_comment_form">
<textarea id="comment" name="comment" rows="5" placeholder="Votre commentaire"></textarea>
</div>
</form>
</div>
<? if (isset($poi_comments) && $poi_comments->number > 0) { ?>
<div id="comments">
<? foreach ($poi_comments->objs as $comment) { ?>
<article <? if($comment->is_archive == 't' || $comment->is_public == 'f') echo 'class="comment_archive" '; ?>>
<div class="comment_title">
<? if ($comment->author_obj->is_avatar_present == 't') { ?>
<img alt="Avatar" class="icon avatar" src="<?=$config['rel_root_folder']?>medias/avatars/<?=$comment->author_obj->id?>_s.jpg">
<? } else { ?>
<i class="icon fas fa-user-secret"></i>
<? } ?>
<? if ($user->rankIsHigher("blocked")) { ?>
<a class="username" href="<?=$config['rel_root_folder']?>user/p/<?=$comment->author_obj->id?>">
<?=$comment->author_obj->name?>
</a>
<? } else { ?>
<?=$comment->author_obj->name?>
<? } ?>
le <? echo datefmt_format($user->datetime_format, date_create($comment->update_date, new DateTimeZone("UTC"))) ?>
<? if (($user->rankIsHigher("moderator") || $user->id == $comment->author) && $comment->is_public == 't') { ?>
<span class="delete_link">
<a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/delete_comment/<?=$comment->id?>">
<i class="fas fa-trash"></i> Effacer le commentaire
</a>
</span>
<? } ?>
<? if (($user->rankIsHigher("moderator") || $user->id == $comment->author) && $comment->is_public == 'f') { ?>
<span class="delete_link">
<a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/restore_comment/<?=$comment->id?>">
<i class="fas fa-eye"></i> Restaurer le commentaire
</a>
</span>
<? } ?>
</div>
<div class="comment_content">
<?=$comment->comment_html?>
</div>
</article>
<? } ?>
<br></div>
<? } else { ?>
<p>Aucun commentaire pour le moment.</p>
<? } ?>
<? } ?>
</section>
<? include('blocks/d.footer.html'); ?>
</div>
<script>
var poi_lat = <?=$poi->lat?>;
var poi_lon = <?=$poi->lon?>;
var poi_type = "<?=$poi->poi_type?>";
var poi_mode = "view";
var root = "<?=$config['rel_root_folder']?>";
</script>
<? if($user->rankIsHigher("premium")) { ?>
<script type="text/javascript">
$( "#PoiHistory" ).change(function() {
window.location.href = "<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/"+$( this ).val();
});
</script>
<? } ?>
<? if($user->rankIsHigher("registered") && $poi->is_archive == "f" && $poi->is_public == "t") { ?>
<script type="text/javascript">
$( "#new_comment_label" ).click(function() {
$( "#new_comment_form" ).show(400);
$( "#new_comment_label input" ).show(0);
$( "#new_comment_label").addClass('sent');
});
</script>
<? } ?>
<script type="text/javascript">
$( "#slide-icon" ).click(function() {
$( "html, body" ).animate({scrollTop: "300px"});
});
</script>
</body>
</html>