38 $this->repo = (is_null(
$repo))
43 ?
$DIC->rbac()->review()
58 $this->repo->addRoleRecommendation($role_id, $ref_id);
68 $this->repo->removeRoleRecommendation($role_id, $ref_id);
78 return $this->repo->getRecommendationsOfRoles([$role_id]);
89 $this->repo->addObjectRecommendation($user_id, $ref_id);
99 $this->repo->removeObjectRecommendation($user_id, $ref_id);
109 $this->repo->removeRecommendationsOfRefId($ref_id);
119 $this->repo->removeRecommendationsOfUser($user_id);
129 $this->repo->removeRecommendationsOfRole($role_id);
143 $role_ids = $review->assignedRoles($user_id);
145 $recommendations =
$repo->getOpenRecommendationsOfUser($user_id, $role_ids);
148 $favourites = $this->fav_manager->getFavouritesOfUser($user_id);
149 $favourites_ref_ids = array_column($favourites,
"ref_id");
151 return array_filter($recommendations,
function (
$i) use ($favourites_ref_ids) {
152 return !in_array(
$i, $favourites_ref_ids);
164 $this->repo->declineObjectRecommendation($user_id, $ref_id);
An exception for terminatinating execution or to throw for unit testing.
Manages favourites, currently the interface for other components, needs discussion.
class ilRbacReview Contains Review functions of core Rbac.
Recommended content db repository.
Recommended content manager (business logic)
__construct(ilRecommendedContentDBRepository $repo=null, ilRbacReview $rbacreview=null, ilFavouritesManager $fav_manager=null)
Constructor.
removeRecommendationsOfRefId(int $ref_id)
Remove all recommendations of a ref id (role and user/object related)
getOpenRecommendationsOfUser(int $user_id)
Get open recommendations for user.
removeObjectRecommendation(int $user_id, int $ref_id)
Remove object recommendation.
removeRecommendationsOfUser(int $user_id)
Remove all recommendations of a user.
removeRecommendationsOfRole(int $role_id)
Remove all recommendations of a role.
declineObjectRecommendation(int $user_id, int $ref_id)
Decline object recommendation.
addObjectRecommendation(int $user_id, int $ref_id)
Add object recommendation.
addRoleRecommendation(int $role_id, int $ref_id)
Add role recommendation.
removeRoleRecommendation(int $role_id, int $ref_id)
Remove role recommendation.
getRecommendationsOfRole(int $role_id)
Add role recommendation.