<!DOCTYPE html>
<!-- Page: member list -->
<html lang="fr">

	<?php include('blocks/d.head.html'); ?>

	<body>

		<?php include('blocks/d.nav.html'); ?>

		<!-- Member table -->
		<section id="member_list">
			<h1>Liste des membres</h1>
			<p class="subtitle">Membres <?=$first?> à <?=$last?> sur les <?=$users->number?> inscrits</p>

			<table>
				<tr class="first">
					<th>
						<a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=name&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Nom d'utilisateur</a>
						<?=$orderby=='name'?$order=='ASC'?'<i class="fas fa-caret-down" aria-hidden="true"></i>':'<i class="fas fa-caret-up" aria-hidden="true"></i>':''?>
					</th>
					<th>
						<a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=rank&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Rôle</a>
						<?=$orderby=='rank'?$order=='ASC'?'<i class="fas fa-caret-down" aria-hidden="true"></i>':'<i class="fas fa-caret-up" aria-hidden="true"></i>':''?>
					</th>
					<th>
						<a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=register_date&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Inscription</a>
						<?=$orderby=='register_date'?$order=='ASC'?'<i class="fas fa-caret-down" aria-hidden="true"></i>':'<i class="fas fa-caret-up" aria-hidden="true"></i>':''?>
					</th>
					<th>
						<a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=visit_date&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Dernière visite</a>
						<?=$orderby=='visit_date'?$order=='ASC'?'<i class="fas fa-caret-down" aria-hidden="true"></i>':'<i class="fas fa-caret-up" aria-hidden="true"></i>':''?>
					</th>
					<th>
						<a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=website&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Site internet</a>
						<?=$orderby=='website'?$order=='ASC'?'<i class="fas fa-caret-down" aria-hidden="true"></i>':'<i class="fas fa-caret-up" aria-hidden="true"></i>':''?>
					</th>
				</tr>
			<?php foreach ($users->objs as $row) { ?>
				<tr>
					<td>
						<?php if ($row->is_avatar_present=='t') { ?>
							<img alt="Avatar" class="icon avatar" src="<?=$config['rel_root_folder']?>medias/avatars/<?=$row->id?>_s.jpg">
						<?php } else { ?>
							<i class="icon fas fa-user-secret"></i>
						<?php } ?>
						<a class="username" href="<?=$config['rel_root_folder']?>user/p/<?=$row->id?>"><?=$row->name?></a>
					</td>
					<td><?=$row->get_rank()?></td>
					<td><?php echo datefmt_format($user->date_format,date_create($row->register_date, new DateTimeZone("UTC"))) ?></td>
					<td><?php echo datefmt_format($user->date_format,date_create($row->visit_date, new DateTimeZone("UTC"))) ?></td>
					<td>
						<?php if ($row->website != "") { ?>
						<a target="_blank" href="<?=$row->website?>">Site internet <span class="external-link"><i class="fas fa-external-link-alt"></i></span></a>
						<?php } ?>
					</td>
				</tr>
			<?php } ?>
			</table> 

			<div class="pagebuttons">
				<?php if ($page != 0) { ?><a class="previous" href="<?=$config['rel_root_folder']?>user/member_list/<?=$page?>?orderby=<?=$orderby?>&amp;order=<?=$order?>"><i class="fas fa-chevron-left fa-fw"></i></a><?php }
				if (($page+1)*$rows_per_pages < $users->number) { ?><a class="next" href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+2?>?orderby=<?=$orderby?>&amp;order=<?=$order?>"><i class="fas fa-chevron-right fa-fw"></i></a><?php } ?>
			</div>


		</section>

		<?php include('blocks/d.footer.html'); ?>

	</body>
</html>
