ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLinkInputGUI Class Reference

This class represents a external and/or internal link in a property form. More...

+ Inheritance diagram for ilLinkInputGUI:
+ Collaboration diagram for ilLinkInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setAllowedLinkTypes ($a_val)
 Set allowed link types (BOTH, INT, EXT) More...
 
 getAllowedLinkTypes ()
 Get allowed link types (BOTH, INT, EXT) More...
 
 setInternalLinkDefault ($a_type, $a_obj=0)
 Set internal link default. More...
 
 setInternalLinkFilterTypes (array $a_val)
 Set internal link filter types. More...
 
 setFilterWhiteList ($a_val)
 Set filter white list. More...
 
 getFilterWhiteList ()
 Get filter white list. More...
 
 setExternalLinkMaxLength ($a_max)
 
 getExternalLinkMaxLength ()
 
 executeCommand ()
 Execute current command. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 render ()
 Render item. More...
 
 getContentOutsideFormTag ()
 
 insert ($a_tpl)
 Insert property html. More...
 
 getIntLinkAttributes ()
 Get value as internal link attributes. More...
 
 setValueByIntLinkAttributes ($a_type, $a_target, $a_target_frame="")
 Set value by internal links attributes. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 

Static Public Member Functions

static getTypeToAttrType ()
 Get internal types to xml attribute types map. More...
 
static getAttrTypeToType ()
 Get internal types to xml attribute types map (reverse) More...
 
static isInternalLink ($a_value)
 
static getTranslatedValue ($a_value)
 
- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 

Data Fields

const EXTERNAL_LINK_MAX_LENGTH = 200
 
const BOTH = "both"
 
const INT = "int"
 
const EXT = "ext"
 

Protected Attributes

 $allowed_link_types = self::BOTH
 
 $int_link_default_type = "RepositoryItem"
 
 $int_link_default_obj = 0
 
 $int_link_filter_types = array("RepositoryItem")
 
 $filter_white_list = true
 
 $external_link_max_length = self::EXTERNAL_LINK_MAX_LENGTH
 
 $obj_definition
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Static Protected Attributes

static $iltypemap
 

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

This class represents a external and/or internal link in a property form.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

ilLinkInputGUI: ilFormPropertyDispatchGUI ilLinkInputGUI: ilInternalLinkGUI

Definition at line 15 of file class.ilLinkInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLinkInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 48 of file class.ilLinkInputGUI.php.

References $DIC, and ilFormPropertyGUI\setType().

49  {
50  global $DIC;
51 
52  $this->ctrl = $DIC->ctrl();
53  $this->lng = $DIC->language();
54 
55  parent::__construct($a_title, $a_postvar);
56  $this->setType("link");
57 
58  $this->obj_definition = $DIC["objDefinition"];
59  }
global $DIC
Definition: saml.php:7
setType($a_type)
Set Type.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilLinkInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Definition at line 251 of file class.ilLinkInputGUI.php.

References $_POST, ilFormPropertyGUI\$lng, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

252  {
253  $lng = $this->lng;
254 
255  // debugging
256  // return false;
257 
258  if ($this->getRequired()) {
259  switch ($_POST[$this->getPostVar() . "_mode"]) {
260  case "ext":
261  if (!$_POST[$this->getPostVar()]) {
262  $this->setAlert($lng->txt("msg_input_is_required"));
263  return false;
264  }
265  break;
266 
267  case "int":
268  if (!$_POST[$this->getPostVar() . "_ajax_type"] ||
269  !$_POST[$this->getPostVar() . "_ajax_id"]) {
270  $this->setAlert($lng->txt("msg_input_is_required"));
271  return false;
272  }
273  break;
274 
275  case "no":
276  default:
277  $this->setAlert($lng->txt("msg_input_is_required"));
278  return false;
279  }
280  }
281 
282  if ($_POST[$this->getPostVar() . "_mode"] == "int") {
283  $_POST[$this->getPostVar() . "_ajax_type"] = ilUtil::stripSlashes($_POST[$this->getPostVar() . "_ajax_type"]);
284  $_POST[$this->getPostVar() . "_ajax_id"] = ilUtil::stripSlashes($_POST[$this->getPostVar() . "_ajax_id"]);
285  $_POST[$this->getPostVar() . "_ajax_target"] = ilUtil::stripSlashes($_POST[$this->getPostVar() . "_ajax_target"]);
286 
287  // overwriting post-data so getInput() will work
288  $val = $_POST[$this->getPostVar() . "_ajax_type"] . "|" .
289  $_POST[$this->getPostVar() . "_ajax_id"];
290  if ($_POST[$this->getPostVar() . "_ajax_target"] != "") {
291  $val .= "|" . $_POST[$this->getPostVar() . "_ajax_target"];
292  }
293 
294  $_POST[$this->getPostVar()] = $val;
295  } elseif ($_POST[$this->getPostVar() . "_mode"] == "no") {
296  $_POST[$this->getPostVar()] = "";
297  } else {
298  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
299  }
300 
301  return true;
302  }
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCommand()

