* @link https://TheTempusProject.com * @license https://opensource.org/licenses/MIT [MIT LICENSE] */ namespace TheTempusProject\Controllers\Admin; use TheTempusProject\Classes\AdminController; use TheTempusProject\Bedrock\Functions\Input; use TheTempusProject\Houdini\Classes\Issues; use TheTempusProject\Houdini\Classes\Views; use TheTempusProject\Houdini\Classes\Navigation; use TheTempusProject\Houdini\Classes\Components; use TheTempusProject\Models\Bugreport as BugreportModel; class Bugreport extends AdminController { protected static $bugreport; public function __construct() { parent::__construct(); self::$bugreport = new BugreportModel; self::$title = 'Admin - Bug Reports'; $view = Navigation::activePageSelect( 'nav.admin', '/admin/bugreport' ); Components::set( 'ADMINNAV', $view ); } public function index( $data = null ) { Views::view( 'bugreport.admin.list', self::$bugreport->listPaginated() ); } public function view( $id = null ) { $data = self::$bugreport->findById( $id ); if ( $data !== false ) { return Views::view( 'bugreport.admin.view', $data ); } Issues::add( 'error', 'Report not found.' ); $this->index(); } public function delete( $data = null ) { if ( Input::exists( 'submit' ) ) { $data = Input::post( 'BR_' ); } if ( self::$bugreport->delete( (array) $data ) ) { Issues::add( 'success', 'Bug Report Deleted' ); } else { Issues::add( 'error', 'There was an error with your request.' ); } $this->index(); } public function clear( $data = null ) { self::$bugreport->empty(); $this->index(); } }