public static function getCoutOfUser($bdd) { $allUser = User::getAllUser($bdd); $couts = []; foreach ($allUser as $user) { $userNotes = Note::getNotesByUser($bdd, $user['id']); $uDevise = Devise::getDeviseById($bdd, $user['devise_id']); $totalNote = 0; foreach ($userNotes as $note) { $totalNote += Note::getMontantTotal($bdd, $note['id'], $uDevise->getTaux()); } $couts[] = ["username" => $user['login'], "total" => $totalNote]; } usort($couts, function ($a, $b) { if ($a['total'] == $b['total']) { return 0; } return $a['total'] < $b['total'] ? 1 : -1; }); return array_slice($couts, 0, 10); }
<div class="statut-<?php echo $note['statut_id']; ?> note-<?php echo $note['id'] ?> note"> <div class="infos-note"> <div><?php echo $note['name']; ?><br/> <?php echo $noteUser->getName(); ?></div> <div><?php echo date("d-m-Y", strtotime($note['date'])); ?></div> <div> <?php // recupere et affiche le nom du statut $noteStatut->setId($note['statut_id']); $stat = $noteStatut->getStatutById($bdd); echo $stat['name']; ?> </div> <div> <?php $devise = Devise::getDeviseById($bdd, $sessionUser->getDevise()); echo '<span class="total-note">' . Note::getMontantTotal($bdd, $note['id'], $devise->getTaux()) . '</span> ' . $devise->getSigne(); ?> </div> <div class="actions"> <button class="note-<?php echo $note['id'] ?> btn btn-danger">Supprimer</button> <a class="btn btn-default" href="<?php echo $basePath. '?page=note&id=' . $note['id']; ?>">editer</a><br/> <a href="<?php echo $basePath . "?page=impression&id=" . $note['id']; ?>" class="btn btn-success">Imprimer</a> <button class="btn-show-frais btn btn-info" data-frais="list-frais-<?php echo $note['id'] ?>"><span class="glyphicon glyphicon-plus"></span> Frais (<span class="count-frais"><?php echo count($allFrais); ?></span>)</button> </div> </div> <div class="list-frais list-frais-<?php echo $note['id'] ?>"> <ul> <?php //boucle des frais de la note foreach ($allFrais as $frais) {