ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 

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
 $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  parent::__construct($a_title, $a_postvar);
52  $this->setType("link");
53 
54  $this->obj_definition = $DIC["objDefinition"];
55  }
setType($a_type)
Set Type.
global $DIC
+ 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 250 of file class.ilLinkInputGUI.php.

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

251  {
252  global $lng;
253 
254  // debugging
255  // return false;
256 
257  if($this->getRequired())
258  {
259  switch($_POST[$this->getPostVar()."_mode"])
260  {
261  case "ext":
262  if(!$_POST[$this->getPostVar()])
263  {
264  $this->setAlert($lng->txt("msg_input_is_required"));
265  return false;
266  }
267  break;
268 
269  case "int":
270  if(!$_POST[$this->getPostVar()."_ajax_type"] ||
271  !$_POST[$this->getPostVar()."_ajax_id"])
272  {
273  $this->setAlert($lng->txt("msg_input_is_required"));
274  return false;
275  }
276  break;
277 
278  case "no":
279  default:
280  $this->setAlert($lng->txt("msg_input_is_required"));
281  return false;
282  }
283  }
284 
285  if($_POST[$this->getPostVar()."_mode"] == "int")
286  {
287  $_POST[$this->getPostVar()."_ajax_type"] = ilUtil::stripSlashes($_POST[$this->getPostVar()."_ajax_type"]);
288  $_POST[$this->getPostVar()."_ajax_id"] = ilUtil::stripSlashes($_POST[$this->getPostVar()."_ajax_id"]);
289  $_POST[$this->getPostVar()."_ajax_target"] = ilUtil::stripSlashes($_POST[$this->getPostVar()."_ajax_target"]);
290 
291  // overwriting post-data so getInput() will work
292  $val = $_POST[$this->getPostVar()."_ajax_type"]."|".
293  $_POST[$this->getPostVar()."_ajax_id"];
294  if ($_POST[$this->getPostVar()."_ajax_target"] != "")
295  {
296  $val.= "|".$_POST[$this->getPostVar()."_ajax_target"];
297  }
298 
299  $_POST[$this->getPostVar()] = $val;
300  }
301  else if($_POST[$this->getPostVar()."_mode"] == "no")
302  {
303  $_POST[$this->getPostVar()] = "";
304  }
305  else
306  {
307  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
308  }
309 
310  return true;
311  }
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
global $lng
Definition: privfeed.php:17
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCommand()

ilLinkInputGUI::executeCommand ( )

Execute current command.

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

References $cmd, $ilCtrl, $lng, $ret, $t, and getFilterWhiteList().

159  {
160  global $ilCtrl, $lng;
161 
162  $next_class = $ilCtrl->getNextClass($this);
163  $cmd = $ilCtrl->getCmd();
164 
165  switch($next_class)
166  {
167  case "ilinternallinkgui":
168  $lng->loadLanguageModule("content");
169  require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
170  $link_gui = new ilInternalLinkGUI($this->int_link_default_type,
171  $this->int_link_default_obj);
172  foreach ($this->int_link_filter_types as $t)
173  {
174  $link_gui->filterLinkType($t);
175  }
176  $link_gui->setFilterWhiteList($this->getFilterWhiteList());
177  $link_gui->setMode("asynch");
178 
179  $ret = $ilCtrl->forwardCommand($link_gui);
180  break;
181 
182  default:
183  var_dump($cmd);
184  //exit();
185  }
186 
187  return $ret;
188  }
getFilterWhiteList()
Get filter white list.
$cmd
Definition: sahs_server.php:35
Class ilInternalLinkGUI.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
$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 72 of file class.ilLinkInputGUI.php.

References $allowed_link_types.

Referenced by getContentOutsideFormTag(), and render().

73  {
75  }
+ 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 114 of file class.ilLinkInputGUI.php.

115  {
116  return array_flip(self::$iltypemap);
117  }

◆ getContentOutsideFormTag()

ilLinkInputGUI::getContentOutsideFormTag ( )

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

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

488  {
489  if($this->getAllowedLinkTypes() == self::INT ||
490  $this->getAllowedLinkTypes() == self::BOTH)
491  {
492  // as the ajax-panel uses a form it has to be outside of the parent form!
494  }
495  }
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 150 of file class.ilLinkInputGUI.php.

