ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLinkInputGUI Class Reference

This class represents a external and/or internal link in a property form. More...

+ Inheritance diagram for ilLinkInputGUI:
+ Collaboration diagram for ilLinkInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setAllowedLinkTypes ($a_val)
 Set allowed link types (LIST, BOTH, INT, EXT) More...
 
 getAllowedLinkTypes ()
 Get allowed link types (LIST, BOTH, INT, EXT) More...
 
 setInternalLinkDefault ($a_type, $a_obj=0)
 Set internal link default. More...
 
 setInternalLinkFilterTypes (array $a_val)
 Set internal link filter types. More...
 
 setFilterWhiteList ($a_val)
 Set filter white list. More...
 
 getFilterWhiteList ()
 Get filter white list. More...
 
 setExternalLinkMaxLength ($a_max)
 
 getExternalLinkMaxLength ()
 
 executeCommand ()
 Execute current command. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 render ()
 Render item. More...
 
 getContentOutsideFormTag ()
 
 insert ($a_tpl)
 Insert property html. More...
 
 getIntLinkAttributes ()
 Get value as internal link attributes. More...
 
 setValueByIntLinkAttributes ($a_type, $a_target, $a_target_frame="")
 Set value by internal links attributes. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 

Static Public Member Functions

static getTypeToAttrType ()
 Get internal types to xml attribute types map. More...
 
static getAttrTypeToType ()
 Get internal types to xml attribute types map (reverse) More...
 
static isInternalLink ($a_value)
 
static getTranslatedValue ($a_value)
 
- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 

Data Fields

const EXTERNAL_LINK_MAX_LENGTH = 200
 
const LIST = "list"
 
const BOTH = "both"
 
const INT = "int"
 
const EXT = "ext"
 

Protected Attributes

 $allowed_link_types = self::BOTH
 
 $int_link_default_type = "RepositoryItem"
 
 $int_link_default_obj = 0
 
 $int_link_filter_types = array("RepositoryItem")
 
 $filter_white_list = true
 
 $external_link_max_length = self::EXTERNAL_LINK_MAX_LENGTH
 
 $obj_definition
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Static Protected Attributes

static $iltypemap
 

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

This class represents a external and/or internal link in a property form.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

ilLinkInputGUI: ilFormPropertyDispatchGUI ilLinkInputGUI: ilInternalLinkGUI

Definition at line 15 of file class.ilLinkInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLinkInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 49 of file class.ilLinkInputGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ilFormPropertyGUI\setType().

50  {
51  global $DIC;
52 
53  $this->ctrl = $DIC->ctrl();
54  $this->lng = $DIC->language();
55 
56  parent::__construct($a_title, $a_postvar);
57  $this->setType("link");
58 
59  $this->obj_definition = $DIC["objDefinition"];
60  }
setType($a_type)
Set Type.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilLinkInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Definition at line 252 of file class.ilLinkInputGUI.php.

References $_POST, ilFormPropertyGUI\$lng, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

