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

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

 isRecipient (ResourceIdentification $identification)
 
 resolveObjectId (ResourceIdentification $identification)
 
 initDB ()
 

Detailed Description

Definition at line 23 of file class.ilExcTutorFeedbackFileStakeholder.php.

Member Function Documentation

◆ canBeAccessedByCurrentUser()

ilExcTutorFeedbackFileStakeholder::canBeAccessedByCurrentUser ( ResourceIdentification  $identification)

Reimplemented from ILIAS\ResourceStorage\Stakeholder\AbstractResourceStakeholder.

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

37 : bool
38 {
39 global $DIC;
40
41 $object_id = $this->resolveObjectId($identification);
42 $is_recipient = $this->isRecipient($identification);
43
44 if ($object_id === null) {
45 return true;
46 }
47
48 $ref_ids = ilObject2::_getAllReferences($object_id);
49 foreach ($ref_ids as $ref_id) {
50 if ($DIC->access()->checkAccessOfUser($this->current_user, 'write', '', $ref_id)) {
51 return true;
52 }
53 if ($is_recipient &&
54 $DIC->access()->checkAccessOfUser($this->current_user, 'read', '', $ref_id)) {
55 return true;
56 }
57 }
58
59 return false;
60 }
resolveObjectId(ResourceIdentification $identification)
isRecipient(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(), isRecipient(), and resolveObjectId().

+ Here is the call graph for this function:

◆ getId()

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

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

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

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

◆ getLocationURIForResourceUsage()

ilExcTutorFeedbackFileStakeholder::getLocationURIForResourceUsage ( ResourceIdentification  $identification)

Reimplemented from ILIAS\ResourceStorage\Stakeholder\AbstractResourceStakeholder.

Definition at line 69 of file class.ilExcTutorFeedbackFileStakeholder.php.

69 : ?string
70 {
71 $this->initDB();
72 $object_id = $this->resolveObjectId($identification);
73 if ($object_id !== null) {
74 $references = ilObject::_getAllReferences($object_id);
75 $ref_id = array_shift($references);
76
77 // 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.
78 return ilLink::_getLink($ref_id, 'exc');
79 }
80 return null;
81 }

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

+ Here is the call graph for this function:

◆ getOwnerOfNewResources()

◆ initDB()

ilExcTutorFeedbackFileStakeholder::initDB ( )
private

Definition at line 110 of file class.ilExcTutorFeedbackFileStakeholder.php.

110 : void
111 {
112 global $DIC;
113 if ($this->database === null) {
114 $this->database = $DIC->database();
115 }
116 }

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

Referenced by getLocationURIForResourceUsage(), isRecipient(), and resolveObjectId().

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

◆ isRecipient()

ilExcTutorFeedbackFileStakeholder::isRecipient ( ResourceIdentification  $identification)
private

Definition at line 83 of file class.ilExcTutorFeedbackFileStakeholder.php.

83 : bool
84 {
85 $this->initDB();
86 $r = $this->database->queryF(
87 "SELECT exc_mem_ass_status.usr_id FROM il_resource_rca JOIN exc_mem_ass_status ON exc_mem_ass_status.feedback_rcid = il_resource_rca.rcid WHERE il_resource_rca.rid = %s;",
88 ['text'],
89 [$identification->serialize()]
90 );
91 $d = $this->database->fetchAssoc($r);
92 $user_id = (int) ($d["usr_id"] ?? 0);
93
94 return ($user_id === $this->current_user);
95 }

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

Referenced by canBeAccessedByCurrentUser().

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

◆ resolveObjectId()

ilExcTutorFeedbackFileStakeholder::resolveObjectId ( ResourceIdentification  $identification)
private

Definition at line 97 of file class.ilExcTutorFeedbackFileStakeholder.php.

97 : ?int
98 {
99 $this->initDB();
100 $r = $this->database->queryF(
101 "SELECT exc_id, rcid FROM il_resource_rca JOIN exc_mem_ass_status ON exc_mem_ass_status.feedback_rcid = il_resource_rca.rcid JOIN exc_assignment ON (exc_assignment.id = exc_mem_ass_status.ass_id) WHERE il_resource_rca.rid = %s;",
102 ['text'],
103 [$identification->serialize()]
104 );
105 $d = $this->database->fetchObject($r);
106
107 return (isset($d->exc_id) ? (int) $d->exc_id : null);
108 }

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()

ilExcTutorFeedbackFileStakeholder::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 62 of file class.ilExcTutorFeedbackFileStakeholder.php.

62 : bool
63 {
64 // at this place we could handle de deletion of a resource. not needed for instruction files IMO.
65
66 return true;
67 }

Field Documentation

◆ $database

ilDBInterface ilExcTutorFeedbackFileStakeholder::$database = null
protected

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


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