Files
thetempusproject/app/plugins/bugreport/controllers/admin/bugreport.php
Joey Kimsey d7e8b586d7 various updates
remove dependence on jQuery
add image delete
Admin ui fix for mobile
image updates to new style
update comments
2025-02-05 06:36:29 -05:00

64 lines
1.9 KiB
PHP

<?php
/**
* app/plugins/bugreport/controllers/admin/bugreport.php
*
* This is the bug report admin controller.
*
* @package TP BugReports
* @version 5.0.1
* @author Joey Kimsey <Joey@thetempusproject.com>
* @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();
}
}