Initial commit

This commit is contained in:
Joey Kimsey
2024-08-04 21:15:59 -04:00
parent c9d1fb983f
commit 0d469501ee
695 changed files with 70184 additions and 71 deletions

View File

@ -0,0 +1,96 @@
<?php
/**
* app/plugins/bugtracker/forms.php
*
* This houses all of the form checking functions for this plugin.
*
* @package TP ToDo
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Plugins\Todo;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Classes\Forms;
class TodoForms extends Forms {
/**
* Adds these functions to the form list.
*/
public function __construct() {
self::addHandler( 'createTask', __CLASS__, 'createTask' );
self::addHandler( 'editTask', __CLASS__, 'editTask' );
self::addHandler( 'createTaskList', __CLASS__, 'createTaskList' );
self::addHandler( 'editTaskList', __CLASS__, 'editTaskList' );
}
/**
* Validates the bug tracker create form.
*
* @return {bool}
*/
public static function createTask() {
if ( ! empty(Input::post( 'dueDate' )) && !self::date( Input::post( 'dueDate' ) ) ) {
self::addUserError( 'Invalid Date.' . Input::post( 'dueDate' ) );
return false;
}
if ( ! empty( Input::post( 'listID' ) ) && !self::id( Input::post( 'listID' ) ) ) {
self::addUserError( 'Invalid Date.' . Input::post( 'dueDate' ) );
return false;
}
if ( !Input::exists( 'task' ) ) {
self::addUserError( 'You must specify a task' );
return false;
}
// if ( !self::token() ) {
// return false;
// }
return true;
}
public static function createTaskList() {
if ( !Input::exists( 'listName' ) ) {
self::addUserError( 'You must specify a title' );
return false;
}
// if ( !self::token() ) {
// return false;
// }
return true;
}
public static function editTaskList() {
if ( !Input::exists( 'listName' ) ) {
self::addUserError( 'You must specify a title' );
return false;
}
// if ( !self::token() ) {
// return false;
// }
return true;
}
/**
* Validates the bug tracker create form.
*
* @return {bool}
*/
public static function editTask() {
if ( !empty(Input::post( 'dueDate' )) && !self::date( Input::post( 'dueDate' ) ) ) {
self::addUserError( 'Invalid Date.' . Input::post( 'dueDate' ) );
return false;
}
if ( !Input::exists( 'task' ) ) {
self::addUserError( 'You must specify a task' );
return false;
}
// if ( !self::token() ) {
// return false;
// }
return true;
}
}
new TodoForms;