253  {
254  $lng = $this->lng;
255 
256  // debugging
257  // return false;
258 
259  if ($this->getRequired()) {
260  if ($_POST[$this->getPostVar() . "_mode_type"] == "list") {
261  return true;
262  }
263 
264  switch ($_POST[$this->getPostVar() . "_mode"]) {
265  case "ext":
266  if (!$_POST[$this->getPostVar()]) {
267  $this->setAlert($lng->txt("msg_input_is_required"));
268  return false;
269  }
270  break;
271 
272  case "int":
273  if (!$_POST[$this->getPostVar() . "_ajax_type"] ||
274  !$_POST[$this->getPostVar() . "_ajax_id"]) {
275  $this->setAlert($lng->txt("msg_input_is_required"));
276  return false;
277  }
278  break;
279 
280  case "no":
281  default:
282  $this->setAlert($lng->txt("msg_input_is_required"));
283  return false;
284  }
285  }
286 
287  if ($_POST[$this->getPostVar() . "_mode"] == "int") {
288  $_POST[$this->getPostVar() . "_ajax_type"] = ilUtil::stripSlashes($_POST[$this->getPostVar() . "_ajax_type"]);
289  $_POST[$this->getPostVar() . "_ajax_id"] = ilUtil::stripSlashes($_POST[$this->getPostVar() . "_ajax_id"]);
290  $_POST[$this->getPostVar() . "_ajax_target"] = ilUtil::stripSlashes($_POST[$this->getPostVar() . "_ajax_target"]);
291 
292  // overwriting post-data so getInput() will work
293  $val = $_POST[$this->getPostVar() . "_ajax_type"] . "|" .
294  $_POST[$this->getPostVar() . "_ajax_id"];
295  if ($_POST[$this->getPostVar() . "_ajax_target"] != "") {
296  $val .= "|" . $_POST[$this->getPostVar() . "_ajax_target"];
297  }
298 
299  $_POST[$this->getPostVar()] = $val;
300  } elseif ($_POST[$this->getPostVar() . "_mode"] == "no") {
301  $_POST[$this->getPostVar()] = "";
302  } else {
303  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
304  }
305 
306  return true;
307  }
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCommand()

ilLinkInputGUI::executeCommand ( )

Execute current command.

Definition at line 163 of file class.ilLinkInputGUI.php.

References ilFormPropertyGUI\$ctrl, ilFormPropertyGUI\$lng, $ret, and getFilterWhiteList().

164  {
165  $ilCtrl = $this->ctrl;
166  $lng = $this->lng;
167 
168  $next_class = $ilCtrl->getNextClass($this);
169  $cmd = $ilCtrl->getCmd();
170 
171  switch ($next_class) {
172  case "ilinternallinkgui":
173  $lng->loadLanguageModule("content");
174  require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
175  $link_gui = new ilInternalLinkGUI(
176  $this->int_link_default_type,
177  $this->int_link_default_obj
178  );
179  foreach ($this->int_link_filter_types as $t) {
180  $link_gui->filterLinkType($t);
181  }
182  $link_gui->setFilterWhiteList($this->getFilterWhiteList());
183  $link_gui->setMode("asynch");
184 
185  $ret = $ilCtrl->forwardCommand($link_gui);
186  break;
187 
188  default:
189  var_dump($cmd);
190  //exit();
191  }
192 
193  return $ret;
194  }
getFilterWhiteList()
Get filter white list.
Class ilInternalLinkGUI.
$ret
Definition: parser.php:6
+ Here is the call graph for this function:

◆ getAllowedLinkTypes()

ilLinkInputGUI::getAllowedLinkTypes ( )

Get allowed link types (LIST, BOTH, INT, EXT)

Returns
string self::LIST|self::BOTH|self::INT|self::EXT

Definition at line 77 of file class.ilLinkInputGUI.php.

References $allowed_link_types.

Referenced by getContentOutsideFormTag(), and render().

78  {
80  }
+ Here is the caller graph for this function:

◆ getAttrTypeToType()

static ilLinkInputGUI::getAttrTypeToType ( )
static

Get internal types to xml attribute types map (reverse)

Returns
string[]

Definition at line 119 of file class.ilLinkInputGUI.php.

120  {
121  return array_flip(self::$iltypemap);
122  }

◆ getContentOutsideFormTag()

ilLinkInputGUI::getContentOutsideFormTag ( )

Definition at line 495 of file class.ilLinkInputGUI.php.

References getAllowedLinkTypes(), and ilInternalLinkGUI\getInitHTML().

496  {
497  if ($this->getAllowedLinkTypes() == self::INT ||
498  $this->getAllowedLinkTypes() == self::BOTH ||
499  $this->getAllowedLinkTypes() == self::LIST) {
500  // as the ajax-panel uses a form it has to be outside of the parent form!
502  }
503  }
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
getAllowedLinkTypes()
Get allowed link types (LIST, BOTH, INT, EXT)
+ Here is the call graph for this function:

