ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilRecommendedContentManager Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilRecommendedContentManager:

Public Member Functions

 __construct (ilRecommendedContentDBRepository $repo=null, ilRbacReview $rbacreview=null, ilFavouritesManager $fav_manager=null)
 
 addRoleRecommendation (int $role_id, int $ref_id)
 
 removeRoleRecommendation (int $role_id, int $ref_id)
 
 getRecommendationsOfRole (int $role_id)
 
 addObjectRecommendation (int $user_id, int $ref_id)
 
 removeObjectRecommendation (int $user_id, int $ref_id)
 
 removeRecommendationsOfRefId (int $ref_id)
 
 removeRecommendationsOfUser (int $user_id)
 
 removeRecommendationsOfRole (int $role_id)
 
 getOpenRecommendationsOfUser (int $user_id)
 
 declineObjectRecommendation (int $user_id, int $ref_id)
 

Protected Attributes

ilRecommendedContentDBRepository $repo
 
ilRbacReview $rbacreview
 
ilFavouritesManager $fav_manager
 
ilAccessHandler $access
 

Detailed Description

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 Recommended content manager (business logic)

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 25 of file class.ilRecommendedContentManager.php.

Constructor & Destructor Documentation

◆ __construct()

ilRecommendedContentManager::__construct ( ilRecommendedContentDBRepository  $repo = null,
ilRbacReview  $rbacreview = null,
ilFavouritesManager  $fav_manager = null 
)

Definition at line 32 of file class.ilRecommendedContentManager.php.

References $DIC, $fav_manager, $rbacreview, $repo, and ILIAS\Repository\access().

36  {
37  global $DIC;
38 
39  $this->repo = (is_null($repo))
41  : $repo;
42 
43  $this->rbacreview = (is_null($rbacreview))
44  ? $DIC->rbac()->review()
45  : $rbacreview;
46 
47  $this->fav_manager = (is_null($fav_manager))
48  ? new ilFavouritesManager()
49  : $fav_manager;
50 
51  $this->access = $DIC->access();
52  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
ilRecommendedContentDBRepository $repo
+ Here is the call graph for this function:

Member Function Documentation

◆ addObjectRecommendation()

ilRecommendedContentManager::addObjectRecommendation ( int  $user_id,
int  $ref_id 
)

Definition at line 73 of file class.ilRecommendedContentManager.php.

73  : void
74  {
75  $this->repo->addObjectRecommendation($user_id, $ref_id);
76  }
$ref_id
Definition: ltiauth.php:67

◆ addRoleRecommendation()

ilRecommendedContentManager::addRoleRecommendation ( int  $role_id,
int  $ref_id 
)

Definition at line 54 of file class.ilRecommendedContentManager.php.

54  : void
55  {
56  $this->repo->addRoleRecommendation($role_id, $ref_id);
57  }
$ref_id
Definition: ltiauth.php:67

◆ declineObjectRecommendation()

ilRecommendedContentManager::declineObjectRecommendation ( int  $user_id,
int  $ref_id 
)

Definition at line 121 of file class.ilRecommendedContentManager.php.

121  : void
122  {
123  $this->repo->declineObjectRecommendation($user_id, $ref_id);
124  }
$ref_id
Definition: ltiauth.php:67

◆ getOpenRecommendationsOfUser()

ilRecommendedContentManager::getOpenRecommendationsOfUser ( int  $user_id)
Returns
int[] ref ids

Definition at line 102 of file class.ilRecommendedContentManager.php.

References $access, $i, $rbacreview, $repo, ilRBACAccessHandler\checkAccess(), and ilRecommendedContentDBRepository\getOpenRecommendationsOfUser().

102  : array
103  {
104  $review = $this->rbacreview;
105  $repo = $this->repo;
107 
108  $role_ids = $review->assignedRoles($user_id);
109 
110  $recommendations = $repo->getOpenRecommendationsOfUser($user_id, $role_ids);
111 
112  // filter out favourites
113  $favourites = $this->fav_manager->getFavouritesOfUser($user_id);
114  $favourites_ref_ids = array_column($favourites, "ref_id");
115 
116  return array_filter($recommendations, static function ($i) use ($favourites_ref_ids, $access): bool {
117  return !in_array($i, $favourites_ref_ids) && $access->checkAccess('visible', '', $i);
118  });
119  }
getOpenRecommendationsOfUser(int $user_id, array $role_ids)
Open recommendations of user (by role or object, without declined ones)
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
ilRecommendedContentDBRepository $repo
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ getRecommendationsOfRole()

ilRecommendedContentManager::getRecommendationsOfRole ( int  $role_id)
Returns
int[] ref ids of recommendations

Definition at line 67 of file class.ilRecommendedContentManager.php.

67  : array
68  {
69  return $this->repo->getRecommendationsOfRoles([$role_id]);
70  }

◆ removeObjectRecommendation()

ilRecommendedContentManager::removeObjectRecommendation ( int  $user_id,
int  $ref_id 
)

Definition at line 78 of file class.ilRecommendedContentManager.php.

78  : void
79  {
80  $this->repo->removeObjectRecommendation($user_id, $ref_id);
81  }
$ref_id
Definition: ltiauth.php:67

◆ removeRecommendationsOfRefId()

ilRecommendedContentManager::removeRecommendationsOfRefId ( int  $ref_id)

Definition at line 84 of file class.ilRecommendedContentManager.php.

84  : void
85  {
86  $this->repo->removeRecommendationsOfRefId($ref_id);
87  }
$ref_id
Definition: ltiauth.php:67

◆ removeRecommendationsOfRole()

ilRecommendedContentManager::removeRecommendationsOfRole ( int  $role_id)

Definition at line 94 of file class.ilRecommendedContentManager.php.

94  : void
95  {
96  $this->repo->removeRecommendationsOfRole($role_id);
97  }

◆ removeRecommendationsOfUser()

ilRecommendedContentManager::removeRecommendationsOfUser ( int  $user_id)

Definition at line 89 of file class.ilRecommendedContentManager.php.

89  : void
90  {
91  $this->repo->removeRecommendationsOfUser($user_id);
92  }

◆ removeRoleRecommendation()

ilRecommendedContentManager::removeRoleRecommendation ( int  $role_id,
int  $ref_id 
)

Definition at line 59 of file class.ilRecommendedContentManager.php.

59  : void
60  {
61  $this->repo->removeRoleRecommendation($role_id, $ref_id);
62  }
$ref_id
Definition: ltiauth.php:67

Field Documentation

◆ $access

ilAccessHandler ilRecommendedContentManager::$access
protected

Definition at line 30 of file class.ilRecommendedContentManager.php.

Referenced by getOpenRecommendationsOfUser().

◆ $fav_manager

ilFavouritesManager ilRecommendedContentManager::$fav_manager
protected

Definition at line 29 of file class.ilRecommendedContentManager.php.

Referenced by __construct().

◆ $rbacreview

ilRbacReview ilRecommendedContentManager::$rbacreview
protected

◆ $repo

ilRecommendedContentDBRepository ilRecommendedContentManager::$repo
protected

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