ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
- 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...
 

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

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

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

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
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTExternalLink::getCheckSum ( )

get checksum

Returns
string

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

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

Referenced by equals().

154  {
155  if (!$this->isNull()) {
156  return md5($this->getUrl() . $this->getTitle());
157  }
158  }
+ 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.

References getTitle(), and getUrl().

Referenced by isNull(), and isValid().

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  }
+ 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 getCheckSum(), and getLength().

54  {
55  return $this->title;
56  }
+ 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 getCheckSum(), and getLength().

75  {
76  return $this->value;
77  }
+ Here is the caller graph for this function:

◆ isLarger()

ilADTExternalLink::isLarger ( ilADT  $a_adt)

Is larger.

Parameters
ilADT$a_adt

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

97  {
98  }

◆ isNull()

ilADTExternalLink::isNull ( )

is null

Returns
bool

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

References getLength().

Referenced by getCheckSum(), and isValid().

113  {
114  return (bool) !$this->getLength();
115  }
+ 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

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

105  {
106  }

◆ isValid()

ilADTExternalLink::isValid ( )

is valid

Returns
boolean

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

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

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  }
$valid
addValidationError($a_error_code)
Add validation error code.
+ Here is the call graph for this function:

◆ isValidDefinition()

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

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

◆ reset()

ilADTExternalLink::reset ( )

Reset.

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  }

◆ 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  }

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: