07c4d55572
The Yaga rule interface as well as the static super class can be auto- magically brought into scope using Garden's autoloader instead of being manullay included where needed. I also renamed `lib` to `library` as this is used everywhere else in Vanilla and moved the rules into the `library` dir to keep everything in the same place.
60 lines
1.6 KiB
PHP
60 lines
1.6 KiB
PHP
<?php if(!defined('APPLICATION')) exit();
|
|
|
|
/**
|
|
* Describes the functions required to create a new rule for badges in Yaga.
|
|
*
|
|
* @author Zachary Doll
|
|
* @since 1.0
|
|
* @package Yaga
|
|
*/
|
|
interface YagaRule {
|
|
/**
|
|
* This performs the grunt work of an award rule. Given an expected criteria,
|
|
* it determines if a specific user meets muster.
|
|
*
|
|
* @param UserObject $User the user object
|
|
* @param stdClass $Criteria This is a standard object with properties that
|
|
* match the criteria that were previously rendered
|
|
* @return int Represents the user that gets the award criteria. You may use
|
|
* True as a shortcut to award the user that did the check. False will not
|
|
* award any user
|
|
*/
|
|
public function Award($Sender, $User, $Criteria);
|
|
|
|
/**
|
|
* This determines what hook the rule should be checked on.
|
|
* @return string The hook name to fire our calculations on
|
|
*/
|
|
public function Hooks();
|
|
|
|
/**
|
|
* Returns the needed criteria form for this rule's criteria.
|
|
*
|
|
* @param Gdn_Form $Form
|
|
* @return string The fully rendered form.
|
|
*/
|
|
public function Form($Form);
|
|
|
|
/**
|
|
* This validates the submitted criteria and does what it wants with the form
|
|
*
|
|
* @param array $Criteria
|
|
* @param Gdn_Form $Form
|
|
*/
|
|
public function Validate($Criteria, $Form);
|
|
|
|
/**
|
|
* Returns a string representing a user friendly name of this rule.
|
|
*
|
|
* @return string Name shown on forms
|
|
*/
|
|
public function Name();
|
|
|
|
/**
|
|
* Returns a string representing the in depth description of how to use this rule.
|
|
*
|
|
* @return string The description
|
|
*/
|
|
public function Description();
|
|
}
|