19 declare(strict_types=1);
25 public function getHTML(
bool $link =
true, array $options = []): string
29 $ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
35 $url = $value[
'link'];
38 if (substr(
$url, 0, 3) ===
'www') {
40 } elseif (filter_var(
$url, FILTER_VALIDATE_EMAIL)) {
43 $links[
'dcl_open_url'] =
$url;
47 if ($this->
http->wrapper()->query()->has(
'tableview_id')) {
48 $tableview_id = $this->
http->wrapper()->query()->retrieve(
'tableview_id', $this->
refinery->kindlyTo()->int());
50 $tableview_id = $this->
getRecord()->getTable()->getFirstTableViewId($this->
user->getId());
53 $this->
ctrl->clearParametersByClass(
"ilDclDetailedViewGUI");
54 $this->
ctrl->setParameterByClass(ilDclDetailedViewGUI::class,
'table_id', $this->
getRecord()->getTableId());
55 $this->
ctrl->setParameterByClass(ilDclDetailedViewGUI::class,
'tableview_id', $tableview_id);
56 $this->
ctrl->setParameterByClass(ilDclDetailedViewGUI::class,
'record_id', $this->
getRecord()->
getId());
57 $links[
'dcl_open_detail_view'] = $this->
ctrl->getLinkTargetByClass(ilDclDetailedViewGUI::class,
'renderRecord');
61 $value = nl2br((
string) $value);
63 switch (count($links)) {
67 return $this->renderer->render(
68 $this->factory->link()->standard(
71 )->withOpenInNewViewport(
true)
76 foreach ($links as $key => $link) {
77 $ui_links[] = $this->factory->link()->standard(
78 $this->
lng->txt($key),
82 return $this->renderer->render(
83 $this->factory->dropdown()->standard(
93 $value = preg_replace(
'/^(https?:\/\/)?(www\.)?/',
'', $value);
94 $half = (
int) ((self::LINK_MAX_LENGTH - 4) / 2);
95 $value = preg_replace(
'/^(.{' . ($half + 1) .
'})(.{4,})(.{' . $half .
'})$/',
'\1...\3', $value);
105 $value = is_array($raw_input) ? $raw_input[
'link'] : $raw_input;
106 $value = is_string($value) ? $value :
"";
109 $field_values[
"field_" . $this->
getRecordField()->getField()->getId() .
"_title"] = (isset($raw_input[
'title'])) ? $raw_input[
'title'] :
'';
112 $field_values[
"field_" . $this->
getRecordField()->getField()->getId()] = $value;
113 $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)
getRecordField()
Get Record Field.