References $external_link_max_length.

Referenced by render().

151  {
153  }
+ 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 134 of file class.ilLinkInputGUI.php.

References $filter_white_list.

Referenced by executeCommand().

135  {
137  }
+ 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 577 of file class.ilLinkInputGUI.php.

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

578  {
579  $val = explode("|", $_POST[$this->getPostVar()]);
580 
581  $ret = false;
582  $type = "";
583  $target = "";
584  if (self::isInternalLink($_POST[$this->getPostVar()]))
585  {
586  $target_frame = $val[2];
587  $map = self::getTypeToAttrType();
588  if (isset($map[$val[0]]))
589  {
590  $type = $map[$val[0]];
591  $target_type = $val[0];
592  if ($val[0] == "chap")
593  {
594  $target_type = "st";
595  }
596  if ($val[0] == "term")
597  {
598  $target_type = "git";
599  }
600  if ($val[0] == "page")
601  {
602  $target_type = "pg";
603  }
604  $target = "il__".$target_type."_".$val[1];
605  }
606  else if ($this->obj_definition->isRBACObject($val[0]))
607  {
608  $type = "RepositoryItem";
609  $target = "il__obj_".$val[1];
610  }
611  if ($type != "")
612  {
613  $ret = array(
614  "Target" => $target,
615  "Type" => $type,
616  "TargetFrame" => $target_frame
617  );
618  }
619  }
620  return $ret;
621  }
$target_type
Definition: goto.php:50
getPostVar()
Get Post Variable.
Create styles array
The data for the language used.
$ret
Definition: parser.php:6
$_POST["username"]
+ Here is the call graph for this function:

◆ getTranslatedValue()

static ilLinkInputGUI::getTranslatedValue (   $a_value)
static

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

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

Referenced by ilWebResourceEditableLinkTableGUI\fillRow().

519  {
520  global $lng;
521 
522  $value = explode("|", $a_value);
523 
524  switch($value[0])
525  {
526  case "media":
527  $type = $lng->txt("obj_mob");
528  $name = ilObject::_lookupTitle($value[1]);
529  break;
530 
531  case "page":
532  include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
533  $type = $lng->txt("obj_pg");
534  $name = ilLMPageObject::_lookupTitle($value[1]);
535  break;
536 
537  case "chap":
538  include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
539  $type = $lng->txt("obj_st");
540  $name = ilStructureObject::_lookupTitle($value[1]);
541  break;
542 
543  case "term":
544  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
545  $type = $lng->txt("term");
546  $name = ilGlossaryTerm::_lookGlossaryTerm($value[1]);
547  break;
548 
549  default:
550  $type = $lng->txt("obj_".$value[0]);
552  break;
553  }
554 
555  return array("type"=>$type, "name"=>$name);
556  }
static _lookupTitle($a_id)
lookup object title
static _lookupTitle($a_obj_id)
Lookup title.
static _lookupObjId($a_id)
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
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 104 of file class.ilLinkInputGUI.php.

105  {
106  return self::$iltypemap;
107  }

◆ getValue()

ilLinkInputGUI::getValue ( )

Get Value.

Returns
string Value

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

Referenced by render().

206  {
207  return $this->value;
208  }
+ Here is the caller graph for this function:

◆ insert()

ilLinkInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

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

References $html, and render().

564  {
565  $html = $this->render();
566 
567  $a_tpl->setCurrentBlock("prop_generic");
568  $a_tpl->setVariable("PROP_GENERIC", $html);
569  $a_tpl->parseCurrentBlock();
570  }
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 497 of file class.ilLinkInputGUI.php.

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

498  {
499  if(strpos($a_value, "|"))
500  {
501  $parts = explode("|", $a_value);
502  if(sizeof($parts) == 2 || sizeof($parts) == 3)
503  {
504  // numeric id
505  if(is_numeric($parts[1]))
506  {
507  // simple type
508  if(preg_match("/^[a-zA-Z_]+$/", $parts[0], $matches))
509  {
510  return true;
511  }
512  }
513  }
514  }
515  return false;
516  }
+ Here is the caller graph for this function:

◆ render()

ilLinkInputGUI::render ( )

Render item.

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

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

Referenced by insert().

317  {
318  global $lng, $ilCtrl;
319 
320  // parse settings
321  $has_int = $has_ext = $has_radio = false;
322  switch($this->getAllowedLinkTypes())
323  {
324  case self::EXT:
325  $has_ext = true;
326  break;
327 
328  case self::INT:
329  $has_int = true;
330  break;
331 
332  case self::BOTH:
333  $has_int = true;
334  $has_ext = true;
335  $has_radio = true;
336  break;
337  }
338  if (!$this->getRequired())
339  {
340  // see #0021274
341 // $has_radio = true;
342  }
343 
344  // external
345  if($has_ext)
346  {
347  $title = $has_radio ? $lng->txt("url") : "";
348 
349  // external
350  $ti = new ilTextInputGUI($title, $this->getPostVar());
351  $ti->setMaxLength($this->getExternalLinkMaxLength());
352  }
353 
354  // internal
355  if($has_int)
356  {
357  $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $this->getPostVar());
358  $link = array(get_class($this->getParent()), "ilformpropertydispatchgui", get_class($this), "ilinternallinkgui");
359  $link = $ilCtrl->getLinkTargetByClass($link, "", false, true, false);
360  $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $_REQUEST["postvar"]);
361 
362  $no_disp_class = (strpos($this->getValue(), "|"))
363  ? ""
364  : " ilNoDisplay";
365 
366  $itpl = new ilTemplate('tpl.prop_link.html',true,true,'Services/Form');
367  $itpl->setVariable("VAL_ID", $this->getPostVar());
368  $itpl->setVariable("URL_EDIT", $link);
369  $itpl->setVariable("TXT_EDIT", $lng->txt("form_get_link"));
370  $itpl->setVariable("CSS_REMOVE", $no_disp_class);
371  $itpl->setVariable("TXT_REMOVE", $lng->txt("remove"));
372 
373  $ne = new ilNonEditableValueGUI($lng->txt("object"), $this->getPostVar()."_val", true);
374 
375  // hidden field for selected value
376  $hidden_type = new ilHiddenInputGUI($this->getPostVar()."_ajax_type");
377  $hidden_id = new ilHiddenInputGUI($this->getPostVar()."_ajax_id");
378  $hidden_target = new ilHiddenInputGUI($this->getPostVar()."_ajax_target");
379  }
380 
381  // mode
382  if ($has_radio)
383  {
384  $ext = new ilRadioOption($lng->txt("form_link_external"), "ext");
385  $ext->addSubItem($ti);
386 
387  $int = new ilRadioOption($lng->txt("form_link_internal"), "int");
388  $int->addSubItem($ne);
389 
390  $mode = new ilRadioGroupInputGUI("", $this->getPostVar()."_mode");
391  if (!$this->getRequired())
392  {
393  $no = new ilRadioOption($lng->txt("form_no_link"), "no");
394  $mode->addOption($no);
395  }
396  $mode->addOption($ext);
397  $mode->addOption($int);
398  }
399  else
400  {
401  $mode = new ilHiddenInputGUI($this->getPostVar()."_mode");
402  if ($has_int)
403  {
404  $mode->setValue("int");
405  }
406  else
407  {
408  $mode->setValue("ext");
409  }
410  }
411 
412  // value
413  $value = $this->getValue();
414  if($value)
415  {
416  // #15647
417  if($has_int && self::isInternalLink($value))
418  {
419  $mode->setValue("int");
420 
421  $value_trans = self::getTranslatedValue($value);
422 
423  $value = explode("|", $value);
424  $hidden_type->setValue($value[0]);
425  $hidden_id->setValue($value[1]);
426  $hidden_target->setValue($value[2]);
427 
428  $itpl->setVariable("VAL_OBJECT_TYPE", $value_trans["type"]);
429  $itpl->setVariable("VAL_OBJECT_NAME", $value_trans["name"]);
430  if ($value[2] != "")
431  {
432  $itpl->setVariable("VAL_TARGET_FRAME", "(" . $value[2].")");
433  }
434  }
435  else if($has_ext)
436  {
437  $mode->setValue("ext");
438 
439  $ti->setValue($value);
440  }
441  }
442  else if (!$this->getRequired())
443  {
444  $mode->setValue("no");
445  }
446 
447  // #10185 - default for external urls
448  if($has_ext && !$ti->getValue())
449  {
450  $ti->setValue("http://");
451  }
452 
453  $ne->setValue($itpl->get());
454 
455  // to html
456  if ($has_radio)
457  {
458  $html = $mode->render();
459  }
460  else
461  {
462  $html = $mode->getToolbarHTML();
463 
464  if ($has_ext)
465  {
466  $html.= $ti->getToolbarHTML();
467  }
468  else
469  {
470  $html.= $ne->render().
471  '<div class="help-block">'.$ne->getInfo().'</div>';
472  }
473  }
474 
475  // js for internal link
476  if($has_int)
477  {
478  include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
479  $html.= $hidden_type->getToolbarHTML().
480  $hidden_id->getToolbarHTML().
481  $hidden_target->getToolbarHTML();
482  }
483 
484  return $html;
485  }
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.
Create styles array
The data for the language used.
This class represents a non editable value in a property form.
global $lng
Definition: privfeed.php:17
getAllowedLinkTypes()
Get allowed link types (BOTH, INT, EXT)
$html
Definition: example_001.php:87
+ 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 62 of file class.ilLinkInputGUI.php.

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

