26 if (is_array($value)) {
27 $link = $value[
'link'];
28 $link_value = $value[
'title'] ? $value[
'title'] : $this->
shortenLink($link);
34 if (substr($link, 0, 3) ===
'www') {
35 $link =
'http://' . $link;
38 if (preg_match(
"/^[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", $link)) {
39 $link =
"mailto:" . $link;
40 } elseif (!(preg_match(
'~(^(news|(ht|f)tp(s?)\://){1}\S+)~i', $link))) {
44 $html =
"<a rel='noopener' target='_blank' href='" . htmlspecialchars($link, ENT_QUOTES) .
"'>" . htmlspecialchars($link_value, ENT_QUOTES) .
"</a>";
46 $this->ctrl->clearParametersByClass(
"ilDclDetailedViewGUI");
47 $this->ctrl->setParameterByClass(
'ilDclDetailedViewGUI',
'record_id', $this->
getRecordField()->
getRecord()->getId());
48 $this->ctrl->setParameterByClass(
'ilDclDetailedViewGUI',
'tableview_id',
$_GET[
'tableview_id']);
49 $html =
'<a href="' . $this->ctrl->getLinkTargetByClass(
"ilDclDetailedViewGUI",
'renderRecord') .
'">' . $value .
'</a>';
51 $html = (is_array($value) && isset($value[
'link']))? $value[
'link'] : $value;
66 if (strlen($value) > self::LINK_MAX_LENGTH) {
67 if (substr($value, 0, 7) ==
"http://") {
68 $value = substr($value, 7);
70 if (substr($value, 0, 8) ==
"https://") {
71 $value = substr($value, 8);
73 if (substr($value, 0, 4) ==
"www.") {
74 $value = substr($value, 4);
79 if (strlen($value) > self::LINK_MAX_LENGTH) {
80 $link = substr($value, 0, (self::LINK_MAX_LENGTH - 3) / 2);
82 $link .= substr($value, -(self::LINK_MAX_LENGTH - 3) / 2);
93 $input_field =
$form->getItemByPostVar(
'field_' . $this->
getField()->getId());
96 $value = is_array($raw_input) ? $raw_input[
'link'] : $raw_input;
97 $field_values =
array();
99 $field_values[
"field_" . $this->
getRecordField()->getField()->getId() .
"_title"] = (isset($raw_input[
'title']))? $raw_input[
'title'] :
'';
103 $breaks =
array(
"<br />" );
104 $value = str_ireplace($breaks,
"", $value);
107 $field_values[
"field_" . $this->
getRecordField()->getField()->getId()] = $value;
108 $input_field->setValueByArray($field_values);
getRecord()
Getter shortcut for record.
getField()
Getter shortcut for field.
const PROP_LINK_DETAIL_PAGE_TEXT
getFormInput()
Gets the value from from the record field.
if(isset($_POST['submit'])) $form
Class ilDclTextFieldRepresentation.
Create styles array
The data for the language used.
Class ilDclBaseRecordRepresentation.
shortenLink($value)
This method shortens a link.
getRecordField()
Get Record Field.
getHTML($link=true)
Outputs html of a certain field.