ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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
 symbol ()
 
 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

Deprecated:
12 This component will be removed with ILIAS 12

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

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

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

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

240 : bool
241 {
243
244 // debugging
245 // return false;
246
247 $mode_type = $this->str($this->getPostVar() . "_mode_type");
248 $ajax_type = $this->str($this->getPostVar() . "_ajax_type");
249 $ajax_id = $this->str($this->getPostVar() . "_ajax_id");
250 $mode = $this->str($this->getPostVar() . "_mode");
251 $value = $this->str($this->getPostVar());
252
253 if ($this->getRequired()) {
254 if ($mode_type == "list") {
255 return true;
256 }
257
258 switch ($mode) {
259 case "ext":
260 if (!$value) {
261 $this->setAlert($lng->txt("msg_input_is_required"));
262 return false;
263 }
264 break;
265
266 case "int":
267 if (!$ajax_type || !$ajax_id) {
268 $this->setAlert($lng->txt("msg_input_is_required"));
269 return false;
270 }
271 break;
272
273 case "no":
274 default:
275 $this->setAlert($lng->txt("msg_input_is_required"));
276 return false;
277 }
278 }
279
280 return true;
281 }
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 160 of file class.ilLinkInputGUI.php.

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

References $lng.

◆ getAllowedLinkTypes()

ilLinkInputGUI::getAllowedLinkTypes ( )

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

83 : string
84 {
86 }

References $allowed_link_types.

◆ getAttrTypeToType()

static ilLinkInputGUI::getAttrTypeToType ( )
static

Get internal types to xml attribute types map (reverse)

Returns
string[]

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

127 : array
128 {
129 return array_flip(self::$iltypemap);
130 }

◆ 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 499 of file class.ilLinkInputGUI.php.

499 : string
500 {
501 if ($this->getAllowedLinkTypes() == self::INT ||
502 $this->getAllowedLinkTypes() == self::BOTH ||
503 $this->getAllowedLinkTypes() == self::LIST) {
504 // as the ajax-panel uses a form it has to be outside of the parent form!
506 }
507 return "";
508 }
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 155 of file class.ilLinkInputGUI.php.

155 : int
156 {
158 }

◆ getFilterWhiteList()

ilLinkInputGUI::getFilterWhiteList ( )

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

142 : bool
143 {
145 }

◆ getInput()

ilLinkInputGUI::getInput ( )

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

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

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

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

◆ getOnloadCode()

ilLinkInputGUI::getOnloadCode ( )

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

650 : array
651 {
652 return [
654 ];
655 }
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 527 of file class.ilLinkInputGUI.php.

527 : array
528 {
529 global $DIC;
530
531 $lng = $DIC->language();
532
533 $value = explode("|", $a_value);
534 if ($value === false || $value === []) {
535 return [];
536 }
537 switch ($value[0]) {
538 case "media":
539 $type = $lng->txt("obj_mob");
540 $name = ilObject::_lookupTitle((int) $value[1]);
541 break;
542
543 case "page":
544 $type = $lng->txt("obj_pg");
545 $name = ilLMPageObject::_lookupTitle((int) $value[1]);
546 break;
547
548 case "ppage":
549 $type = $lng->txt("cont_prtf_page");
550 $name = ilPortfolioPage::lookupTitle((int) $value[1]);
551 break;
552
553 case "chap":
554 $type = $lng->txt("obj_st");
555 $name = ilStructureObject::_lookupTitle((int) $value[1]);
556 break;
557
558 case "term":
559 $type = $lng->txt("term");
561 break;
562
563 case "wpage":
564 $type = $lng->txt("cont_wiki_page");
565 $name = ilWikiPage::lookupTitle((int) $value[1]);
566 break;
567
568 default:
569 $type = $lng->txt("obj_" . $value[0]);
571 break;
572 }
573 return array("type" => $type, "name" => $name);
574 }
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)
static lookupTitle(int $a_page_id, string $lang="-")

References $DIC, $lng, ilGlossaryTerm\_lookGlossaryTerm(), ilObject\_lookupObjId(), ilLMObject\_lookupTitle(), ilObject\_lookupTitle(), ilPortfolioPage\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 117 of file class.ilLinkInputGUI.php.

117 : array
118 {
119 return self::$iltypemap;
120 }
static array $iltypemap

◆ getValue()

ilLinkInputGUI::getValue ( )

Get Value.

Returns
string

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

205 : string
206 {
207 return $this->value;
208 }

◆ insert()

ilLinkInputGUI::insert ( ilTemplate  $a_tpl)

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

576 : void
577 {
578 $html = $this->render();
579
580 $a_tpl->setCurrentBlock("prop_generic");
581 $a_tpl->setVariable("PROP_GENERIC", $html);
582 $a_tpl->parseCurrentBlock();
583 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
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 510 of file class.ilLinkInputGUI.php.

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

References $parts.

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

+ Here is the caller graph for this function:

◆ render()

ilLinkInputGUI::render ( )

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

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

78 : void
79 {
80 $this->allowed_link_types = $a_val;
81 }

◆ setExternalLinkMaxLength()

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

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

150 : void
151 {
152 $this->external_link_max_length = $a_max;
153 }

◆ setFilterWhiteList()

ilLinkInputGUI::setFilterWhiteList ( bool  $a_val)

Set filter white list.

Parameters
bool$a_valfilter list is white list

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

137 : void
138 {
139 $this->filter_white_list = $a_val;
140 }

◆ 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 94 of file class.ilLinkInputGUI.php.

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

◆ setInternalLinkFilterTypes()

ilLinkInputGUI::setInternalLinkFilterTypes ( array  $a_val)

Set internal link filter types.

Parameters
array$a_valfilter types

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

107 : void
108 {
109 $this->int_link_filter_types = $a_val;
110 }

◆ setValue()

ilLinkInputGUI::setValue ( string  $a_value)

Set Value.

Parameters
string$a_value

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

196 : void
197 {
198 $this->value = $a_value;
199 }

◆ setValueByArray()

ilLinkInputGUI::setValueByArray ( array  $a_values)

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

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

◆ setValueByIntLinkAttributes()

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

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

631 : void {
632 $t = explode("_", $a_target);
633 $target_id = ($t[3] ?? "");
634 $type = "";
636 if ($a_type == "RepositoryItem") {
637 $type = ilObject::_lookupType((int) $target_id, true);
638 } elseif (isset($map[$a_type])) {
639 $type = $map[$a_type];
640 }
641 if ($type != "" && $target_id != "") {
642 $val = $type . "|" . $target_id;
643 if ($a_target_frame != "") {
644 $val .= "|" . $a_target_frame;
645 }
646 $this->setValue($val);
647 }
648 }
static getAttrTypeToType()
Get internal types to xml attribute types map (reverse)
static _lookupType(int $id, bool $reference=false)

Field Documentation

◆ $allowed_link_types

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

Definition at line 38 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 43 of file class.ilLinkInputGUI.php.

◆ $filter_white_list

bool ilLinkInputGUI::$filter_white_list = true
protected

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

◆ $iltypemap

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

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

◆ $int_link_default_obj

int ilLinkInputGUI::$int_link_default_obj = 0
protected

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

◆ $int_link_default_type

string ilLinkInputGUI::$int_link_default_type = "RepositoryItem"
protected

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

◆ $int_link_filter_types

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

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

◆ $obj_definition

ilObjectDefinition ilLinkInputGUI::$obj_definition
protected

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

◆ $requested_postvar

string ilLinkInputGUI::$requested_postvar
protected

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

◆ $value

string ilLinkInputGUI::$value = ""
protected

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

◆ BOTH

const ilLinkInputGUI::BOTH = "both"

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

◆ EXT

const ilLinkInputGUI::EXT = "ext"

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

◆ EXTERNAL_LINK_MAX_LENGTH

const ilLinkInputGUI::EXTERNAL_LINK_MAX_LENGTH = 200

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

◆ INT

const ilLinkInputGUI::INT = "int"

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

Referenced by ilPageObjectGUI\initOpenedContentForm().

◆ LIST

const ilLinkInputGUI::LIST = "list"

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

Referenced by ilObjLinkResourceGUI\addLinkInputToForm().


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