35 throw new ilException(
'$position_id cannot be null');
41 'position_id' => $position_id,
47 $template_set->setContextId(
$context->getId());
48 $template_set->setPositionId($position_id);
49 $template_set->setNewlyCreated(
true);
50 $template_set->create();
53 $template_set->setProtected(!$editable);
54 $template_set->afterObjectLoad();
62 'position_id' => $position_id,
78 $ilOrgUnitObjectPositionSetting = $ilOrgUnitGlobalSettings->getObjectPositionSettingsByType(
$context->getContext());
80 if (!$ilOrgUnitObjectPositionSetting->isActive()) {
82 "Postion-related permissions not active in {$context->getContext()}",
93 'position_id' => $position_id,
96 $dedicated_set->afterObjectLoad();
97 return $dedicated_set;
117 $ilOrgUnitObjectPositionSetting = $ilOrgUnitGlobalSettings->getObjectPositionSettingsByType(
$context->getContext());
119 if (!$ilOrgUnitObjectPositionSetting->isActive()) {
121 "Position-related permissions not active in {$context->getContext()}",
129 'position_id' => $position_id,
131 if ($dedicated_set) {
132 $dedicated_set->afterObjectLoad();
133 return $dedicated_set;
139 $set->setProtected(
false);
141 $set->setPositionId($position_id);
142 $set->setContextId(
$context->getId());
143 $set->setOperations($template->getOperations());
144 $set->setNewlyCreated(
true);
146 $set->afterObjectLoad();
155 public static function removeLocalSetForRefId(
int $ref_id,
int $position_id): bool
165 $ilOrgUnitObjectPositionSetting = $ilOrgUnitGlobalSettings->getObjectPositionSettingsByType(
$context->getContext());
167 if (!$ilOrgUnitObjectPositionSetting->isActive()) {
169 "Position-related permissions not active in {$context->getContext()}",
177 'position_id' => $position_id,
178 'protected' =>
false,
180 if ($dedicated_set) {
181 $dedicated_set->delete();
195 $activated_components = [];
197 if ($ilOrgUnitObjectPositionSetting->isActive()) {
198 $activated_components[] = $ilOrgUnitObjectPositionSetting->getType();
202 foreach ($activated_components as
$context) {
231 throw new ilException(
'$position_id cannot be null');
static where($where, $operator=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static findByRefId(int $ref_id)
static findByName(string $context_name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllTemplateSetsForAllActivedContexts(int $position_id, bool $editable=false)
static hasLocalSet(int $ref_id, int $position_id)
static getContextByRefId(int $ref_id)
static assertRefIdAndPositionIdIsNotNull(int $ref_id, int $position_id)
static getTemplateSetForContextName(string $context_name, string $position_id, bool $editable=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...