コード例 #1
0
 public function load()
 {
     BGGData::getUserInfos();
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     BGGData::getDetailOwned($arrayRawGamesOwned);
     BGGData::getGamesAndExpansionsOwned();
     BGGData::getGamesRated();
     BGGData::getPlays();
 }
コード例 #2
0
 public function ajaxTableLastAcquisition($username, $page)
 {
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     $arrayGamesDetails = BGGData::getDetailOwned($arrayRawGamesOwned);
     $arrayRawGamesAndExpansionsOwned = BGGData::getGamesAndExpansionsOwned();
     Stats::getCollectionArrays($arrayRawGamesOwned);
     Stats::getOwnedRelatedArrays($arrayGamesDetails);
     Stats::getAcquisitionRelatedArrays($arrayRawGamesAndExpansionsOwned);
     $params['lastAcquisition'] = $this->getLastAcquisition($page);
     $params['userinfo'] = UserInfos::getUserInformations(BGGData::getUserInfos());
     return \View::make('partials.lines-table-last-games-acquisition', $params);
 }
コード例 #3
0
 public function game($username, $idGame)
 {
     $paramsMenu = Page::getMenuParams();
     $arrayRawUserInfos = BGGData::getUserInfos();
     $arrayUserInfos = UserInfos::getUserInformations($arrayRawUserInfos);
     $params['userinfo'] = $arrayUserInfos;
     $arrayGameDetail = BGGData::getDetailOfGame($idGame);
     $arrayGameDetail = Stats::convertBggDetailInfo($arrayGameDetail);
     $arrayGameDetail = array_merge($arrayGameDetail, Stats::getDetailInfoGame($arrayGameDetail));
     $arrayRawGamesPlays = BGGData::getPlays();
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     $arrayGamesDetails = BGGData::getDetailOwned($arrayRawGamesOwned);
     $arrayRawGamesAndExpansionsOwned = BGGData::getGamesAndExpansionsOwned();
     Stats::getCollectionArrays($arrayRawGamesOwned);
     Stats::getOwnedRelatedArrays($arrayGamesDetails);
     Stats::getOwnedExpansionLink($arrayRawGamesAndExpansionsOwned);
     if (isset($GLOBALS['data']['gamesCollection'][$idGame])) {
         $arrayGameDetail['collection'] = $GLOBALS['data']['gamesCollection'][$idGame];
     }
     Stats::getPlaysRelatedArrays($arrayRawGamesPlays);
     if (isset($GLOBALS['data']['arrayTotalPlays'][$idGame])) {
         $arrayGameDetail['numplays'] = count($GLOBALS['data']['arrayTotalPlays'][$idGame]);
         $allPlays = $GLOBALS['data']['arrayTotalPlays'][$idGame]['plays'];
         if ($allPlays) {
             uasort($allPlays, 'App\\Lib\\Utility::compareDate');
             $arrayGameDetail['lastPlayed']['date'] = $allPlays[0]['date'];
             $arrayGameDetail['lastPlayed']['since'] = Carbon::createFromTimestamp($allPlays[0]['date'])->diffForHumans();
             $arrayGameDetail['plays'] = $allPlays;
         } else {
             $arrayGameDetail['lastPlayed'] = '';
         }
     } else {
         $arrayGameDetail['numplays'] = 0;
         $arrayGameDetail['lastPlayed'] = '';
         $arrayGameDetail['plays'] = [];
     }
     $params['game'] = $arrayGameDetail;
     $params = array_merge($params, $paramsMenu);
     return \View::make('game', $params);
 }
