Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401]

(no description)

File Size: 210 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

published_resource_repository:: (4 methods):
  published_resources_from_records()
  get_available_resources_from_records()
  find_all_for_user()
  find_all_by_ids_for_user()


Class: published_resource_repository  - X-Ref

Class published_resource_repository for fetching the published_resource instances from the store.

published_resources_from_records(array $records)   X-Ref
Convert a list of stdClasses to a list of published_resource instances.

param: array $records the records.
return: array the array of published_resource instances.

get_available_resources_from_records(array $resources, int $userid)   X-Ref
Given a list of published resources, return a list of those which are available to the provided user.

param: array $resources the array of records representing published resources.
param: int $userid the Moodle user id to check.
return: array an array of stdClasses containing data about resources which are available to the current user.

find_all_for_user(int $userid)   X-Ref
Find all published resources which are visible to the given user.

param: int $userid the id of the user to check.
return: published_resource[] an array of published_resource view objects instances.

find_all_by_ids_for_user(array $ids, int $userid)   X-Ref
Find all published_resource instances matching the supplied ids for the current user.

param: array $ids the array containing object ids to lookup
param: int $userid the id of the user to check
return: array an array of published_resource instances which are available to the user.