19declare(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",
49 "wpage" =>
"WikiPage",
50 "ppage" =>
"PortfolioPage",
58 string $a_postvar =
""
62 $this->
ctrl = $DIC->ctrl();
63 $this->
lng = $DIC->language();
68 $this->obj_definition =
$DIC[
"objDefinition"];
70 $this->requested_postvar = $this->
str(
"postvar");
80 $this->allowed_link_types = $a_val;
98 $this->int_link_default_type = $a_type;
99 $this->int_link_default_obj = $a_obj;
109 $this->int_link_filter_types = $a_val;
119 return self::$iltypemap;
129 return array_flip(self::$iltypemap);
139 $this->filter_white_list = $a_val;
144 return $this->filter_white_list;
152 $this->external_link_max_length = $a_max;
157 return $this->external_link_max_length;
162 $ilCtrl = $this->ctrl;
165 $next_class = $ilCtrl->getNextClass($this);
166 $cmd = $ilCtrl->getCmd();
169 switch ($next_class) {
170 case "ilinternallinkgui":
171 $lng->loadLanguageModule(
"content");
173 $this->int_link_default_type,
174 $this->int_link_default_obj
176 foreach ($this->int_link_filter_types as $t) {
177 $link_gui->filterLinkType($t);
179 $link_gui->setFilterWhiteList($this->getFilterWhiteList());
181 $ret = $ilCtrl->forwardCommand($link_gui);
198 $this->value = $a_value;
212 switch ($a_values[$this->getPostVar() .
"_mode"] ??
null) {
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"];
221 $this->setValue($val);
229 if ($a_values[$this->getPostVar()]) {
230 $this->setValue($a_values[$this->getPostVar()]);
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());
253 if ($this->getRequired()) {
254 if ($mode_type ==
"list") {
261 $this->setAlert(
$lng->txt(
"msg_input_is_required"));
267 if (!$ajax_type || !$ajax_id) {
268 $this->setAlert(
$lng->txt(
"msg_input_is_required"));
275 $this->setAlert(
$lng->txt(
"msg_input_is_required"));
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());
291 if ($mode ==
"int") {
293 $val = $ajax_type .
"|" . $ajax_id;
294 if ($ajax_target !=
"") {
295 $val .=
"|" . $ajax_target;
298 } elseif ($mode ==
"no") {
307 $ilCtrl = $this->ctrl;
313 $hidden_target =
null;
316 $has_int = $has_ext = $has_radio = $has_list =
false;
317 switch ($this->getAllowedLinkTypes()) {
339 if (!$this->getRequired()) {
346 $title = $has_radio ?
$lng->txt(
"url") :
"";
350 $ti->setMaxLength($this->getExternalLinkMaxLength());
353 $itpl =
new ilTemplate(
'tpl.prop_link.html',
true,
true,
'components/ILIAS/Form');
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);
362 $no_disp_class = (strpos($this->
getValue(),
"|"))
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"));
377 $hidden_target =
new ilHiddenInputGUI($this->getPostVar() .
"_ajax_target");
385 $ext->addSubItem($ti);
390 $int->addSubItem($ne);
393 $mode->setParentForm($this->getParentForm());
394 if (!$this->getRequired()) {
396 $mode->addOption($no);
400 $mode->addOption($ext);
403 $mode->addOption($int);
408 $mode->setValue(
"int");
410 $mode->setValue(
"ext");
418 $mode_type->addOption($mode_single);
420 $mode_type->addOption($mode_list);
422 if (!$this->getRequired()) {
424 $mode->addOption($no);
427 $ext->addSubItem($ti);
429 $int->addSubItem($ne);
430 $mode->addOption($ext);
431 $mode->addOption($int);
432 $mode_single->addSubItem($mode);
439 if ($has_int && self::isInternalLink($value)) {
440 $mode->setValue(
"int");
442 $value_trans = self::getTranslatedValue($value);
444 $value = explode(
"|", $value);
445 $hidden_type->setValue($value[0]);
446 $hidden_id->setValue($value[1]);
447 $hidden_target->setValue($value[2] ??
"");
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] .
")");
454 } elseif ($has_ext) {
455 $mode->setValue(
"ext");
457 $ti->setValue($value);
459 } elseif (!$this->getRequired()) {
460 $mode->setValue(
"no");
464 if ($has_ext && !$ti->getValue()) {
465 $ti->setValue(
"https://");
469 $ne->setValue($itpl->get());
474 $html = $mode->render();
476 $html = $mode->getToolbarHTML();
479 $html .= $ti->getToolbarHTML();
480 } elseif ($has_int) {
481 $html .= $ne->render() .
482 '<div class="help-block">' . $ne->getInfo() .
'</div>';
486 $html = $mode_type->render();
491 $html .= $hidden_type->getToolbarHTML() .
492 $hidden_id->getToolbarHTML() .
493 $hidden_target->getToolbarHTML();
501 if ($this->getAllowedLinkTypes() == self::INT ||
502 $this->getAllowedLinkTypes() == self::BOTH ||
503 $this->getAllowedLinkTypes() == self::LIST) {
512 if (strpos($a_value,
"|")) {
513 $parts = explode(
"|", $a_value);
516 if (is_numeric(
$parts[1])) {
518 if (preg_match(
"/^[a-zA-Z_]+$/",
$parts[0])) {
533 $value = explode(
"|", $a_value);
534 if ($value ===
false || $value === []) {
539 $type =
$lng->txt(
"obj_mob");
544 $type =
$lng->txt(
"obj_pg");
549 $type =
$lng->txt(
"cont_prtf_page");
554 $type =
$lng->txt(
"obj_st");
559 $type =
$lng->txt(
"term");
564 $type =
$lng->txt(
"cont_wiki_page");
569 $type =
$lng->txt(
"obj_" . $value[0]);
573 return array(
"type" => $type,
"name" => $name);
578 $html = $this->render();
592 $val = explode(
"|", $this->getInput());
596 if (self::isInternalLink($this->getInput())) {
597 $target_frame = $val[2] ??
"";
598 $map = self::getTypeToAttrType();
599 if (isset($map[$val[0]])) {
600 $type = $map[$val[0]];
601 $target_type = $val[0];
602 if ($val[0] ==
"chap") {
605 if ($val[0] ==
"term") {
606 $target_type =
"git";
608 if ($val[0] ==
"page") {
611 $target =
"il__" . $target_type .
"_" . $val[1];
612 } elseif ($this->obj_definition->isRBACObject($val[0])) {
613 $type =
"RepositoryItem";
614 $target =
"il__obj_" . $val[1];
620 "TargetFrame" => $target_frame
630 string $a_target_frame =
""
632 $t = explode(
"_", $a_target);
633 $target_id = ($t[3] ??
"");
635 $map = self::getAttrTypeToType();
636 if ($a_type ==
"RepositoryItem") {
638 } elseif (isset($map[$a_type])) {
639 $type = $map[$a_type];
641 if ($type !=
"" && $target_id !=
"") {
642 $val = $type .
"|" . $target_id;
643 if ($a_target_frame !=
"") {
644 $val .=
"|" . $a_target_frame;
646 $this->setValue($val);
setVariable($variable, $value='')
Sets a variable value.
static _lookGlossaryTerm(int $term_id)
get glossary term
static getOnloadCode(string $a_url)
static getInitHTML(string $a_url)
Get initialisation HTML to use internal link editing.
static _lookupTitle(int $a_obj_id)
This class represents a non editable value in a property form.
parses the objects.xml it handles the xml-description of all ilias objects
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static lookupTitle(int $a_page_id)
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
This class represents a text property in a property form.
static lookupTitle(int $a_page_id, string $lang="-")
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc