Slight amount of the third part of today's bread.
This commit is contained in:
parent
743623201c
commit
15ea923db2
1 changed files with 59 additions and 0 deletions
59
_sakura/components/Action.php
Normal file
59
_sakura/components/Action.php
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
/*
|
||||
* Action code handler
|
||||
*/
|
||||
|
||||
namespace Sakura;
|
||||
|
||||
/**
|
||||
* Class Action
|
||||
* @package Sakura
|
||||
*/
|
||||
class Action
|
||||
{
|
||||
private $actions = []; // Contains the action methods
|
||||
private $code = null; // Contains the action code we're working with
|
||||
|
||||
// Constructor
|
||||
public function __construct($code = null)
|
||||
{
|
||||
// Populate $actions, sets $code (if not null)
|
||||
}
|
||||
|
||||
// Generating an action code
|
||||
public function generate($action, $instructions, $user = 0)
|
||||
{
|
||||
// Takes an action, specifies instructions and optionally adds a target user
|
||||
// stores this code in the database and assigns it to $this->code
|
||||
// This function should only work if $code is null
|
||||
}
|
||||
|
||||
// Execute the procedure for this action code
|
||||
public function execute()
|
||||
{
|
||||
// Looks for the code in the database and executes the procedure
|
||||
// This and all functions below should only work if $this->code isn't null for obvious reasons
|
||||
}
|
||||
|
||||
// Checking if a code is still valid
|
||||
public function validate()
|
||||
{
|
||||
// Checks if $this->code is still valid
|
||||
}
|
||||
|
||||
// Make a code invalid
|
||||
public function invalidate()
|
||||
{
|
||||
// Invalidates the set action code
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Concept
|
||||
* =======
|
||||
* Action codes are a thing to have the system or something related generate an
|
||||
* md5(?) hashed string that they can enter into a box and have the system respond
|
||||
* by doing something.
|
||||
* Said actions are stored in a database table and can be added, removed and
|
||||
* changed if needed. These actions will probably be stored using JSON.
|
||||
*/
|
Reference in a new issue