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

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

 resolveObjectId (ResourceIdentification $identification)
 
 initDB ()
 

Private Attributes

int $current_user
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilExcSampleSolutionStakeholder::__construct ( int  $owner = 6)

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

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

32  {
33  global $DIC;
34  $this->current_user = (int) ($DIC->isDependencyAvailable('user')
35  ? $DIC->user()->getId()
36  : (defined('ANONYMOUS_USER_ID') ? ANONYMOUS_USER_ID : 6));
37  $this->owner = $owner;
38  }
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()

ilExcSampleSolutionStakeholder::canBeAccessedByCurrentUser ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

Definition at line 50 of file class.ilExcSampleSolutionStakeholder.php.

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

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

◆ getId()

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

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

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

40  : string
41  {
42  return 'exc_sample_solution';
43  }

◆ getLocationURIForResourceUsage()

ilExcSampleSolutionStakeholder::getLocationURIForResourceUsage ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

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

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

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

◆ getOwnerOfNewResources()

ilExcSampleSolutionStakeholder::getOwnerOfNewResources ( )

◆ initDB()

ilExcSampleSolutionStakeholder::initDB ( )
private

Definition at line 104 of file class.ilExcSampleSolutionStakeholder.php.

References $DIC.

Referenced by getLocationURIForResourceUsage(), and resolveObjectId().

104  : void
105  {
106  global $DIC;
107  if ($this->database === null) {
108  $this->database = $DIC->database();
109  }
110  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ resolveObjectId()

ilExcSampleSolutionStakeholder::resolveObjectId ( ResourceIdentification  $identification)
private

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

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

Referenced by canBeAccessedByCurrentUser(), and getLocationURIForResourceUsage().

91  : ?int
92  {
93  $this->initDB();
94  $r = $this->database->queryF(
95  "SELECT exc_id FROM exc_assignment WHERE exc_assignment.solution_rid = %s;",
96  ['text'],
97  [$identification->serialize()]
98  );
99  $d = $this->database->fetchObject($r);
100 
101  return (isset($d->exc_id) ? (int) $d->exc_id : null);
102  }
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resourceHasBeenDeleted()

ilExcSampleSolutionStakeholder::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 70 of file class.ilExcSampleSolutionStakeholder.php.

70  : bool
71  {
72  // at this place we could handle de deletion of a resource. not needed for instruction files IMO.
73 
74  return true;
75  }

Field Documentation

◆ $current_user

int ilExcSampleSolutionStakeholder::$current_user
private

Definition at line 28 of file class.ilExcSampleSolutionStakeholder.php.

◆ $database

ilDBInterface ilExcSampleSolutionStakeholder::$database = null
protected

Definition at line 29 of file class.ilExcSampleSolutionStakeholder.php.

◆ $owner

int ilExcSampleSolutionStakeholder::$owner = 6
protected

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

Referenced by __construct(), and getOwnerOfNewResources().


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