ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjForumNotificationDataProvider Class Reference

Class ilObjForumNotificationDataProvider. More...

+ Inheritance diagram for ilObjForumNotificationDataProvider:
+ Collaboration diagram for ilObjForumNotificationDataProvider:

Public Member Functions

 __construct (ilForumPost $objPost, $ref_id)
 
 getRefId ()
 
 getObjId ()
 
 getThreadId ()
 
 getPostId ()
 
 getForumId ()
 
 getForumTitle ()
 
 getThreadTitle ()
 
 getPostTitle ()
 
 getPostMessage ()
 
 getPosDisplayUserId ()
 
 getPostUserName ($user_lang)
 
 getPostDate ()
 
 getPostUpdate ()
 
 getPostUpdateUserName ($user_lang)
 
 getPostCensored ()
 
 getPostCensoredDate ()
 
 getCensorshipComment ()
 
 getAttachments ()
 
 getPosUserAlias ()
 
 getForumNotificationRecipients ()
 
 getThreadNotificationRecipients ()
 
 getPostAnsweredRecipients ()
 
 getPostActivationRecipients ()
 
 setPosAuthorId ($pos_author_id)
 
 getPosAuthorId ()
 
 getRefId ()
 
 getObjId ()
 
 getForumId ()
 
 getForumTitle ()
 
 getThreadId ()
 
 getThreadTitle ()
 
 getPostId ()
 
 getPostTitle ()
 
 getPostMessage ()
 
 getPosAuthorId ()
 
 getPosDisplayUserId ()
 
 getPosUserAlias ()
 
 getPostUserName ($user_lang)
 
 getPostDate ()
 
 getPostUpdate ()
 
 getPostUpdateUserName ($user_lang)
 
 getPostCensored ()
 
 getPostCensoredDate ()
 
 getCensorshipComment ()
 
 getAttachments ()
 

Data Fields

 $pos_author_id = 0
 
 $objPost
 

Protected Member Functions

 read ()
 

Protected Attributes

 $ref_id = 0
 
 $obj_id = 0
 
 $post_user_name = ''
 
 $forum_id = 0
 
 $forum_title = ''
 
 $thread_title = ''
 
 $attachments = array()
 

Private Member Functions

 readThreadTitle ()
 
 readForumData ()
 
 readAttachments ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjForumNotificationDataProvider::__construct ( ilForumPost  $objPost,
  $ref_id 
)
Parameters
ilForumPost$objPost
int$ref_id

Definition at line 59 of file class.ilObjForumNotificationDataProvider.php.

References $objPost, $ref_id, ilObject\_lookupObjId(), and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ getAttachments()

ilObjForumNotificationDataProvider::getAttachments ( )

◆ getCensorshipComment()

ilObjForumNotificationDataProvider::getCensorshipComment ( )
Returns
string

Implements ilForumNotificationMailData.

Definition at line 229 of file class.ilObjForumNotificationDataProvider.php.

230 {
231 return $this->objPost->getCensorshipComment();
232 }

◆ getForumId()

ilObjForumNotificationDataProvider::getForumId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 102 of file class.ilObjForumNotificationDataProvider.php.

References $forum_id.

Referenced by getForumNotificationRecipients().

+ Here is the caller graph for this function:

◆ getForumNotificationRecipients()

ilObjForumNotificationDataProvider::getForumNotificationRecipients ( )
Returns
array

Definition at line 311 of file class.ilObjForumNotificationDataProvider.php.

312 {
313 global $ilDB, $ilAccess, $ilUser;
314
315 $res = $ilDB->queryf('
316 SELECT frm_notification.user_id FROM frm_notification, frm_data
317 WHERE frm_data.top_pk = %s
318 AND frm_notification.frm_id = frm_data.top_frm_fk
319 AND frm_notification.user_id <> %s
320 GROUP BY frm_notification.user_id',
321 array('integer', 'integer'),
322 array($this->getForumId(), $ilUser->getId()));
323
324 // get all references of obj_id
325 $frm_references = ilObject::_getAllReferences($this->getObjId());
326 $rcps = array();
327 while($row = $ilDB->fetchAssoc($res))
328 {
329 // do rbac check before sending notification
330 foreach((array)$frm_references as $ref_id)
331 {
332 if($ilAccess->checkAccessOfUser($row['user_id'], 'read', '', $ref_id))
333 {
334 $rcps[] = $row['user_id'];
335 }
336 }
337 }
338
339
340 return array_unique($rcps);
341 }
static _getAllReferences($a_id)
get all reference ids of object
global $ilDB
global $ilUser
Definition: imgupload.php:15

