Exemplo n.º 1
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);
 }
Exemplo n.º 2
0
 public function home()
 {
     $paramsMenu = Page::getMenuParams();
     $arrayRawUserInfos = BGGData::getUserInfos();
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     $arrayGamesDetails = BGGData::getDetailOwned($arrayRawGamesOwned);
     $arrayRawGamesAndExpansionsOwned = BGGData::getGamesAndExpansionsOwned();
     $arrayRawGamesPlays = BGGData::getPlays();
     Stats::getPlaysRelatedArrays($arrayRawGamesPlays);
     Stats::getCollectionArrays($arrayRawGamesOwned);
     Stats::getOwnedRelatedArrays($arrayGamesDetails);
     Stats::getAcquisitionRelatedArrays($arrayRawGamesAndExpansionsOwned);
     $params['lastPlayed'] = $this->getLastPlays();
     if (SessionManager::ifLoginAsSelf()) {
         $params['lastAcquisition'] = $this->getLastAcquisition();
     } else {
         $params['lastAcquisition'] = [];
     }
     $arrayUserInfos = UserInfos::getUserInformations($arrayRawUserInfos);
     $params['userinfo'] = $arrayUserInfos;
     $params = array_merge($params, $paramsMenu);
     return \View::make('summary', $params);
 }
Exemplo n.º 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);
 }
Exemplo n.º 4
0
 public function annuel()
 {
     $paramsMenu = Page::getMenuParams();
     $arrayRawUserInfos = BGGData::getUserInfos();
     $arrayRawGamesAndExpansionsOwned = BGGData::getGamesAndExpansionsOwned();
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     $arrayUserInfos = UserInfos::getUserInformations($arrayRawUserInfos);
     $arrayRawGamesPlays = BGGData::getPlays();
     $arrayRawGamesRated = BGGData::getGamesRated();
     Stats::getPlaysRelatedArrays($arrayRawGamesPlays);
     Stats::getAcquisitionRelatedArrays($arrayRawGamesAndExpansionsOwned);
     Stats::getRatedRelatedArrays($arrayRawGamesRated);
     Stats::getCollectionArrays($arrayRawGamesOwned);
     $allPlays = 0;
     $params['yearSelected'] = '';
     $params['listYear'] = [];
     $params['table'] = [];
     $params['stats'] = [];
     $firstYear = (int) $GLOBALS['data']['firstDatePlayRecorded']->format('Y');
     for ($i = date('Y'); $i >= $firstYear; $i--) {
         $params['listYear'][$i] = $i;
     }
     $params['userinfo'] = $arrayUserInfos;
     if (Input::get('year')) {
         $yearSelected = Input::get('year');
         $firstTryGame = 0;
         if (isset($GLOBALS['data']['arrayPlaysByYear'][$yearSelected])) {
             $gamesFirstTryAndRated = [];
             $gamesCollectionNotPlayed = [];
             foreach ($GLOBALS['data']['arrayPlaysByYear'][$yearSelected] as $idGame => $gameInfo) {
                 $otherInformationsGame = $GLOBALS['data']['arrayTotalPlays'][$idGame];
                 $dtoGames[$idGame] = ['nbPlayed' => $gameInfo['nbPlayed'], 'otherInfo' => $otherInformationsGame];
                 $allPlays += $gameInfo['nbPlayed'];
                 if (date('Y', $GLOBALS['data']['arrayTotalPlays'][$idGame]['firstPlay']) == $yearSelected) {
                     if (isset($GLOBALS['data']['gamesRated'][$idGame])) {
                         $gamesFirstTryAndRated[$idGame] = $GLOBALS['data']['gamesRated'][$idGame];
                     }
                     $firstTryGame++;
                 }
             }
             foreach ($GLOBALS['data']['gamesCollection'] as $idGame => $gameInfo) {
                 if (!isset($GLOBALS['data']['arrayPlaysByYear'][$yearSelected][$idGame])) {
                     $gamesCollectionNotPlayed[$idGame] = $gameInfo;
                     $gamesCollectionNotPlayed[$idGame]['rating'] = '';
                     if (isset($GLOBALS['data']['gamesRated'][$idGame])) {
                         $gamesCollectionNotPlayed[$idGame]['rating'] = $GLOBALS['data']['gamesRated'][$idGame]['rating'];
                     }
                 }
             }
             $nbGameCollectionPlayAtLeastOnce = count($GLOBALS['data']['gamesCollection']) - count($gamesCollectionNotPlayed);
             // First try and rated
             uasort($gamesFirstTryAndRated, 'App\\Lib\\Utility::compareOrderRating');
             $gamesFirstTryAndRated = array_slice($gamesFirstTryAndRated, 0, 20, true);
             // Most plays this year
             uasort($dtoGames, 'App\\Lib\\Utility::compareOrderNbPlayed');
             $dtoGames = array_slice($dtoGames, 0, 30, true);
             $params['table']['firstTryAndGoodRated'] = $gamesFirstTryAndRated;
             $params['table']['mostPlaysThisYear'] = $dtoGames;
             $params['table']['gameCollectionNotPlayed'] = $gamesCollectionNotPlayed;
             $params['stats']['playTotal'] = $allPlays;
             $params['stats']['percentNewGame'] = round($firstTryGame / count($GLOBALS['data']['arrayPlaysByYear'][$yearSelected]) * 100) . ' % (' . $firstTryGame . ' / ' . count($GLOBALS['data']['arrayPlaysByYear'][$yearSelected]) . ')';
             $params['stats']['playDifferentTotal'] = count($GLOBALS['data']['arrayPlaysByYear'][$yearSelected]);
         }
         $params['stats']['percentGameCollectionPlayed'] = round($nbGameCollectionPlayAtLeastOnce / count($arrayRawGamesOwned['item']) * 100);
         $params['yearSelected'] = $yearSelected;
     }
     $params = array_merge($paramsMenu, $params);
     return \View::make('rapports_annuel', $params);
 }
Exemplo n.º 5
0
 public function login()
 {
     $paramsMenu = Page::getMenuParams();
     return \View::make('login', $paramsMenu);
 }
Exemplo n.º 6
0
 public function home()
 {
     $paramsMenu = Page::getMenuParams();
     // Games owned
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     Stats::getCollectionArrays($arrayRawGamesOwned);
     Stats::getOwnedRelatedArrays(BGGData::getDetailOwned($arrayRawGamesOwned));
     unset($arrayRawGamesOwned);
     // Games and expansions owned
     Stats::getAcquisitionRelatedArrays(BGGData::getGamesAndExpansionsOwned());
     // Games played
     Stats::getPlaysRelatedArrays(BGGData::getPlays());
     // Games rated
     Stats::getRatedRelatedArrays(BGGData::getGamesRated());
     // User infos
     $arrayUserInfos = UserInfos::getUserInformations(BGGData::getUserInfos());
     $totalPlayGameCollection = 0;
     $totalGameOwnedNotPlayed = 0;
     foreach ($GLOBALS['data']['gamesCollection'] as $idGame => $game) {
         if (isset($GLOBALS['data']['arrayTotalPlays'][$idGame])) {
             $totalPlayGameCollection += $GLOBALS['data']['arrayTotalPlays'][$idGame]['nbPlayed'];
         } else {
             $totalGameOwnedNotPlayed++;
         }
     }
     $params['userinfo'] = $arrayUserInfos;
     $params['stats']['nbGamesOwned'] = count($GLOBALS['data']['gamesCollection']);
     $params['stats']['nbGamesAndExpansionsOwned'] = $GLOBALS['data']['nbGamesAndExpansionsOwned'];
     $params['stats']['nbPlaysTotal'] = $GLOBALS['data']['countAllPlays'];
     $params['stats']['nbPlaysDifferentGame'] = count($GLOBALS['data']['arrayTotalPlays']);
     $params['stats']['averagePlayByMonth'] = 0;
     $params['stats']['averagePlayDifferentByMonth'] = 0;
     if (count($GLOBALS['data']['arrayPlaysByMonth']) > 0) {
         $params['stats']['averagePlayByMonth'] = round($GLOBALS['data']['countAllPlays'] / count($GLOBALS['data']['arrayPlaysByMonth']));
         $params['stats']['averagePlayDifferentByMonth'] = round(count($GLOBALS['data']['arrayTotalPlays']) / count($GLOBALS['data']['arrayPlaysByMonth']));
     }
     $params['stats']['hindex'] = $GLOBALS['data']['hindex'];
     $params['stats']['averageAcquisitionByMonth'] = '';
     if (SessionManager::ifLoginAsSelf()) {
         if (count($GLOBALS['data']['acquisitionsByMonth']) > 0) {
             $params['stats']['averageAcquisitionByMonth'] = round($GLOBALS['data']['totalWithAcquisitionDate'] / count($GLOBALS['data']['acquisitionsByMonth']));
         }
     }
     $params['stats']['averageValueGames'] = '';
     $params['stats']['totalValueGames'] = '';
     if (SessionManager::ifLoginAsSelf()) {
         if (count($GLOBALS['data']['arrayValuesGames']) > 0) {
             $params['stats']['averageValueGames'] = Utility::displayMoney($GLOBALS['data']['totalGamesValue'] / count($GLOBALS['data']['arrayValuesGames']));
         }
         $params['stats']['totalValueGames'] = Utility::displayMoney($GLOBALS['data']['totalGamesValue']);
     }
     $params['stats']['nbPlayAveragePlayCollectionGame'] = round($totalPlayGameCollection / count($GLOBALS['data']['gamesCollection']), 2);
     $params['stats']['nbPlayAverageByDay'] = 0;
     $params['stats']['nbPlayDifferentAverageByDay'] = 0;
     if (isset($GLOBALS['data']['nbDaysSinceFirstPlay'])) {
         $params['stats']['nbPlayAverageByDay'] = round($GLOBALS['data']['countAllPlays'] / $GLOBALS['data']['nbDaysSinceFirstPlay'], 2);
         $params['stats']['nbPlayDifferentAverageByDay'] = round(count($GLOBALS['data']['arrayTotalPlays']) / $GLOBALS['data']['nbDaysSinceFirstPlay'], 2);
     }
     $params['stats']['nbGameOwnedNotPlayed'] = $totalGameOwnedNotPlayed;
     if (count($GLOBALS['data']['gamesCollection']) > 0) {
         $params['stats']['percentGameOwnedNotPlayed'] = Utility::displayPercent(round($totalGameOwnedNotPlayed / count($GLOBALS['data']['gamesCollection']) * 100, 2));
     }
     $params['graphs']['byMonth'] = Graphs::getPlayByMonth();
     $params['graphs']['byYear'] = Graphs::getPlayByYear();
     $params['graphs']['byDayWeek'] = Graphs::getPlayByDayWeek();
     $params['graphs']['mostPlayed'] = Graphs::getMostPlayed();
     $params['graphs']['nbPlayer'] = Graphs::getNbPlayerCollection();
     $params['graphs']['acquisitionByMonth'] = Graphs::getAcquisitionByMonth();
     $params['graphs']['mostType'] = Graphs::getMostType();
     $params['graphs']['playsByRating'] = Graphs::getPlayByRating();
     $params['graphs']['playsByLength'] = Graphs::getPlayByLength();
     $params['table']['ownedTimePlayed'] = Graphs::getOwnedTimePlayed();
     $params['table']['mostDesigner'] = Graphs::getMostDesignerOwned();
     $params['table']['ownedRentable'] = Graphs::getOwnedRentable();
     $params = array_merge($params, $paramsMenu);
     return \View::make('stats', $params);
 }