1: <?php if(!defined('APPLICATION')) exit();
2:
3: /**
4: * Describes the functions required to create a new rule for badges in Yaga.
5: *
6: * @author Zachary Doll
7: * @since 1.0
8: * @package Yaga
9: */
10: interface YagaRule {
11: /**
12: * This performs the grunt work of an award rule. Given an expected criteria,
13: * it determines if a specific user meets muster.
14: *
15: * @param mixed $Sender The object calling the award method.
16: * @param UserObject $User the user object of the calling user
17: * @param stdClass $Criteria This is a standard object with properties that
18: * match the criteria that were previously rendered
19: * @return int Represents the user that gets the award criteria. You may use
20: * True as a shortcut to award the user that did the check. False will not
21: * award any user
22: */
23: public function Award($Sender, $User, $Criteria);
24:
25: /**
26: * This determines what hook the rule should be checked on.
27: * @return string The hook name to fire our calculations on
28: */
29: public function Hooks();
30:
31: /**
32: * Returns the needed criteria form for this rule's criteria.
33: *
34: * @param Gdn_Form $Form
35: * @return string The fully rendered form.
36: */
37: public function Form($Form);
38:
39: /**
40: * This validates the submitted criteria and does what it wants with the form
41: *
42: * @param array $Criteria
43: * @param Gdn_Form $Form
44: */
45: public function Validate($Criteria, $Form);
46:
47: /**
48: * Returns a string representing a user friendly name of this rule.
49: *
50: * @return string Name shown on forms
51: */
52: public function Name();
53:
54: /**
55: * Returns a string representing the in depth description of how to use this rule.
56: *
57: * @return string The description
58: */
59: public function Description();
60:
61: /**
62: * Returns a bool representing whether the Award function can award a user
63: * other than the calling user. Rules that depend on interaction should return
64: * true.
65: *
66: * @return bool Whether or not interactions need to be checked
67: */
68: public function Interacts();
69: }
70: