* @link https://TheTempusProject.com * @license https://opensource.org/licenses/MIT [MIT LICENSE] */ namespace TheTempusProject\Controllers; use TheTempusProject\Houdini\Classes\Views; use TheTempusProject\Classes\Controller; use TheTempusProject\Models\Dicehistory; use TheTempusProject\Houdini\Classes\Issues; use TheTempusProject\Houdini\Classes\Components; use TheTempusProject\TheTempusProject as App; class Dice extends Controller { protected static $diceHistory; public function __construct() { self::$title = 'Dice Rollers - {SITENAME}'; self::$pageDescription = 'These dice should be able to help you roll just about any combination you would encounter in normal play.'; self::$diceHistory = new Dicehistory; if ( ! App::$isLoggedIn ) { Issues::add( 'info', 'If you register an account and log in, you can save your dice roll history.' ); Components::set( 'diceHistory', '' ); } else { $history = self::$diceHistory->userHistory(); $historyView = Views::simpleView( 'dice.historyElement', $history ); Components::set( 'diceHistory', $historyView ); } parent::__construct(); } public function index() { Views::view( 'dice.index' ); } }