ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilADTInternalLink.php
Go to the documentation of this file.
1<?php
2
4{
8 protected $value;
9
14 protected function isValidDefinition(ilADTDefinition $a_def)
15 {
16 return $a_def instanceof ilADTInternalLinkDefinition;
17 }
18
22 public function reset()
23 {
24 parent::reset();
25 $this->value = null;
26 }
27
32 public function setTargetRefId($a_value)
33 {
34 $this->value = $a_value;
35 }
36
40 public function getTargetRefId()
41 {
42 return $this->value;
43 }
44
50 public function equals(ilADT $a_adt)
51 {
52 if ($this->getDefinition()->isComparableTo($a_adt)) {
53 return strcmp($this->getCheckSum(), $a_adt->getCheckSum()) === 0;
54 }
55 }
56
61 public function isLarger(ilADT $a_adt)
62 {
63 }
64
69 public function isSmaller(ilADT $a_adt)
70 {
71 }
72
77 public function isNull()
78 {
79 return (bool) !$this->getTargetRefId();
80 }
81
82
87 public function isValid()
88 {
89 $valid = parent::isValid();
90 if (!$this->isNull()) {
91 $tree = $GLOBALS['DIC']->repositoryTree();
92 if (
93 !$tree->isInTree($this->getTargetRefId()) ||
94 $tree->isDeleted($this->getTargetRefId())
95 ) {
96 $this->valid = false;
97 $this->addValidationError(self::ADT_VALIDATION_ERROR_INVALID_NODE);
98 }
99 }
100 return $valid;
101 }
102
107 public function getCheckSum()
108 {
109 if (!$this->isNull()) {
110 return md5($this->getTargetRefId());
111 }
112 }
113
117 public function exportStdClass()
118 {
119 if (!$this->isNull()) {
120 $obj = new stdClass();
121 $obj->target_ref_id = $this->getTargetRefId();
122
123 return $obj;
124 }
125 }
126
127
131 public function importStdClass($a_std)
132 {
133 if (is_object($a_std)) {
134 $this->setTargetRefId($a_std->target_ref_id);
135 }
136 }
137}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
ADT definition base class.
ADT base class.
Definition: class.ilADT.php:12
addValidationError($a_error_code)
Add validation error code.
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
Definition: class.ilADT.php:97
$valid