ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 }
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
ADT form bridge base class.
ADT base class.
Definition: class.ilADT.php:11
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
$lng
This class represents a text property in a property form.
getElementId()
Get element id.
This class represents a number property in a property form.
$def
Definition: croninfo.php:21
$url
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.