ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilExcInstructionFilesStakeholder Class Reference
+ Inheritance diagram for ilExcInstructionFilesStakeholder:
+ Collaboration diagram for ilExcInstructionFilesStakeholder:

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

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

Member Function Documentation

◆ canBeAccessedByCurrentUser()

ilExcInstructionFilesStakeholder::canBeAccessedByCurrentUser ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

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

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

40  : bool
41  {
42  global $DIC;
43 
44  $object_id = $this->resolveObjectId($identification);
45  if ($object_id === null) {
46  return true;
47  }
48 
49  $ref_ids = ilObject2::_getAllReferences($object_id);
50  foreach ($ref_ids as $ref_id) {
51  // one must have read permissions on the exercise to see the instruction files
52  if ($DIC->access()->checkAccessOfUser($this->current_user, 'read', '', $ref_id)) {
53  return true;
54  }
55  }
56 
57  return false;
58  }
static _getAllReferences(int $id)
get all reference ids for object ID
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:26
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 30 of file class.ilExcInstructionFilesStakeholder.php.

30  : string
31  {
32  return 'exc_instruction_files';
33  }

◆ getLocationURIForResourceUsage()

ilExcInstructionFilesStakeholder::getLocationURIForResourceUsage ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

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

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

67  : ?string
68  {
69  $this->initDB();
70  $object_id = $this->resolveObjectId($identification);
71  if ($object_id !== null) {
72  $references = ilObject::_getAllReferences($object_id);
73  $ref_id = array_shift($references);
74 
75  // 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.
76  return ilLink::_getLink($ref_id, 'exc');
77  }
78  return null;
79  }
static _getAllReferences(int $id)
get all reference ids for object ID
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
resolveObjectId(ResourceIdentification $identification)
+ Here is the call graph for this function:

◆ getOwnerOfNewResources()

◆ initDB()

ilExcInstructionFilesStakeholder::initDB ( )
private

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

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

Referenced by getLocationURIForResourceUsage(), and resolveObjectId().

94  : void
95  {
96  global $DIC;
97  if ($this->database === null) {
98  $this->database = $DIC->database();
99  }
100  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveObjectId()

ilExcInstructionFilesStakeholder::resolveObjectId ( ResourceIdentification  $identification)
private

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

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

Referenced by canBeAccessedByCurrentUser(), and getLocationURIForResourceUsage().

81  : ?int
82  {
83  $this->initDB();
84  $r = $this->database->queryF(
85  "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;",
86  ['text'],
87  [$identification->serialize()]
88  );
89  $d = $this->database->fetchObject($r);
90 
91  return (isset($d->exc_id) ? (int) $d->exc_id : null);
92  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$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 60 of file class.ilExcInstructionFilesStakeholder.php.

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

Field Documentation

◆ $database

ilDBInterface ilExcInstructionFilesStakeholder::$database = null
protected

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


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