ILIAS  release_7 Revision v7.30-3-g800a261c036
ilCourseReferencePathInfo Class Reference

Class ilCourseReferencePathInfo. More...

+ Collaboration diagram for ilCourseReferencePathInfo:

Public Member Functions

 __construct (int $ref_id, int $target_ref_id=0)
 ilCourseReferencePathInfo constructor. More...
 
 getParentCourseRefId ()
 
 hasParentCourse ()
 
 getTargetId ()
 
 isMemberUpdateEnabled ()
 
 checkManagmentAccess ()
 Check manage member for both target and parent course. More...
 

Static Public Member Functions

static getInstanceByRefId (int $ref_id, int $target_ref_id=0)
 
static isReferenceMemberUpdateConfirmationRequired (int $course_ref_id, array $participants)
 

Protected Member Functions

 init ()
 Init path info. More...
 

Private Attributes

 $logger = null
 
 $tree = null
 
 $access = null
 
 $ref_id = 0
 
 $target_ref_id = 0
 
 $has_parent_course = false
 
 $parent_course_ref_id = 0
 
 $member_update_enabled = false
 

Static Private Attributes

static $instances = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCourseReferencePathInfo::__construct ( int  $ref_id,
int  $target_ref_id = 0 
)

ilCourseReferencePathInfo constructor.

Definition at line 61 of file class.ilCourseReferencePathInfo.php.

62 {
63 global $DIC;
64
65 $this->logger = $DIC->logger()->crsr();
66 $this->tree = $DIC->repositoryTree();
67 $this->access = $DIC->access();
68
69 $this->ref_id = $ref_id;
70 $this->target_ref_id = $target_ref_id;
71 $this->init();
72
73 $this->logger->info('ref_id: ' . $this->ref_id);
74 $this->logger->info('target_ref_id: ' . $this->target_ref_id);
75 $this->logger->info('parent course: ' . $this->parent_course_ref_id);
76 $this->logger->info('has parent course: ' . $this->has_parent_course);
77 }
global $DIC
Definition: goto.php:24

References $DIC, $ref_id, $target_ref_id, and init().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkManagmentAccess()

ilCourseReferencePathInfo::checkManagmentAccess ( )

Check manage member for both target and parent course.

Returns
bool

Definition at line 161 of file class.ilCourseReferencePathInfo.php.

162 {
163 if (!$this->hasParentCourse()) {
164 $this->logger->dump('Access failed: no parent course');
165 return false;
166 }
167 return
168 $this->access->checkAccess('manage_members', '', $this->target_ref_id) &&
169 $this->access->checkAccess('manage_members', '', $this->parent_course_ref_id);
170 }

References hasParentCourse().

+ Here is the call graph for this function:

◆ getInstanceByRefId()

static ilCourseReferencePathInfo::getInstanceByRefId ( int  $ref_id,
int  $target_ref_id = 0 
)
static
Parameters
int$ref_id
int$target_ref_id
Returns
\ilCourseReferencePathInfo

Definition at line 84 of file class.ilCourseReferencePathInfo.php.

85 {
86 if (!array_key_exists($ref_id, self::$instances)) {
87 self::$instances[$ref_id] = new self($ref_id, $target_ref_id);
88 }
89 return self::$instances[$ref_id];
90 }
Class ilCourseReferencePathInfo.

References $ref_id, and $target_ref_id.

Referenced by ilCourseReferenceAppEventListener\handleReferences(), ilObjCourseReferenceGUI\initForm(), isReferenceMemberUpdateConfirmationRequired(), ilObjCourseReferenceGUI\loadPropertiesFromSettingsForm(), and ilCourseReferenceDeleteConfirmationTableGUI\readLinkedCourseAssignments().

+ Here is the caller graph for this function:

◆ getParentCourseRefId()

ilCourseReferencePathInfo::getParentCourseRefId ( )
Returns
int

Definition at line 128 of file class.ilCourseReferencePathInfo.php.

References $parent_course_ref_id.

Referenced by init().

+ Here is the caller graph for this function:

◆ getTargetId()

ilCourseReferencePathInfo::getTargetId ( )
Returns
int

Definition at line 144 of file class.ilCourseReferencePathInfo.php.

144 : int
145 {
147 }

References $target_ref_id.

◆ hasParentCourse()

ilCourseReferencePathInfo::hasParentCourse ( )
Returns
bool

Definition at line 136 of file class.ilCourseReferencePathInfo.php.

References $has_parent_course.

Referenced by checkManagmentAccess().

+ Here is the caller graph for this function:

◆ init()

ilCourseReferencePathInfo::init ( )
protected

Init path info.

Definition at line 176 of file class.ilCourseReferencePathInfo.php.

177 {
178 if (!$this->target_ref_id) {
179 $target_obj_id = ilObjCourseReference::_lookupTargetId(ilObject::_lookupObjId($this->ref_id));
180 $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
181 $this->target_ref_id = end($target_ref_ids);
182 }
183
184 $this->member_update_enabled = ilObjCourseReference::lookupMemberUpdateEnabled(ilObject::_lookupObjId($this->ref_id));
185 $this->parent_course_ref_id = $this->tree->checkForParentType($this->ref_id, 'crs');
186
187 if ($this->getParentCourseRefId() && !$this->tree->checkForParentType($this->ref_id, 'grp')) {
188 $this->has_parent_course = true;
189 }
190 }
static _lookupTargetId($a_obj_id)
lookup target id
static lookupMemberUpdateEnabled(int $obj_id)
static _lookupObjId($a_id)
static _getAllReferences($a_id)
get all reference ids of object

References ilObject\_getAllReferences(), ilObject\_lookupObjId(), ilContainerReference\_lookupTargetId(), getParentCourseRefId(), and ilObjCourseReference\lookupMemberUpdateEnabled().

Referenced by __construct().

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

◆ isMemberUpdateEnabled()

ilCourseReferencePathInfo::isMemberUpdateEnabled ( )
Returns
bool

Definition at line 152 of file class.ilCourseReferencePathInfo.php.

References $member_update_enabled.

◆ isReferenceMemberUpdateConfirmationRequired()

static ilCourseReferencePathInfo::isReferenceMemberUpdateConfirmationRequired ( int  $course_ref_id,
array  $participants 
)
static
Parameters
int$course_ref_id
int[]$participants
Returns
bool

Definition at line 98 of file class.ilCourseReferencePathInfo.php.

98 : bool
99 {
100 global $DIC;
101
102 $tree = $DIC->repositoryTree();
103 $childs = $tree->getChildsByType($course_ref_id, 'crsr');
104 foreach ($childs as $tree_node) {
105 $path_info = self::getInstanceByRefId($tree_node['child']);
106 if (!$path_info->hasParentCourse()) {
107 continue;
108 }
109 if (!$path_info->isMemberUpdateEnabled()) {
110 continue;
111 }
112 if (!$path_info->checkManagmentAccess()) {
113 continue;
114 }
115 $part = ilParticipants::getInstance($path_info->getTargetId());
116 foreach ($participants as $part_id) {
117 if ($part->isMember($part_id)) {
118 return true;
119 }
120 }
121 }
122 return false;
123 }
static getInstanceByRefId(int $ref_id, int $target_ref_id=0)
static getInstance($a_ref_id)
Get instance by ref_id.

References $DIC, $tree, ilParticipants\getInstance(), and getInstanceByRefId().

Referenced by ilMembershipGUI\confirmDeleteParticipants().

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

Field Documentation

◆ $access

ilCourseReferencePathInfo::$access = null
private

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

◆ $has_parent_course

ilCourseReferencePathInfo::$has_parent_course = false
private

Definition at line 44 of file class.ilCourseReferencePathInfo.php.

Referenced by hasParentCourse().

◆ $instances

ilCourseReferencePathInfo::$instances = []
staticprivate

Definition at line 13 of file class.ilCourseReferencePathInfo.php.

◆ $logger

ilCourseReferencePathInfo::$logger = null
private

Definition at line 18 of file class.ilCourseReferencePathInfo.php.

◆ $member_update_enabled

ilCourseReferencePathInfo::$member_update_enabled = false
private

Definition at line 55 of file class.ilCourseReferencePathInfo.php.

Referenced by isMemberUpdateEnabled().

◆ $parent_course_ref_id

ilCourseReferencePathInfo::$parent_course_ref_id = 0
private

Definition at line 49 of file class.ilCourseReferencePathInfo.php.

Referenced by getParentCourseRefId().

◆ $ref_id

ilCourseReferencePathInfo::$ref_id = 0
private

Definition at line 33 of file class.ilCourseReferencePathInfo.php.

Referenced by __construct(), and getInstanceByRefId().

◆ $target_ref_id

ilCourseReferencePathInfo::$target_ref_id = 0
private

◆ $tree

ilCourseReferencePathInfo::$tree = null
private

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