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

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

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

Member Function Documentation

◆ canBeAccessedByCurrentUser()

ilExcSubmissionStakeholder::canBeAccessedByCurrentUser ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

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

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

37  : bool
38  {
39  global $DIC;
40 
41  $object_id = $this->resolveObjectId($identification);
42  if ($object_id === null) {
43  return true;
44  }
45 
46  $ref_ids = ilObject2::_getAllReferences($object_id);
47  foreach ($ref_ids as $ref_id) {
48  // one must have write permissions on the exercise to see the submission
49  if (
50  $DIC->access()->checkAccessOfUser($this->current_user, 'read', '', $ref_id) ||
51  $DIC->access()->checkAccessOfUser($this->current_user, 'write', '', $ref_id)) {
52  return true;
53  }
54  }
55 
56  return false;
57  }
static _getAllReferences(int $id)
get all reference ids for object ID
resolveObjectId(ResourceIdentification $identification)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

◆ getId()

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

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

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

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

◆ getLocationURIForResourceUsage()

ilExcSubmissionStakeholder::getLocationURIForResourceUsage ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

Definition at line 66 of file class.ilExcSubmissionStakeholder.php.

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

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

◆ getOwnerOfNewResources()

◆ initDB()

ilExcSubmissionStakeholder::initDB ( )
private

Definition at line 93 of file class.ilExcSubmissionStakeholder.php.

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

Referenced by getLocationURIForResourceUsage(), and resolveObjectId().

93  : void
94  {
95  global $DIC;
96  if ($this->database === null) {
97  $this->database = $DIC->database();
98  }
99  }
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()

ilExcSubmissionStakeholder::resolveObjectId ( ResourceIdentification  $identification)
private

Definition at line 80 of file class.ilExcSubmissionStakeholder.php.

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

Referenced by canBeAccessedByCurrentUser(), and getLocationURIForResourceUsage().

80  : ?int
81  {
82  $this->initDB();
83  $r = $this->database->queryF(
84  "SELECT obj_id FROM exc_returned WHERE exc_returned.solution_rid = %s;",
85  ['text'],
86  [$identification->serialize()]
87  );
88  $d = $this->database->fetchObject($r);
89 
90  return (isset($d->obj_id) ? (int) $d->obj_id : null);
91  }
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()

ilExcSubmissionStakeholder::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 59 of file class.ilExcSubmissionStakeholder.php.

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

Field Documentation

◆ $database

ilDBInterface ilExcSubmissionStakeholder::$database = null
protected

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


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