References $ilDB, $ilUser, $ref_id, $res, $row, ilObject\_getAllReferences(), getForumId(), and getObjId().

+ Here is the call graph for this function:

◆ getForumTitle()

ilObjForumNotificationDataProvider::getForumTitle ( )
Returns
string frm_data.top_name

Implements ilForumNotificationMailData.

Definition at line 110 of file class.ilObjForumNotificationDataProvider.php.

References $forum_title.

◆ getObjId()

ilObjForumNotificationDataProvider::getObjId ( )

◆ getPosAuthorId()

ilObjForumNotificationDataProvider::getPosAuthorId ( )

◆ getPosDisplayUserId()

ilObjForumNotificationDataProvider::getPosDisplayUserId ( )
Returns
string frm_posts.pos_display_user_id

Implements ilForumNotificationMailData.

Definition at line 142 of file class.ilObjForumNotificationDataProvider.php.

143 {
144 return $this->objPost->getDisplayUserId();
145 }

◆ getPostActivationRecipients()

ilObjForumNotificationDataProvider::getPostActivationRecipients ( )
Returns
array

Definition at line 392 of file class.ilObjForumNotificationDataProvider.php.

393 {
394 include_once './Modules/Forum/classes/class.ilForum.php';
395 // get moderators to notify about needed activation
396 $rcps = ilForum::_getModerators($this->getRefId());
397 return (array)$rcps;
398 }
_getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)

References ilForum\_getModerators(), and getRefId().

+ Here is the call graph for this function:

◆ getPostAnsweredRecipients()

ilObjForumNotificationDataProvider::getPostAnsweredRecipients ( )
Returns
array

Definition at line 378 of file class.ilObjForumNotificationDataProvider.php.

379 {
380 include_once './Modules/Forum/classes/class.ilForumPost.php';
381 $parent_objPost = new ilForumPost($this->objPost->getParentId());
382
383 $rcps = array();
384 $rcps[] = $parent_objPost->getPosAuthorId();
385
386 return $rcps;
387 }

◆ getPostCensored()

ilObjForumNotificationDataProvider::getPostCensored ( )
Returns
bool frm_posts.pos_cens

Implements ilForumNotificationMailData.

Definition at line 216 of file class.ilObjForumNotificationDataProvider.php.

217 {
218 return $this->objPost->isCensored();
219 }

◆ getPostCensoredDate()

ilObjForumNotificationDataProvider::getPostCensoredDate ( )
Returns
string frm_posts.pos_cens_date

Implements ilForumNotificationMailData.

Definition at line 224 of file class.ilObjForumNotificationDataProvider.php.

225 {
226 return $this->objPost->getCensoredDate();
227 }

◆ getPostDate()

ilObjForumNotificationDataProvider::getPostDate ( )
Returns
string frm_posts.pos_date

Implements ilForumNotificationMailData.

Definition at line 173 of file class.ilObjForumNotificationDataProvider.php.

174 {
175 return $this->objPost->getCreateDate();
176 }

◆ getPostId()

ilObjForumNotificationDataProvider::getPostId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 94 of file class.ilObjForumNotificationDataProvider.php.

95 {
96 return $this->objPost->getId();
97 }

◆ getPostMessage()

ilObjForumNotificationDataProvider::getPostMessage ( )
Returns
string frm_posts.pos_message

Implements ilForumNotificationMailData.

Definition at line 134 of file class.ilObjForumNotificationDataProvider.php.

135 {
136 return $this->objPost->getMessage();
137 }

◆ getPostTitle()

ilObjForumNotificationDataProvider::getPostTitle ( )
Returns
string frm_posts.pos_subject

Implements ilForumNotificationMailData.

Definition at line 126 of file class.ilObjForumNotificationDataProvider.php.

127 {
128 return $this->objPost->getSubject();
129 }

◆ getPostUpdate()

ilObjForumNotificationDataProvider::getPostUpdate ( )
Returns
string frm_posts.pos_update

