/** * Leaderboards page * Shows hourly, daily & weekly leaderboards */ public function index() { $UserModel = UserModel::getInstance(); $leaderboardPastWeekArray = $UserModel->getTopUsersByMessageCount(50, "week"); $leaderboardPastDayArray = $UserModel->getTopUsersByMessageCount(50, "day"); $leaderboardPastHourArray = $UserModel->getTopUsersByMessageCount(50, "hour"); View::load("leaderboard", array("leaderboardWeekEntries" => $leaderboardPastWeekArray, "leaderboardDayEntries" => $leaderboardPastDayArray, "leaderboardHourEntries" => $leaderboardPastHourArray)); }
/** * Shows stats for the given user * * @param string nickname to get stats for */ public function user($nick) { $UserModel = UserModel::getInstance(); $ChannelModel = ChannelModel::getInstance(); if ($UserModel->getOnlineStatus($nick)) { $isOnline = "yes"; } View::load("userstats", array("online" => $isOnline, "nickname" => $nick, "hour" => array("messages" => $UserModel->getMessageCount($nick, "hour"), "words" => $UserModel->getWordCount($nick, "hour"), "wordsPerMessage" => $UserModel->getAverageWordsPerMessage($nick, "hour")), "day" => array("messages" => $UserModel->getMessageCount($nick, "day"), "words" => $UserModel->getWordCount($nick, "day"), "wordsPerMessage" => $UserModel->getAverageWordsPerMessage($nick, "day")), "week" => array("messages" => $UserModel->getMessageCount($nick, "week"), "words" => $UserModel->getWordCount($nick, "week"), "wordsPerMessage" => $UserModel->getAverageWordsPerMessage($nick, "week")), "latestUserMessages" => $ChannelModel->getLatestMessages(10, $nick))); }
public function profile() { $um = UserModel::getInstance(); $nick = $um->getLoggedInNick(); if (!$nick) { header("Location: " . Config::getVal("general", "app_url") . "/index.php/user/login"); } else { View::load('user/profile', array("nick" => $nick)); } }
* Index page for AwesomeIRCBotWeb * Includes all the library files and dispatches * the request to a controller * * Copyright (c) 2011, Jack Harley * All Rights Reserved */ session_start(); error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); ini_set("display_errors", "On"); date_default_timezone_set('UTC'); require_once __DIR__ . "/lib/hydrogen/hydrogen.inc.php"; require_once __DIR__ . "/lib/awesomeircbotweb/awesomeircbotweb.inc.php"; use hydrogen\controller\Dispatcher; use hydrogen\view\View; use hydrogen\config\Config; use hydrogen\errorhandler\ErrorHandler; use awesomeircbotweb\models\UserModel; use awesomeircbotweb\models\ChannelModel; ErrorHandler::attachErrorPage(); View::setVar("channel", Config::getVal("general", "channel")); View::setVar("ircAddress", Config::getVal("general", "irc_network_address")); $um = UserModel::getInstance(); $nick = $um->getLoggedInNick(); if ($nick) { View::setVar("loggedInUser", $nick); } Dispatcher::addHomeMatchRule("\\awesomeircbotweb\\controllers\\HomeController", "index"); Dispatcher::addPathInfoAutoMapRule("\\awesomeircbotweb\\controllers", "Controller"); Dispatcher::addMatchAllRule("\\awesomeircbotweb\\controllers\\ErrorController", "notFound"); Dispatcher::dispatch();