ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilADTExternalLink Class Reference
+ 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)
 Check if given ADT is larger than self. More...
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isNull ()
 is null More...
 
 getLength ()
 Get length. More...
 
 isValid ()
 
 getCheckSum ()
 get checksum More...
 
 exportStdClass ()
 @inheritDoc More...
 
 importStdClass (?stdClass $a_std)
 @inheritDoc More...
 
- 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

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

Member Function Documentation

◆ equals()

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

Reimplemented from ilADT.

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

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.

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

+ Here is the call graph for this function:

◆ exportStdClass()

ilADTExternalLink::exportStdClass ( )

@inheritDoc

Reimplemented from ilADT.

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

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 }

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

+ Here is the call graph for this function:

◆ getCheckSum()

ilADTExternalLink::getCheckSum ( )

get checksum

Returns
string

Reimplemented from ilADT.

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

149 : ?string
150 {
151 if (!$this->isNull()) {
152 return md5($this->getUrl() . $this->getTitle());
153 }
154 return null;
155 }

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

Referenced by equals().

+ 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.

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 }

References getTitle(), and getUrl().

Referenced by isNull(), and isValid().

+ 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.

63 : ?string
64 {
65 return $this->title;
66 }

References $title.

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

+ 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.

84 : ?string
85 {
86 return $this->value;
87 }

References $value.

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

+ Here is the caller graph for this function:

◆ importStdClass()

ilADTExternalLink::importStdClass ( ?stdClass  $a_std)

@inheritDoc

Reimplemented from ilADT.

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

174 : void
175 {
176 if (is_object($a_std)) {
177 $this->setTitle($a_std->title);
178 $this->setUrl($a_std->url);
179 }
180 }

References setTitle(), and setUrl().

+ Here is the call graph for this function:

◆ isLarger()

ilADTExternalLink::isLarger ( ilADT  $a_adt)

Check if given ADT is larger than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

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

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

◆ isNull()

ilADTExternalLink::isNull ( )

is null

Returns
bool

Reimplemented from ilADT.

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

115 : bool
116 {
117 return !$this->getLength();
118 }

References getLength().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTExternalLink::isSmaller ( ilADT  $a_adt)

Check if given ADT is smaller than self.

Parameters
ilADT$a_adt
Returns
bool | null

Reimplemented from ilADT.

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

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

◆ isValid()

ilADTExternalLink::isValid ( )

Reimplemented from ilADT.

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

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

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

+ Here is the call graph for this function:

◆ isValidDefinition()

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

Reimplemented from ilADT.

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

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

◆ reset()

ilADTExternalLink::reset ( )

Reset.

Reimplemented from ilADT.

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.

51 : void
52 {
53 if ($a_title !== null) {
54 $a_title = trim($a_title);
55 }
56 $this->title = $a_title;
57 }

Referenced by importStdClass().

+ 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.

72 : void
73 {
74 if ($a_value !== null) {
75 $a_value = trim($a_value);
76 }
77 $this->value = $a_value;
78 }

Referenced by importStdClass().

+ 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: