ILIAS  release_8 Revision v8.23
ilWebLinkParameter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilWebLinkParameter:
+ Collaboration diagram for ilWebLinkParameter:

Public Member Functions

 __construct (ilObjUser $user, int $webr_id, int $link_id, int $param_id, int $value, string $name)
 
 appendToLink (string $link)
 
 getInfo ()
 
 toXML (ilXmlWriter $writer)
 
 getWebrId ()
 
 getLinkId ()
 
 getParamId ()
 
- Public Member Functions inherited from ilWebLinkBaseParameter
 __construct (int $value, string $name)
 
 getValue ()
 
 getName ()
 

Private Attributes

int $webr_id
 
int $link_id
 
int $param_id
 
ilObjUser $user
 

Additional Inherited Members

- Data Fields inherited from ilWebLinkBaseParameter
const UNDEFINED_NAME = 'undefined'
 
const USER_ID_NAME = 'user_id'
 
const SESSION_ID_NAME = 'session_id'
 
const LOGIN_NAME = 'login'
 
const MATRICULATION_NAME = 'matriculation'
 
const VALUES
 TODO Once the GUI is updated, undefined can be dropped. More...
 
const VALUES_TEXT
 Keys of the language variables to the possible values, e.g. More...
 
- Protected Attributes inherited from ilWebLinkBaseParameter
int $value
 
string $name
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Immutable class for parameters attached to Web Link items

Author
Tim Schmitz schmi.nosp@m.tz@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilWebLinkParameter::__construct ( ilObjUser  $user,
int  $webr_id,
int  $link_id,
int  $param_id,
int  $value,
string  $name 
)

Member Function Documentation

◆ appendToLink()

ilWebLinkParameter::appendToLink ( string  $link)

Definition at line 49 of file class.ilWebLinkParameter.php.

References ilWebLinkBaseParameter\getName(), ilWebLinkBaseParameter\getValue(), and ILIAS\Repository\user().

49  : string
50  {
51  if (!strpos($link, '?')) {
52  $link .= "?";
53  } else {
54  $link .= "&";
55  }
56  $link .= ($this->getName() . "=");
57  switch ($this->getValue()) {
58  case self::VALUES['login']:
59  $link .= (urlencode(
60  $this->user->getLogin()
61  ));
62  break;
63 
64  case self::VALUES['session_id']:
65  $link .= (session_id());
66  break;
67 
68  case self::VALUES['user_id']:
69  $link .= ($this->user->getId());
70  break;
71 
72  case self::VALUES['matriculation']:
73  $link .= ($this->user->getMatriculation());
74  break;
75 
76  default:
78  'Invalid parameter value'
79  );
80  }
81 
82  return $link;
83  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getInfo()

ilWebLinkParameter::getInfo ( )

Definition at line 85 of file class.ilWebLinkParameter.php.

References ilWebLinkBaseParameter\getName(), and ilWebLinkBaseParameter\getValue().

85  : string
86  {
87  $info = $this->getName();
88 
89  switch ($this->getValue()) {
90  case self::VALUES['user_id']:
91  return $info . '=USER_ID';
92 
93  case self::VALUES['session_id']:
94  return $info . '=SESSION_ID';
95 
96  case self::VALUES['login']:
97  return $info . '=LOGIN';
98 
99  case self::VALUES['matriculation']:
100  return $info . '=MATRICULATION';
101 
102  default:
103  throw new ilWebLinkParameterException(
104  'Invalid parameter value'
105  );
106  }
107  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getLinkId()

ilWebLinkParameter::getLinkId ( )

Definition at line 143 of file class.ilWebLinkParameter.php.

References $link_id.

143  : int
144  {
145  return $this->link_id;
146  }

◆ getParamId()

ilWebLinkParameter::getParamId ( )

Definition at line 148 of file class.ilWebLinkParameter.php.

References $param_id.

Referenced by toXML().

148  : int
149  {
150  return $this->param_id;
151  }
+ Here is the caller graph for this function:

◆ getWebrId()

ilWebLinkParameter::getWebrId ( )

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

References $webr_id.

138  : int
139  {
140  return $this->webr_id;
141  }

◆ toXML()

ilWebLinkParameter::toXML ( ilXmlWriter  $writer)

Definition at line 109 of file class.ilWebLinkParameter.php.

References ilWebLinkBaseParameter\$value, ilWebLinkBaseParameter\getName(), getParamId(), ilWebLinkBaseParameter\getValue(), and ilXmlWriter\xmlElement().

109  : void
110  {
111  switch ($this->getValue()) {
112  case self::VALUES['user_id']:
113  $value = 'userId';
114  break;
115 
116  case self::VALUES['login']:
117  $value = 'userName';
118  break;
119 
120  case self::VALUES['matriculation']:
121  $value = 'matriculation';
122  break;
123 
124  default:
125  return;
126  }
127 
128  $writer->xmlElement(
129  'DynamicParameter',
130  [
131  'id' => $this->getParamId(),
132  'name' => $this->getName(),
133  'type' => $value
134  ]
135  );
136  }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

Field Documentation

◆ $link_id

int ilWebLinkParameter::$link_id
private

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

Referenced by __construct(), and getLinkId().

◆ $param_id

int ilWebLinkParameter::$param_id
private

Definition at line 29 of file class.ilWebLinkParameter.php.

Referenced by __construct(), and getParamId().

◆ $user

ilObjUser ilWebLinkParameter::$user
private

Definition at line 31 of file class.ilWebLinkParameter.php.

Referenced by __construct().

◆ $webr_id

int ilWebLinkParameter::$webr_id
private

Definition at line 27 of file class.ilWebLinkParameter.php.

Referenced by __construct(), and getWebrId().


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