ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilExcTutorTeamFeedbackFileStakeholder Class Reference
+ Inheritance diagram for ilExcTutorTeamFeedbackFileStakeholder:
+ Collaboration diagram for ilExcTutorTeamFeedbackFileStakeholder:

Public Member Functions

 __construct (int $owner=6)
 
 getId ()
 
 getOwnerOfNewResources ()
 
 canBeAccessedByCurrentUser (ResourceIdentification $identification)
 
 resourceHasBeenDeleted (ResourceIdentification $identification)
 
 getLocationURIForResourceUsage (ResourceIdentification $identification)
 
- Public Member Functions inherited from ILIAS\ResourceStorage\Stakeholder\AbstractResourceStakeholder
 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...
 

Protected Attributes

int $owner = 6
 
ilDBInterface $database = null
 

Private Member Functions

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

Private Attributes

int $current_user
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExcTutorTeamFeedbackFileStakeholder::__construct ( int  $owner = 6)

Definition at line 33 of file class.ilExcTutorTeamFeedbackFileStakeholder.php.

References $DIC, $owner, ANONYMOUS_USER_ID, and ILIAS\Repository\int().

34  {
35  global $DIC;
36  $this->current_user = (int) ($DIC->isDependencyAvailable('user')
37  ? $DIC->user()->getId()
38  : (defined('ANONYMOUS_USER_ID') ? ANONYMOUS_USER_ID : 6));
39  $this->owner = $owner;
40  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ canBeAccessedByCurrentUser()

ilExcTutorTeamFeedbackFileStakeholder::canBeAccessedByCurrentUser ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

Definition at line 52 of file class.ilExcTutorTeamFeedbackFileStakeholder.php.

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

52  : bool
53  {
54  global $DIC;
55 
56  $object_id = $this->resolveObjectId($identification);
57  $is_recipient = $this->isRecipient($identification);
58 
59  if ($object_id === null) {
60  return true;
61  }
62 
63  $ref_ids = ilObject2::_getAllReferences($object_id);
64  foreach ($ref_ids as $ref_id) {
65  if ($DIC->access()->checkAccessOfUser($this->current_user, 'write', '', $ref_id)) {
66  return true;
67  }
68  if ($is_recipient &&
69  $DIC->access()->checkAccessOfUser($this->current_user, 'read', '', $ref_id)) {
70  return true;
71  }
72  }
73 
74  return false;
75  }
static _getAllReferences(int $id)
get all reference ids for object ID
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ getId()

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

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

Definition at line 42 of file class.ilExcTutorTeamFeedbackFileStakeholder.php.

42  : string
43  {
44  return 'exc_tutor_team_feedback';
45  }

◆ getLocationURIForResourceUsage()

ilExcTutorTeamFeedbackFileStakeholder::getLocationURIForResourceUsage ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

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

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

84  : ?string
85  {
86  $this->initDB();
87  $object_id = $this->resolveObjectId($identification);
88  if ($object_id !== null) {
89  $references = ilObject::_getAllReferences($object_id);
90  $ref_id = array_shift($references);
91 
92  // 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.
93  return ilLink::_getLink($ref_id, 'exc');
94  }
95  return null;
96  }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ getOwnerOfNewResources()

ilExcTutorTeamFeedbackFileStakeholder::getOwnerOfNewResources ( )

◆ initDB()

ilExcTutorTeamFeedbackFileStakeholder::initDB ( )
private

Definition at line 125 of file class.ilExcTutorTeamFeedbackFileStakeholder.php.

References $DIC.

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

125  : void
126  {
127  global $DIC;
128  if ($this->database === null) {
129  $this->database = $DIC->database();
130  }
131  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ isRecipient()

ilExcTutorTeamFeedbackFileStakeholder::isRecipient ( ResourceIdentification  $identification)
private

Definition at line 98 of file class.ilExcTutorTeamFeedbackFileStakeholder.php.

References $current_user, $r, initDB(), and ILIAS\ResourceStorage\Identification\AbstractIdentification\serialize().

Referenced by canBeAccessedByCurrentUser().

98  : bool
99  {
100  $this->initDB();
101  $r = $this->database->queryF(
102  "SELECT te.usr_id FROM il_resource_rca JOIN exc_team_data ON exc_team_data.feedback_rcid = il_resource_rca.rcid JOIN il_exc_team te ON te.id = exc_team_data.id WHERE il_resource_rca.rid = %s AND te.usr_id = %s;",
103  ['text', 'integer'],
104  [$identification->serialize(), $this->current_user]
105  );
106  if ($this->database->fetchAssoc($r)) {
107  return true;
108  }
109  return false;
110  }
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveObjectId()

ilExcTutorTeamFeedbackFileStakeholder::resolveObjectId ( ResourceIdentification  $identification)
private

Definition at line 112 of file class.ilExcTutorTeamFeedbackFileStakeholder.php.

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

Referenced by canBeAccessedByCurrentUser(), and getLocationURIForResourceUsage().

112  : ?int
113  {
114  $this->initDB();
115  $r = $this->database->queryF(
116  "SELECT exc_id, rcid FROM il_resource_rca JOIN exc_team_data ON exc_team_data.feedback_rcid = il_resource_rca.rcid JOIN il_exc_team te ON te.id = exc_team_data.id JOIN exc_assignment ON (exc_assignment.id = exc_team_data.ass_id) WHERE il_resource_rca.rid = %s;",
117  ['text'],
118  [$identification->serialize()]
119  );
120  $d = $this->database->fetchObject($r);
121 
122  return (isset($d->exc_id) ? (int) $d->exc_id : null);
123  }
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resourceHasBeenDeleted()

ilExcTutorTeamFeedbackFileStakeholder::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.

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

Definition at line 77 of file class.ilExcTutorTeamFeedbackFileStakeholder.php.

77  : bool
78  {
79  // at this place we could handle de deletion of a resource. not needed for instruction files IMO.
80 
81  return true;
82  }

Field Documentation

◆ $current_user

int ilExcTutorTeamFeedbackFileStakeholder::$current_user
private

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

Referenced by isRecipient().

◆ $database

ilDBInterface ilExcTutorTeamFeedbackFileStakeholder::$database = null
protected

◆ $owner

int ilExcTutorTeamFeedbackFileStakeholder::$owner = 6
protected

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