1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5/**
6 * external link form bridge
7 *
8 * @author Stefan Meyer <meyer@leifos.com>
9 * @ingroup ServicesADT
10 */
11class ilADTInternalLinkFormBridge extends ilADTFormBridge
12{
13
14    /**
15     * Is valid type
16     * @param ilADT $a_adt
17     * @return bool
18     */
19    protected function isValidADT(ilADT $a_adt)
20    {
21        return $a_adt instanceof ilADTInternalLink;
22    }
23
24    /**
25     * Add element to form
26     */
27    public function addToForm()
28    {
29        $def = $this->getADT()->getCopyOfDefinition();
30
31        $subitems = new ilRepositorySelector2InputGUI(
32            $this->getTitle(),
33            $this->getElementId(),
34            false
35        );
36        $subitems->setValue($this->getADT()->getTargetRefId());
37        $exp = $subitems->getExplorerGUI();
38        $exp->setSkipRootNode(false);
39        $exp->setRootId(ROOT_FOLDER_ID);
40        $this->addBasicFieldProperties($subitems, $def);
41        $this->addToParentElement($subitems);
42    }
43
44    /**
45     * Import from post
46     */
47    public function importFromPost()
48    {
49        $this->getADT()->setTargetRefId($this->getForm()->getInput($this->getElementId()));
50    }
51}
52