◆ getExternalLinkMaxLength()

ilLinkInputGUI::getExternalLinkMaxLength ( )
Returns
int

Definition at line 155 of file class.ilLinkInputGUI.php.

References $external_link_max_length.

Referenced by render().

156  {
158  }
+ Here is the caller graph for this function:

◆ getFilterWhiteList()

ilLinkInputGUI::getFilterWhiteList ( )

Get filter white list.

Returns
bool filter list is white list

Definition at line 139 of file class.ilLinkInputGUI.php.

References $filter_white_list.

Referenced by executeCommand().

140  {
142  }
+ Here is the caller graph for this function:

◆ getIntLinkAttributes()

ilLinkInputGUI::getIntLinkAttributes ( )

Get value as internal link attributes.

Returns
array (with keys "Type", "Target" and "TargetFrame")

Definition at line 581 of file class.ilLinkInputGUI.php.

References $_POST, $ret, $target_type, ilFormPropertyGUI\$type, and ilFormPropertyGUI\getPostVar().

582  {
583  $val = explode("|", $_POST[$this->getPostVar()]);
584 
585  $ret = false;
586  $type = "";
587  $target = "";
588  if (self::isInternalLink($_POST[$this->getPostVar()])) {
589  $target_frame = $val[2];
590  $map = self::getTypeToAttrType();
591  if (isset($map[$val[0]])) {
592  $type = $map[$val[0]];
593  $target_type = $val[0];
594  if ($val[0] == "chap") {
595  $target_type = "st";
596  }
597  if ($val[0] == "term") {
598  $target_type = "git";
599  }
600  if ($val[0] == "page") {
601  $target_type = "pg";
602  }
603  $target = "il__" . $target_type . "_" . $val[1];
604  } elseif ($this->obj_definition->isRBACObject($val[0])) {
605  $type = "RepositoryItem";
606  $target = "il__obj_" . $val[1];
607  }
608  if ($type != "") {
609  $ret = array(
610  "Target" => $target,
611  "Type" => $type,
612  "TargetFrame" => $target_frame
613  );
614  }
615  }
616  return $ret;
617  }
$target_type
Definition: goto.php:50
getPostVar()
Get Post Variable.
$ret
Definition: parser.php:6
$_POST["username"]
+ Here is the call graph for this function:

◆ getTranslatedValue()

static ilLinkInputGUI::getTranslatedValue (   $a_value)
static

Definition at line 522 of file class.ilLinkInputGUI.php.

References $DIC, ilFormPropertyGUI\$lng, $name, ilFormPropertyGUI\$type, ilGlossaryTerm\_lookGlossaryTerm(), ilObject\_lookupObjId(), ilLMObject\_lookupTitle(), and ilObject\_lookupTitle().

Referenced by ilWebResourceEditableLinkTableGUI\fillRow().

523  {
524  global $DIC;
525 
526  $lng = $DIC->language();
527 
528  $value = explode("|", $a_value);
529 
530  switch ($value[0]) {
531  case "media":
532  $type = $lng->txt("obj_mob");
533  $name = ilObject::_lookupTitle($value[1]);
534  break;
535 
536  case "page":
537  include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
538  $type = $lng->txt("obj_pg");
539  $name = ilLMPageObject::_lookupTitle($value[1]);
540  break;
541 
542  case "chap":
543  include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
544  $type = $lng->txt("obj_st");
546  break;
547 
548  case "term":
549  $type = $lng->txt("term");
551  break;
552 
553  default:
554  $type = $lng->txt("obj_" . $value[0]);
556  break;
557  }
558 
559  return array("type" => $type, "name" => $name);
560  }
static _lookupTitle($a_id)
lookup object title
static _lookupTitle($a_obj_id)
Lookup title.
if($format !==null) $name
Definition: metadata.php:230
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
static _lookGlossaryTerm($term_id)
get glossary term
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTypeToAttrType()

static ilLinkInputGUI::getTypeToAttrType ( )
static

Get internal types to xml attribute types map.

