This commit is contained in:
Joey Kimsey
2024-12-02 17:43:55 -05:00
parent 113499254b
commit de5530b1e3
95 changed files with 3192 additions and 509 deletions

View File

@ -0,0 +1,103 @@
<?php
/**
* app/plugins/resume/controllers/admin/resume.php
*
* This is the Resume admin controller.
*
* @package TP Resume
* @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\Check;
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\Classes\Forms;
use TheTempusProject\Models\Positions;
class Resume extends AdminController {
public static $positions;
public function __construct() {
parent::__construct();
self::$positions = new Positions;
self::$title = 'Admin - Resume';
$view = Navigation::activePageSelect( 'nav.admin', '/admin/resume' );
Components::set( 'ADMINNAV', $view );
}
public function index( $data = null ) {
Views::view( 'resume.admin.list', self::$positions->listPaginated() );
}
public function create( $data = null ) {
if ( !Input::exists( 'submit' ) ) {
return Views::view( 'resume.admin.create' );
}
if ( !Forms::check( 'newPosition' ) ) {
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
return $this->index();
}
$result = self::$positions->create( Input::post( 'name' ), Input::post( 'position' ), Input::post( 'start' ), Input::post( 'end' ), Input::post( 'details' ) );
if ( $result ) {
Issues::add( 'success', 'Your position has been created.' );
return $this->index();
} else {
Issues::add( 'error', [ 'There was an unknown error submitting your data.' => Check::userErrors() ] );
return $this->index();
}
}
public function edit( $data = null ) {
if ( !Input::exists( 'submit' ) ) {
return Views::view( 'resume.admin.edit', self::$positions->findById( $data ) );
}
if ( !Forms::check( 'editPosition' ) ) {
Issues::add( 'error', [ 'There was an error with your form.' => Check::userErrors() ] );
return $this->index();
}
$fields = [
'name' => Input::post( 'name' ),
'position' => Input::post( 'position' ),
'start' => Input::post( 'start' ),
'end' => Input::post( 'end' ),
'details' => Input::post( 'details' ),
];
if ( self::$positions->update( $data, $fields ) ) {
Issues::add( 'success', 'Position Updated.' );
return $this->index();
}
Issues::add( 'error', 'There was an error with your request.' );
$this->index();
}
public function view( $data = null ) {
$positionData = self::$positions->findById( $data );
if ( $positionData !== false ) {
return Views::view( 'resume.admin.view', $positionData );
}
Issues::add( 'error', 'Position not found.' );
$this->index();
}
public function delete( $data = null ) {
if ( $data == null ) {
if ( Input::exists( 'P_' ) ) {
$data = Input::post( 'P_' );
}
}
if ( !self::$positions->delete( (array) $data ) ) {
Issues::add( 'error', 'There was an error with your request.' );
} else {
Issues::add( 'success', 'Position has been deleted' );
}
$this->index();
}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* app/plugins/resume/controllers/resume.php
*
* This is the bug reports controller.
*
* @package TP Resume
* @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\Issues;
use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Classes\Controller;
use TheTempusProject\Models\Positions;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Houdini\Classes\Template;
class Resume extends Controller {
protected static $positions;
public function index() {
self::$positions = new Positions;
self::$title = '{SITENAME} - Resume';
self::$pageDescription = 'Its not the longest resume in the world, but I\'m certainly proud of it.';
$positions = self::$positions->listPaginated();
if ( false == $positions ) {
Issues::add( 'error', 'Well, this is embarrassing, surely he wouldn\'t just have no resume..... right.... Dave? ... erm Joey?' );
return;
} else {
Components::set( 'RESUME_NAV', Views::simpleView( 'resume.nav') );
Components::set( 'RESUME_DOWNLOADS', Views::simpleView( 'resume.download') );
if ( !Input::exists( 'view' ) ) {
return Views::view( 'resume.resume', $positions );
} else {
Components::append( 'TEMPLATE_CSS_INCLUDES', Template::parse('<link rel="stylesheet" href="{ROOT_URL}app/plugins/resume/css/timeline.css" />') );
$side = 'left';
foreach ($positions as $key => $position) {
$position->side = $side; // Add the new entry for side
$side = ($side === 'left') ? 'right' : 'left'; // Alternate between left and right
}
return Views::view( 'resume.timeline', $positions );
}
}
}
public function test() {
self::$positions = new Positions;
self::$title = '{SITENAME} - Resume';
self::$pageDescription = 'Its not the longest resume in the world, but I\'m certainly proud of it.';
return Views::view( 'resume.test' );
}
}