ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilADTExternalLink Class Reference
+ Inheritance diagram for ilADTExternalLink:
+ Collaboration diagram for ilADTExternalLink:

Public Member Functions

 reset ()
 Reset. More...
 
 setTitle ($a_title=null)
 Set title. More...
 
 getTitle ()
 Getb title. More...
 
 setUrl ($a_value=null)
 Set url. More...
 
 getUrl ()
 Get url. More...
 
 equals (ilADT $a_adt)
 
 isLarger (ilADT $a_adt)
 Is larger. More...
 
 isSmaller (ilADT $a_adt)
 Is smaller. More...
 
 isNull ()
 is null More...
 
 getLength ()
 Get length. More...
 
 isValid ()
 is valid More...
 
 getCheckSum ()
 get checksum More...
 
 exportStdClass ()
 @inheritDoc More...
 
 importStdClass ($a_std)
 @inheritDoc More...
 
- Public Member Functions inherited from ilADT
 __construct (ilADTDefinition $a_def)
 Constructor. More...
 
 getType ()
 Get type (from class/instance) 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)
 Check if given ADT is larger or equal than self. More...
 
 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 ()
 Is currently valid. More...
 
 getValidationErrors ()
 Get all validation error codes. More...
 
 translateErrorCode ($a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass ($a_std)
 Import value from stdClass. More...
 

Data Fields

const MAX_LENGTH = 500
 
- 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
 reset ()
 Init property defaults. More...
 
 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 getDefinition ()
 Get definition. More...
 
 addValidationError ($a_error_code)
 Add validation error code. More...
 

Protected Attributes

 $value
 
 $title
 
- Protected Attributes inherited from ilADT
 $definition
 
 $validation_errors = []
 

Detailed Description

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

Member Function Documentation

◆ equals()

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

Reimplemented from ilADT.

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

86 {
87 if ($this->getDefinition()->isComparableTo($a_adt)) {
88 return strcmp($this->getCheckSum(), $a_adt->getCheckSum()) === 0;
89 }
90 }
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
Definition: class.ilADT.php:97

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 164 of file class.ilADTExternalLink.php.

165 {
166 if (!$this->isNull()) {
167 $obj = new stdClass();
168 $obj->url = $this->getUrl();
169 $obj->title = $this->getTitle();
170
171 return $obj;
172 }
173 }

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 153 of file class.ilADTExternalLink.php.

154 {
155 if (!$this->isNull()) {
156 return md5($this->getUrl() . $this->getTitle());
157 }
158 }

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 121 of file class.ilADTExternalLink.php.

122 {
123 if (function_exists("mb_strlen")) {
124 return mb_strlen($this->getUrl() . $this->getTitle(), "UTF-8");
125 } else {
126 return strlen($this->getUrl() . $this->getTitle());
127 }
128 }

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 ( )

Getb title.

Returns
string

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

References $title.

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

+ Here is the caller graph for this function:

◆ getUrl()

ilADTExternalLink::getUrl ( )

Get url.

Returns
type

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

References $value.

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

+ Here is the caller graph for this function:

◆ importStdClass()

ilADTExternalLink::importStdClass (   $a_std)

@inheritDoc

Reimplemented from ilADT.

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

180 {
181 if (is_object($a_std)) {
182 $this->setTitle($a_std->title);
183 $this->setUrl($a_std->url);
184 }
185 }

References setTitle(), and setUrl().

+ Here is the call graph for this function:

◆ isLarger()

ilADTExternalLink::isLarger ( ilADT  $a_adt)

Is larger.

Parameters
ilADT$a_adt

Reimplemented from ilADT.

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

97 {
98 }

◆ isNull()

ilADTExternalLink::isNull ( )

is null

Returns
bool

Reimplemented from ilADT.

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

113 {
114 return (bool) !$this->getLength();
115 }

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)

Is smaller.

Parameters
ilADT$a_adt

Reimplemented from ilADT.

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

105 {
106 }

◆ isValid()

ilADTExternalLink::isValid ( )

is valid

Returns
boolean

Reimplemented from ilADT.

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

136 {
137 $valid = parent::isValid();
138
139 if (!$this->isNull()) {
140 if (self::MAX_LENGTH < $this->getLength()) {
141 $valid = false;
142 $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_LENGTH);
143 }
144 }
145
146 return $valid;
147 }
addValidationError($a_error_code)
Add validation 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 22 of file class.ilADTExternalLink.php.

◆ reset()

ilADTExternalLink::reset ( )

Reset.

Reimplemented from ilADT.

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

31 {
32 parent::reset();
33 $this->value = null;
34 $this->title = null;
35 }

◆ setTitle()

ilADTExternalLink::setTitle (   $a_title = null)

Set title.

Parameters
string$a_title

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

42 {
43 if ($a_title !== null) {
44 $a_title = trim($a_title);
45 }
46 $this->title = $a_title;
47 }

Referenced by importStdClass().

+ Here is the caller graph for this function:

◆ setUrl()

ilADTExternalLink::setUrl (   $a_value = null)

Set url.

Parameters
string$a_value

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

63 {
64 if ($a_value !== null) {
65 $a_value = trim($a_value);
66 }
67 $this->value = $a_value;
68 }

Referenced by importStdClass().

+ Here is the caller graph for this function:

Field Documentation

◆ $title

ilADTExternalLink::$title
protected

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

Referenced by getTitle().

◆ $value

ilADTExternalLink::$value
protected

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

Referenced by getUrl().

◆ MAX_LENGTH

const ilADTExternalLink::MAX_LENGTH = 500

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


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