ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Data class for like feature. More...
Public Member Functions | |
__construct (array $a_obj_ids=array(), ilDB $db=null, $lng=null) | |
Constructor. More... | |
getExpressionTypes () | |
Get types. More... | |
addExpression ( $a_user_id, $a_like_type, $a_obj_id, $a_obj_type, $a_sub_obj_id=0, $a_sub_obj_type="", $a_news_id=0) | |
Add expression for a user and object. More... | |
removeExpression ( $a_user_id, $a_like_type, $a_obj_id, $a_obj_type, $a_sub_obj_id=0, $a_sub_obj_type="", $a_news_id=0) | |
Remove expression for a user and object. More... | |
getExpressionCounts ($obj_id, $obj_type, $sub_obj_id, $sub_obj_type, $news_id) | |
Get expression counts for obj/subobj/news. More... | |
isExpressionSet ( $a_user_id, $a_like_type, $a_obj_id, $a_obj_type, $a_sub_obj_id=0, $a_sub_obj_type="", $a_news_id=0) | |
Is expression set for a user and object? More... | |
getExpressionEntries ($obj_id, $obj_type, $sub_obj_id, $sub_obj_type, $news_id) | |
Get expression entries for obj/subobj/news. More... | |
getExpressionEntriesForObject ($obj_id, $since_ts=null) | |
Get expression entries for obj/subobj/news. More... | |
Data Fields | |
const | TYPE_LIKE = 0 |
const | TYPE_DISLIKE = 1 |
const | TYPE_LOVE = 2 |
const | TYPE_LAUGH = 3 |
const | TYPE_ASTOUNDED = 4 |
const | TYPE_SAD = 5 |
const | TYPE_ANGRY = 6 |
Protected Member Functions | |
loadDataForObjects ($a_obj_ids=array()) | |
Load data (for objects) More... | |
Protected Attributes | |
$data = array() | |
$db | |
$lng | |
Data class for like feature.
DB related operations.
The like table only holds a record if an expression has been added. After a "dislike" the record disappears. This reduces space and increases performance. But we do not know "when" something has been disliked.
Since the subobject_type column is pk it must be not null and does not allow "" due to the abstract DB handling. We internally save "" as "-" here.
Definition at line 19 of file class.ilLikeData.php.
ilLikeData::__construct | ( | array | $a_obj_ids = array() , |
ilDB | $db = null , |
||
$lng = null |
|||
) |
Constructor.
ilDB | $db |
Definition at line 49 of file class.ilLikeData.php.
References $db, $DIC, $lng, and loadDataForObjects().
ilLikeData::addExpression | ( | $a_user_id, | |
$a_like_type, | |||
$a_obj_id, | |||
$a_obj_type, | |||
$a_sub_obj_id = 0 , |
|||
$a_sub_obj_type = "" , |
|||
$a_news_id = 0 |
|||
) |
Add expression for a user and object.
int | $a_user_id | user id (who is liking) |
int | $a_like_type | one of self::TYPE_LIKE to self::TYPE_ANGRY |
int | $a_obj_id | object id (must be an repository object id) |
string | $a_obj_type | object type (redundant, for performance reasons) |
int | $a_sub_obj_id | subobject id (as defined by the module being responsible for main object type) |
string | $a_sub_obj_type | subobject type (as defined by the module being responsible for main object type) |
int | $a_news_id | news is (optional news id, if like action is dedicated to a news for the object/subobject) |
Definition at line 95 of file class.ilLikeData.php.
References $db, $ilDB, data, and ilUtil\now().
ilLikeData::getExpressionCounts | ( | $obj_id, | |
$obj_type, | |||
$sub_obj_id, | |||
$sub_obj_type, | |||
$news_id | |||
) |
Get expression counts for obj/subobj/news.
int | $obj_id | |
string | $obj_type | |
int | $sub_obj_id | |
string | $sub_obj_type | |
int | $news_id |
ilLikeDataException |
Definition at line 215 of file class.ilLikeData.php.
References $txt, data, and getExpressionTypes().
ilLikeData::getExpressionEntries | ( | $obj_id, | |
$obj_type, | |||
$sub_obj_id, | |||
$sub_obj_type, | |||
$news_id | |||
) |
Get expression entries for obj/subobj/news.
int | $obj_id | |
string | $obj_type | |
int | $sub_obj_id | |
string | $sub_obj_type | |
int | $news_id |
ilLikeDataException |
Definition at line 274 of file class.ilLikeData.php.
References $txt, $user, data, getExpressionTypes(), and ilUtil\sortArray().
ilLikeData::getExpressionEntriesForObject | ( | $obj_id, | |
$since_ts = null |
|||
) |
Get expression entries for obj/subobj/news.
int | $obj_id | |
int | $since_ts | timestamp (show only data since...) |
ilLikeDataException |
Definition at line 310 of file class.ilLikeData.php.
References $si, $user, data, and ilUtil\sortArray().
ilLikeData::getExpressionTypes | ( | ) |
Get types.
Definition at line 70 of file class.ilLikeData.php.
Referenced by getExpressionCounts(), and getExpressionEntries().
ilLikeData::isExpressionSet | ( | $a_user_id, | |
$a_like_type, | |||
$a_obj_id, | |||
$a_obj_type, | |||
$a_sub_obj_id = 0 , |
|||
$a_sub_obj_type = "" , |
|||
$a_news_id = 0 |
|||
) |
Is expression set for a user and object?
int | $a_user_id | user id (who is liking) |
int | $a_like_type | one of self::TYPE_LIKE to self::TYPE_ANGRY |
int | $a_obj_id | object id (must be an repository object id) |
string | $a_obj_type | object type (redundant, for performance reasons) |
int | $a_sub_obj_id | subobject id (as defined by the module being responsible for main object type) |
string | $a_sub_obj_type | subobject type (as defined by the module being responsible for main object type) |
int | $a_news_id | news is (optional news id, if like action is dedicated to a news for the object/subobject) |
Definition at line 248 of file class.ilLikeData.php.
References data.
|
protected |
Load data (for objects)
int[] | load data for objects |
Definition at line 184 of file class.ilLikeData.php.
References $db, $id, $ilDB, and data.
Referenced by __construct().
ilLikeData::removeExpression | ( | $a_user_id, | |
$a_like_type, | |||
$a_obj_id, | |||
$a_obj_type, | |||
$a_sub_obj_id = 0 , |
|||
$a_sub_obj_type = "" , |
|||
$a_news_id = 0 |
|||
) |
Remove expression for a user and object.
int | $a_user_id | user id (who is liking) |
int | $a_like_type | one of self::TYPE_LIKE to self::TYPE_ANGRY |
int | $a_obj_id | object id (must be an repository object id) |
string | $a_obj_type | object type (redundant, for performance reasons) |
int | $a_sub_obj_id | subobject id (as defined by the module being responsible for main object type) |
string | $a_sub_obj_type | subobject type (as defined by the module being responsible for main object type) |
int | $a_news_id | news is (optional news id, if like action is dedicated to a news for the object/subobject) |
Definition at line 144 of file class.ilLikeData.php.
|
protected |
Definition at line 33 of file class.ilLikeData.php.
|
protected |
Definition at line 38 of file class.ilLikeData.php.
Referenced by __construct(), addExpression(), loadDataForObjects(), and removeExpression().
|
protected |
Definition at line 43 of file class.ilLikeData.php.
Referenced by __construct().
const ilLikeData::TYPE_ANGRY = 6 |
Definition at line 27 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_ASTOUNDED = 4 |
Definition at line 25 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_DISLIKE = 1 |
Definition at line 22 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_LAUGH = 3 |
Definition at line 24 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_LIKE = 0 |
Definition at line 21 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_LOVE = 2 |
Definition at line 23 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_SAD = 5 |
Definition at line 26 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().