Add new plugins: WIP, Suggestions, Reviews

This commit is contained in:
Joey Kimsey
2024-12-11 08:00:06 -05:00
parent 6a6fe4171f
commit a8a99b37e3
41 changed files with 2079 additions and 0 deletions

79
app/plugins/wip/forms.php Normal file
View File

@ -0,0 +1,79 @@
<?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;