ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilExcRepoObjAssignmentAccessInfo Class Reference

Repository object assignment information. More...

+ Inheritance diagram for ilExcRepoObjAssignmentAccessInfo:
+ Collaboration diagram for ilExcRepoObjAssignmentAccessInfo:

Public Member Functions

 isGranted ()
 Is access granted due to exercise assignment conditions? More...
 
 getNotGrantedReasons ()
 Get reasons why access is not granted. More...
 
 isGranted ()
 Is access granted due to exercise assignment conditions? More...
 
 getNotGrantedReasons ()
 Get reasons why access is not granted. More...
 

Static Public Member Functions

static getInfo ($a_ref_id, $a_user_id)
 

Protected Member Functions

 __construct ($a_is_granted, array $a_not_granted_reasons)
 Constructor. More...
 

Protected Attributes

 $is_granted
 
 $not_granted_reasons
 
 $lng
 
 $access
 

Detailed Description

Repository object assignment information.

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 12 of file class.ilExcRepoObjAssignmentAccessInfo.php.

Constructor & Destructor Documentation

◆ __construct()

ilExcRepoObjAssignmentAccessInfo::__construct (   $a_is_granted,
array  $a_not_granted_reasons 
)
protected

Constructor.

Parameters
bool$a_is_granted
string[]$a_not_granted_reasons

Definition at line 39 of file class.ilExcRepoObjAssignmentAccessInfo.php.

40 {
41 global $DIC;
42
43 $this->access = $DIC->access();
44 $this->is_granted = $a_is_granted;
45 $this->not_granted_reasons = $a_not_granted_reasons;
46
47 $this->lng = $DIC->language();
48 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ getInfo()

static ilExcRepoObjAssignmentAccessInfo::getInfo (   $a_ref_id,
  $a_user_id 
)
static
Parameters
int$a_ref_idref id
int$a_user_iduser id
Returns
ilExcRepoObjAssignmentAccessInfo

Definition at line 78 of file class.ilExcRepoObjAssignmentAccessInfo.php.

79 {
80 global $DIC;
81
82 include_once("./Modules/Exercise/RepoObjectAssignment/classes/class.ilExcRepoObjAssignment.php");
84 $lng = $DIC->language();
85 $access = $DIC->access();
86
87 // if this object is not assigned to any assignment, we do not deny the access
88 $assignment_info = $repo_obj_ass->getAssignmentInfoOfObj($a_ref_id, $a_user_id);
89 if (count($assignment_info) == 0) {
90 return new self(true, []);
91 }
92
93 $granted = true;
94 $reasons = [];
95 foreach ($assignment_info as $i) {
96 if (!$i->isUserSubmission()) {
97 $has_write_permission = false;
98 foreach ($i->getReadableRefIds() as $exc_ref_id) {
99 if ($access->checkAccessOfUser($a_user_id, "write", "", $exc_ref_id)) {
100 $has_write_permission = true;
101 }
102 }
103 if (!$has_write_permission) {
104 $granted = false;
105 $reasons[0] = $lng->txt("exc_obj_not_submitted_by_user");
106 }
107 }
108 }
109
110 return new self($granted, $reasons);
111 }
$i
Definition: disco.tpl.php:19

References $access, $DIC, $i, $lng, and ilExcRepoObjAssignment\getInstance().

Referenced by ilExcRepoObjAssignment\getAccessInfo(), and ilExcRepoObjAssignment\isGranted().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNotGrantedReasons()

ilExcRepoObjAssignmentAccessInfo::getNotGrantedReasons ( )

Get reasons why access is not granted.

Returns
string[]

Implements ilExcRepoObjAssignmentAccessInfoInterface.

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

References $not_granted_reasons.

◆ isGranted()

ilExcRepoObjAssignmentAccessInfo::isGranted ( )

Is access granted due to exercise assignment conditions?

Returns
int assignment id

Implements ilExcRepoObjAssignmentAccessInfoInterface.

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

References $is_granted.

Field Documentation

◆ $access

ilExcRepoObjAssignmentAccessInfo::$access
protected

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

Referenced by getInfo().

◆ $is_granted

ilExcRepoObjAssignmentAccessInfo::$is_granted
protected

Definition at line 17 of file class.ilExcRepoObjAssignmentAccessInfo.php.

Referenced by isGranted().

◆ $lng

ilExcRepoObjAssignmentAccessInfo::$lng
protected

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

Referenced by getInfo().

◆ $not_granted_reasons

ilExcRepoObjAssignmentAccessInfo::$not_granted_reasons
protected

Definition at line 22 of file class.ilExcRepoObjAssignmentAccessInfo.php.

Referenced by getNotGrantedReasons().


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