<div id="breadcrumb_tools">
<?php include('breadcrumb.tpl.php'); ?>
<?php if ($tpl['pages']['prev']['active']
	   || $tpl['user']['admin'] || $tpl['item_edit'] || $tpl['selection']
	   || $tpl['category']['unlocked'] || $tpl['item_download']
	   || $tpl['favorites'] || $tpl['diaporama']
	   || $tpl['pages']['next']['active']) : ?>
	<ul id="tools" class="item">
<?php if ($tpl['pages']['prev']['active']) : ?>
		<li id="link_prev"><a href="<?php echo $tpl['pages']['prev']['link']; ?>#content">&#xf053;</a></li>
<?php endif; ?>
<?php if ($tpl['user']['admin']) : ?>
		<li id="link_admin"><a title="<?php echo __('Administrer'); ?>" href="<?php echo $tpl['item']['link_admin']; ?>">&#xe90c;</a></li>
<?php endif; ?>
<?php if ($tpl['item_edit']) : ?>
		<li id="link_edit"><a data-box="item" title="<?php echo __('Éditer'); ?>" href="javascript:;">&#xe962;</a></li>
<?php endif; ?>
<?php if ($tpl['selection']) : ?>
		<li id="link_selection" class="<?php echo $tpl['item']['in_selection'] ? 'remove' : 'add'; ?>">
			<a title="<?php echo $tpl['item']['in_selection'] ? __('Retirer de la sélection') : __('Ajouter à la sélection'); ?>"
			   data-l10n-add="<?php echo __('Ajouter à la sélection'); ?>"
			   data-l10n-remove="<?php echo __('Retirer de la sélection'); ?>"
			   href="javascript:;">&#xea52;</a>
		</li>
<?php endif; ?>
<?php if ($tpl['category']['unlocked']) : ?>
		<li id="link_logout">
			<a data-id="<?php echo $tpl['category']['id']; ?>" title="<?php echo __('Verrouiller'); ?>" href="<?php echo $tpl['category']['link_logout']; ?>">&#xe92e;</a>
		</li>
<?php endif; ?>
<?php if ($tpl['item_download']) : ?>
		<li id="link_download"><a title="<?php printf(__('Télécharger') . ' (%s)', $tpl['item']['stats']['filesize']['text']); ?>" href="<?php echo $tpl['item']['source_download']; ?>">&#xe9c7;</a></li>
<?php endif; ?>
<?php if ($tpl['favorites']) : ?>
		<li id="link_favorites" class="<?php echo $tpl['item']['user']['in_favorites'] ? 'remove' : 'add'; ?>">
			<a title="<?php echo $tpl['item']['user']['in_favorites'] ? __('Retirer de mes favoris') : __('Ajouter à mes favoris'); ?>" href="javascript:;">&#xe910;</a>
		</li>
<?php endif; ?>
<?php if (!empty($tpl['diaporama'])) : ?>
		<li id="link_diaporama"><a title="<?php echo __('Lancer un diaporama'); ?>" href="javascript:;">&#xf04b;</a></li>
<?php endif; ?>
<?php if ($tpl['pages']['next']['active']) : ?>
		<li id="link_next"><a href="<?php echo $tpl['pages']['next']['link']; ?>#content">&#xf054;</a></li>
<?php endif; ?>
	</ul>
<?php endif; ?>
</div>

<?php if (($display_item_pagination_top || $tpl['user']['admin']) && $tpl['pages']['count'] > 1) : ?>
<div data-option-display="item_pagination_top" id="pages_top"<?php if ($display_item_pagination_top) : ?> class="show"<?php endif; ?>>
<?php include('pagination.tpl.php'); ?>
</div>
<?php endif; ?>

<div id="item" class="<?php if ($tpl['item']['user']['in_favorites']) : ?> favorite<?php endif; ?><?php if ($tpl['users'] && $tpl['item']['in_selection']) : ?> selection<?php endif; ?>">
	<div id="item_container"<?php if ($tpl['item']['is_image']) : ?> class="viewer"<?php endif; ?>>
<?php if ($tpl['item']['is_image']) : ?>
		<a id="item_link"<?php if ($tpl['item_download']) : ?> href="<?php echo $tpl['item']['source']; ?>"<?php endif; ?>>
			<img id="item_img"
				data-type="<?php echo $tpl['item']['type_mime']; ?>"
				alt="<?php echo $tpl['item']['title']; ?>"
				src="<?php echo $tpl['item']['source']; ?>">
		</a>
<?php else : ?>
		<video controls
			<?php if (!$tpl['item_download']) : ?>controlsList="nodownload"<?php endif; ?>
			<?php if ($tpl['config']('video_loop')) : ?>loop<?php endif; ?>
			<?php if ($tpl['config']('video_muted')) : ?>muted<?php endif; ?>
			poster="<?php echo $tpl['item']['thumb_src']('1045', '', TRUE); ?>">
			<source src="<?php echo $tpl['item']['source']; ?>" type="<?php echo $tpl['item']['type_mime']; ?>">
		</video>
<?php endif; ?>
	</div>
<?php if ($display_item_prev_next || $tpl['user']['admin']) : ?>
<?php if ($tpl['pages']['prev']['active']) : ?>
	<div data-option-display="item_prev_next" id="item_prev"<?php if ($display_item_prev_next) : ?> class="show"<?php endif; ?>><a href="<?php echo $tpl['pages']['prev']['link']; ?>#content">&#xf053;</a></div>
<?php endif; ?>
<?php if ($tpl['pages']['next']['active']) : ?>
	<div data-option-display="item_prev_next" id="item_next"<?php if ($display_item_prev_next) : ?> class="show"<?php endif; ?>><a href="<?php echo $tpl['pages']['next']['link']; ?>#content">&#xf054;</a></div>
<?php endif; ?>
<?php endif; ?>
</div>

<?php if ($display_item_stats || $tpl['user']['admin']) : ?>
<ul id="item_stats" data-option-display="item_stats"<?php if ($display_item_stats) : ?> class="show"<?php endif; ?>>
<?php if ($tpl['users'] && $tpl['config']('favorites')) : ?>
	<li id="item_favorites"><span><?php echo $tpl['item']['stats']['favorites']['short']; ?></span> <span>&#xe910;</span></li>
<?php endif; ?>
	<li id="item_views"><span><?php echo $tpl['item']['stats']['views']['short']; ?></span> <span>&#xe907;</span></li>
</ul>
<?php endif; ?>

<?php if ($display_item_title || $tpl['user']['admin']) : ?>
<h2 id="item_title" data-option-display="item_title"<?php if ($display_item_title) : ?> class="show"<?php endif; ?>>
	<?php echo $tpl['item']['title']; ?>
</h2>
<?php endif; ?>

<?php if (!Utility::isEmpty($description = $tpl['format_description']($tpl['item']['description']))) : ?>
<div id="item_description" class="object_desc"><?php echo $description; ?></div>
<?php endif; ?>

<div id="item_columns"<?php if ($tpl['comments']) : ?> class="item_columns_comment"<?php endif; ?>>
	<div id="item_left">
	<div id="item_left_inner">
<?php if ($tpl['votes']) : ?>
		<div id="item_rating">
			<h3 class="icon"><span>&#xe9d9;</span> <?php echo __('Votes'); ?> (<span id="item_rating_votes"><?php echo $tpl['item']['stats']['votes']['short']; ?></span>)</h3>
			<span><?php echo __('Note moyenne :'); ?></span>
			<p id="item_note">
				<span><?php foreach ($tpl['item']['stats']['rating']['array'] as $k => $v) : ?><span class="rating" data-rating="<?php echo $k+1; ?>"><?php if ($v == 1) : ?>&#xe9d9;<?php elseif ($v == 0) : ?>&#xe9d7;<?php else : ?>&#xe9d8;<?php endif; ?></span><?php endforeach; ?></span>
				<span id="item_note_formated"><?php echo $tpl['item']['stats']['rating']['formated']; ?></span>
			</p>
