Esempio n. 1
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);
 }
Esempio n. 2
0
 public function home()
 {
     $params = [];
     if (SessionManager::ifBggInfo()) {
         $arrayRawUserInfos = BGGData::getUserInfos();
         $arrayBuddies = UserInfos::formatArrayUserInfo($arrayRawUserInfos, 'buddies', 'buddy');
         $arrayGamesTop = UserInfos::formatArrayUserInfo($arrayRawUserInfos, 'top', 'item');
         $arrayUserInfos = UserInfos::getUserInformations($arrayRawUserInfos);
         $params['userinfo'] = $arrayUserInfos;
         $params['userinfo']['lists']['buddies'] = $arrayBuddies;
         $params['userinfo']['lists']['topGames'] = $arrayGamesTop;
     }
     $paramsMenu = Page::getMenuParams();
     $params = array_merge($params, $paramsMenu);
     return \View::make('home', $params);
 }
 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);
 }
 public function compare()
 {
     $compareUsername = $_GET['compare'];
     $arrayRawUserInfos = BGGData::getUserInfos();
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     $arrayRawGamesPlays = BGGData::getPlays();
     $arrayUserInfos = UserInfos::getUserInformations($arrayRawUserInfos);
     Stats::getCollectionArrays($arrayRawGamesOwned);
     $gamesOwnedOtherUser = BGGData::getGamesOwnedByUsername($compareUsername);
     Stats::getCollectionArrays($gamesOwnedOtherUser, 'gamesCompare');
     Stats::getPlaysRelatedArrays($arrayRawGamesPlays);
     $gamesInCommon = array_intersect_key($GLOBALS['data']['gamesCompare'], $GLOBALS['data']['gamesCollection']);
     if (count($GLOBALS['data']['gamesCollection']) > 0 && count($GLOBALS['data']['gamesCompare']) > 0) {
         $similarity = round(count($gamesInCommon) / count($GLOBALS['data']['gamesCollection']) * 100, 2);
     } else {
         $similarity = 0;
     }
     $gamesNotPlayed = [];
     foreach ($GLOBALS['data']['gamesCompare'] as $idGame => $game) {
         if (!isset($GLOBALS['data']['arrayTotalPlays'][$idGame])) {
             $gamesNotPlayed[$idGame] = $game;
         }
     }
     usort($gamesNotPlayed, 'App\\Lib\\Utility::compareRatingBgg');
     if (count($GLOBALS['data']['gamesCompare']) > 0) {
         $percentCollection = round(count($gamesNotPlayed) / count($GLOBALS['data']['gamesCompare']) * 100, 2);
     }
     $params['compareinfo'] = ['username_compared' => $compareUsername, 'nb_collection' => count($GLOBALS['data']['gamesCollection']), 'nb_collection_compared' => count($GLOBALS['data']['gamesCompare'])];
     $params['userinfo'] = $arrayUserInfos;
     $params['gamesInCommon'] = ['correlation' => $similarity, 'games' => $gamesInCommon];
     $params['gamesNotPlayed'] = ['nbGames' => count($gamesNotPlayed), 'percentCollection' => $percentCollection, 'games' => $gamesNotPlayed];
     return \View::make('rapports_compare', $params);
 }
Esempio n. 5
0
 /**
  * @param $page
  */
 public function ajaxTableRentable($type, $username, $page)
 {
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     $arrayRawGamesPlays = BGGData::getPlays();
     $arrayRawGamesAndExpansionsOwned = BGGData::getGamesAndExpansionsOwned();
     $arrayRawUserInfos = BGGData::getUserInfos();
     Stats::getPlaysRelatedArrays($arrayRawGamesPlays);
     Stats::getCollectionArrays($arrayRawGamesOwned);
     Stats::getAcquisitionRelatedArrays($arrayRawGamesAndExpansionsOwned);
     $arrayUserInfos = UserInfos::getUserInformations($arrayRawUserInfos);
     $params['table']['ownedRentable'] = Graphs::getOwnedRentable($page);
     $params['type'] = $type;
     $params['userinfo'] = $arrayUserInfos;
     return \View::make('partials.lines-table-rentable', $params);
 }