Bootstrap 5 updates continued

This commit is contained in:
Joey Kimsey
2024-12-14 06:15:47 -05:00
parent 41426fda4e
commit de6d608857
44 changed files with 439 additions and 389 deletions

View File

@ -0,0 +1,58 @@
<?php
/**
* app/plugins/contact/controllers/admin/contact.php
*
* This is the contact admin controller.
*
* @package TP Contact
* @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\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\Classes\AdminController;
use TheTempusProject\Models\Contact as ContactModel;
class Contact extends AdminController {
protected static $contact;
public function __construct() {
parent::__construct();
self::$title = 'Admin - Contact';
self::$contact = new ContactModel;
$view = Navigation::activePageSelect( 'nav.admin', '/admin/contact' );
Components::set( 'ADMINNAV', $view );
}
public function view( $id = null ) {
Views::view( 'contact.admin.view', self::$contact->findById( $id ) );
}
public function delete( $data = null ) {
if ( Input::exists( 'submit' ) ) {
$data = Input::post( 'F_' );
}
if ( self::$contact->delete( (array) $data ) ) {
Issues::add( 'success', 'contact deleted' );
} else {
Issues::add( 'error', 'There was an error with your request.' );
}
$this->index();
}
public function clear( $data = null ) {
self::$contact->clear();
$this->index();
}
public function index( $data = null ) {
Views::view( 'contact.admin.list', self::$contact->listPaginated() );
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* app/plugins/contact/controllers/contact.php
*
* This is the home controller for the contact plugin.
*
* @package TP Contact
* @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\Houdini\Classes\Issues;
use TheTempusProject\Classes\Controller;
use TheTempusProject\Classes\Forms;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Bedrock\Functions\Session;
use TheTempusProject\Hermes\Functions\Redirect;
use TheTempusProject\Models\Contact as ContactModel;
class Contact extends Controller {
protected static $contact;
public function index() {
self::$contact = new ContactModel;
self::$title = 'Contact - {SITENAME}';
self::$pageDescription = 'At {SITENAME}, we value our users\' input. You can provide any contact or suggestions using this form.';
if ( !Input::exists() ) {
return Views::view( 'contact.create' );
}
if ( !Forms::check( 'contact' ) ) {
Issues::add( 'error', [ 'There was an error with your form, please check your submission and try again.' => Check::userErrors() ] );
return Views::view( 'contact.create' );
}
$result = self::$contact->create( Input::post( 'name' ), Input::post( 'contactEmail' ), Input::post( 'entry' ) );
if ( $result ) {
Session::flash( 'success', 'Thank you! Your contact has been received.' );
Redirect::to( 'home/index' );
} else {
Issues::add( 'error', [ 'There was an error with your form, please check your submission and try again.' => Check::userErrors() ] );
}
}
}