<?php if ($tpl['votable']) : ?>
<?php if ($tpl['votes_add']) : ?>
			<span><?php echo __('Votre note :'); ?></span>
			<p id="item_user_note" data-rating="<?php echo (int) $tpl['item']['user']['rating']; ?>">
				<span><?php foreach ($tpl['item']['user']['rating_array'] as $k => $v) : ?><a href="javascript:;" class="rating" data-rating="<?php echo $k+1; ?>"><?php if ($v == 1) : ?>&#xe9d9;<?php else : ?>&#xe9d7;<?php endif; ?></a><?php endforeach; ?></span>
				<a<?php if (!$tpl['item']['user']['rating']) : ?> class="hidden"<?php endif; ?> href="javascript:;" title="<?php echo __('Supprimer'); ?>" id="item_user_note_delete">&#xe916;</a>
			</p>
<?php else : ?>
			<p class="message_info"><?php echo __('Vous n\'avez pas l\'autorisation de voter.'); ?></p>
<?php endif; ?>
<?php else : ?>
			<p class="message_info"><?php echo __('L\'ajout de note est désactivé pour ce fichier.'); ?></p>
<?php endif; ?>
		</div>
<?php endif; ?>
<?php if ($tpl['users'] && ($display_item_user || $tpl['user']['admin'])) : ?>
		<div id="item_user" data-option-display="item_user"<?php if ($display_item_user) : ?> class="show"<?php endif; ?>>
			<h3 class="icon"><span>&#xe971;</span> <?php echo __('Utilisateur'); ?></h3>
			<div>
				<span id="item_user_avatar">
<?php if ($tpl['item']['owner']['link']) : ?>
					<a href="<?php echo $tpl['item']['owner']['link']; ?>" tabindex="-1">
<?php endif; ?>
						<img alt="<?php printf(__('Avatar de %s'), $tpl['item']['owner']['nickname']); ?>" width="50" height="50" src="<?php echo $tpl['item']['owner']['avatar_source'] ?>">
<?php if ($tpl['item']['owner']['link']) : ?>
					</a>
<?php endif; ?>
				</span>
<?php
$login = $tpl['item']['owner']['link']
	? '<a class="u" href="' . $tpl['item']['owner']['link'] . '">' . $tpl['item']['owner']['nickname'] . '</a>'
	: $tpl['item']['owner']['nickname'];
?>
				<p><?php printf(__('Publiée le %s par %s'), '<a class="u" href="' . $tpl['item']['date_published_link'] . '#content">' . $tpl['item']['date_published_text'] . '</a><br>', '<span id="item_user_login">' . $login . '</span>'); ?></p>
			</div>
		</div>
<?php endif; ?>
<?php if ($display_item_properties || $tpl['user']['admin']) : ?>
		<div data-option-display="item_properties" id="item_properties"<?php if ($display_item_properties) : ?> class="show"<?php endif; ?>>
			<h3 class="icon"><span>&#xf05a;</span> <?php echo __('Propriétés'); ?></h3>
			<ul>
				<li><span><?php echo __('Type de fichier'); ?></span> : <?php echo $tpl['item']['type_text']; ?></li>
				<li><span><?php echo __('Poids'); ?></span> : <?php echo $tpl['item']['stats']['filesize']['text']; ?></li>
				<li><span><?php echo __('Dimensions'); ?></span> : <?php echo $tpl['item']['width'] . ' x ' . $tpl['item']['height']; ?> <?php echo __('pixels'); ?></li>
<?php if ($tpl['item']['is_video']) : ?>
				<li><span><?php echo __('Durée'); ?></span> : <?php echo $tpl['item']['duration_text']; ?></li>
<?php endif; ?>
<?php if ($tpl['item']['datetime_created']) : ?>
				<li><span><?php echo __('Date de création'); ?></span> : <a class="u" href="<?php echo $tpl['item']['date_created_link']; ?>#content"><?php echo $tpl['item']['date_created_text']; ?></a></li>
