Overview

Packages

  • None
  • Yaga

Classes

  • ActedModel
  • ActionController
  • ActionModel
  • AwardCombo
  • BadgeAwardModel
  • BadgeController
  • BadgeModel
  • BadgesController
  • BadgesModule
  • BestController
  • BestFilterModule
  • CakeDayPost
  • CommentCount
  • CommentMarathon
  • DiscussionBodyLength
  • DiscussionCategory
  • DiscussionCount
  • DiscussionPageCount
  • HasMentioned
  • HolidayVisit
  • LeaderBoardModule
  • LengthOfService
  • ManualAward
  • NecroPost
  • NewbieComment
  • PhotoExists
  • PostCount
  • PostReactions
  • QnAAnserCount
  • RankController
  • RankModel
  • ReactController
  • ReactionCount
  • ReactionModel
  • ReflexComment
  • RulesController
  • SocialConnection
  • Yaga
  • YagaController
  • YagaHooks

Interfaces

  • YagaRule
  • Overview
  • Package
  • Class
  • Tree
  • Todo
  • Download
 1: <?php if(!defined('APPLICATION')) exit();
 2: 
 3: /**
 4:  * This rule awards badges if the user posts on the anniversary of their account
 5:  * creation.
 6:  *
 7:  * @author Zachary Doll
 8:  * @since 1.0
 9:  * @package Yaga
10:  */
11: class CakeDayPost implements YagaRule {
12: 
13:   public function Award($Sender, $User, $Criteria) {
14:     // Determine if today is the target day
15:     $CakeDate = strtotime($User->DateInserted);
16:     
17:     $CakeMonth = date('n', $CakeDate);
18:     $CakeDay = date('j', $CakeDate);
19:     $TodaysMonth = date('n');
20:     $TodaysDay = date('j');
21: 
22:     if($CakeMonth == $TodaysMonth
23:             && $CakeDay == $TodaysDay) {
24:       return TRUE;
25:     }
26:     else {
27:       return FALSE;
28:     }
29:   }
30: 
31:   public function Form($Form) {
32:     return '';
33:   }
34: 
35:   public function Validate($Criteria, $Form) {
36:     return;
37:   }
38: 
39:   public function Hooks() {
40:     return array('DiscussionModel_AfterSaveDiscussion', 'CommentModel_AfterSaveComment', 'ActivityModel_BeforeSaveComment');
41:   }
42: 
43:   public function Description() {
44:     $Description = T('Yaga.Rules.CakeDayPost.Desc');
45:     return Wrap($Description, 'div', array('class' => 'InfoMessage'));
46:   }
47: 
48:   public function Name() {
49:     return T('Yaga.Rules.CakeDayPost');
50:   }
51:   
52:   public function Interacts() {
53:     return FALSE;
54:   }
55: }
56: 
Yaga API documentation generated by ApiGen 2.8.0