80 lines
2.2 KiB
PHP
80 lines
2.2 KiB
PHP
<?php
|
|
/**
|
|
* app/plugins/wip/forms.php
|
|
*
|
|
* This houses all of the form checking functions for this plugin.
|
|
*
|
|
* @package TP Wip
|
|
* @version 3.0
|
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
* @link https://TheTempusProject.com
|
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
*/
|
|
namespace TheTempusProject\Plugins\Wip;
|
|
|
|
use TheTempusProject\Bedrock\Functions\Input;
|
|
use TheTempusProject\Bedrock\Functions\Check;
|
|
use TheTempusProject\Classes\Forms;
|
|
|
|
class WipForms extends Forms {
|
|
/**
|
|
* Adds these functions to the form list.
|
|
*/
|
|
public function __construct() {
|
|
self::addHandler( 'newProject', __CLASS__, 'newProject' );
|
|
self::addHandler( 'editProject', __CLASS__, 'editProject' );
|
|
}
|
|
|
|
/**
|
|
* Validates the new project post form.
|
|
*
|
|
* @return {bool}
|
|
*/
|
|
public static function newProject() {
|
|
if ( !Input::exists( 'title' ) ) {
|
|
self::addUserError( 'You must specify title' );
|
|
return false;
|
|
}
|
|
if ( !Input::exists( 'description' ) ) {
|
|
self::addUserError( 'You must specify description' );
|
|
return false;
|
|
}
|
|
if ( !Input::exists( 'progress' ) ) {
|
|
self::addUserError( 'You must specify progress' );
|
|
return false;
|
|
}
|
|
if ( !Input::exists( 'startDate' ) ) {
|
|
self::addUserError( 'You must specify startDate' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Validates the edit project post form.
|
|
*
|
|
* @return {bool}
|
|
*/
|
|
public static function editProject() {
|
|
if ( !Input::exists( 'title' ) ) {
|
|
self::addUserError( 'You must specify title' );
|
|
return false;
|
|
}
|
|
if ( !Input::exists( 'description' ) ) {
|
|
self::addUserError( 'You must specify description' );
|
|
return false;
|
|
}
|
|
if ( !Input::exists( 'progress' ) ) {
|
|
self::addUserError( 'You must specify progress' );
|
|
return false;
|
|
}
|
|
if ( !Input::exists( 'startDate' ) ) {
|
|
self::addUserError( 'You must specify startDate' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
new WipForms;
|