<?php endif; ?>
			</ul>
		</div>
<?php endif; ?>
<?php if ($tpl['geolocation']) : ?>
		<div id="item_geolocation">
			<h3 class="icon"><span>&#xe94b;</span> <?php echo __('Géolocalisation'); ?></h3>
			<div id="worldmap"
				data-l10n-map="<?php echo __('Plan'); ?>"
				data-l10n-satellite="<?php echo __('Satellite'); ?>"
				data-layer="<?php echo $tpl['geolocation_default_layer']; ?>"
				data-lat="<?php echo $tpl['item']['geolocation_lat']; ?>"
				data-long="<?php echo $tpl['item']['geolocation_long']; ?>"
				data-zoom="<?php echo $tpl['geolocation_default_zoom']; ?>">
			</div>
			<ul>
				<li><?php echo $tpl['item']['geolocation_coords']; ?></li>
			<ul>
		</div>
<?php endif; ?>
<?php if ($tpl['item']['exif']) : ?>
		<div id="item_exif">
			<h3 class="icon"><span>&#xe903;</span> <?php echo __('Métadonnées EXIF'); ?></h3>
			<ul>
<?php foreach ($tpl['item']['exif'] as &$i) : ?>
				<li><span><?php echo $i['name']; ?></span> : <?php if (isset($i['link'])) : ?><a class="u" href="<?php echo $i['link']; ?>#content"><?php echo $i['value']; ?></a><?php else : ?><?php echo $i['value']; ?><?php endif; ?></li>
<?php endforeach; ?>
			</ul>
		</div>
<?php endif; ?>
<?php if ($tpl['item']['iptc']) : ?>
		<div id="item_iptc">
			<h3 class="icon"><span>&#xe926;</span> <?php echo __('Métadonnées IPTC'); ?></h3>
			<ul>
<?php foreach ($tpl['item']['iptc'] as &$i) : ?>
				<li><span><?php echo $i['name']; ?></span> : <?php if (isset($i['link'])) : ?><a class="u" href="<?php echo $i['link']; ?>#content"><?php echo $i['value']; ?></a><?php else : ?><?php echo $i['value']; ?><?php endif; ?></li>
<?php endforeach; ?>
			</ul>
		</div>
<?php endif; ?>
<?php if ($tpl['item']['xmp']) : ?>
		<div id="item_xmp">
			<h3 class="icon"><span>&#xe913;</span> <?php echo __('Métadonnées XMP'); ?></h3>
			<ul>
<?php foreach ($tpl['item']['xmp'] as &$i) : ?>
				<li><span><?php echo $i['name']; ?></span> : <?php if (isset($i['link'])) : ?><a class="u" href="<?php echo $i['link']; ?>#content"><?php echo $i['value']; ?></a><?php else : ?><?php echo $i['value']; ?><?php endif; ?></li>
<?php endforeach; ?>
			</ul>
		</div>
<?php endif; ?>
<?php if ($tpl['item']['tags']) : ?>
		<div id="item_tags">
			<h3 class="icon"><span>&#xf02c;</span> <?php echo __('Tags'); ?></h3>
			<ul>
<?php foreach ($tpl['item']['tags'] as &$i) : ?>
				<li><a href="<?php echo $i['link']; ?>#content"><?php echo $i['name']; ?></a></li>
<?php endforeach; ?>
			</ul>
		</div>
<?php endif; ?>
	</div>
	</div>
<?php if ($tpl['comments']) : ?>
	<div id="item_right">
	<div id="item_right_inner">
		<div id="item_comments">
			<div id="item_comments_messages">
				<h3 class="icon"><span>&#xe932;</span> <?php echo __('Commentaires'); ?> (<?php echo count($tpl['comments_messages']); ?>)</h3>
<?php if ($tpl['comments_messages']) : ?>
				<div id="item_comments_container" tabindex="-1">
<?php foreach ($tpl['comments_messages'] as &$i) : ?>
<?php if ($i['preview']) : ?>
					<div id="comment-form"></div>
					<p id="comment_preview"><?php echo __('Aperçu de votre commentaire.'); ?></p>
