1: <?php if(!defined('APPLICATION')) exit();
2:
3: /**
4: * This rule awards badges when a user mentions another user in a discussion,
5: * comment, or activity
6: *
7: * @author Zachary Doll
8: * @since 1.0
9: * @package Yaga
10: */
11: class HasMentioned implements YagaRule{
12:
13: public function Award($Sender, $User, $Criteria) {
14: $HasMentioned = count($Sender->EventArguments['MentionedUsers']);
15: if($HasMentioned) {
16: return TRUE;
17: }
18: else {
19: return FALSE;
20: }
21: }
22:
23: public function Form($Form) {
24: return '';
25: }
26:
27: public function Validate($Criteria, $Form) {
28: return;
29: }
30:
31: public function Hooks() {
32: return array('CommentModel_BeforeNotification', 'DiscussionModel_BeforeNotification');
33: }
34:
35: public function Description() {
36: $Description = T('Yaga.Rules.HasMentioned.Desc');
37: return Wrap($Description, 'div', array('class' => 'InfoMessage'));
38: }
39:
40: public function Name() {
41: return T('Yaga.Rules.HasMentioned');
42: }
43:
44: public function Interacts() {
45: return FALSE;
46: }
47: }
48: