ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilADTExternalLinkFormBridge.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
13
19 protected function isValidADT(ilADT $a_adt)
20 {
21 return $a_adt instanceof ilADTExternalLink;
22 }
23
27 public function addToForm()
28 {
29 $lng = $GLOBALS['DIC']->language();
30
31
32 $def = $this->getADT()->getCopyOfDefinition();
33
34 $both = new ilCombinationInputGUI($this->getTitle(), $this->getElementId());
35 $this->addBasicFieldProperties($both, $def);
36
37 $title = new ilTextInputGUI('', $this->getElementId() . '_title');
38 $title->setMaxLength(250);
39 $title->setValue($this->getADT()->getTitle());
40 $both->addCombinationItem('title', $title, $lng->txt('title'));
41
42 $url = new ilTextInputGUI('', $this->getElementId() . '_url');
43 $url->setSize(250);
44 $url->setValue($this->getADT()->getUrl());
45 $both->addCombinationItem('url', $url, $lng->txt('url'));
46
47 $this->addToParentElement($both);
48 }
49
53 public function importFromPost()
54 {
55 $logger = $GLOBALS['DIC']->logger()->amet();
56
57 $this->getADT()->setUrl($this->getForm()->getInput($this->getElementId() . '_url'));
58 $this->getADT()->setTitle($this->getForm()->getInput($this->getElementId() . '_title'));
59
60 $combination = $this->getForm()->getItemByPostVar($this->getElementId());
61 if (!$combination instanceof ilCombinationInputGUI) {
62 $logger->warning('Cannot find combination input gui');
63 return;
64 }
65
66 $combination->getCombinationItem('url')->setValue($this->getADT()->getUrl());
67 $combination->getCombinationItem('title')->setValue($this->getADT()->getTitle());
68 }
69}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
ADT form bridge base class.
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
getElementId()
Get element id.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
ADT base class.
Definition: class.ilADT.php:12
This class represents a number property in a property form.
This class represents a text property in a property form.
$url
$lng