<?php include('pagination.tpl.php'); ?>

<div id="obj_links_js">
	<form>
		<a class="js show_all" href="javascript:;"><?php echo __('Tout montrer'); ?></a>
		<span class="sep">-</span>
		<a class="js hide_all" href="javascript:;"><?php echo __('Tout cacher'); ?></a>
	</form>
<?php include('object_select.tpl.php'); ?>
</div>

<form<?php if ($tpl['options']['thumbs_size'][1]['selected']) : ?> class="large"<?php endif; ?> id="obj_form" action="<?php echo $tpl['current_url']; ?>" method="post">
<?php foreach ($tpl['items'] as &$i) : ?>
	<div id="obj_<?php echo $i['id']; ?>" class="selectable_class obj obj_pending<?php if (isset($_POST['selected'][$i['id']])) : ?> selected<?php endif; ?>">
		<div class="obj_body">
			<div class="obj_image">
				<a class="viewer" href="<?php echo $i['link']; ?>">
<?php if ($i['type'] == 'video') : ?>					
					<span class="duration" id="videoduration_<?php echo $i['id']; ?>"><?php echo $i['duration_text']; ?></span>
<?php endif; ?>
					<img alt="<?php echo __('Vignette'); ?>"
<?php if ($i['type'] == 'video') : ?>
						data-video-id="<?php echo $i['id']; ?>"
<?php endif; ?>
						src="<?php echo $i['thumb_src'](); ?>">
				</a>
			</div>
			<div class="obj_infos">
				<div class="obj_basics">
					<p class="obj_title">
						<span class="obj_title_link">
							<a class="viewer" href="<?php echo $i['link']; ?>"><?php echo $i['title']; ?></a>
						</span>
					</p>
					<p class="obj_status">
						<?php echo $i['status_text']; ?>
					</p>
				</div>
				<div class="obj_details">
					<p class="obj_links">
						<span class="icon icon_stats show_parts"><a data-id="obj_fold_stats_<?php echo $i['id']; ?>" class="js" href="javascript:;"><?php echo __('Statistiques'); ?></a></span>
					</p>
					<p class="obj_cat">
						<?php echo $i['type_text']; ?>
					</p>
				</div>
			</div>
			<div class="obj_checkbox selectable_zone">
				<input<?php if (isset($_POST['selected'][$i['id']])) : ?> checked<?php endif; ?> class="selectable" name="selected[<?php echo $i['id']; ?>]" type="checkbox">
			</div>
		</div>
		<div class="obj_fold obj_fold_stats" id="obj_fold_stats_<?php echo $i['id']; ?>">
			<table class="light">
				<tr>
					<td><?php echo __('Album'); ?></td>
					<td class="num"><a href="<?php echo $i['album_link']; ?>"><?php echo $i['album_name']; ?></a></td>
				</tr>
				<tr>
					<td><?php echo __('Type de fichier'); ?></td>
					<td class="num"><?php echo $i['type_text']; ?></td>
				</tr>
				<tr>
					<td><?php echo __('Poids'); ?></td>
					<td class="num"><?php echo $i['filesize_formated']; ?></td>
				</tr>
				<tr>
					<td><?php echo __('Dimensions'); ?></td>
					<td class="num"><?php echo $i['width']; ?> x <?php echo $i['height']; ?></td>
				</tr>
<?php if ($i['type'] == 'video') : ?>
				<tr>
					<td><?php echo __('Durée'); ?></td>
					<td class="num"><?php echo $i['duration']; ?></td>
				</tr>
<?php endif; ?>
				<tr>
					<td><?php echo __('Date d\'envoi'); ?></td>
					<td class="num"><?php echo $i['adddt_formated']; ?></td>
				</tr>
				<tr>
					<td><?php echo __('Utilisateur'); ?></td>
					<td class="num"><a href="<?php echo $i['user_link']; ?>"><?php echo $i['user_nickname']; ?></a></td>
				</tr>
				<tr>
					<td><?php echo __('IP'); ?></td>
					<td class="num"><?php echo $i['ip']; ?></td>
				</tr>
			</table>
		</div>
	</div>
<?php endforeach; ?>

	<div id="submit" class="submit_actions<?php if ($tpl['nb_pages'] > 1) : ?> submit_pages<?php endif; ?>">
		<div>
			<p id="form_actions">
				<label for="selection_action"><?php printf(__('Action sur la sélection (%s) :'), '<span id="select_num">' . (empty($_POST['selected']) ? 0 : count($_POST['selected'])) . '</span>'); ?></label>
				<select id="selection_action" name="action">
					<optgroup label="<?php echo __('État'); ?>">
						<option value="activate"><?php echo __('Ajouter à la galerie et activer'); ?></option>
						<option value="deactivate"><?php echo __('Ajouter à la galerie et désactiver'); ?></option>
					</optgroup>
					<optgroup label="<?php echo __('Suppression'); ?>">
						<option value="delete_confirm"><?php echo __('Supprimer'); ?></option>
					</optgroup>
				</select>
				<input name="anticsrf" type="hidden" value="<?php echo $tpl['anticsrf'](); ?>">
				<input name="selection" type="submit" value="<?php echo __('Valider'); ?>">
			</p>
		</div>
	</div>
</form>

<?php include('pagination.tpl.php'); ?>

<script nonce="<?php echo CSP_NONCE; ?>" type="text/javascript">
var confirm_delete = "<?php echo $tpl['php2js'](__('Supprimer les fichiers sélectionnés ?')); ?>";
</script>