Exemplo 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);
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
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);
 }