Repair member list page

This commit is contained in:
Léo Serre 2018-10-18 23:13:39 +02:00
parent 0f00e4d991
commit 53aae22a60
3 changed files with 19 additions and 23 deletions

View File

@ -208,8 +208,7 @@ if(isset($controller->splitted_url[1])) {
$i = 0; $i = 0;
foreach ($users->ids as $row) { foreach ($users->ids as $row) {
$user_list[$i] = new User(); $user_list[$i] = new User();
$user_list[$i]->id = $row; $user_list[$i]->checkID($row);
$user_list[$i]->populate();
$i++; $i++;
} }

View File

@ -45,10 +45,7 @@ class Locale
/***** /*****
** Populate the object using raw data from SQL ** Populate the object using raw data from SQL
*****/ *****/
private function populate($row) { public function populate($row) {
$this->forcePopulate($row);
}
public function forcePopulate($row) {
$this->name = $row['name']; $this->name = $row['name'];
$this->display_name = $row['display_name']; $this->display_name = $row['display_name'];
$this->flag_name = $row['flag_name']; $this->flag_name = $row['flag_name'];
@ -98,7 +95,7 @@ class Locales
for($i = 0; $i < $this->number; $i++) { for($i = 0; $i < $this->number; $i++) {
$locale = pg_fetch_assoc($result, $i); $locale = pg_fetch_assoc($result, $i);
$this->objs[$i] = new Locale; $this->objs[$i] = new Locale;
$this->objs[$i]->forcePopulate($locale); $this->objs[$i]->populate($locale);
} }
} }
} }

View File

@ -15,41 +15,41 @@
<tr class="first"> <tr class="first">
<th> <th>
<a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=name&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Nom d'utilisateur</a> <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="fa fa-caret-down" aria-hidden="true"></i>':'<i class="fa fa-caret-up" aria-hidden="true"></i>':''?> <?=$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>
<th> <th>
<a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=role&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Rôle</a> <a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=rank&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Rôle</a>
<?=$orderby=='role'?$order=='ASC'?'<i class="fa fa-caret-down" aria-hidden="true"></i>':'<i class="fa fa-caret-up" aria-hidden="true"></i>':''?> <?=$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>
<th> <th>
<a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=registered&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Inscription</a> <a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=register_date&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Inscription</a>
<?=$orderby=='registered'?$order=='ASC'?'<i class="fa fa-caret-down" aria-hidden="true"></i>':'<i class="fa fa-caret-up" aria-hidden="true"></i>':''?> <?=$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>
<th> <th>
<a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=lastlogin&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Dernière visite</a> <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=='lastlogin'?$order=='ASC'?'<i class="fa fa-caret-down" aria-hidden="true"></i>':'<i class="fa fa-caret-up" aria-hidden="true"></i>':''?> <?=$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>
<th> <th>
<a href="<?=$config['rel_root_folder']?>user/member_list/<?=$page+1?>?orderby=website&amp;order=<?=$order=='ASC'?'DESC':'ASC'?>">Site internet</a> <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="fa fa-caret-down" aria-hidden="true"></i>':'<i class="fa fa-caret-up" aria-hidden="true"></i>':''?> <?=$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> </th>
</tr> </tr>
<? foreach ($user_list as $row) { ?> <? foreach ($user_list as $row) { ?>
<tr> <tr>
<td> <td>
<? if ($row->avatar=='t') { ?> <? if ($row->is_avatar_present=='t') { ?>
<img alt="Avatar" class="icon avatar" src="<?=$config['rel_root_folder']?>medias/avatars/<?=$row->id?>_s.jpg"> <img alt="Avatar" class="icon avatar" src="<?=$config['rel_root_folder']?>medias/avatars/<?=$row->id?>_s.jpg">
<? } else { ?> <? } else { ?>
<i class="icon fa fa-user-secret"></i> <i class="icon fas fa-user-secret"></i>
<? } ?> <? } ?>
<a class="username" href="<?=$config['rel_root_folder']?>user/p/<?=$row->id?>"><?=$row->name?></a> <a class="username" href="<?=$config['rel_root_folder']?>user/p/<?=$row->id?>"><?=$row->name?></a>
</td> </td>
<td><?=$row->role()?></td> <td><?=$row->get_rank()?></td>
<td><? echo strftime('%e %B %G',strtotime($row->registered)) ?></td> <td><? echo strftime('%e %B %G',strtotime($row->register_date)) ?></td>
<td><? echo strftime('%e %B %G',strtotime($row->lastlogin)) ?></td> <td><? echo strftime('%e %B %G',strtotime($row->visit_date)) ?></td>
<td> <td>
<? if ($row->website != "") { ?> <? if ($row->website != "") { ?>
<a target="_blank" href="<?=$row->website?>">Site internet <span class="external-link"><i class="fa fa-external-link"></i></span></a> <a target="_blank" href="<?=$row->website?>">Site internet <span class="external-link"><i class="fas fa-external-link-alt"></i></span></a>
<? } ?> <? } ?>
</td> </td>
</tr> </tr>
@ -57,8 +57,8 @@
</table> </table>
<div class="pagebuttons"> <div class="pagebuttons">
<? if ($page != 0) { ?><a class="previous" href="<?=$config['rel_root_folder']?>user/member_list/<?=$page?>?orderby=<?=$orderby?>&amp;order=<?=$order?>"><i class="fa fa-chevron-left fa-fw"></i></a><? } <? 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><? }
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="fa fa-chevron-right fa-fw"></i></a><? } ?> 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><? } ?>
</div> </div>