53 lines
1.6 KiB
PHP
53 lines
1.6 KiB
PHP
<?php
|
|
/**
|
|
* app/controllers/admin/home.php
|
|
*
|
|
* This is the admin dashboard controller.
|
|
*
|
|
* @version 3.0
|
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
* @link https://TheTempusProject.com
|
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
*/
|
|
namespace TheTempusProject\Controllers\Admin;
|
|
|
|
use TheTempusProject\Houdini\Classes\Views;
|
|
use TheTempusProject\Houdini\Classes\Components;
|
|
use TheTempusProject\Classes\AdminController;
|
|
use TheTempusProject\Models\User;
|
|
use TheTempusProject\Plugins\Comments;
|
|
use TheTempusProject\Plugins\Blog;
|
|
|
|
class Home extends AdminController {
|
|
public static $user;
|
|
public static $comments;
|
|
public static $posts;
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
self::$title = 'Admin - Home';
|
|
}
|
|
|
|
public function index() {
|
|
if ( class_exists( 'TheTempusProject\Plugins\Comments' ) ) {
|
|
$comments = new Comments;
|
|
self::$comments = $comments->getModel();
|
|
$comments = Views::simpleView( 'comments.admin.dashboard', self::$comments->recent( 'all', 5 ) );
|
|
Components::set( 'commentDash', $comments );
|
|
}
|
|
|
|
if ( class_exists( 'TheTempusProject\Plugins\Blog' ) ) {
|
|
$blog = new Blog;
|
|
self::$posts = $blog->posts;
|
|
$posts = Views::simpleView( 'blog.admin.dashboard', self::$posts->recent( 5 ) );
|
|
Components::set( 'blogDash', $posts );
|
|
}
|
|
|
|
self::$user = new User;
|
|
$users = Views::simpleView( 'admin.dashboard.users', self::$user->recent( 5 ) );
|
|
Components::set( 'userDash', $users );
|
|
|
|
Views::view( 'admin.dashboard.dash' );
|
|
}
|
|
}
|