/** * Listing Action. */ public function listAction() { $showPaginate = false; switch ($this->settings['listUsers']) { case 'activeUserWidget': $dataset['users'] = $this->frontendUserRepository->findByFilter((int) $this->settings['widgets']['activeUser']['limit'], ['postCountSession' => 'DESC', 'username' => 'ASC']); $partial = 'User/ActiveBox'; break; case 'helpfulUserWidget': $dataset['users'] = $this->frontendUserRepository->findByFilter((int) $this->settings['widgets']['helpfulUser']['limit'], ['helpfulCountSession' => 'DESC', 'username' => 'ASC']); $partial = 'User/HelpfulBox'; break; case 'onlineUserWidget': //NO DATA - Ajax Reload $dataset['count'] = 0; $partial = 'User/OnlineBox'; break; case 'rankingList': $dataset['ranks'] = $this->rankRepository->findAllForRankingOverview(); $partial = 'User/ListRanking'; break; case 'topUserList': $dataset['users'] = $this->frontendUserRepository->findTopUserByPoints(50); $partial = 'User/ListTopUser'; break; default: $dataset['users'] = $this->frontendUserRepository->findByFilter(0, array('username' => 'ASC')); $partial = 'User/List'; break; } $this->view->assign('showPaginate', $showPaginate); $this->view->assign('partial', $partial); $this->view->assign('dataset', $dataset); }
/** * Decrease the user's points. * * @param int $by The amount of points to be removed * * @return void */ public function decreasePoints($by) { $this->points = $this->points - $by; $currentRank = $this->getRank(); $rank = $this->rankRepository->findOneRankByPoints($this->getPoints()); if ($rank !== NULL && $rank != $currentRank) { $this->setRank($rank); $rank->increaseUserCount(); $currentRank->decreaseUserCount(); $this->rankRepository->update($currentRank); $this->rankRepository->update($rank); } }