ILIAS  release_8 Revision v8.24
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 (string $a_title="", string $a_postvar="")
 
 setAllowedLinkTypes (string $a_val)
 Set allowed link types (LIST, BOTH, INT, EXT) More...
 
 getAllowedLinkTypes ()
 
 setInternalLinkDefault (string $a_type, int $a_obj=0)
 Set internal link default. More...
 
 setInternalLinkFilterTypes (array $a_val)
 Set internal link filter types. More...
 
 setFilterWhiteList (bool $a_val)
 Set filter white list. More...
 
 getFilterWhiteList ()
 
 setExternalLinkMaxLength (int $a_max)
 
 getExternalLinkMaxLength ()
 
 executeCommand ()
 
 setValue (string $a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray (array $a_values)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 render ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 insert (ilTemplate $a_tpl)
 
 getIntLinkAttributes ()
 Get value as internal link attributes. More...
 
 setValueByIntLinkAttributes (string $a_type, string $a_target, string $a_target_frame="")
 
 getOnloadCode ()
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $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...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. 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 (string $a_value)
 
static getTranslatedValue (string $a_value)
 
- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $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

string $allowed_link_types = self::BOTH
 
string $int_link_default_type = "RepositoryItem"
 
int $int_link_default_obj = 0
 
array $int_link_filter_types = array("RepositoryItem")
 
bool $filter_white_list = true
 
int $external_link_max_length = self::EXTERNAL_LINK_MAX_LENGTH
 
ilObjectDefinition $obj_definition
 
string $requested_postvar
 
string $value = ""
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Static Protected Attributes

static array $iltypemap
 

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

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

@ilCtrl_IsCalledBy ilLinkInputGUI: ilFormPropertyDispatchGUI @ilCtrl_Calls ilLinkInputGUI: ilInternalLinkGUI

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

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

57 {
58 global $DIC;
59
60 $this->ctrl = $DIC->ctrl();
61 $this->lng = $DIC->language();
62
63 parent::__construct($a_title, $a_postvar);
64 $this->setType("link");
65
66 $this->obj_definition = $DIC["objDefinition"];
67
68 $this->requested_postvar = $this->str("postvar");
69 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilFormPropertyGUI\setType(), and ilFormPropertyGUI\str().

+ 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
bool Input ok, true/false

Reimplemented from ilFormPropertyGUI.

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

238 : bool
239 {
241
242 // debugging
243 // return false;
244
245 $mode_type = $this->str($this->getPostVar() . "_mode_type");
246 $ajax_type = $this->str($this->getPostVar() . "_ajax_type");
247 $ajax_id = $this->str($this->getPostVar() . "_ajax_id");
248 $mode = $this->str($this->getPostVar() . "_mode");
249 $value = $this->str($this->getPostVar());
250
251 if ($this->getRequired()) {
252 if ($mode_type == "list") {
253 return true;
254 }
255
256 switch ($mode) {
257 case "ext":
258 if (!$value) {
259 $this->setAlert($lng->txt("msg_input_is_required"));
260 return false;
261 }
262 break;
263
264 case "int":
265 if (!$ajax_type || !$ajax_id) {
266 $this->setAlert($lng->txt("msg_input_is_required"));
267 return false;
268 }
269 break;
270
271 case "no":
272 default:
273 $this->setAlert($lng->txt("msg_input_is_required"));
274 return false;
275 }
276 }
277
278 return true;
279 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

References $lng, and ILIAS\Repository\str().

+ Here is the call graph for this function:

◆ executeCommand()

ilLinkInputGUI::executeCommand ( )
Returns
mixed

Reimplemented from ilFormPropertyGUI.

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

159 {
160 $ilCtrl = $this->ctrl;
162
163 $next_class = $ilCtrl->getNextClass($this);
164 $cmd = $ilCtrl->getCmd();
165
166 $ret = "";
167 switch ($next_class) {
168 case "ilinternallinkgui":
169 $lng->loadLanguageModule("content");
170 $link_gui = new ilInternalLinkGUI(
171 $this->int_link_default_type,
172 $this->int_link_default_obj
173 );
174 foreach ($this->int_link_filter_types as $t) {
175 $link_gui->filterLinkType($t);
176 }
177 $link_gui->setFilterWhiteList($this->getFilterWhiteList());
178
179 $ret = $ilCtrl->forwardCommand($link_gui);
180 break;
181
182 default:
183 var_dump($cmd);
184 //exit();
185 }
186
187 return $ret;
188 }
Internal link selector.
loadLanguageModule(string $a_module)
Load language module.

References $lng.

◆ getAllowedLinkTypes()

ilLinkInputGUI::getAllowedLinkTypes ( )

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

81 : string
82 {
84 }

References $allowed_link_types.

◆ getAttrTypeToType()

static ilLinkInputGUI::getAttrTypeToType ( )
static

Get internal types to xml attribute types map (reverse)

Returns
string[]

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

125 : array
126 {
127 return array_flip(self::$iltypemap);
128 }

◆ getContentOutsideFormTag()

ilLinkInputGUI::getContentOutsideFormTag ( )

Get content that has to reside outside of the parent form tag, e.g.

panels/layers

Reimplemented from ilFormPropertyGUI.

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

497 : string
498 {
499 if ($this->getAllowedLinkTypes() == self::INT ||
500 $this->getAllowedLinkTypes() == self::BOTH ||
501 $this->getAllowedLinkTypes() == self::LIST) {
502 // as the ajax-panel uses a form it has to be outside of the parent form!
504 }
505 return "";
506 }
static getInitHTML(string $a_url)
Get initialisation HTML to use internal link editing.

References ilInternalLinkGUI\getInitHTML().

+ Here is the call graph for this function:

◆ getExternalLinkMaxLength()

ilLinkInputGUI::getExternalLinkMaxLength ( )

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

153 : int
154 {
156 }

◆ getFilterWhiteList()

ilLinkInputGUI::getFilterWhiteList ( )

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

140 : bool
141 {
143 }

◆ getInput()

ilLinkInputGUI::getInput ( )

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

281 : string
282 {
283 $ajax_type = $this->str($this->getPostVar() . "_ajax_type");
284 $ajax_id = $this->str($this->getPostVar() . "_ajax_id");
285 $ajax_target = $this->str($this->getPostVar() . "_ajax_target");
286 $mode = $this->str($this->getPostVar() . "_mode");
287 $value = $this->str($this->getPostVar());
288
289 if ($mode == "int") {
290 // overwriting post-data so getInput() will work
291 $val = $ajax_type . "|" . $ajax_id;
292 if ($ajax_target != "") {
293 $val .= "|" . $ajax_target;
294 }
295 return $val;
296 } elseif ($mode == "no") {
297 return "";
298 }
299 return $value;
300 }

References ILIAS\Repository\str().

+ Here is the call graph for this function:

◆ getIntLinkAttributes()

ilLinkInputGUI::getIntLinkAttributes ( )

Get value as internal link attributes.

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

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

583 : ?array
584 {
585 $val = explode("|", $this->getInput());
586 $ret = null;
587 $type = "";
588 $target = "";
589 if (self::isInternalLink($this->getInput())) {
590 $target_frame = $val[2] ?? "";
592 if (isset($map[$val[0]])) {
593 $type = $map[$val[0]];
594 $target_type = $val[0];
595 if ($val[0] == "chap") {
596 $target_type = "st";
597 }
598 if ($val[0] == "term") {
599 $target_type = "git";
600 }
601 if ($val[0] == "page") {
602 $target_type = "pg";
603 }
604 $target = "il__" . $target_type . "_" . $val[1];
605 } elseif ($this->obj_definition->isRBACObject($val[0])) {
606 $type = "RepositoryItem";
607 $target = "il__obj_" . $val[1];
608 }
609 if ($type != "") {
610 $ret = array(
611 "Target" => $target,
612 "Type" => $type,
613 "TargetFrame" => $target_frame
614 );
615 }
616 }
617 return $ret;
618 }
static getTypeToAttrType()
Get internal types to xml attribute types map.
$target_type
Definition: goto.php:51

References $target_type, and $type.

◆ getOnloadCode()

ilLinkInputGUI::getOnloadCode ( )

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

643 : array
644 {
645 return [
647 ];
648 }
static getOnloadCode(string $a_url)

References ilInternalLinkGUI\getOnloadCode().

+ Here is the call graph for this function:

◆ getTranslatedValue()

static ilLinkInputGUI::getTranslatedValue ( string  $a_value)
static

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

525 : array
526 {
527 global $DIC;
528
529 $lng = $DIC->language();
530
531 $value = explode("|", $a_value);
532 if ($value === false || $value === []) {
533 return [];
534 }
535 switch ($value[0]) {
536 case "media":
537 $type = $lng->txt("obj_mob");
539 break;
540
541 case "page":
542 $type = $lng->txt("obj_pg");
544 break;
545
546 case "chap":
547 $type = $lng->txt("obj_st");
549 break;
550
551 case "term":
552 $type = $lng->txt("term");
554 break;
555
556 case "wpage":
557 $type = $lng->txt("cont_wiki_page");
559 break;
560
561 default:
562 $type = $lng->txt("obj_" . $value[0]);
564 break;
565 }
566 return array("type" => $type, "name" => $name);
567 }
static _lookGlossaryTerm(int $term_id)
get glossary term
static _lookupTitle(int $a_obj_id)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static lookupTitle(int $a_page_id)
if($format !==null) $name
Definition: metadata.php:247

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

Referenced by ilWebResourceEditableLinkTableGUI\fillRow().

+ 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 115 of file class.ilLinkInputGUI.php.

115 : array
116 {
117 return self::$iltypemap;
118 }
static array $iltypemap

◆ getValue()

ilLinkInputGUI::getValue ( )

Get Value.

Returns
string

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

203 : string
204 {
205 return $this->value;
206 }

◆ insert()

ilLinkInputGUI::insert ( ilTemplate  $a_tpl)

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

569 : void
570 {
571 $html = $this->render();
572
573 $a_tpl->setCurrentBlock("prop_generic");
574 $a_tpl->setVariable("PROP_GENERIC", $html);
575 $a_tpl->parseCurrentBlock();
576 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ isInternalLink()

static ilLinkInputGUI::isInternalLink ( string  $a_value)
static

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

508 : bool
509 {
510 if (strpos($a_value, "|")) {
511 $parts = explode("|", $a_value);
512 if (sizeof($parts) == 2 || sizeof($parts) == 3) {
513 // numeric id
514 if (is_numeric($parts[1])) {
515 // simple type
516 if (preg_match("/^[a-zA-Z_]+$/", $parts[0])) {
517 return true;
518 }
519 }
520 }
521 }
522 return false;
523 }
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64

References $parts.

Referenced by ilObjLinkResourceListGUI\getCommandFrame(), ilWebLinkXmlParser\handlerEndTag(), ilObjLinkResourceGUI\updateLinks(), and ilWebLinkDatabaseRepository\validateInternalItemTarget().

+ Here is the caller graph for this function:

◆ render()

ilLinkInputGUI::render ( )

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

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

References $lng, and ILIAS\UI\Implementation\Component\Input\getValue().

+ Here is the call graph for this function:

◆ setAllowedLinkTypes()

ilLinkInputGUI::setAllowedLinkTypes ( string  $a_val)

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

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

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

76 : void
77 {
78 $this->allowed_link_types = $a_val;
79 }

◆ setExternalLinkMaxLength()

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

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

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

◆ setFilterWhiteList()

ilLinkInputGUI::setFilterWhiteList ( bool  $a_val)

Set filter white list.

Parameters
bool$a_valfilter list is white list

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

135 : void
136 {
137 $this->filter_white_list = $a_val;
138 }

◆ setInternalLinkDefault()

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

Set internal link default.

Parameters
string$a_typelink type
int$a_objobject id

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

95 : void {
96 $this->int_link_default_type = $a_type;
97 $this->int_link_default_obj = $a_obj;
98 }

◆ setInternalLinkFilterTypes()

ilLinkInputGUI::setInternalLinkFilterTypes ( array  $a_val)

Set internal link filter types.

Parameters
array$a_valfilter types

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

105 : void
106 {
107 $this->int_link_filter_types = $a_val;
108 }

◆ setValue()

ilLinkInputGUI::setValue ( string  $a_value)

Set Value.

Parameters
string$a_value

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

194 : void
195 {
196 $this->value = $a_value;
197 }

◆ setValueByArray()

ilLinkInputGUI::setValueByArray ( array  $a_values)

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

208 : void
209 {
210 switch ($a_values[$this->getPostVar() . "_mode"] ?? null) {
211 case "int":
212 if ($a_values[$this->getPostVar() . "_ajax_type"] &&
213 $a_values[$this->getPostVar() . "_ajax_id"]) {
214 $val = $a_values[$this->getPostVar() . "_ajax_type"] . "|" .
215 $a_values[$this->getPostVar() . "_ajax_id"];
216 if ($a_values[$this->getPostVar() . "_ajax_target"] != "") {
217 $val .= "|" . $a_values[$this->getPostVar() . "_ajax_target"];
218 }
219 $this->setValue($val);
220 }
221 break;
222
223 case "no":
224 break;
225
226 default:
227 if ($a_values[$this->getPostVar()]) {
228 $this->setValue($a_values[$this->getPostVar()]);
229 }
230 break;
231 }
232 }
setValue(string $a_value)
Set Value.

◆ setValueByIntLinkAttributes()

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

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

624 : void {
625 $t = explode("_", $a_target);
626 $target_id = ($t[3] ?? "");
627 $type = "";
629 if ($a_type == "RepositoryItem") {
631 } elseif (isset($map[$a_type])) {
632 $type = $map[$a_type];
633 }
634 if ($type != "" && $target_id != "") {
635 $val = $type . "|" . $target_id;
636 if ($a_target_frame != "") {
637 $val .= "|" . $a_target_frame;
638 }
639 $this->setValue($val);
640 }
641 }
static getAttrTypeToType()
Get internal types to xml attribute types map (reverse)
static _lookupType(int $id, bool $reference=false)
$target_id
Definition: goto.php:52

Field Documentation

◆ $allowed_link_types

string ilLinkInputGUI::$allowed_link_types = self::BOTH
protected

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

Referenced by getAllowedLinkTypes().

◆ $external_link_max_length

int ilLinkInputGUI::$external_link_max_length = self::EXTERNAL_LINK_MAX_LENGTH
protected

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

◆ $filter_white_list

bool ilLinkInputGUI::$filter_white_list = true
protected

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

◆ $iltypemap

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

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

◆ $int_link_default_obj

int ilLinkInputGUI::$int_link_default_obj = 0
protected

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

◆ $int_link_default_type

string ilLinkInputGUI::$int_link_default_type = "RepositoryItem"
protected

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

◆ $int_link_filter_types

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

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

◆ $obj_definition

ilObjectDefinition ilLinkInputGUI::$obj_definition
protected

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

◆ $requested_postvar

string ilLinkInputGUI::$requested_postvar
protected

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

◆ $value

string ilLinkInputGUI::$value = ""
protected

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

◆ BOTH

const ilLinkInputGUI::BOTH = "both"

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

◆ EXT

const ilLinkInputGUI::EXT = "ext"

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

◆ EXTERNAL_LINK_MAX_LENGTH

const ilLinkInputGUI::EXTERNAL_LINK_MAX_LENGTH = 200

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

◆ INT

const ilLinkInputGUI::INT = "int"

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

Referenced by ilPageObjectGUI\initOpenedContentForm().

◆ LIST

const ilLinkInputGUI::LIST = "list"

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

Referenced by ilObjLinkResourceGUI\addLinkInputToForm().


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