ilLinkInputGUI::executeCommand ( )

Execute current command.

Definition at line 162 of file class.ilLinkInputGUI.php.

References ilFormPropertyGUI\$ctrl, $ilCtrl, ilFormPropertyGUI\$lng, $ret, $t, and getFilterWhiteList().

163  {
165  $lng = $this->lng;
166 
167  $next_class = $ilCtrl->getNextClass($this);
168  $cmd = $ilCtrl->getCmd();
169 
170  switch ($next_class) {
171  case "ilinternallinkgui":
172  $lng->loadLanguageModule("content");
173  require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
174  $link_gui = new ilInternalLinkGUI(
175  $this->int_link_default_type,
176  $this->int_link_default_obj
177  );
178  foreach ($this->int_link_filter_types as $t) {
179  $link_gui->filterLinkType($t);
180  }
181  $link_gui->setFilterWhiteList($this->getFilterWhiteList());
182  $link_gui->setMode("asynch");
183 
184  $ret = $ilCtrl->forwardCommand($link_gui);
185  break;
186 
187  default:
188  var_dump($cmd);
189  //exit();
190  }
191 
192  return $ret;
193  }
getFilterWhiteList()
Get filter white list.
Class ilInternalLinkGUI.
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
+ Here is the call graph for this function:

◆ getAllowedLinkTypes()

ilLinkInputGUI::getAllowedLinkTypes ( )

Get allowed link types (BOTH, INT, EXT)

Returns
string self::BOTH|self::INT|self::EXT

Definition at line 76 of file class.ilLinkInputGUI.php.

References $allowed_link_types.

Referenced by getContentOutsideFormTag(), and render().

77  {
79  }
+ Here is the caller graph for this function:

◆ getAttrTypeToType()

static ilLinkInputGUI::getAttrTypeToType ( )
static

Get internal types to xml attribute types map (reverse)

Returns
string[]

Definition at line 118 of file class.ilLinkInputGUI.php.

119  {
120  return array_flip(self::$iltypemap);
121  }

◆ getContentOutsideFormTag()

ilLinkInputGUI::getContentOutsideFormTag ( )

Definition at line 453 of file class.ilLinkInputGUI.php.

References getAllowedLinkTypes(), and ilInternalLinkGUI\getInitHTML().

454  {
455  if ($this->getAllowedLinkTypes() == self::INT ||
456  $this->getAllowedLinkTypes() == self::BOTH) {
457  // as the ajax-panel uses a form it has to be outside of the parent form!
459  }
460  }
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
getAllowedLinkTypes()
Get allowed link types (BOTH, INT, EXT)
+ Here is the call graph for this function:

◆ getExternalLinkMaxLength()

ilLinkInputGUI::getExternalLinkMaxLength ( )
Returns
int

Definition at line 154 of file class.ilLinkInputGUI.php.

References $external_link_max_length.

Referenced by render().

155  {
157  }
+ Here is the caller graph for this function:

◆ getFilterWhiteList()

ilLinkInputGUI::getFilterWhiteList ( )

Get filter white list.

Returns
bool filter list is white list

Definition at line 138 of file class.ilLinkInputGUI.php.

References $filter_white_list.

Referenced by executeCommand().

139  {
141  }
+ Here is the caller graph for this function:

◆ getIntLinkAttributes()

ilLinkInputGUI::getIntLinkAttributes ( )

Get value as internal link attributes.

Returns
array (with keys "Type", "Target" and "TargetFrame")

Definition at line 539 of file class.ilLinkInputGUI.php.

References $_POST, $map, $ret, $target, $target_type, ilFormPropertyGUI\$type, and ilFormPropertyGUI\getPostVar().

540  {
541  $val = explode("|", $_POST[$this->getPostVar()]);
542 
543  $ret = false;
544  $type = "";
545  $target = "";
546  if (self::isInternalLink($_POST[$this->getPostVar()])) {
547  $target_frame = $val[2];
548  $map = self::getTypeToAttrType();
549  if (isset($map[$val[0]])) {
550  $type = $map[$val[0]];
551  $target_type = $val[0];
552  if ($val[0] == "chap") {
553  $target_type = "st";
554  }
555  if ($val[0] == "term") {
556  $target_type = "git";
557  }
558  if ($val[0] == "page") {
559  $target_type = "pg";
560  }
561  $target = "il__" . $target_type . "_" . $val[1];
562  } elseif ($this->obj_definition->isRBACObject($val[0])) {
563  $type = "RepositoryItem";
564  $target = "il__obj_" . $val[1];
565  }
566  if ($type != "") {
567  $ret = array(
568  "Target" => $target,
569  "Type" => $type,
570  "TargetFrame" => $target_frame
571  );
572  }
573  }
574  return $ret;
575  }
$target_type
Definition: goto.php:48
getPostVar()
Get Post Variable.
$ret
Definition: parser.php:6
$target
Definition: test.php:19
$_POST["username"]
+ Here is the call graph for this function:

◆ getTranslatedValue()

static ilLinkInputGUI::getTranslatedValue (   $a_value)
static

Definition at line 479 of file class.ilLinkInputGUI.php.

References $DIC, ilFormPropertyGUI\$lng, $name, ilFormPropertyGUI\$type, ilGlossaryTerm\_lookGlossaryTerm(), ilObject\_lookupObjId(), ilLMObject\_lookupTitle(), and ilObject\_lookupTitle().

Referenced by ilWebResourceEditableLinkTableGUI\fillRow().

480  {
481  global $DIC;
482 
483  $lng = $DIC->language();
484 
485  $value = explode("|", $a_value);
486 
487  switch ($value[0]) {
488  case "media":
489  $type = $lng->txt("obj_mob");
490  $name = ilObject::_lookupTitle($value[1]);
491  break;
492 
493  case "page":
494  include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
495  $type = $lng->txt("obj_pg");
496  $name = ilLMPageObject::_lookupTitle($value[1]);
497  break;
498 
499  case "chap":
500  include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
501  $type = $lng->txt("obj_st");
503  break;
504 
505  case "term":
506  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
507  $type = $lng->txt("term");
509  break;
510 
511  default:
512  $type = $lng->txt("obj_" . $value[0]);
514  break;
515  }
516 
517  return array("type" => $type, "name" => $name);
518  }
global $DIC
Definition: saml.php:7
static _lookupTitle($a_id)
lookup object title
static _lookupTitle($a_obj_id)
Lookup title.
static _lookupObjId($a_id)
static _lookGlossaryTerm($term_id)
get glossary term
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTypeToAttrType()

static ilLinkInputGUI::getTypeToAttrType ( )
static

Get internal types to xml attribute types map.

Returns
string[]

Definition at line 108 of file class.ilLinkInputGUI.php.

109  {
110  return self::$iltypemap;
111  }

◆ getValue()

ilLinkInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 210 of file class.ilLinkInputGUI.php.

Referenced by render().

211  {
212  return $this->value;
213  }
+ Here is the caller graph for this function:

◆ insert()

ilLinkInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

Definition at line 525 of file class.ilLinkInputGUI.php.

References $html, and render().

526  {
527  $html = $this->render();
528 
529  $a_tpl->setCurrentBlock("prop_generic");
530  $a_tpl->setVariable("PROP_GENERIC", $html);
531  $a_tpl->parseCurrentBlock();
532  }
render()
Render item.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ isInternalLink()

static ilLinkInputGUI::isInternalLink (   $a_value)
static

Definition at line 462 of file class.ilLinkInputGUI.php.

Referenced by ilObjLinkResourceGUI\checkLinkInput(), ilObjLinkResourceListGUI\getCommandFrame(), ilObjLinkResourceGUI\handleSubItemLinks(), ilWebResourceLinkTableGUI\parse(), and ilObjLinkResourceGUI\updateLinks().