Implements ilForumNotificationMailData.

Definition at line 181 of file class.ilObjForumNotificationDataProvider.php.

182 {
183 return $this->objPost->getChangeDate();
184 }

◆ getPostUpdateUserName()

ilObjForumNotificationDataProvider::getPostUpdateUserName (   $user_lang)
Returns
string login

Implements ilForumNotificationMailData.

Definition at line 189 of file class.ilObjForumNotificationDataProvider.php.

190 {
191 // GET AUTHOR OF UPDATED POST
192 if($this->objPost->getUpdateUserId() > 0)
193 {
194 $this->post_user_name = ilObjUser::_lookupLogin($this->objPost->getUpdateUserId());
195 }
196
197 if($this->objPost->getDisplayUserId() == 0 && $this->objPost->getPosAuthorId() == $this->objPost->getUpdateUserId())
198 {
199 if(strlen($this->objPost->getUserAlias()))
200 {
201 $this->post_user_name = $this->objPost->getUserAlias() . ' (' . $user_lang->txt('frm_pseudonym') . ')';
202 }
203
204 if($this->post_user_name == '')
205 {
206 $this->post_user_name = $user_lang->txt('forums_anonymous');
207 }
208 }
209
211 }
static _lookupLogin($a_user_id)
lookup login

References $post_user_name, and ilObjUser\_lookupLogin().

+ Here is the call graph for this function:

◆ getPostUserName()

ilObjForumNotificationDataProvider::getPostUserName (   $user_lang)
Returns
string

Implements ilForumNotificationMailData.

Definition at line 150 of file class.ilObjForumNotificationDataProvider.php.

151 {
152 // GET AUTHOR OF NEW POST
153 if($this->objPost->getDisplayUserId())
154 {
155 $this->post_user_name = ilObjUser::_lookupLogin($this->objPost->getDisplayUserId());
156 }
157 else if(strlen($this->objPost->getUserAlias()))
158 {
159 $this->post_user_name = $this->objPost->getUserAlias() . ' (' . $user_lang->txt('frm_pseudonym') . ')';
160 }
161
162 if($this->post_user_name == '')
163 {
164 $this->post_user_name = $user_lang->txt('forums_anonymous');
165 }
166
168 }

References $post_user_name, and ilObjUser\_lookupLogin().

+ Here is the call graph for this function:

◆ getPosUserAlias()

ilObjForumNotificationDataProvider::getPosUserAlias ( )
Returns
string frm_posts.pos_usr_alias

Implements ilForumNotificationMailData.

Definition at line 245 of file class.ilObjForumNotificationDataProvider.php.

246 {
247 return $this->objPost->getUserAlias();
248 }

◆ getRefId()

ilObjForumNotificationDataProvider::getRefId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 70 of file class.ilObjForumNotificationDataProvider.php.

71 {
72 return $this->ref_id;
73 }

References $ref_id.

Referenced by getPostActivationRecipients().

+ Here is the caller graph for this function:

◆ getThreadId()

ilObjForumNotificationDataProvider::getThreadId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 86 of file class.ilObjForumNotificationDataProvider.php.

87 {
88 return $this->objPost->getThreadId();
89 }

Referenced by getThreadNotificationRecipients().

+ Here is the caller graph for this function:

◆ getThreadNotificationRecipients()

ilObjForumNotificationDataProvider::getThreadNotificationRecipients ( )
Returns
array

Definition at line 346 of file class.ilObjForumNotificationDataProvider.php.

347 {
348 global $ilDB, $ilAccess, $ilUser;
349
350 // GET USERS WHO WANT TO BE INFORMED ABOUT NEW POSTS
351 $res = $ilDB->queryf('
352 SELECT user_id FROM frm_notification
353 WHERE thread_id = %s
354 AND user_id <> %s',
355 array('integer', 'integer'),
356 array($this->getThreadId(), $_SESSION['AccountId']));
357
358 // get all references of obj_id
359 $frm_references = ilObject::_getAllReferences($this->getObjId());
360 $rcps = array();
361 while($row = $ilDB->fetchAssoc($res))
362 {
363 // do rbac check before sending notification
364 foreach((array)$frm_references as $ref_id)
365 {
366 if($ilAccess->checkAccessOfUser($row['user_id'], 'read', '', $ref_id))
367 {
368 $rcps[] = $row['user_id'];
369 }
370 }
371 }
372 return $rcps;
373 }
$_SESSION["AccountId"]

References $_SESSION, $ilDB, $ilUser, $ref_id, $res, $row, ilObject\_getAllReferences(), getObjId(), and getThreadId().

+ Here is the call graph for this function:

◆ getThreadTitle()

ilObjForumNotificationDataProvider::getThreadTitle ( )
Returns
string frm_threads.thr_subject

Implements ilForumNotificationMailData.

Definition at line 118 of file class.ilObjForumNotificationDataProvider.php.

References $thread_title.

◆ read()

ilObjForumNotificationDataProvider::read ( )
protected

Definition at line 253 of file class.ilObjForumNotificationDataProvider.php.

References readAttachments(), readForumData(), and readThreadTitle().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readAttachments()

ilObjForumNotificationDataProvider::readAttachments ( )
private

Definition at line 296 of file class.ilObjForumNotificationDataProvider.php.

297 {
298 require_once 'Modules/Forum/classes/class.ilFileDataForum.php';
299 $fileDataForum = new ilFileDataForum($this->getObjId(), $this->objPost->getId());
300 $filesOfPost = $fileDataForum->getFilesOfPost();
301
302 foreach($filesOfPost as $attachment)
303 {
304 $this->attachments[] = $attachment['name'];
305 }
306 }
This class handles all operations on files for the forum object.

References getObjId().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readForumData()

ilObjForumNotificationDataProvider::readForumData ( )
private

Definition at line 279 of file class.ilObjForumNotificationDataProvider.php.

280 {
281 global $ilDB;
282
283 $result = $ilDB->queryf('
284 SELECT top_pk, top_name FROM frm_data
285 WHERE top_frm_fk = %s',
286 array('integer'), array($this->getObjId()));
287
288 $row = $ilDB->fetchAssoc($result);
289 $this->forum_id = $row['top_pk'];
290 $this->forum_title = $row['top_name'];
291 }
$result

References $ilDB, $result, $row, and getObjId().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readThreadTitle()

ilObjForumNotificationDataProvider::readThreadTitle ( )
private

Definition at line 263 of file class.ilObjForumNotificationDataProvider.php.

264 {
265 global $ilDB;
266
267 $result = $ilDB->queryf('
268 SELECT thr_subject FROM frm_threads
269 WHERE thr_pk = %s',
270 array('integer'), array($this->objPost->getThreadId()));
271
272 $row = $ilDB->fetchAssoc($result);
273 $this->thread_title = $row['thr_subject'];
274 }

References $ilDB, $result, and $row.

Referenced by read().

+ Here is the caller graph for this function:

◆ setPosAuthorId()

ilObjForumNotificationDataProvider::setPosAuthorId (   $pos_author_id)
Parameters
$pos_author_id

Definition at line 402 of file class.ilObjForumNotificationDataProvider.php.

403 {
404 $this->pos_author_id = $pos_author_id;
405 }

References $pos_author_id.

Field Documentation

◆ $attachments

array ilObjForumNotificationDataProvider::$attachments = array()
protected

Definition at line 48 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getAttachments().

◆ $forum_id

ilObjForumNotificationDataProvider::$forum_id = 0
protected

Definition at line 33 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getForumId().

◆ $forum_title

string ilObjForumNotificationDataProvider::$forum_title = ''
protected

Definition at line 38 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getForumTitle().

◆ $obj_id

int ilObjForumNotificationDataProvider::$obj_id = 0
protected

Definition at line 20 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getObjId().

◆ $objPost

ilObjForumNotificationDataProvider::$objPost

Definition at line 53 of file class.ilObjForumNotificationDataProvider.php.

Referenced by __construct().

◆ $pos_author_id

ilObjForumNotificationDataProvider::$pos_author_id = 0

Definition at line 29 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getPosAuthorId(), and setPosAuthorId().

◆ $post_user_name

string ilObjForumNotificationDataProvider::$post_user_name = ''
protected

◆ $ref_id

int ilObjForumNotificationDataProvider::$ref_id = 0
protected

◆ $thread_title

string ilObjForumNotificationDataProvider::$thread_title = ''
protected

Definition at line 43 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getThreadTitle().


The documentation for this class was generated from the following file: