44 lines
1.5 KiB
PHP
44 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* app/plugins/initiativetracker/controllers/initiative.php
|
|
*
|
|
* This is the home controller for the initiativetracker plugin.
|
|
*
|
|
* @package TP InitiativeTracker
|
|
* @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\Inithistory;
|
|
use TheTempusProject\Houdini\Classes\Issues;
|
|
use TheTempusProject\Houdini\Classes\Components;
|
|
use TheTempusProject\TheTempusProject as App;
|
|
|
|
class Initiative extends Controller {
|
|
protected static $initiativeHistory;
|
|
|
|
public function __construct() {
|
|
self::$title = 'Initiative Tracker - {SITENAME}';
|
|
self::$pageDescription = 'This is for tracking player and creature turns and initiatives.';
|
|
self::$initiativeHistory = new Inithistory;
|
|
if ( ! App::$isLoggedIn ) {
|
|
Issues::add( 'info', 'If you register an account and log in, you can save your initiatives.' );
|
|
Components::set( 'initiativeHistory', '' );
|
|
} else {
|
|
$history = self::$initiativeHistory->userHistory();
|
|
$historyView = Views::simpleView( 'initiativetracker.historyElement', $history );
|
|
Components::set( 'initiativeHistory', $historyView );
|
|
}
|
|
parent::__construct();
|
|
}
|
|
|
|
public function index() {
|
|
Views::view( 'initiativetracker.index' );
|
|
}
|
|
}
|