ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBookObjectInfoStakeholder Class Reference
+ Inheritance diagram for ilBookObjectInfoStakeholder:
+ Collaboration diagram for ilBookObjectInfoStakeholder:

Public Member Functions

 getId ()
 
 getOwnerOfNewResources ()
 
 canBeAccessedByCurrentUser (ResourceIdentification $identification)
 
 resourceHasBeenDeleted (ResourceIdentification $identification)
 
 getLocationURIForResourceUsage (ResourceIdentification $identification)
 
- Public Member Functions inherited from ILIAS\ResourceStorage\Stakeholder\AbstractResourceStakeholder
 __construct (?int $user_id_of_owner=null)
 
 setOwner (int $user_id_of_owner)
 
 getFullyQualifiedClassName ()
 
 isResourceInUse (ResourceIdentification $identification)
 
 canBeAccessedByCurrentUser (ResourceIdentification $identification)
 
 resourceHasBeenDeleted (ResourceIdentification $identification)
 
 getOwnerOfResource (ResourceIdentification $identification)
 
 getConsumerNameForPresentation ()
 
 getLocationURIForResourceUsage (ResourceIdentification $identification)
 
- Public Member Functions inherited from ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder
 __construct ()
 Constructor must not have any parameters. More...
 
 getId ()
 
 getConsumerNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 canBeAccessedByCurrentUser (ResourceIdentification $identification)
 
 isResourceInUse (ResourceIdentification $identification)
 
 resourceHasBeenDeleted (ResourceIdentification $identification)
 
 getOwnerOfResource (ResourceIdentification $identification)
 
 getOwnerOfNewResources ()
 
 getLocationURIForResourceUsage (ResourceIdentification $identification)
 

Protected Attributes

ilDBInterface $database = null
 
- Protected Attributes inherited from ILIAS\ResourceStorage\Stakeholder\AbstractResourceStakeholder
int $default_owner
 
int $current_user
 

Private Member Functions

 resolveObjectId (ResourceIdentification $identification)
 
 initDB ()
 

Detailed Description

Definition at line 22 of file class.ilBookObjectInfoStakeholder.php.

Member Function Documentation

◆ canBeAccessedByCurrentUser()

ilBookObjectInfoStakeholder::canBeAccessedByCurrentUser ( ResourceIdentification  $identification)

Reimplemented from ILIAS\ResourceStorage\Stakeholder\AbstractResourceStakeholder.

Definition at line 37 of file class.ilBookObjectInfoStakeholder.php.

37 : bool
38 {
39 global $DIC;
40
41 $object_id = $this->resolveObjectId($identification);
42 if ($object_id === null) {
43 return true;
44 }
45
46 $ref_ids = ilObject2::_getAllReferences($object_id);
47 foreach ($ref_ids as $ref_id) {
48 // one must have read permissions on the exercise to see the instruction files
49 if ($DIC->access()->checkAccessOfUser($this->current_user, 'read', '', $ref_id)) {
50 return true;
51 }
52 }
53
54 return false;
55 }
resolveObjectId(ResourceIdentification $identification)
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26

References $DIC, $ref_id, ilObject\_getAllReferences(), and resolveObjectId().

+ Here is the call graph for this function:

◆ getId()

ilBookObjectInfoStakeholder::getId ( )
Returns
string not longer than 64 characters

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

Definition at line 27 of file class.ilBookObjectInfoStakeholder.php.

27 : string
28 {
29 return 'book_object_info';
30 }

◆ getLocationURIForResourceUsage()

ilBookObjectInfoStakeholder::getLocationURIForResourceUsage ( ResourceIdentification  $identification)

Reimplemented from ILIAS\ResourceStorage\Stakeholder\AbstractResourceStakeholder.

Definition at line 64 of file class.ilBookObjectInfoStakeholder.php.

64 : ?string
65 {
66 $this->initDB();
67 $object_id = $this->resolveObjectId($identification);
68 if ($object_id !== null) {
69 $references = ilObject::_getAllReferences($object_id);
70 $ref_id = array_shift($references);
71
72 // we currently deliver the goto-url of the exercise in which the resource is used. if possible, you could deliver a more speficic url wo the assignment as well.
73 return ilLink::_getLink($ref_id, 'exc');
74 }
75 return null;
76 }

References $ref_id, ilObject\_getAllReferences(), initDB(), and resolveObjectId().

+ Here is the call graph for this function:

◆ getOwnerOfNewResources()

◆ initDB()

ilBookObjectInfoStakeholder::initDB ( )
private

Definition at line 91 of file class.ilBookObjectInfoStakeholder.php.

91 : void
92 {
93 global $DIC;
94 if ($this->database === null) {
95 $this->database = $DIC->database();
96 }
97 }

References $DIC, and ILIAS\Repository\database().

Referenced by getLocationURIForResourceUsage(), and resolveObjectId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveObjectId()

ilBookObjectInfoStakeholder::resolveObjectId ( ResourceIdentification  $identification)
private

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

78 : ?int
79 {
80 $this->initDB();
81 $r = $this->database->queryF(
82 "SELECT pool_id FROM booking_object WHERE booking_object.obj_info_rid = %s;",
83 ['text'],
84 [$identification->serialize()]
85 );
86 $d = $this->database->fetchObject($r);
87
88 return (isset($d->pool_id) ? (int) $d->pool_id : null);
89 }

References Vendor\Package\$d, ILIAS\Repository\database(), initDB(), and ILIAS\ResourceStorage\Identification\AbstractIdentification\serialize().

Referenced by canBeAccessedByCurrentUser(), and getLocationURIForResourceUsage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resourceHasBeenDeleted()

ilBookObjectInfoStakeholder::resourceHasBeenDeleted ( ResourceIdentification  $identification)
Returns
bool true: if the Stakeholder could handle the deletion; false: if the Stakeholder could not handle the deletion of the resource.

Reimplemented from ILIAS\ResourceStorage\Stakeholder\AbstractResourceStakeholder.

Definition at line 57 of file class.ilBookObjectInfoStakeholder.php.

57 : bool
58 {
59 // at this place we could handle de deletion of a resource. not needed for instruction files IMO.
60
61 return true;
62 }

Field Documentation

◆ $database

ilDBInterface ilBookObjectInfoStakeholder::$database = null
protected

Definition at line 24 of file class.ilBookObjectInfoStakeholder.php.


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