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

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 24 of file class.ilExcPeerReviewFileStakeholder.php.

Member Function Documentation

◆ canBeAccessedByCurrentUser()

ilExcPeerReviewFileStakeholder::canBeAccessedByCurrentUser ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

Definition at line 38 of file class.ilExcPeerReviewFileStakeholder.php.

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

38  : bool
39  {
40  global $DIC;
41 
42  $object_id = $this->resolveObjectId($identification);
43  if ($object_id === null) {
44  return true;
45  }
46 
47  $ref_ids = ilObject2::_getAllReferences($object_id);
48  foreach ($ref_ids as $ref_id) {
49  // one must have write permissions on the exercise to see the submission
50  if (
51  $DIC->access()->checkAccessOfUser($this->current_user, 'read', '', $ref_id) ||
52  $DIC->access()->checkAccessOfUser($this->current_user, 'write', '', $ref_id)) {
53  return true;
54  }
55  }
56 
57  return false;
58  }
resolveObjectId(ResourceIdentification $identification)
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
+ Here is the call graph for this function:

◆ getId()

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

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

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

28  : string
29  {
30  return 'exc_peer_rev_file';
31  }

◆ getLocationURIForResourceUsage()

ilExcPeerReviewFileStakeholder::getLocationURIForResourceUsage ( ResourceIdentification  $identification)

Implements ILIAS\ResourceStorage\Stakeholder\ResourceStakeholder.

Definition at line 67 of file class.ilExcPeerReviewFileStakeholder.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  }
resolveObjectId(ResourceIdentification $identification)
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
+ Here is the call graph for this function:

◆ getOwnerOfNewResources()

◆ initDB()

ilExcPeerReviewFileStakeholder::initDB ( )
private

Definition at line 101 of file class.ilExcPeerReviewFileStakeholder.php.

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

Referenced by getLocationURIForResourceUsage(), and resolveObjectId().

101  : void
102  {
103  global $DIC;
104  if ($this->database === null) {
105  $this->database = $DIC->database();
106  }
107  }
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()

ilExcPeerReviewFileStakeholder::resolveObjectId ( ResourceIdentification  $identification)
private

Definition at line 81 of file class.ilExcPeerReviewFileStakeholder.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 ass_id FROM exc_crit_file WHERE rid = %s",
86  ['text'],
87  [$identification->serialize()]
88  );
89  if (($d = $this->database->fetchObject($r)) !== null) {
90  $r2 = $this->database->queryF(
91  "SELECT obj_id FROM exc_assignment WHERE ass_id = %s",
92  ['integer'],
93  [$d->ass_id]
94  );
95  $d2 = $this->database->fetchObject($r2);
96  }
97 
98  return (isset($d2->obj_id) ? (int) $d2->obj_id : null);
99  }
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()

ilExcPeerReviewFileStakeholder::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.ilExcPeerReviewFileStakeholder.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 ilExcPeerReviewFileStakeholder::$database = null
protected

Definition at line 26 of file class.ilExcPeerReviewFileStakeholder.php.


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