463  {
464  if (strpos($a_value, "|")) {
465  $parts = explode("|", $a_value);
466  if (sizeof($parts) == 2 || sizeof($parts) == 3) {
467  // numeric id
468  if (is_numeric($parts[1])) {
469  // simple type
470  if (preg_match("/^[a-zA-Z_]+$/", $parts[0], $matches)) {
471  return true;
472  }
473  }
474  }
475  }
476  return false;
477  }
+ Here is the caller graph for this function:

◆ render()

ilLinkInputGUI::render ( )

Render item.

Definition at line 307 of file class.ilLinkInputGUI.php.

References ilFormPropertyGUI\$ctrl, $html, $ilCtrl, $int, ilFormPropertyGUI\$lng, ilFormPropertyGUI\$title, ilRadioOption\addSubItem(), getAllowedLinkTypes(), getExternalLinkMaxLength(), ilFormPropertyGUI\getParent(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), and getValue().

Referenced by insert().

308  {
309  $lng = $this->lng;
311 
312  // parse settings
313  $has_int = $has_ext = $has_radio = false;
314  switch ($this->getAllowedLinkTypes()) {
315  case self::EXT:
316  $has_ext = true;
317  break;
318 
319  case self::INT:
320  $has_int = true;
321  break;
322 
323  case self::BOTH:
324  $has_int = true;
325  $has_ext = true;
326  $has_radio = true;
327  break;
328  }
329  if (!$this->getRequired()) {
330  // see #0021274
331 // $has_radio = true;
332  }
333 
334  // external
335  if ($has_ext) {
336  $title = $has_radio ? $lng->txt("url") : "";
337 
338  // external
339  $ti = new ilTextInputGUI($title, $this->getPostVar());
340  $ti->setMaxLength($this->getExternalLinkMaxLength());
341  }
342 
343  // internal
344  if ($has_int) {
345  $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $this->getPostVar());
346  $link = array(get_class($this->getParent()), "ilformpropertydispatchgui", get_class($this), "ilinternallinkgui");
347  $link = $ilCtrl->getLinkTargetByClass($link, "", false, true, false);
348  $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $_REQUEST["postvar"]);
349 
350  $no_disp_class = (strpos($this->getValue(), "|"))
351  ? ""
352  : " ilNoDisplay";
353 
354  $itpl = new ilTemplate('tpl.prop_link.html', true, true, 'Services/Form');
355  $itpl->setVariable("VAL_ID", $this->getPostVar());
356  $itpl->setVariable("URL_EDIT", $link);
357  $itpl->setVariable("TXT_EDIT", $lng->txt("form_get_link"));
358  $itpl->setVariable("CSS_REMOVE", $no_disp_class);
359  $itpl->setVariable("TXT_REMOVE", $lng->txt("remove"));
360 
361  $ne = new ilNonEditableValueGUI($lng->txt("object"), $this->getPostVar() . "_val", true);
362 
363  // hidden field for selected value
364  $hidden_type = new ilHiddenInputGUI($this->getPostVar() . "_ajax_type");
365  $hidden_id = new ilHiddenInputGUI($this->getPostVar() . "_ajax_id");
366  $hidden_target = new ilHiddenInputGUI($this->getPostVar() . "_ajax_target");
367  }
368 
369  // mode
370  if ($has_radio) {
371  $ext = new ilRadioOption($lng->txt("form_link_external"), "ext");
372  $ext->addSubItem($ti);
373 
374  $int = new ilRadioOption($lng->txt("form_link_internal"), "int");
375  $int->addSubItem($ne);
376 
377  $mode = new ilRadioGroupInputGUI("", $this->getPostVar() . "_mode");
378  if (!$this->getRequired()) {
379  $no = new ilRadioOption($lng->txt("form_no_link"), "no");
380  $mode->addOption($no);
381  }
382  $mode->addOption($ext);
383  $mode->addOption($int);
384  } else {
385  $mode = new ilHiddenInputGUI($this->getPostVar() . "_mode");
386  if ($has_int) {
387  $mode->setValue("int");
388  } else {
389  $mode->setValue("ext");
390  }
391  }
392 
393  // value
394  $value = $this->getValue();
395  if ($value) {
396  // #15647
397  if ($has_int && self::isInternalLink($value)) {
398  $mode->setValue("int");
399 
400  $value_trans = self::getTranslatedValue($value);
401 
402  $value = explode("|", $value);
403  $hidden_type->setValue($value[0]);
404  $hidden_id->setValue($value[1]);
405  $hidden_target->setValue($value[2]);
406 
407  $itpl->setVariable("VAL_OBJECT_TYPE", $value_trans["type"]);
408  $itpl->setVariable("VAL_OBJECT_NAME", $value_trans["name"]);
409  if ($value[2] != "") {
410  $itpl->setVariable("VAL_TARGET_FRAME", "(" . $value[2] . ")");
411  }
412  } elseif ($has_ext) {
413  $mode->setValue("ext");
414 
415  $ti->setValue($value);
416  }
417  } elseif (!$this->getRequired()) {
418  $mode->setValue("no");
419  }
420 
421  // #10185 - default for external urls
422  if ($has_ext && !$ti->getValue()) {
423  $ti->setValue("http://");
424  }
425 
426  $ne->setValue($itpl->get());
427 
428  // to html
429  if ($has_radio) {
430  $html = $mode->render();
431  } else {
432  $html = $mode->getToolbarHTML();
433 
434  if ($has_ext) {
435  $html .= $ti->getToolbarHTML();
436  } else {
437  $html .= $ne->render() .
438  '<div class="help-block">' . $ne->getInfo() . '</div>';
439  }
440  }
441 
442  // js for internal link
443  if ($has_int) {
444  include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
445  $html .= $hidden_type->getToolbarHTML() .
446  $hidden_id->getToolbarHTML() .
447  $hidden_target->getToolbarHTML();
448  }
449 
450  return $html;
451  }
This class represents an option in a radio group.
getPostVar()
Get Post Variable.
global $ilCtrl
Definition: ilias.php:18
This class represents a hidden form property in a property form.
This class represents a property in a property form.
addSubItem($a_item)
Add Subitem.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
getParent()
Get Parent GUI object.
This class represents a non editable value in a property form.
getAllowedLinkTypes()
Get allowed link types (BOTH, INT, EXT)
$html
Definition: example_001.php:87
$int
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAllowedLinkTypes()

ilLinkInputGUI::setAllowedLinkTypes (   $a_val)

Set allowed link types (BOTH, INT, EXT)

Parameters
string$a_valself::BOTH|self::INT|self::EXT

Definition at line 66 of file class.ilLinkInputGUI.php.

Referenced by ilPCSectionGUI\initForm(), and ilPageObjectGUI\initOpenedContentForm().

67  {
68  $this->allowed_link_types = $a_val;
69  }
+ Here is the caller graph for this function:

◆ setExternalLinkMaxLength()

ilLinkInputGUI::setExternalLinkMaxLength (   $a_max)
Parameters
intmax length for external links

Definition at line 146 of file class.ilLinkInputGUI.php.

147  {
148  $this->external_link_max_length = $a_max;
149  }

◆ setFilterWhiteList()

ilLinkInputGUI::setFilterWhiteList (   $a_val)

Set filter white list.

Parameters
bool$a_valfilter list is white list

Definition at line 128 of file class.ilLinkInputGUI.php.

129  {
130  $this->filter_white_list = $a_val;
131  }

◆ setInternalLinkDefault()

ilLinkInputGUI::setInternalLinkDefault (   $a_type,
  $a_obj = 0 
)

Set internal link default.

Parameters
string$a_typelink type
int$a_objobject id

Definition at line 87 of file class.ilLinkInputGUI.php.

References $a_type.

88  {
89  $this->int_link_default_type = $a_type;
90  $this->int_link_default_obj = $a_obj;
91  }
$a_type
Definition: workflow.php:92

◆ setInternalLinkFilterTypes()

ilLinkInputGUI::setInternalLinkFilterTypes ( array  $a_val)

Set internal link filter types.

Parameters
array$a_valfilter types

Definition at line 98 of file class.ilLinkInputGUI.php.

Referenced by ilObjLinkResourceGUI\initFormLink().

99  {
100  $this->int_link_filter_types = $a_val;
101  }
+ Here is the caller graph for this function:

◆ setValue()

ilLinkInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 200 of file class.ilLinkInputGUI.php.

Referenced by setValueByArray(), and setValueByIntLinkAttributes().