コード例 #4
0
 public function tobuy()
 {
     $arrayRawUserInfos = BGGData::getUserInfos();
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     $arrayRawGamesPreviouslyOwned = BGGData::getGamesPreviouslyOwned();
     $arrayGamesDetails = BGGData::getDetailOwned($arrayRawGamesOwned);
     $arrayRawGamesRated = BGGData::getGamesRated();
     $arrayRawGamesPlays = BGGData::getPlays();
     $arrayGamesHot = BGGData::getHotWithDetails();
     $arrayUserInfos = UserInfos::getUserInformations($arrayRawUserInfos);
     Stats::getRatedRelatedArrays($arrayRawGamesRated);
     Stats::getCollectionArrays($arrayRawGamesOwned);
     Stats::getCollectionArrays($arrayRawGamesPreviouslyOwned, 'gamesPrevOwned');
     Stats::getOwnedRelatedArrays($arrayGamesDetails);
     Stats::getPlaysRelatedArrays($arrayRawGamesPlays);
     $params['userinfo'] = $arrayUserInfos;
     $gamesToBuy = [];
     // High rated
     $highRating = [];
     foreach ($GLOBALS['data']['gamesRated'] as $idGame => $ratedGame) {
         if (!isset($GLOBALS['data']['gamesCollection'][$idGame]) && !isset($GLOBALS['data']['gamesPrevOwned'][$idGame])) {
             $highRating[$idGame] = $ratedGame;
         }
     }
     uasort($highRating, 'App\\Lib\\Utility::compareOrderRating');
     $highRating = array_slice($highRating, 0, 50, true);
     foreach ($highRating as &$game) {
         $game['weight'] = $game['rating'];
         $game['rating'] .= ' / 10';
     }
     Utility::normalizeArray($highRating, 'weight');
     $this->compileGameArray($gamesToBuy, $highRating, 'Bien classé', 1, 'rating');
     // Played frequently
     $playsFrequently = [];
     foreach ($GLOBALS['data']['arrayTotalPlays'] as $idGame => $game) {
         if (!isset($GLOBALS['data']['gamesCollection'][$idGame]) && !isset($GLOBALS['data']['gamesPrevOwned'][$idGame])) {
             $playsFrequently[$idGame] = $game;
         }
     }
     usort($playsFrequently, 'App\\Lib\\Utility::compareOrderNbPlayed');
     $playsFrequently = array_slice($playsFrequently, 0, 50, true);
     foreach ($playsFrequently as &$game) {
         $game['weight'] = $game['nbPlayed'];
         $game['nbPlayed'] .= ' parties';
     }
     Utility::normalizeArray($playsFrequently, 'weight');
     $this->compileGameArray($gamesToBuy, $playsFrequently, 'Joué souvent', 1, 'nbPlayed');
     // Game hot of the same author
     $gameWithDesignerHot = [];
     $mostDesigner = Graphs::getMostDesignerOwned();
     foreach ($arrayGamesHot as $idGame => $game) {
         if (!isset($GLOBALS['data']['gamesCollection'][$idGame]) && !isset($GLOBALS['data']['gamesPrevOwned'][$idGame])) {
             if (isset($game['detail']['boardgamedesigner'])) {
                 foreach ($game['detail']['boardgamedesigner'] as $hotDesigner) {
                     if (isset($mostDesigner[$hotDesigner['id']])) {
                         $gameWithDesignerHot[$idGame] = $game;
                         $gameWithDesignerHot[$idGame]['weight'] = $mostDesigner[$hotDesigner['id']]['nbOwned'];
                         $gameWithDesignerHot[$idGame]['designer'] = $mostDesigner[$hotDesigner['id']]['name'];
                     }
                 }
             }
         }
     }
     Utility::normalizeArray($gameWithDesignerHot, 'weight');
     $this->compileGameArray($gamesToBuy, $gameWithDesignerHot, 'Jeu d\'un auteur apprécié', 1, 'designer');
     usort($gamesToBuy, 'App\\Lib\\Utility::compareOrderWeight');
     $params['games'] = $gamesToBuy;
     return \View::make('rapports_tobuy', $params);
 }
コード例 #5
0
 /**
  * @param $username
  * @param $page
  */
 public function ajaxMostTypePrevious($username, $page)
 {
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     $arrayGamesDetails = BGGData::getDetailOwned($arrayRawGamesOwned);
     Stats::getCollectionArrays($arrayRawGamesOwned);
     Stats::getOwnedRelatedArrays($arrayGamesDetails);
     $mostType = Graphs::getMostType($page);
     echo json_encode($mostType);
 }