Returns
string[]

Definition at line 109 of file class.ilLinkInputGUI.php.

110  {
111  return self::$iltypemap;
112  }

◆ getValue()

ilLinkInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 211 of file class.ilLinkInputGUI.php.

Referenced by render().

212  {
213  return $this->value;
214  }
+ Here is the caller graph for this function:

◆ insert()

ilLinkInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

Definition at line 567 of file class.ilLinkInputGUI.php.

References render().

568  {
569  $html = $this->render();
570 
571  $a_tpl->setCurrentBlock("prop_generic");
572  $a_tpl->setVariable("PROP_GENERIC", $html);
573  $a_tpl->parseCurrentBlock();
574  }
render()
Render item.
+ Here is the call graph for this function:

◆ isInternalLink()

static ilLinkInputGUI::isInternalLink (   $a_value)
static

Definition at line 505 of file class.ilLinkInputGUI.php.

Referenced by ilObjLinkResourceGUI\checkLinkInput(), ilObjLinkResourceListGUI\getCommandFrame(), ilObjLinkResourceGUI\handleSubItemLinks(), ilWebResourceLinkTableGUI\parse(), and ilObjLinkResourceGUI\updateLinks().

506  {
507  if (strpos($a_value, "|")) {
508  $parts = explode("|", $a_value);
509  if (sizeof($parts) == 2 || sizeof($parts) == 3) {
510  // numeric id
511  if (is_numeric($parts[1])) {
512  // simple type
513  if (preg_match("/^[a-zA-Z_]+$/", $parts[0], $matches)) {
514  return true;
515  }
516  }
517  }
518  }
519  return false;
520  }
+ Here is the caller graph for this function:

◆ render()

ilLinkInputGUI::render ( )

Render item.

Definition at line 312 of file class.ilLinkInputGUI.php.

References ilFormPropertyGUI\$ctrl, ilFormPropertyGUI\$lng, ilFormPropertyGUI\$title, ilRadioOption\addSubItem(), getAllowedLinkTypes(), getExternalLinkMaxLength(), ilFormPropertyGUI\getParent(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), and getValue().

Referenced by insert().

