ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCourseReferencePathInfo Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilCourseReferencePathInfo

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

Constructor & Destructor Documentation

◆ __construct()

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

ilCourseReferencePathInfo constructor.

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

76 {
77 global $DIC;
78
79 $this->logger = $DIC->logger()->crsr();
80 $this->tree = $DIC->repositoryTree();
81 $this->access = $DIC->access();
82
83 $this->ref_id = $ref_id;
84 $this->target_ref_id = $target_ref_id;
85 $this->init();
86
87 $this->logger->info('ref_id: ' . $this->ref_id);
88 $this->logger->info('target_ref_id: ' . $this->target_ref_id);
89 $this->logger->info('parent course: ' . $this->parent_course_ref_id);
90 $this->logger->info('has parent course: ' . $this->has_parent_course);
91 }
global $DIC
Definition: shib_login.php:26

References $DIC, $ref_id, $target_ref_id, ILIAS\Repository\access(), init(), and ILIAS\Repository\logger().

+ 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 175 of file class.ilCourseReferencePathInfo.php.

176 {
177 if (!$this->hasParentCourse()) {
178 $this->logger->dump('Access failed: no parent course');
179 return false;
180 }
181 return
182 $this->access->checkAccess('manage_members', '', $this->target_ref_id) &&
183 $this->access->checkAccess('manage_members', '', $this->parent_course_ref_id);
184 }

References ILIAS\Repository\access(), hasParentCourse(), and ILIAS\Repository\logger().

+ 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 98 of file class.ilCourseReferencePathInfo.php.

99 {
100 if (!array_key_exists($ref_id, self::$instances)) {
101 self::$instances[$ref_id] = new self($ref_id, $target_ref_id);
102 }
103 return self::$instances[$ref_id];
104 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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 142 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 158 of file class.ilCourseReferencePathInfo.php.

158 : int
159 {
161 }

References $target_ref_id.

◆ hasParentCourse()

ilCourseReferencePathInfo::hasParentCourse ( )
Returns
bool

Definition at line 150 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 190 of file class.ilCourseReferencePathInfo.php.

191 {
192 if (!$this->target_ref_id) {
193 $target_obj_id = ilObjCourseReference::_lookupTargetId(ilObject::_lookupObjId($this->ref_id));
194 $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
195 $this->target_ref_id = end($target_ref_ids);
196 }
197
198 $this->member_update_enabled = ilObjCourseReference::lookupMemberUpdateEnabled(ilObject::_lookupObjId($this->ref_id));
199 $this->parent_course_ref_id = $this->tree->checkForParentType($this->ref_id, 'crs');
200
201 if ($this->getParentCourseRefId() && !$this->tree->checkForParentType($this->ref_id, 'grp')) {
202 $this->has_parent_course = true;
203 }
204 }
static _lookupTargetId(int $a_obj_id)
static lookupMemberUpdateEnabled(int $obj_id)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupObjId(int $ref_id)

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 166 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 112 of file class.ilCourseReferencePathInfo.php.

112 : bool
113 {
114 global $DIC;
115
116 $tree = $DIC->repositoryTree();
117 $childs = $tree->getChildsByType($course_ref_id, 'crsr');
118 foreach ($childs as $tree_node) {
119 $path_info = self::getInstanceByRefId($tree_node['child']);
120 if (!$path_info->hasParentCourse()) {
121 continue;
122 }
123 if (!$path_info->isMemberUpdateEnabled()) {
124 continue;
125 }
126 if (!$path_info->checkManagmentAccess()) {
127 continue;
128 }
129 $part = ilParticipants::getInstance($path_info->getTargetId());
130 foreach ($participants as $part_id) {
131 if ($part->isMember($part_id)) {
132 return true;
133 }
134 }
135 }
136 return false;
137 }
static getInstanceByRefId(int $ref_id, int $target_ref_id=0)
static getInstance(int $a_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 42 of file class.ilCourseReferencePathInfo.php.

◆ $has_parent_course

ilCourseReferencePathInfo::$has_parent_course = false
private

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

Referenced by hasParentCourse().

◆ $instances

ilCourseReferencePathInfo::$instances = []
staticprivate

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

◆ $logger

ilCourseReferencePathInfo::$logger = null
private

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

◆ $member_update_enabled

ilCourseReferencePathInfo::$member_update_enabled = false
private

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

Referenced by isMemberUpdateEnabled().

◆ $parent_course_ref_id

ilCourseReferencePathInfo::$parent_course_ref_id = 0
private

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

Referenced by getParentCourseRefId().

◆ $ref_id

ilCourseReferencePathInfo::$ref_id = 0
private

Definition at line 47 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: