ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilADTExternalLink 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 ilADTExternalLink:
+ Collaboration diagram for ilADTExternalLink:

Public Member Functions

 reset ()
 Reset. More...
 
 setTitle (?string $a_title=null)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setUrl (?string $a_value=null)
 Set url. More...
 
 getUrl ()
 Get url. More...
 
 equals (ilADT $a_adt)
 
 isLarger (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 
 isNull ()
 is null More...
 
 getLength ()
 Get length. More...
 
 isValid ()
 
 getCheckSum ()
 get checksum More...
 
 exportStdClass ()
 
 importStdClass (?stdClass $a_std)
 
- Public Member Functions inherited from ilADT
 __construct (ilADTDefinition $a_def)
 
 getType ()
 Get type (from class/instance) More...
 
 reset ()
 Init property defaults. More...
 
 getCopyOfDefinition ()
 Get copy of definition. More...
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isLargerOrEqual (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isSmallerOrEqual (ilADT $a_adt)
 Check if given ADT is smaller or equal than self. More...
 
 isInbetween (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (exclusive) More...
 
 isInbetweenOrEqual (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (inclusive) More...
 
 isNull ()
 Is currently null. More...
 
 isValid ()
 
 getValidationErrors ()
 Get all validation error codes. More...
 
 translateErrorCode (string $a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass (?stdClass $a_std)
 Import value from stdClass. More...
 

Data Fields

const MAX_LENGTH = 2000
 
- Data Fields inherited from ilADT
const ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED = "adt1"
 
const ADT_VALIDATION_ERROR_MAX_LENGTH = "adt2"
 
const ADT_VALIDATION_ERROR_MAX_SIZE = "adt3"
 
const ADT_VALIDATION_ERROR_MIN = "adt4"
 
const ADT_VALIDATION_ERROR_MAX = "adt5"
 
const ADT_VALIDATION_DATE = "adt6"
 
const ADT_VALIDATION_ERROR_INVALID_NODE = 'adt7'
 

Protected Member Functions

 isValidDefinition (ilADTDefinition $a_def)
 
- Protected Member Functions inherited from ilADT
 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 getDefinition ()
 Get definition. More...
 
 addValidationError (string $a_error_code)
 

Protected Attributes

string $value
 
string $title
 
- Protected Attributes inherited from ilADT
ilADTDefinition $definition
 
ilLanguage $lng
 
array $validation_errors = []
 

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

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

Member Function Documentation

◆ equals()

ilADTExternalLink::equals ( ilADT  $a_adt)
Parameters
ilADT$a_adt
Returns
bool

Definition at line 93 of file class.ilADTExternalLink.php.

References getCheckSum(), ilADT\getCheckSum(), and ilADT\getDefinition().

93  : ?bool
94  {
95  if ($this->getDefinition()->isComparableTo($a_adt)) {
96  return strcmp($this->getCheckSum() ?? '', $a_adt->getCheckSum() ?? '') === 0;
97  }
98  return null;
99  }
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:

◆ exportStdClass()

ilADTExternalLink::exportStdClass ( )

Definition at line 160 of file class.ilADTExternalLink.php.

References getTitle(), getUrl(), and isNull().

160  : ?stdClass
161  {
162  if (!$this->isNull()) {
163  $obj = new stdClass();
164  $obj->url = $this->getUrl();
165  $obj->title = $this->getTitle();
166  return $obj;
167  }
168  return null;
169  }
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTExternalLink::getCheckSum ( )

get checksum

Returns
string

Definition at line 149 of file class.ilADTExternalLink.php.

References getTitle(), getUrl(), and isNull().

Referenced by equals().

149  : ?string
150  {
151  if (!$this->isNull()) {
152  return md5($this->getUrl() . $this->getTitle());
153  }
154  return null;
155  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLength()

ilADTExternalLink::getLength ( )

Get length.

Returns
int

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

References getTitle(), and getUrl().

Referenced by isNull(), and isValid().

124  : int
125  {
126  if (function_exists("mb_strlen")) {
127  return mb_strlen($this->getUrl() . $this->getTitle(), "UTF-8");
128  } else {
129  return strlen($this->getUrl() . $this->getTitle());
130  }
131  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilADTExternalLink::getTitle ( )

Get title.

Returns
string|null

Definition at line 63 of file class.ilADTExternalLink.php.

References $title.

Referenced by exportStdClass(), getCheckSum(), and getLength().

63  : ?string
64  {
65  return $this->title;
66  }
+ Here is the caller graph for this function:

◆ getUrl()

ilADTExternalLink::getUrl ( )

Get url.

Returns
string|null

Definition at line 84 of file class.ilADTExternalLink.php.

References $value.

Referenced by exportStdClass(), getCheckSum(), and getLength().

84  : ?string
85  {
86  return $this->value;
87  }
+ Here is the caller graph for this function:

◆ importStdClass()

ilADTExternalLink::importStdClass ( ?stdClass  $a_std)

Definition at line 174 of file class.ilADTExternalLink.php.

References setTitle(), and setUrl().

174  : void
175  {
176  if (is_object($a_std)) {
177  $this->setTitle($a_std->title);
178  $this->setUrl($a_std->url);
179  }
180  }
+ Here is the call graph for this function:

◆ isLarger()

ilADTExternalLink::isLarger ( ilADT  $a_adt)

Definition at line 101 of file class.ilADTExternalLink.php.

101  : ?bool
102  {
103  return null;
104  }

◆ isNull()

ilADTExternalLink::isNull ( )

is null

Returns
bool

Definition at line 115 of file class.ilADTExternalLink.php.

References getLength().

Referenced by exportStdClass(), getCheckSum(), and isValid().

115  : bool
116  {
117  return !$this->getLength();
118  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTExternalLink::isSmaller ( ilADT  $a_adt)

Definition at line 106 of file class.ilADTExternalLink.php.

106  : ?bool
107  {
108  return null;
109  }

◆ isValid()

ilADTExternalLink::isValid ( )

Definition at line 133 of file class.ilADTExternalLink.php.

References $valid, ilADT\addValidationError(), getLength(), and isNull().

133  : bool
134  {
135  $valid = parent::isValid();
136  if (!$this->isNull()) {
137  if (self::MAX_LENGTH < $this->getLength()) {
138  $valid = false;
139  $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_LENGTH);
140  }
141  }
142  return $valid;
143  }
addValidationError(string $a_error_code)
$valid
+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTExternalLink::isValidDefinition ( ilADTDefinition  $a_def)
protected
Parameters
ilADTDefinition$a_def
Returns
bool

Definition at line 32 of file class.ilADTExternalLink.php.

32  : bool
33  {
34  return $a_def instanceof ilADTExternalLinkDefinition;
35  }

◆ reset()

ilADTExternalLink::reset ( )

Reset.

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

40  : void
41  {
42  parent::reset();
43  $this->value = null;
44  $this->title = null;
45  }

◆ setTitle()

ilADTExternalLink::setTitle ( ?string  $a_title = null)

Set title.

Parameters
string | null$a_title

Definition at line 51 of file class.ilADTExternalLink.php.

Referenced by importStdClass().

51  : void
52  {
53  if ($a_title !== null) {
54  $a_title = trim($a_title);
55  }
56  $this->title = $a_title;
57  }
+ Here is the caller graph for this function:

◆ setUrl()

ilADTExternalLink::setUrl ( ?string  $a_value = null)

Set url.

Parameters
string | null$a_value

Definition at line 72 of file class.ilADTExternalLink.php.

Referenced by importStdClass().

72  : void
73  {
74  if ($a_value !== null) {
75  $a_value = trim($a_value);
76  }
77  $this->value = $a_value;
78  }
+ Here is the caller graph for this function:

Field Documentation

◆ $title

string ilADTExternalLink::$title
protected

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

Referenced by getTitle().

◆ $value

string ilADTExternalLink::$value
protected

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

Referenced by getUrl().

◆ MAX_LENGTH

const ilADTExternalLink::MAX_LENGTH = 2000

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


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