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

Public Member Functions

 __construct (int $owner=6)
 ilObjFileStakeholder constructor. More...
 
 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

 resolveObjectId (ResourceIdentification $identification)
 
 initDB ()
 

Private Attributes

int $current_user
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExcInstructionFilesStakeholder::__construct ( int  $owner = 6)

ilObjFileStakeholder constructor.

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

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

38  {
39  global $DIC;
40  $this->current_user = (int) ($DIC->isDependencyAvailable('user')
41  ? $DIC->user()->getId()
42  : (defined('ANONYMOUS_USER_ID') ? ANONYMOUS_USER_ID : 6));
43  $this->owner = $owner;
44  }
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()

ilExcInstructionFilesStakeholder::canBeAccessedByCurrentUser ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

Definition at line 56 of file class.ilExcInstructionFilesStakeholder.php.

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

56  : bool
57  {
58  global $DIC;
59 
60  $object_id = $this->resolveObjectId($identification);
61  if ($object_id === null) {
62  return true;
63  }
64 
65  $ref_ids = ilObject2::_getAllReferences($object_id);
66  foreach ($ref_ids as $ref_id) {
67  // one must have read permissions on the exercise to see the instruction files
68  if ($DIC->access()->checkAccessOfUser($this->current_user, 'read', '', $ref_id)) {
69  return true;
70  }
71  }
72 
73  return false;
74  }
static _getAllReferences(int $id)
get all reference ids for object ID
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
resolveObjectId(ResourceIdentification $identification)
+ Here is the call graph for this function:

◆ getId()

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

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

Definition at line 46 of file class.ilExcInstructionFilesStakeholder.php.

46  : string
47  {
48  return 'exc_instruction_files';
49  }

◆ getLocationURIForResourceUsage()

ilExcInstructionFilesStakeholder::getLocationURIForResourceUsage ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

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

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

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

◆ getOwnerOfNewResources()

ilExcInstructionFilesStakeholder::getOwnerOfNewResources ( )

◆ initDB()

ilExcInstructionFilesStakeholder::initDB ( )
private

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

References $DIC.

Referenced by getLocationURIForResourceUsage(), and resolveObjectId().

110  : void
111  {
112  global $DIC;
113  if ($this->database === null) {
114  $this->database = $DIC->database();
115  }
116  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ resolveObjectId()

ilExcInstructionFilesStakeholder::resolveObjectId ( ResourceIdentification  $identification)
private

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

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

Referenced by canBeAccessedByCurrentUser(), and getLocationURIForResourceUsage().

97  : ?int
98  {
99  $this->initDB();
100  $r = $this->database->queryF(
101  "SELECT exc_id, rcid FROM il_resource_rca JOIN exc_assignment ON exc_assignment.if_rcid = il_resource_rca.rcid 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  }
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resourceHasBeenDeleted()

ilExcInstructionFilesStakeholder::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 76 of file class.ilExcInstructionFilesStakeholder.php.

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

Field Documentation

◆ $current_user

int ilExcInstructionFilesStakeholder::$current_user
private

Definition at line 31 of file class.ilExcInstructionFilesStakeholder.php.

◆ $database

ilDBInterface ilExcInstructionFilesStakeholder::$database = null
protected

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

◆ $owner

int ilExcInstructionFilesStakeholder::$owner = 6
protected

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