ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilNewsSubscription Class Reference

This class handles news subscriptions of users. More...

+ Collaboration diagram for ilNewsSubscription:

Static Public Member Functions

static _subscribe ($a_ref_id, $a_user_id)
 Subscribe a user to an object (ref id). More...
 
static _unsubscribe ($a_ref_id, $a_user_id)
 Unsubscribe a user from an object (ref id). More...
 
static _hasSubscribed ($a_ref_id, $a_user_id)
 Check whether user has subscribed to an object. More...
 
static _getSubscriptionsOfUser ($a_user_id)
 Get subscriptions of user. More...
 

Detailed Description

This class handles news subscriptions of users.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 13 of file class.ilNewsSubscription.php.

Member Function Documentation

◆ _getSubscriptionsOfUser()

static ilNewsSubscription::_getSubscriptionsOfUser (   $a_user_id)
static

Get subscriptions of user.

Parameters
int$a_ref_idref id
int$a_user_iduser id
Returns
boolean has subscribed true/false

Definition at line 83 of file class.ilNewsSubscription.php.

84 {
85 global $DIC;
86
87 $ilDB = $DIC->database();
88
89 $query = "SELECT * FROM il_news_subscription WHERE user_id = " .
90 $ilDB->quote($a_user_id, "integer");
91 $set = $ilDB->query($query);
92 $ref_ids = array();
93 while ($rec = $ilDB->fetchAssoc($set)) {
94 $ref_ids[] = $rec["ref_id"];
95 }
96
97 return $ref_ids;
98 }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46

References $DIC, $ilDB, and $query.

Referenced by ilNewsItem\_getNewsItemsOfUser().

+ Here is the caller graph for this function:

◆ _hasSubscribed()

static ilNewsSubscription::_hasSubscribed (   $a_ref_id,
  $a_user_id 
)
static

Check whether user has subscribed to an object.

Parameters
int$a_ref_idref id
int$a_user_iduser id
Returns
boolean has subscribed true/false

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

60 {
61 global $DIC;
62
63 $ilDB = $DIC->database();
64
65 $query = "SELECT * FROM il_news_subscription WHERE ref_id = " .
66 $ilDB->quote($a_ref_id, "integer") . " AND user_id = " .
67 $ilDB->quote($a_user_id, "integer");
68 $set = $ilDB->query($query);
69 if ($rec = $ilDB->fetchAssoc($set)) {
70 return true;
71 } else {
72 return false;
73 }
74 }

References $DIC, $ilDB, and $query.

◆ _subscribe()

static ilNewsSubscription::_subscribe (   $a_ref_id,
  $a_user_id 
)
static

Subscribe a user to an object (ref id).

Parameters
int$a_ref_idref id
int$a_user_iduser id

Definition at line 21 of file class.ilNewsSubscription.php.

22 {
23 global $DIC;
24
25 $ilDB = $DIC->database();
26
27 $ilDB->manipulate("DELETE FROM il_news_subscription WHERE " .
28 " ref_id = " . $ilDB->quote($a_ref_id, "integer") . " " .
29 " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
30 $ilDB->manipulate("INSERT INTO il_news_subscription (ref_id, user_id) VALUES (" .
31 $ilDB->quote($a_ref_id, "integer") . ", " .
32 $ilDB->quote($a_user_id, "integer") . ")");
33 }

References $DIC, and $ilDB.

Referenced by ilNewsForContextBlockGUI\subscribeNews().

+ Here is the caller graph for this function:

◆ _unsubscribe()

static ilNewsSubscription::_unsubscribe (   $a_ref_id,
  $a_user_id 
)
static

Unsubscribe a user from an object (ref id).

Parameters
int$a_ref_idref id
int$a_user_iduser id

Definition at line 41 of file class.ilNewsSubscription.php.

42 {
43 global $DIC;
44
45 $ilDB = $DIC->database();
46
47 $ilDB->manipulate("DELETE FROM il_news_subscription WHERE ref_id = " .
48 $ilDB->quote($a_ref_id, "integer") . " AND user_id = " .
49 $ilDB->quote($a_user_id, "integer"));
50 }

References $DIC, and $ilDB.

Referenced by ilNewsForContextBlockGUI\unsubscribeNews().

+ Here is the caller graph for this function:

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