23 public function getHTML(
bool $link =
true, array $options = []): string
27 $ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
28 $views = $this->
getRecord()->getTable()->getVisibleTableViews(
$ref_id,
true, $this->
user->getId());
33 if (is_array($value)) {
34 $link = (string) $value[
'link'];
35 $link_value = $value[
'title'] ?: $this->
shortenLink($link);
37 $link = (string) $value;
41 if (substr($link, 0, 3) ===
'www') {
42 $link =
'https://' . $link;
46 "/^[a-z0-9!#$%&'*+=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i",
49 $link =
"mailto:" . $link;
50 } elseif (!(preg_match(
'~(^(news|(ht|f)tp(s?)\://){1}\S+)~i', $link))) {
54 $html =
"<a rel='noopener' target='_blank' href='" . htmlspecialchars(
57 ) .
"'>" . htmlspecialchars($link_value, ENT_QUOTES) .
"</a>";
59 $view = array_shift($views);
60 if ($this->
http->wrapper()->query()->has(
'tableview_id')) {
61 $tableview_id = $this->
http->wrapper()->query()->retrieve(
'tableview_id', $this->
refinery->kindlyTo()->int());
62 foreach ($views as $v) {
63 if ($v->getId() === $tableview_id) {
64 $view = $tableview_id;
70 $this->
ctrl->clearParametersByClass(
"ilDclDetailedViewGUI");
71 $this->
ctrl->setParameterByClass(
72 'ilDclDetailedViewGUI',
77 $this->
ctrl->setParameterByClass(ilDclDetailedViewGUI::class,
'table_id', $this->
getRecord()->getTableId());
78 $this->
ctrl->setParameterByClass(ilDclDetailedViewGUI::class,
'tableview_id', $view->getId());
79 $html =
'<a href="' . $this->
ctrl->getLinkTargetByClass(
80 "ilDclDetailedViewGUI",
82 ) .
'">' . $value .
'</a>';
84 $html = (is_array($value) && isset($value[
'link'])) ? $value[
'link'] : nl2br((
string) $value);
92 $value = preg_replace(
'/^(https?:\/\/)?(www\.)?/',
'', $value);
93 $half = (
int) ((self::LINK_MAX_LENGTH - 4) / 2);
94 $value = preg_replace(
'/^(.{' . ($half + 1) .
'})(.{4,})(.{' . $half .
'})$/',
'\1...\3', $value);
104 $value = is_array($raw_input) ? $raw_input[
'link'] : $raw_input;
107 $field_values[
"field_" . $this->
getRecordField()->getField()->getId() .
"_title"] = (isset($raw_input[
'title'])) ? $raw_input[
'title'] :
'';
111 $breaks = [
"<br />"];
112 $value = str_ireplace($breaks,
"", $value);
115 $field_values[
"field_" . $this->
getRecordField()->getField()->getId()] = $value;
116 $input_field->setValueByArray($field_values);
getHTML(bool $link=true, array $options=[])
getRecord()
Getter shortcut for record.
getField()
Getter shortcut for field.
shortenLink(string $value)
const PROP_LINK_DETAIL_PAGE_TEXT
static http()
Fetches the global http state from ILIAS.
getFormInput()
Gets the value from from the record field.
fillFormInput(ilPropertyFormGUI $form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getRecordField()
Get Record Field.