313  {
314  $lng = $this->lng;
315  $ilCtrl = $this->ctrl;
316 
317  // parse settings
318  $has_int = $has_ext = $has_radio = $has_list = false;
319  switch ($this->getAllowedLinkTypes()) {
320  case self::EXT:
321  $has_ext = true;
322  break;
323 
324  case self::INT:
325  $has_int = true;
326  break;
327 
328  case self::BOTH:
329  $has_int = true;
330  $has_ext = true;
331  $has_radio = true;
332  break;
333 
334  case self::LIST:
335  $has_int = true;
336  $has_ext = true;
337  $has_radio = true;
338  $has_list = true;
339  break;
340  }
341  if (!$this->getRequired()) {
342  // see #0021274
343  $has_radio = true;
344  }
345 
346  // external
347  if ($has_ext) {
348  $title = $has_radio ? $lng->txt("url") : "";
349 
350  // external
351  $ti = new ilTextInputGUI($title, $this->getPostVar());
352  $ti->setMaxLength($this->getExternalLinkMaxLength());
353  }
354 
355  // internal
356  if ($has_int) {
357  $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $this->getPostVar());
358  $link = array(get_class($this->getParent()), "ilformpropertydispatchgui", get_class($this), "ilinternallinkgui");
359  $link = $ilCtrl->getLinkTargetByClass($link, "", false, true, false);
360  $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $_REQUEST["postvar"]);
361 
362  $no_disp_class = (strpos($this->getValue(), "|"))
363  ? ""
364  : " ilNoDisplay";
365 
366  $itpl = new ilTemplate('tpl.prop_link.html', true, true, 'Services/Form');
367  $itpl->setVariable("VAL_ID", $this->getPostVar());
368  $itpl->setVariable("URL_EDIT", $link);
369  $itpl->setVariable("TXT_EDIT", $lng->txt("form_get_link"));
370  $itpl->setVariable("CSS_REMOVE", $no_disp_class);
371  $itpl->setVariable("TXT_REMOVE", $lng->txt("remove"));
372 
373  $ne = new ilNonEditableValueGUI($lng->txt("object"), $this->getPostVar() . "_val", true);
374 
375  // hidden field for selected value
376  $hidden_type = new ilHiddenInputGUI($this->getPostVar() . "_ajax_type");
377  $hidden_id = new ilHiddenInputGUI($this->getPostVar() . "_ajax_id");
378  $hidden_target = new ilHiddenInputGUI($this->getPostVar() . "_ajax_target");
379  }
380 
381  // mode
382  if ($has_radio) {
383  $ext = new ilRadioOption($lng->txt("form_link_external"), "ext");
384  $ext->addSubItem($ti);
385 
386  if ($has_int) {
387  $int = new ilRadioOption($lng->txt("form_link_internal"), "int");
388  $int->addSubItem($ne);
389  }
390 
391  $mode = new ilRadioGroupInputGUI("", $this->getPostVar() . "_mode");
392  if (!$this->getRequired()) {
393  $no = new ilRadioOption($lng->txt("form_no_link"), "no");
394  $mode->addOption($no);
395  }
396  $mode->addOption($ext);
397  if ($has_int) {
398  $mode->addOption($int);
399  }
400  } else {
401  $mode = new ilHiddenInputGUI($this->getPostVar() . "_mode");
402  if ($has_int) {
403  $mode->setValue("int");
404  } else {
405  $mode->setValue("ext");
406  }
407  }
408 
409  // list mode
410  if ($has_list) {
411  $mode_type = new ilRadioGroupInputGUI("", $this->getPostVar() . "_mode_type");
412  $mode_single = new ilRadioOption($lng->txt("webr_link_type_single"), "single");
413  $mode_type->addOption($mode_single);
414  $mode_list = new ilRadioOption($lng->txt("webr_link_type_list"), "list");
415  $mode_type->addOption($mode_list);
416  $mode = new ilRadioGroupInputGUI($lng->txt("webr_link_target"), $this->getPostVar() . "_mode");
417  if (!$this->getRequired()) {
418  $no = new ilRadioOption($lng->txt("form_no_link"), "no");
419  $mode->addOption($no);
420  }
421  $ext = new ilRadioOption($lng->txt("form_link_external"), "ext");
422  $ext->addSubItem($ti);
423  $int = new ilRadioOption($lng->txt("form_link_internal"), "int");
424  $int->addSubItem($ne);
425  $mode->addOption($ext);
426  $mode->addOption($int);
427  $mode_single->addSubItem($mode);
428  }
429 
430  // value
431  $value = $this->getValue();
432  if ($value) {
433  // #15647
434  if ($has_int && self::isInternalLink($value)) {
435  $mode->setValue("int");
436 
437  $value_trans = self::getTranslatedValue($value);
438 
439  $value = explode("|", $value);
440  $hidden_type->setValue($value[0]);
441  $hidden_id->setValue($value[1]);
442  $hidden_target->setValue($value[2]);
443 
444  $itpl->setVariable("VAL_OBJECT_TYPE", $value_trans["type"]);
445  $itpl->setVariable("VAL_OBJECT_NAME", $value_trans["name"]);
446  if ($value[2] != "") {
447  $itpl->setVariable("VAL_TARGET_FRAME", "(" . $value[2] . ")");
448  }
449  } elseif ($has_ext) {
450  $mode->setValue("ext");
451 
452  $ti->setValue($value);
453  }
454  } elseif (!$this->getRequired()) {
455  $mode->setValue("no");
456  }
457 
458  // #10185 - default for external urls
459  if ($has_ext && !$ti->getValue()) {
460  $ti->setValue("https://");
461  }
462 
463  if ($has_int) {
464  $ne->setValue($itpl->get());
465  }
466 
467  // to html
468  if ($has_radio) {
469  $html = $mode->render();
470  } else {
471  $html = $mode->getToolbarHTML();
472 
473  if ($has_ext) {
474  $html .= $ti->getToolbarHTML();
475  } elseif ($has_int) {
476  $html .= $ne->render() .
477  '<div class="help-block">' . $ne->getInfo() . '</div>';
478  }
479  }
480  if ($has_list) {
481  $html = $mode_type->render();
482  }
483 
484  // js for internal link
485  if ($has_int) {
486  include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
487  $html .= $hidden_type->getToolbarHTML() .
488  $hidden_id->getToolbarHTML() .
489  $hidden_target->getToolbarHTML();
490  }
491 
492  return $html;
493  }
This class represents an option in a radio group.
getPostVar()
Get Post Variable.
This class represents a hidden form property in a property form.
This class represents a property in a property form.
addSubItem($a_item)
Add Subitem.
getParent()
Get Parent GUI object.
This class represents a non editable value in a property form.
getAllowedLinkTypes()
Get allowed link types (LIST, BOTH, INT, EXT)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAllowedLinkTypes()

ilLinkInputGUI::setAllowedLinkTypes (   $a_val)

Set allowed link types (LIST, BOTH, INT, EXT)

Parameters
string$a_valself::LIST|self::BOTH|self::INT|self::EXT

Definition at line 67 of file class.ilLinkInputGUI.php.

Referenced by ilPCSectionGUI\initForm(), ilObjLinkResourceGUI\initFormLink(), and ilPageObjectGUI\initOpenedContentForm().

68  {
69  $this->allowed_link_types = $a_val;
70  }
+ Here is the caller graph for this function:

◆ setExternalLinkMaxLength()

ilLinkInputGUI::setExternalLinkMaxLength (   $a_max)
Parameters
intmax length for external links

Definition at line 147 of file class.ilLinkInputGUI.php.

148  {
149  $this->external_link_max_length = $a_max;
150  }

◆ setFilterWhiteList()

ilLinkInputGUI::setFilterWhiteList (   $a_val)

Set filter white list.

Parameters
bool$a_valfilter list is white list

Definition at line 129 of file class.ilLinkInputGUI.php.

130  {
131  $this->filter_white_list = $a_val;
132  }

◆ setInternalLinkDefault()

ilLinkInputGUI::setInternalLinkDefault (   $a_type,
  $a_obj = 0 
)

Set internal link default.

Parameters
string$a_typelink type
int$a_objobject id

Definition at line 88 of file class.ilLinkInputGUI.php.

89  {
90  $this->int_link_default_type = $a_type;
91  $this->int_link_default_obj = $a_obj;
92  }

◆ setInternalLinkFilterTypes()

ilLinkInputGUI::setInternalLinkFilterTypes ( array  $a_val)

Set internal link filter types.

Parameters
array$a_valfilter types

Definition at line 99 of file class.ilLinkInputGUI.php.

100  {
101  $this->int_link_filter_types = $a_val;
102  }

◆ setValue()

ilLinkInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 201 of file class.ilLinkInputGUI.php.

Referenced by setValueByArray(), and setValueByIntLinkAttributes().

