Files
thetempusproject/app/plugins/resume/forms.php
Joey Kimsey 825d422d93 wip
2025-02-06 03:49:00 -05:00

88 lines
2.4 KiB
PHP

<?php
/**
* app/plugins/resume/forms.php
*
* This houses all of the form checking functions for this plugin.
*
* @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\Plugins\Resume;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Classes\Forms;
class ResumeForms extends Forms {
/**
* Adds these functions to the form list.
*/
public function __construct() {
self::addHandler( 'newPosition', __CLASS__, 'newPosition' );
self::addHandler( 'editPosition', __CLASS__, 'editPosition' );
}
/**
* Validates the new position post form.
*
* @return {bool}
*/
public static function newPosition() {
if ( !Input::exists( 'name' ) ) {
self::addUserError( 'You must specify name' );
return false;
}
if ( !Input::exists( 'position' ) ) {
self::addUserError( 'You must specify position' );
return false;
}
if ( !Input::exists( 'start' ) ) {
self::addUserError( 'You must specify start' );
return false;
}
if ( !Input::exists( 'end' ) ) {
self::addUserError( 'You must specify end' );
return false;
}
if ( !Input::exists( 'details' ) ) {
self::addUserError( 'You must specify details' );
return false;
}
return true;
}
/**
* Validates the edit position post form.
*
* @return {bool}
*/
public static function editPosition() {
if ( !Input::exists( 'name' ) ) {
self::addUserError( 'You must specify name' );
return false;
}
if ( !Input::exists( 'position' ) ) {
self::addUserError( 'You must specify position' );
return false;
}
if ( !Input::exists( 'start' ) ) {
self::addUserError( 'You must specify start' );
return false;
}
if ( !Input::exists( 'end' ) ) {
self::addUserError( 'You must specify end' );
return false;
}
if ( !Input::exists( 'details' ) ) {
self::addUserError( 'You must specify details' );
return false;
}
return true;
}
}
new ResumeForms;