33 $this->db = (is_null(
$db))
49 "rep_rec_content_role",
51 "role_id" => [
"integer", $role_id],
52 "ref_id" => [
"integer", $ref_id]
68 "DELETE FROM rep_rec_content_role WHERE " .
69 " role_id = %s AND ref_id = %s",
70 [
"integer",
"integer"],
85 $db->insert(
"rep_rec_content_obj", [
86 "user_id" => [
"integer", $user_id],
87 "ref_id" => [
"integer", $ref_id],
88 "declined" => [
"integer",
false]
103 "DELETE FROM rep_rec_content_obj WHERE " .
104 " user_id = %s AND ref_id = %s",
105 [
"integer",
"integer"],
120 "DELETE FROM rep_rec_content_obj WHERE " .
127 "DELETE FROM rep_rec_content_role WHERE " .
144 "DELETE FROM rep_rec_content_obj WHERE " .
161 "DELETE FROM rep_rec_content_role WHERE " .
179 "SELECT * FROM rep_rec_content_obj " .
180 " WHERE user_id = %s AND ref_id = %s",
181 [
"integer",
"integer"],
184 if ($rec =
$db->fetchAssoc($set)) {
203 "rep_rec_content_obj",
205 "declined" => [
"integer",
true]
208 "user_id" => [
"integer", $user_id],
209 "ref_id" => [
"integer", $ref_id]
213 $db->insert(
"rep_rec_content_obj", [
214 "user_id" => [
"integer", $user_id],
215 "ref_id" => [
"integer", $ref_id],
216 "declined" => [
"integer",
true]
232 "SELECT DISTINCT ref_id FROM rep_rec_content_role " .
233 " WHERE " .
$db->in(
"role_id", $role_ids,
false,
"integer")
235 return array_column(
$db->fetchAll($set),
"ref_id");
249 "SELECT ref_id FROM rep_rec_content_obj " .
250 " WHERE user_id = %s AND declined = %s",
251 [
"integer",
"integer"],
254 return array_column(
$db->fetchAll($set),
"ref_id");
268 "SELECT ref_id FROM rep_rec_content_obj " .
269 " WHERE user_id = %s AND declined = %s",
270 [
"integer",
"integer"],
273 return array_column(
$db->fetchAll($set),
"ref_id");
292 $recommendations = array_unique($role_recommendations + $obj_recommendations);
296 return array_filter($recommendations,
function (
$i) use ($declined_recommendations) {
297 return !in_array(
$i, $declined_recommendations);
addObjectRecommendation(int $user_id, int $ref_id)
Add object recommendation.
Recommended content db repository.
addRoleRecommendation(int $role_id, int $ref_id)
Add role recommendation.
removeRecommendationsOfRole(int $role_id)
Remove all recommendations of a role.
getOpenRecommendationsOfUser(int $user_id, array $role_ids)
Open recommendations of user (by role or object, without declined ones)
removeRecommendationsOfRefId(int $ref_id)
Remove all recommendations of a ref id (role and user/object related)
declineObjectRecommendation(int $user_id, int $ref_id)
Decline object recommendation.
ifExistsObjectRecommendation(int $user_id, int $ref_id)
Does object recommendation exist?
__construct(\ilDBInterface $db=null)
Constructor.
getRecommendationsOfRoles(array $role_ids)
Get recommendations of roles.
removeRecommendationsOfUser(int $user_id)
Remove all recommendations of a user.
getDeclinedUserObjectRecommendations(int $user_id)
Get declined user object recommendations.
removeRoleRecommendation(int $role_id, int $ref_id)
Remove role recommendation.
getUserObjectRecommendations(int $user_id)
Get user object recommendations.
removeObjectRecommendation(int $user_id, int $ref_id)
Remove object recommendation.