202  {
203  $this->value = $a_value;
204  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilLinkInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 221 of file class.ilLinkInputGUI.php.

References ilFormPropertyGUI\getPostVar(), and setValue().

222  {
223  switch ($a_values[$this->getPostVar() . "_mode"]) {
224  case "int":
225  if ($a_values[$this->getPostVar() . "_ajax_type"] &&
226  $a_values[$this->getPostVar() . "_ajax_id"]) {
227  $val = $a_values[$this->getPostVar() . "_ajax_type"] . "|" .
228  $a_values[$this->getPostVar() . "_ajax_id"];
229  if ($a_values[$this->getPostVar() . "_ajax_target"] != "") {
230  $val .= "|" . $a_values[$this->getPostVar() . "_ajax_target"];
231  }
232  $this->setValue($val);
233  }
234  break;
235 
236  case "no":
237  break;
238 
239  default:
240  if ($a_values[$this->getPostVar()]) {
241  $this->setValue($a_values[$this->getPostVar()]);
242  }
243  break;
244  }
245  }
getPostVar()
Get Post Variable.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:

◆ setValueByIntLinkAttributes()

ilLinkInputGUI::setValueByIntLinkAttributes (   $a_type,
  $a_target,
  $a_target_frame = "" 
)

Set value by internal links attributes.

Parameters

Definition at line 625 of file class.ilLinkInputGUI.php.

References $target_id, ilFormPropertyGUI\$type, ilObject\_lookupType(), and setValue().

626  {
627  $t = explode("_", $a_target);
628  $target_id = $t[3];
629  $type = "";
630  $map = self::getAttrTypeToType();
631  if ($a_type == "RepositoryItem") {
633  } elseif (isset($map[$a_type])) {
634  $type = $map[$a_type];
635  }
636  if ($type != "" && $target_id != "") {
637  $val = $type . "|" . $target_id;
638  if ($a_target_frame != "") {
639  $val .= "|" . $a_target_frame;
640  }
641  $this->setValue($val);
642  }
643  }
$target_id
Definition: goto.php:51
setValue($a_value)
Set Value.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

Field Documentation

◆ $allowed_link_types

ilLinkInputGUI::$allowed_link_types = self::BOTH
protected

Definition at line 23 of file class.ilLinkInputGUI.php.

Referenced by getAllowedLinkTypes().

◆ $external_link_max_length

ilLinkInputGUI::$external_link_max_length = self::EXTERNAL_LINK_MAX_LENGTH
protected

Definition at line 29 of file class.ilLinkInputGUI.php.

Referenced by getExternalLinkMaxLength().

◆ $filter_white_list

ilLinkInputGUI::$filter_white_list = true
protected

Definition at line 27 of file class.ilLinkInputGUI.php.

Referenced by getFilterWhiteList().

◆ $iltypemap

ilLinkInputGUI::$iltypemap
staticprotected
Initial value:
= array(
"page" => "PageObject",
"chap" => "StructureObject",
"term" => "GlossaryItem",
"wpage" => "WikiPage"
)

Definition at line 31 of file class.ilLinkInputGUI.php.

◆ $int_link_default_obj

ilLinkInputGUI::$int_link_default_obj = 0
protected

Definition at line 25 of file class.ilLinkInputGUI.php.

◆ $int_link_default_type

ilLinkInputGUI::$int_link_default_type = "RepositoryItem"
protected

Definition at line 24 of file class.ilLinkInputGUI.php.

◆ $int_link_filter_types

ilLinkInputGUI::$int_link_filter_types = array("RepositoryItem")
protected

Definition at line 26 of file class.ilLinkInputGUI.php.

◆ $obj_definition

ilLinkInputGUI::$obj_definition
protected

Definition at line 41 of file class.ilLinkInputGUI.php.

◆ BOTH

const ilLinkInputGUI::BOTH = "both"

Definition at line 20 of file class.ilLinkInputGUI.php.

Referenced by ilPCSectionGUI\initForm().

◆ EXT

const ilLinkInputGUI::EXT = "ext"

Definition at line 22 of file class.ilLinkInputGUI.php.

Referenced by ilPCSectionGUI\initForm().

◆ EXTERNAL_LINK_MAX_LENGTH

const ilLinkInputGUI::EXTERNAL_LINK_MAX_LENGTH = 200

Definition at line 17 of file class.ilLinkInputGUI.php.

◆ INT

const ilLinkInputGUI::INT = "int"

Definition at line 21 of file class.ilLinkInputGUI.php.

Referenced by ilPageObjectGUI\initOpenedContentForm().

◆ LIST

const ilLinkInputGUI::LIST = "list"

Definition at line 19 of file class.ilLinkInputGUI.php.

Referenced by ilObjLinkResourceGUI\initFormLink().


The documentation for this class was generated from the following file: