ILIAS
trunk Revision v11.0_alpha-1761-g6dbbfa7b760
|
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...
Public Member Functions | |
__construct (array $a_obj_ids=array(), ?ilDBInterface $db=null, ?ilLanguage $lng=null) | |
getExpressionTypes () | |
Get types. More... | |
addExpression (int $a_user_id, int $a_like_type, int $a_obj_id, string $a_obj_type, int $a_sub_obj_id=0, string $a_sub_obj_type="", int $a_news_id=0) | |
Add expression for a user and object. More... | |
removeExpression (int $a_user_id, int $a_like_type, int $a_obj_id, string $a_obj_type, int $a_sub_obj_id=0, string $a_sub_obj_type="", int $a_news_id=0) | |
Remove expression for a user and object. More... | |
getExpressionCounts (int $obj_id, string $obj_type, int $sub_obj_id, string $sub_obj_type, int $news_id) | |
Get expression counts for obj/subobj/news. More... | |
isExpressionSet (int $a_user_id, int $a_like_type, int $a_obj_id, string $a_obj_type, int $a_sub_obj_id=0, string $a_sub_obj_type="", int $a_news_id=0) | |
Is expression set for a user and object? More... | |
getExpressionEntries (int $obj_id, string $obj_type, int $sub_obj_id, string $sub_obj_type, int $news_id) | |
Get expression entries for obj/subobj/news. More... | |
getExpressionEntriesForObject (int $obj_id, ?string $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 (array $a_obj_ids=array()) | |
Load data (for objects) More... | |
Protected Attributes | |
array | $data = array() |
ilDBInterface | $db |
ilLanguage | $lng |
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 30 of file class.ilLikeData.php.
ilLikeData::__construct | ( | array | $a_obj_ids = array() , |
?ilDBInterface | $db = null , |
||
?ilLanguage | $lng = null |
||
) |
Definition at line 44 of file class.ilLikeData.php.
References $db, $DIC, $lng, ILIAS\Repository\lng(), loadDataForObjects(), and null.
ilLikeData::addExpression | ( | int | $a_user_id, |
int | $a_like_type, | ||
int | $a_obj_id, | ||
string | $a_obj_type, | ||
int | $a_sub_obj_id = 0 , |
||
string | $a_sub_obj_type = "" , |
||
int | $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 90 of file class.ilLikeData.php.
References $db, $ilDB, ANONYMOUS_USER_ID, and ilUtil\now().
ilLikeData::getExpressionCounts | ( | int | $obj_id, |
string | $obj_type, | ||
int | $sub_obj_id, | ||
string | $sub_obj_type, | ||
int | $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 210 of file class.ilLikeData.php.
References $txt, and getExpressionTypes().
ilLikeData::getExpressionEntries | ( | int | $obj_id, |
string | $obj_type, | ||
int | $sub_obj_id, | ||
string | $sub_obj_type, | ||
int | $news_id | ||
) |
Get expression entries for obj/subobj/news.
ilLikeDataException |
Definition at line 266 of file class.ilLikeData.php.
References $txt, getExpressionTypes(), and ilArrayUtil\sortArray().
ilLikeData::getExpressionEntriesForObject | ( | int | $obj_id, |
?string | $since_ts = null |
||
) |
Get expression entries for obj/subobj/news.
int | $obj_id | |
?string | $since_ts timestamp (show only data since...) |
ilLikeDataException |
Definition at line 306 of file class.ilLikeData.php.
References null, and ilArrayUtil\sortArray().
ilLikeData::getExpressionTypes | ( | ) |
Get types.
Definition at line 65 of file class.ilLikeData.php.
References ILIAS\Repository\lng().
Referenced by getExpressionCounts(), and getExpressionEntries().
ilLikeData::isExpressionSet | ( | int | $a_user_id, |
int | $a_like_type, | ||
int | $a_obj_id, | ||
string | $a_obj_type, | ||
int | $a_sub_obj_id = 0 , |
||
string | $a_sub_obj_type = "" , |
||
int | $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 247 of file class.ilLikeData.php.
|
protected |
Load data (for objects)
int[] | $a_obj_ids load data for objects |
Definition at line 178 of file class.ilLikeData.php.
References $db, $id, and $ilDB.
Referenced by __construct().
ilLikeData::removeExpression | ( | int | $a_user_id, |
int | $a_like_type, | ||
int | $a_obj_id, | ||
string | $a_obj_type, | ||
int | $a_sub_obj_id = 0 , |
||
string | $a_sub_obj_type = "" , |
||
int | $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 139 of file class.ilLikeData.php.
References $db, $ilDB, and ANONYMOUS_USER_ID.
|
protected |
Definition at line 40 of file class.ilLikeData.php.
|
protected |
Definition at line 41 of file class.ilLikeData.php.
Referenced by __construct(), addExpression(), loadDataForObjects(), and removeExpression().
|
protected |
Definition at line 42 of file class.ilLikeData.php.
Referenced by __construct().
const ilLikeData::TYPE_ANGRY = 6 |
Definition at line 38 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_ASTOUNDED = 4 |
Definition at line 36 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_DISLIKE = 1 |
Definition at line 33 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_LAUGH = 3 |
Definition at line 35 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_LIKE = 0 |
Definition at line 32 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_LOVE = 2 |
Definition at line 34 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().
const ilLikeData::TYPE_SAD = 5 |
Definition at line 37 of file class.ilLikeData.php.
Referenced by ilLikeGUI\getExpressionText(), and ilLikeGUI\getGlyphForConst().