63  {
64  $this->allowed_link_types = $a_val;
65  }
+ Here is the caller graph for this function:

◆ setExternalLinkMaxLength()

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

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

Referenced by ilObjLinkResourceGUI\initFormLink().

143  {
144  $this->external_link_max_length = $a_max;
145  }
+ Here is the caller graph for this function:

◆ setFilterWhiteList()

ilLinkInputGUI::setFilterWhiteList (   $a_val)

Set filter white list.

Parameters
bool$a_valfilter list is white list

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

125  {
126  $this->filter_white_list = $a_val;
127  }

◆ setInternalLinkDefault()

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

Set internal link default.

Parameters
string$a_typelink type
int$a_objobject id

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

References $a_type.

84  {
85  $this->int_link_default_type = $a_type;
86  $this->int_link_default_obj = $a_obj;
87  }
$a_type
Definition: workflow.php:93

◆ setInternalLinkFilterTypes()

ilLinkInputGUI::setInternalLinkFilterTypes ( array  $a_val)

Set internal link filter types.

Parameters
array$a_valfilter types

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

95  {
96  $this->int_link_filter_types = $a_val;
97  }

◆ setValue()

ilLinkInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

Referenced by setValueByArray(), and setValueByIntLinkAttributes().

196  {
197  $this->value = $a_value;
198  }
+ 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 215 of file class.ilLinkInputGUI.php.

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

216  {
217  switch($a_values[$this->getPostVar()."_mode"])
218  {
219  case "int":
220  if($a_values[$this->getPostVar()."_ajax_type"] &&
221  $a_values[$this->getPostVar()."_ajax_id"])
222  {
223  $val = $a_values[$this->getPostVar()."_ajax_type"]."|".
224  $a_values[$this->getPostVar()."_ajax_id"];
225  if ($a_values[$this->getPostVar()."_ajax_target"] != "")
226  {
227  $val.= "|".$a_values[$this->getPostVar()."_ajax_target"];
228  }
229  $this->setValue($val);
230  }
231  break;
232 
233  case "no":
234  break;
235 
236  default:
237  if($a_values[$this->getPostVar()])
238  {
239  $this->setValue($a_values[$this->getPostVar()]);
240  }
241  break;
242  }
243  }
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 629 of file class.ilLinkInputGUI.php.

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

630  {
631  $t = explode("_", $a_target);
632  $target_id = $t[3];
633  $type = "";
634  $map = self::getAttrTypeToType();
635  if ($a_type == "RepositoryItem")
636  {
638  }
639  else if (isset($map[$a_type]))
640  {
641  $type = $map[$a_type];
642  }
643  if ($type != "" && $target_id != "")
644  {
645  $val = $type."|".$target_id;
646  if ($a_target_frame != "")
647  {
648  $val.= "|".$a_target_frame;
649  }
650  $this->setValue($val);
651  }
652  }
$target_id
Definition: goto.php:51
setValue($a_value)
Set Value.
$a_type
Definition: workflow.php:93
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:
"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: