2013-11-11 14:45:31 -06:00
|
|
|
<?php if(!defined('APPLICATION')) exit();
|
2013-12-18 21:19:15 -05:00
|
|
|
|
2013-11-11 14:45:31 -06:00
|
|
|
/**
|
2013-12-18 21:19:15 -05:00
|
|
|
* This rule awards badges when a user mentions another user in a discussion,
|
2013-11-12 09:35:07 -06:00
|
|
|
* comment, or activity
|
2013-11-11 14:45:31 -06:00
|
|
|
*
|
|
|
|
* @author Zachary Doll
|
|
|
|
* @since 1.0
|
|
|
|
* @package Yaga
|
|
|
|
*/
|
|
|
|
class HasMentioned implements YagaRule{
|
|
|
|
|
|
|
|
public function Award($Sender, $User, $Criteria) {
|
2013-11-15 13:56:14 -06:00
|
|
|
$HasMentioned = count($Sender->EventArguments['MentionedUsers']);
|
|
|
|
if($HasMentioned) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-11-11 14:45:31 -06:00
|
|
|
}
|
2013-12-18 21:19:15 -05:00
|
|
|
|
2013-11-11 14:45:31 -06:00
|
|
|
public function Form($Form) {
|
2013-12-11 15:40:19 -06:00
|
|
|
return '';
|
2013-11-11 14:45:31 -06:00
|
|
|
}
|
2013-12-18 21:19:15 -05:00
|
|
|
|
2013-12-11 16:56:37 -06:00
|
|
|
public function Validate($Criteria, $Form) {
|
|
|
|
return;
|
|
|
|
}
|
2013-12-18 21:19:15 -05:00
|
|
|
|
2013-11-11 14:45:31 -06:00
|
|
|
public function Hooks() {
|
2013-11-15 13:56:14 -06:00
|
|
|
return array('CommentModel_BeforeNotification', 'DiscussionModel_BeforeNotification');
|
2013-11-11 14:45:31 -06:00
|
|
|
}
|
2013-12-18 21:19:15 -05:00
|
|
|
|
2013-11-11 14:45:31 -06:00
|
|
|
public function Description() {
|
2013-12-04 14:09:26 -06:00
|
|
|
$Description = T('Yaga.Rules.HasMentioned.Desc');
|
2013-12-11 15:40:19 -06:00
|
|
|
return Wrap($Description, 'div', array('class' => 'InfoMessage'));
|
2013-11-11 14:45:31 -06:00
|
|
|
}
|
2013-12-18 21:19:15 -05:00
|
|
|
|
2013-11-11 14:45:31 -06:00
|
|
|
public function Name() {
|
2013-12-04 14:09:26 -06:00
|
|
|
return T('Yaga.Rules.HasMentioned');
|
2013-11-11 14:45:31 -06:00
|
|
|
}
|
2014-02-19 08:48:21 -06:00
|
|
|
|
|
|
|
public function Interacts() {
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-11-11 14:45:31 -06:00
|
|
|
}
|