<?php endif; ?>
					<div class="comment" id="comment-<?php echo $i['id']; ?>" data-comment-id="<?php echo $i['id']; ?>" data-user-id="<?php echo $i['user']['id']; ?>">
						<div class="comment_top">
							<div class="comment_avatar"><?php if ($i['user']['link']) : ?><a href="<?php echo $i['user']['link']; ?>" tabindex="-1"><?php endif; ?><img alt="<?php printf(__('Avatar de %s'), $i['user']['name']); ?>" src="<?php echo $i['user']['avatar']; ?>"><?php if ($i['user']['link']) : ?></a><?php endif; ?></div>
							<div class="comment_infos">
								<div>
									<p class="comment_author">
										<span class="comment_name"><?php if ($i['user']['link']) : ?><a href="<?php echo $i['user']['link']; ?>"><?php endif; ?><?php echo $i['user']['name']; ?><?php if ($i['user']['link']) : ?></a><?php endif; ?></span>
<?php if ($i['user']['website']) : ?>
										<span class="comment_website">(<a href="<?php echo $i['user']['website']; ?>"><?php echo __('site'); ?></a>)</span>
<?php endif; ?>
									</p>
<?php if (!$i['preview'] && $i['user']['edit']) : ?>
									<p class="comment_edit">
										<a data-box="comment" title="<?php echo __('Éditer'); ?>" href="javascript:;">&#xe962;</a>
									</p>
<?php endif; ?>
								</div>
								<div>
									<p class="comment_date">
										<span><?php echo $i['date']; ?></span>
										<span><?php echo $i['date_short']; ?></span>
									</p>
									<p class="comment_num"><a href="#comment-<?php echo $i['id']; ?>">#<?php echo $i['num']; ?></a></p>
								</div>
							</div>
						</div>
						<p class="comment_message"><?php echo $tpl['format_comment']($i['message']); ?></p>
					</div>
<?php endforeach; ?>
				</div>
<?php else : ?>
				<p id="item_no_comment"><?php echo __('Aucun commentaire.'); ?></p>
<?php endif; ?>
			</div>
<?php if ($tpl['comments_add']) : ?>
			<div id="item_comments_add">
<?php if (!$tpl['comments_form']['preview']) : ?>
				<div id="comment-form"></div>
<?php endif; ?>
				<h3><?php echo __('Ajouter un commentaire'); ?></h3>
				<form action="<?php echo $tpl['current_url_pageless']; ?>#comment-form" method="post" class="standard" autocomplete="off">
<?php include(__DIR__ . '/report.tpl.php'); ?>

					<p class="field">
						<label for="f_email">Email :</label>
						<input maxlength="255" id="f_email" name="f_email" type="text">
					</p>
<?php if (!$tpl['user']['auth']) : ?>
					<p class="field<?php if ($tpl['comments_form']['field_error'] == 'author') : ?> field_error<?php endif; ?> required">
						<label for="author"><?php echo __('Auteur :'); ?></label>
						<input required class="large<?php if ($tpl['comments_form']['field_error'] == 'author') : ?> autofocus<?php endif; ?>" value="<?php echo $tpl['comments_form']['author']; ?>" maxlength="<?php echo $tpl['comments_form']['author_maxlength']; ?>" id="author" name="author" type="text">
					</p>
					<p class="field<?php if ($tpl['comments_form']['field_error'] == 'email') : ?> field_error<?php endif; ?> <?php if ($tpl['comments_form']['email_required']) : ?> required<?php endif; ?>">
						<label for="email"><?php echo __('Courriel (ne sera pas publié) :'); ?></label>
						<input<?php if ($tpl['comments_form']['email_required']) : ?> required<?php endif; ?> class="large<?php if ($tpl['comments_form']['field_error'] == 'email') : ?> autofocus<?php endif; ?>" value="<?php echo $tpl['comments_form']['email']; ?>" maxlength="<?php echo $tpl['comments_form']['email_maxlength']; ?>" id="email" name="email" type="email">
					</p>
					<p class="field<?php if ($tpl['comments_form']['field_error'] == 'website') : ?> field_error<?php endif; ?> <?php if ($tpl['comments_form']['website_required']) : ?> required<?php endif; ?>">
						<label for="website"><?php echo __('Site Web :'); ?></label>
						<input<?php if ($tpl['comments_form']['website_required']) : ?> required<?php endif; ?> class="large<?php if ($tpl['comments_form']['field_error'] == 'website') : ?> autofocus<?php endif; ?>" value="<?php echo $tpl['comments_form']['website']; ?>" maxlength="<?php echo $tpl['comments_form']['website_maxlength']; ?>" id="website" name="website" type="url">
					</p>
<?php endif; ?>
					<p class="field<?php if ($tpl['comments_form']['field_error'] == 'message') : ?> field_error<?php endif; ?><?php if (!$tpl['user']['auth']) : ?> required<?php endif; ?>">
						<label for="message">
							<?php echo __('Message :'); ?>
<?php if ($tpl['comments_emoji_picker']) : ?>
							<a data-box="emoji" id="item_comment_emoji_link" href="javascript:;" title="<?php echo __('Sélectionner un émoji'); ?>"><span class="emoji">&#x1F642;</span></a>
<?php endif; ?>
						</label>
						<textarea required maxlength="<?php echo $tpl['comments_form']['message_maxlength']; ?>"<?php if ($tpl['comments_form']['field_error'] == 'message') : ?> class="autofocus"<?php endif; ?> id="message" name="message" rows="8" cols="40"><?php echo $tpl['comments_form']['message']; ?></textarea>
					</p>
<?php if (!$tpl['user']['auth']) : ?>
					<p class="message_info"><?php echo __('Les champs marqués d\'un astérisque sont obligatoires.'); ?></p>
<?php endif; ?>
<?php if ($tpl['comments_form']['moderate']) : ?>
					<p class="message_info"><?php echo __('Les commentaires sont modérés.'); ?></p>
<?php endif; ?>
					<div id="submit">
						<p>
							<input name="anticsrf" type="hidden" value="<?php echo $tpl['anticsrf'](); ?>">
							<input class="button" name="preview" type="submit" value="<?php echo __('Prévisualiser'); ?>">
							<input class="button" name="comment" type="submit" value="<?php echo __('Envoyer'); ?>">
						</p>
<?php if (!$tpl['user']['auth']) : ?>
						<p id="item_comment_remember">
							<input<?php if ($tpl['comments_form']['remember']) : ?> checked<?php endif; ?> id="remember" name="remember" type="checkbox">
							<span><label for="remember"><?php echo __('Se souvenir de moi ?'); ?></label></span>
						</p>
<?php endif; ?>
					</div>
				</form>
			</div>
<?php elseif ($tpl['comments_add_deactivated']) : ?>
			<p class="message_info"><?php echo __('L\'ajout de commentaire est désactivé pour ce fichier.'); ?></p>
<?php else : ?>
			<p class="message_info"><?php echo __('Vous n\'avez pas l\'autorisation de poster un commentaire.'); ?></p>
<?php endif; ?>
<?php if (!empty($tpl['rss'])) : ?>
			<ul id="rss">
				<li><a title="<?php echo $tpl['rss']['comments']['title']; ?>" href="<?php echo $tpl['rss']['comments']['link']; ?>"><span>&#xe901;</span> <span><?php echo $tpl['rss']['comments']['link_text']; ?></span></a></li>
			</ul>
<?php endif; ?>
		</div>
	</div>
	</div>
<?php endif; ?>
</div>

<?php if (($display_item_pagination_bottom || $tpl['user']['admin']) && $tpl['pages']['count'] > 1) : ?>
<div data-option-display="item_pagination_bottom" id="pages_bottom"<?php if ($display_item_pagination_bottom) : ?> class="show"<?php endif; ?>>
<?php include('pagination.tpl.php'); ?>
</div>
<?php endif; ?>
