@@ -23,6 +23,89 @@ class Forum extends \BaseModel
23
23
* Extra Methods
24
24
*******************************************************************/
25
25
26
+ public function getForumTypes ()
27
+ {
28
+ $ class = get_called_class ();
29
+
30
+ switch ($ class ) {
31
+ case 'Forum_Post ' :
32
+ case 'Syntax\Core\Forum_Post ' :
33
+ return Forum_Post_Type::orderByNameAsc ()->get ();
34
+ break ;
35
+ case 'Forum_Reply ' :
36
+ case 'Syntax\Core\Forum_Reply ' :
37
+ return Forum_Reply_Type::orderByNameAsc ()->get ();
38
+ break ;
39
+ }
40
+ }
41
+
42
+ public function setModeration ($ reason )
43
+ {
44
+ if ($ this instanceof Forum_Post || $ this instanceof Forum_Reply) {
45
+ // Set this as locked for moderation
46
+ $ this ->moderatorLockedFlag = 1 ;
47
+ $ this ->save ();
48
+
49
+ // Create the moderation record
50
+ $ report = new Forum_Moderation ;
51
+ $ report ->resource_type = get_called_class ();
52
+ $ report ->resource_id = $ this ->id ;
53
+ $ report ->user_id = Auth::user ()->id ;
54
+ $ report ->reason = $ reason ;
55
+
56
+ $ report ->save ();
57
+ }
58
+ }
59
+
60
+ public function unsetModeration ($ moderationId )
61
+ {
62
+ if ($ this instanceof Forum_Post || $ this instanceof Forum_Reply) {
63
+ $ this ->moderatorLockedFlag = 0 ;
64
+ $ this ->save ();
65
+
66
+ // Create the moderation log
67
+ $ moderationLog = new Forum_Moderation_Log ;
68
+ $ moderationLog ->forum_moderation_id = $ moderationId ;
69
+ $ moderationLog ->user_id = Auth::user ()->id ;
70
+ $ moderationLog ->action = Forum_Moderation::REMOVE_REPORT ;
71
+
72
+ $ moderationLog ->save ();
73
+ }
74
+ }
75
+
76
+ public function setAdminReview ($ moderationId )
77
+ {
78
+ if ($ this instanceof Forum_Post || $ this instanceof Forum_Reply) {
79
+ // Set the object for admin review
80
+ $ this ->adminReviewFlag = 1 ;
81
+ $ this ->save ();
82
+
83
+ // Create the moderation log
84
+ $ moderationLog = new Forum_Moderation_Log ;
85
+ $ moderationLog ->forum_moderation_id = $ moderationId ;
86
+ $ moderationLog ->user_id = Auth::user ()->id ;
87
+ $ moderationLog ->action = Forum_Moderation::ADMIN_REVIEW ;
88
+
89
+ $ moderationLog ->save ();
90
+ }
91
+ }
92
+
93
+ public function adminDeletePost ($ moderationId )
94
+ {
95
+ if ($ this instanceof Forum_Post || $ this instanceof Forum_Reply) {
96
+ // Delete the object
97
+ $ this ->delete ();
98
+
99
+ // Create the moderation log
100
+ $ moderationLog = new Forum_Moderation_Log ;
101
+ $ moderationLog ->forum_moderation_id = $ moderationId ;
102
+ $ moderationLog ->user_id = Auth::user ()->id ;
103
+ $ moderationLog ->action = Forum_Moderation::DELETE_POST ;
104
+
105
+ $ moderationLog ->save ();
106
+ }
107
+ }
108
+
26
109
/**
27
110
* Get all users that have a forum role
28
111
*
0 commit comments