ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
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).
static _unsubscribe ($a_ref_id, $a_user_id)
 Unsubscribe a user from an object (ref id).
static _hasSubscribed ($a_ref_id, $a_user_id)
 Check whether user has subscribed to an object.
static _getSubscriptionsOfUser ($a_user_id)
 Get subscriptions of user.

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

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 80 of file class.ilNewsSubscription.php.

References $ilDB, and $query.

Referenced by ilNewsItem\_getNewsItemsOfUser().

{
global $ilDB;
$query = "SELECT * FROM il_news_subscription WHERE user_id = ".
$ilDB->quote($a_user_id, "integer");
$set = $ilDB->query($query);
$ref_ids = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$ref_ids[] = $rec["ref_id"];
}
return $ref_ids;
}

+ Here is the caller graph for this function:

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 55 of file class.ilNewsSubscription.php.

References $ilDB, and $query.

{
global $ilDB;
$query = "SELECT * FROM il_news_subscription WHERE ref_id = ".
$ilDB->quote($a_ref_id, "integer")." AND user_id = ".
$ilDB->quote($a_user_id, "integer");
$set = $ilDB->query($query);
if ($rec = $ilDB->fetchAssoc($set))
{
return true;
}
else
{
return false;
}
}
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.

References $ilDB.

Referenced by ilNewsForContextBlockGUI\subscribeNews().

{
global $ilDB;
$ilDB->manipulate("DELETE FROM il_news_subscription WHERE ".
" ref_id = ".$ilDB->quote($a_ref_id, "integer")." ".
" AND user_id = ".$ilDB->quote($a_user_id, "integer"));
$ilDB->manipulate("INSERT INTO il_news_subscription (ref_id, user_id) VALUES (".
$ilDB->quote($a_ref_id, "integer").", ".
$ilDB->quote($a_user_id, "integer").")");
}

+ Here is the caller graph for this function:

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 39 of file class.ilNewsSubscription.php.

References $ilDB.

Referenced by ilNewsForContextBlockGUI\unsubscribeNews().

{
global $ilDB;
$ilDB->manipulate("DELETE FROM il_news_subscription WHERE ref_id = ".
$ilDB->quote($a_ref_id, "integer")." AND user_id = ".
$ilDB->quote($a_user_id, "integer"));
}

+ Here is the caller graph for this function:


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