19 declare(strict_types=1);
32 $this->target_type =
'prg';
33 $this->reference_type =
'prgr';
35 $this->
lng->loadLanguageModule(
'prg');
38 public static function _goto(
string $target): void
43 $ilCtrl = $DIC[
'ilCtrl'];
44 $ilCtrl->setTargetScript(
'ilias.php');
45 $ilCtrl->setParameterByClass(self::class,
"ref_id", $target);
46 $ilCtrl->redirectByClass([ilRepositoryGUI::class, self::class],
"view");
56 $target_id = $this->cont_request->getTargetId();
59 if ($target_id === 0) {
60 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
'select_object_to_link'));
64 if ($create && !$ilAccess->checkAccess(
'visible',
'', $target_id)) {
65 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
'permission_denied'));
70 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
'prgr_may_not_create_circular_reference'));
84 $self_id = (
int) $this->
object->getRefId();
85 $container_id = $this->tree->getParentId($self_id);
88 if (!$this->
access->checkAccess(
'visible',
'', $target_id)) {
89 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
'permission_denied'),
true);
95 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
'prgr_may_not_create_circular_reference'));
101 parent::updateObject();
109 $obj->setTargetId($target_obj_id);
111 parent::putObjectInTree($obj, $parent_node_id);
116 if ($reference_position === $obj_to_be_referenced) {
119 $queque = [$reference_position];
120 while ($parent = array_shift($queque)) {
121 $p_parent = (
int) $this->tree->getParentId($parent);
122 if ($p_parent === $obj_to_be_referenced) {
126 $queque[] = $p_parent;
130 $parent_ref_ref_id = (
int) array_shift($ref_ids);
131 $parent_ref_loc = (
int) $this->tree->getParentId($parent_ref_ref_id);
132 if ($parent_ref_loc === $obj_to_be_referenced) {
136 $queque[] = $parent_ref_loc;
static _goto(string $target)
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
static _getAllReferences(int $id)
get all reference ids for object ID
initForm(int $a_mode=self::MODE_EDIT)
static _goto(string $target)
static _lookupObjId(int $ref_id)
ilObjStudyProgrammeReferenceGUI: ilPermissionGUI, ilInfoScreenGUI, ilPropertyFormGUI ...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupSourceIds(int $a_target_id)
Get ids of all container references that target the object with the given id.
form( $class_path, string $cmd, string $submit_caption="")
__construct(Container $dic, ilPlugin $plugin)
static _lookupTargetRefId(int $a_obj_id)
__construct( $data, int $id, bool $call_by_reference=true, bool $prepare_output=false)
putObjectInTree(ilObject $obj, $parent_node_id=null)
static _lookupType(int $id, bool $reference=false)
tryingToCreateCircularReference(int $obj_to_be_referenced, int $reference_position)