19 declare(strict_types=1);
33 public const LIST =
"list";
34 public const BOTH =
"both";
35 public const INT =
"int";
36 public const EXT =
"ext";
46 "page" =>
"PageObject",
47 "chap" =>
"StructureObject",
48 "term" =>
"GlossaryItem",
57 string $a_postvar =
"" 61 $this->
ctrl = $DIC->ctrl();
62 $this->
lng = $DIC->language();
67 $this->obj_definition = $DIC[
"objDefinition"];
69 $this->requested_postvar = $this->
str(
"postvar");
79 $this->allowed_link_types = $a_val;
97 $this->int_link_default_type = $a_type;
98 $this->int_link_default_obj = $a_obj;
108 $this->int_link_filter_types = $a_val;
118 return self::$iltypemap;
128 return array_flip(self::$iltypemap);
138 $this->filter_white_list = $a_val;
151 $this->external_link_max_length = $a_max;
164 $next_class = $ilCtrl->getNextClass($this);
165 $cmd = $ilCtrl->getCmd();
168 switch ($next_class) {
169 case "ilinternallinkgui":
172 $this->int_link_default_type,
173 $this->int_link_default_obj
175 foreach ($this->int_link_filter_types as $t) {
176 $link_gui->filterLinkType($t);
180 $ret = $ilCtrl->forwardCommand($link_gui);
197 $this->value = $a_value;
213 if ($a_values[$this->
getPostVar() .
"_ajax_type"] &&
214 $a_values[$this->
getPostVar() .
"_ajax_id"]) {
215 $val = $a_values[$this->
getPostVar() .
"_ajax_type"] .
"|" .
217 if ($a_values[$this->
getPostVar() .
"_ajax_target"] !=
"") {
218 $val .=
"|" . $a_values[$this->
getPostVar() .
"_ajax_target"];
253 if ($mode_type ==
"list") {
266 if (!$ajax_type || !$ajax_id) {
286 $ajax_target = $this->
str($this->
getPostVar() .
"_ajax_target");
290 if ($mode ==
"int") {
292 $val = $ajax_type .
"|" . $ajax_id;
293 if ($ajax_target !=
"") {
294 $val .=
"|" . $ajax_target;
297 } elseif ($mode ==
"no") {
312 $hidden_target =
null;
315 $has_int = $has_ext = $has_radio = $has_list =
false;
352 $itpl =
new ilTemplate(
'tpl.prop_link.html',
true,
true,
'components/ILIAS/Form');
356 $ilCtrl->setParameterByClass(
"ilformpropertydispatchgui",
"postvar", $this->
getPostVar());
357 $link = array(get_class($this->
getParentForm()),
"ilformpropertydispatchgui", get_class($this),
"ilinternallinkgui");
358 $link = $ilCtrl->getLinkTargetByClass($link,
"",
'',
true,
false);
359 $ilCtrl->setParameterByClass(
"ilformpropertydispatchgui",
"postvar", $this->requested_postvar);
361 $no_disp_class = (strpos($this->
getValue(),
"|"))
365 $itpl->setVariable(
"VAL_ID", $this->
getPostVar());
366 $itpl->setVariable(
"URL_EDIT", $link);
367 $itpl->setVariable(
"TXT_EDIT",
$lng->
txt(
"form_get_link"));
368 $itpl->setVariable(
"CSS_REMOVE", $no_disp_class);
369 $itpl->setVariable(
"TXT_REMOVE",
$lng->
txt(
"remove"));
395 $mode->addOption($no);
399 $mode->addOption($ext);
402 $mode->addOption($int);
407 $mode->setValue(
"int");
409 $mode->setValue(
"ext");
417 $mode_type->addOption($mode_single);
419 $mode_type->addOption($mode_list);
423 $mode->addOption($no);
429 $mode->addOption($ext);
430 $mode->addOption($int);
431 $mode_single->addSubItem($mode);
438 if ($has_int && self::isInternalLink($value)) {
439 $mode->setValue(
"int");
441 $value_trans = self::getTranslatedValue($value);
443 $value = explode(
"|", $value);
444 $hidden_type->setValue($value[0]);
445 $hidden_id->setValue($value[1]);
446 $hidden_target->setValue($value[2] ??
"");
448 $itpl->setVariable(
"VAL_OBJECT_TYPE", $value_trans[
"type"]);
449 $itpl->setVariable(
"VAL_OBJECT_NAME", $value_trans[
"name"]);
450 if (($value[2] ??
"") !=
"") {
451 $itpl->setVariable(
"VAL_TARGET_FRAME",
"(" . $value[2] .
")");
453 } elseif ($has_ext) {
454 $mode->setValue(
"ext");
456 $ti->setValue($value);
459 $mode->setValue(
"no");
463 if ($has_ext && !$ti->getValue()) {
464 $ti->setValue(
"https://");
468 $ne->setValue($itpl->get());
473 $html = $mode->render();
475 $html = $mode->getToolbarHTML();
478 $html .= $ti->getToolbarHTML();
479 } elseif ($has_int) {
480 $html .= $ne->render() .
481 '<div class="help-block">' . $ne->getInfo() .
'</div>';
485 $html = $mode_type->render();
490 $html .= $hidden_type->getToolbarHTML() .
491 $hidden_id->getToolbarHTML() .
492 $hidden_target->getToolbarHTML();
511 if (strpos($a_value,
"|")) {
512 $parts = explode(
"|", $a_value);
515 if (is_numeric(
$parts[1])) {
517 if (preg_match(
"/^[a-zA-Z_]+$/",
$parts[0])) {
530 $lng = $DIC->language();
532 $value = explode(
"|", $a_value);
533 if ($value ===
false || $value === []) {
567 return array(
"type" =>
$type,
"name" => $name);
586 $val = explode(
"|", $this->
getInput());
590 if (self::isInternalLink($this->
getInput())) {
591 $target_frame = $val[2] ??
"";
592 $map = self::getTypeToAttrType();
593 if (isset($map[$val[0]])) {
594 $type = $map[$val[0]];
595 $target_type = $val[0];
596 if ($val[0] ==
"chap") {
599 if ($val[0] ==
"term") {
600 $target_type =
"git";
602 if ($val[0] ==
"page") {
605 $target =
"il__" . $target_type .
"_" . $val[1];
606 } elseif ($this->obj_definition->isRBACObject($val[0])) {
607 $type =
"RepositoryItem";
608 $target =
"il__obj_" . $val[1];
614 "TargetFrame" => $target_frame
624 string $a_target_frame =
"" 626 $t = explode(
"_", $a_target);
627 $target_id = ($t[3] ??
"");
629 $map = self::getAttrTypeToType();
630 if ($a_type ==
"RepositoryItem") {
632 } elseif (isset($map[$a_type])) {
633 $type = $map[$a_type];
635 if (
$type !=
"" && $target_id !=
"") {
636 $val =
$type .
"|" . $target_id;
637 if ($a_target_frame !=
"") {
638 $val .=
"|" . $a_target_frame;
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
This class represents an option in a radio group.
static getInitHTML(string $a_url)
Get initialisation HTML to use internal link editing.
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...
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
static lookupTitle(int $a_page_id, string $lang="-")
static getOnloadCode(string $a_url)
loadLanguageModule(string $a_module)
Load language module.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $a_obj_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setVariable($variable, $value='')
Sets a variable value.
static _lookupTitle(int $obj_id)
static _lookGlossaryTerm(int $term_id)
get glossary term
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)
static _lookupType(int $id, bool $reference=false)