Initial commit
This commit is contained in:
43
app/plugins/dice/controllers/dice.php
Normal file
43
app/plugins/dice/controllers/dice.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/dice/controllers/dice.php
|
||||
*
|
||||
* This is the home controller for the dice plugin.
|
||||
*
|
||||
* @package TP Dice
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @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' );
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user