201  {
202  $this->value = $a_value;
203  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilLinkInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 220 of file class.ilLinkInputGUI.php.

References ilFormPropertyGUI\getPostVar(), and setValue().

221  {
222  switch ($a_values[$this->getPostVar() . "_mode"]) {
223  case "int":
224  if ($a_values[$this->getPostVar() . "_ajax_type"] &&
225  $a_values[$this->getPostVar() . "_ajax_id"]) {
226  $val = $a_values[$this->getPostVar() . "_ajax_type"] . "|" .
227  $a_values[$this->getPostVar() . "_ajax_id"];
228  if ($a_values[$this->getPostVar() . "_ajax_target"] != "") {
229  $val .= "|" . $a_values[$this->getPostVar() . "_ajax_target"];
230  }
231  $this->setValue($val);
232  }
233  break;
234 
235  case "no":
236  break;
237 
238  default:
239  if ($a_values[$this->getPostVar()]) {
240  $this->setValue($a_values[$this->getPostVar()]);
241  }
242  break;
243  }
244  }
getPostVar()
Get Post Variable.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:

◆ setValueByIntLinkAttributes()

ilLinkInputGUI::setValueByIntLinkAttributes (   $a_type,
  $a_target,
  $a_target_frame = "" 
)

Set value by internal links attributes.

Parameters

Definition at line 583 of file class.ilLinkInputGUI.php.

References $a_type, $map, $t, $target_id, ilFormPropertyGUI\$type, ilObject\_lookupType(), and setValue().

584  {
585  $t = explode("_", $a_target);
586  $target_id = $t[3];
587  $type = "";
588  $map = self::getAttrTypeToType();
589  if ($a_type == "RepositoryItem") {
591  } elseif (isset($map[$a_type])) {
592  $type = $map[$a_type];
593  }
594  if ($type != "" && $target_id != "") {
595  $val = $type . "|" . $target_id;
596  if ($a_target_frame != "") {
597  $val .= "|" . $a_target_frame;
598  }
599  $this->setValue($val);
600  }
601  }
$target_id
Definition: goto.php:49
setValue($a_value)
Set Value.
$a_type
Definition: workflow.php:92
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

Field Documentation

◆ $allowed_link_types

ilLinkInputGUI::$allowed_link_types = self::BOTH
protected

Definition at line 22 of file class.ilLinkInputGUI.php.

Referenced by getAllowedLinkTypes().

◆ $external_link_max_length

ilLinkInputGUI::$external_link_max_length = self::EXTERNAL_LINK_MAX_LENGTH
protected

Definition at line 28 of file class.ilLinkInputGUI.php.

Referenced by getExternalLinkMaxLength().

◆ $filter_white_list

ilLinkInputGUI::$filter_white_list = true
protected

Definition at line 26 of file class.ilLinkInputGUI.php.

Referenced by getFilterWhiteList().

◆ $iltypemap

ilLinkInputGUI::$iltypemap
staticprotected
Initial value:
= array(
"page" => "PageObject",
"chap" => "StructureObject",
"term" => "GlossaryItem",
"wpage" => "WikiPage"
)

Definition at line 30 of file class.ilLinkInputGUI.php.

◆ $int_link_default_obj

ilLinkInputGUI::$int_link_default_obj = 0
protected

Definition at line 24 of file class.ilLinkInputGUI.php.

◆ $int_link_default_type

ilLinkInputGUI::$int_link_default_type = "RepositoryItem"
protected

Definition at line 23 of file class.ilLinkInputGUI.php.

◆ $int_link_filter_types

ilLinkInputGUI::$int_link_filter_types = array("RepositoryItem")
protected

Definition at line 25 of file class.ilLinkInputGUI.php.

◆ $obj_definition

ilLinkInputGUI::$obj_definition
protected

Definition at line 40 of file class.ilLinkInputGUI.php.

◆ BOTH

const ilLinkInputGUI::BOTH = "both"

Definition at line 19 of file class.ilLinkInputGUI.php.

Referenced by ilPCSectionGUI\initForm().

◆ EXT

const ilLinkInputGUI::EXT = "ext"

Definition at line 21 of file class.ilLinkInputGUI.php.

◆ EXTERNAL_LINK_MAX_LENGTH

const ilLinkInputGUI::EXTERNAL_LINK_MAX_LENGTH = 200

Definition at line 17 of file class.ilLinkInputGUI.php.

◆ INT

const ilLinkInputGUI::INT = "int"

Definition at line 20 of file class.ilLinkInputGUI.php.

Referenced by ilPageObjectGUI\initOpenedContentForm().


The documentation for this class was generated from the following file: