ILIAS  release_8 Revision v8.24
ilMDTypicalAgeRange Class Reference
+ Inheritance diagram for ilMDTypicalAgeRange:
+ Collaboration diagram for ilMDTypicalAgeRange:

Public Member Functions

 setTypicalAgeRange (string $a_typical_age_range)
 
 getTypicalAgeRange ()
 
 setTypicalAgeRangeLanguage (ilMDLanguageItem $lng_obj)
 
 getTypicalAgeRangeLanguage ()
 
 getTypicalAgeRangeLanguageCode ()
 
 setTypicalAgeRangeMinimum (string $a_min)
 
 getTypicalAgeRangeMinimum ()
 
 setTypicalAgeRangeMaximum (string $a_max)
 
 getTypicalAgeRangeMaximum ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (ilXmlWriter $writer)
 
 __parseTypicalAgeRange ()
 
- Public Member Functions inherited from ilMDBase
 __construct (int $a_rbac_id=0, int $a_obj_id=0, string $a_type='')
 constructor More...
 
 read ()
 
 setRBACId (int $a_id)
 
 getRBACId ()
 
 setObjId (int $a_id)
 
 getObjId ()
 
 setObjType (string $a_type)
 
 getObjType ()
 
 setMetaId (int $a_meta_id, bool $a_read_data=true)
 
 getMetaId ()
 
 setParentType (string $a_parent_type)
 
 getParentType ()
 
 setParentId (int $a_id)
 
 getParentId ()
 
 setExportMode (bool $a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (ilXmlWriter $writer)
 

Static Public Member Functions

static _getIds (int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
 

Private Attributes

string $typical_age_range = ''
 
ilMDLanguageItem $typical_age_range_language = null
 
string $typical_age_range_minimum = ''
 
string $typical_age_range_maximum = ''
 

Additional Inherited Members

- Protected Attributes inherited from ilMDBase
ilLogger $log
 
ilDBInterface $db
 

Detailed Description

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

Member Function Documentation

◆ __getFields()

ilMDTypicalAgeRange::__getFields ( )
Returns
array<string, array<string, mixed>>

Definition at line 116 of file class.ilMDTypicalAgeRange.php.

116 : array
117 {
118 return array(
119 'rbac_id' => array('integer', $this->getRBACId()),
120 'obj_id' => array('integer', $this->getObjId()),
121 'obj_type' => array('text', $this->getObjType()),
122 'parent_type' => array('text', $this->getParentType()),
123 'parent_id' => array('integer', $this->getParentId()),
124 'typical_age_range' => array('text', $this->getTypicalAgeRange()),
125 'tar_language' => array('text', $this->getTypicalAgeRangeLanguageCode()),
126 'tar_min' => array('text', $this->getTypicalAgeRangeMinimum()),
127 'tar_max' => array('text', $this->getTypicalAgeRangeMaximum())
128 );
129 }

References ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), ilMDBase\getRBACId(), getTypicalAgeRange(), getTypicalAgeRangeLanguageCode(), getTypicalAgeRangeMaximum(), and getTypicalAgeRangeMinimum().

Referenced by save(), and update().

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

◆ __parseTypicalAgeRange()

ilMDTypicalAgeRange::__parseTypicalAgeRange ( )

Definition at line 191 of file class.ilMDTypicalAgeRange.php.

191 : bool
192 {
193 if (preg_match("/\s*(\d*)\s*(-?)\s*(\d*)/", $this->getTypicalAgeRange(), $matches)) {
194 if (!$matches[2] and !$matches[3]) {
195 $min = $max = $matches[1];
196 } elseif ($matches[2] and !$matches[3]) {
197 $min = $matches[1];
198 $max = 99;
199 } else {
200 $min = $matches[1];
201 $max = $matches[3];
202 }
203 $this->setTypicalAgeRangeMaximum((string) $max);
204 $this->setTypicalAgeRangeMinimum((string) $min);
205
206 return true;
207 }
208
209 if (!$this->getTypicalAgeRange()) {
210 $this->setTypicalAgeRangeMinimum('-1');
211 $this->setTypicalAgeRangeMaximum('-1');
212 }
213
214 return true;
215 }
setTypicalAgeRangeMinimum(string $a_min)
setTypicalAgeRangeMaximum(string $a_max)

References getTypicalAgeRange(), setTypicalAgeRangeMaximum(), and setTypicalAgeRangeMinimum().

Referenced by update().

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

◆ _getIds()

static ilMDTypicalAgeRange::_getIds ( int  $a_rbac_id,
int  $a_obj_id,
int  $a_parent_id,
string  $a_parent_type 
)
static
Returns
int[]

Definition at line 169 of file class.ilMDTypicalAgeRange.php.

169 : array
170 {
171 global $DIC;
172
173 $ilDB = $DIC->database();
174
175 $query = "SELECT meta_tar_id FROM il_meta_tar " .
176 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
177 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
178 "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
179 "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
180
181 $res = $ilDB->query($query);
182 $ids = [];
183 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
184 $ids[] = (int) $row->meta_tar_id;
185 }
186
187 return $ids;
188 }
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$query

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilMDEducational\getTypicalAgeRangeIds().

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

◆ delete()

ilMDTypicalAgeRange::delete ( )

Reimplemented from ilMDBase.

Definition at line 102 of file class.ilMDTypicalAgeRange.php.

102 : bool
103 {
104 if ($this->getMetaId()) {
105 $query = "DELETE FROM il_meta_tar " .
106 "WHERE meta_tar_id = " . $this->db->quote($this->getMetaId(), 'integer');
107 $res = $this->db->manipulate($query);
108 return true;
109 }
110 return false;
111 }

References $query, $res, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ getTypicalAgeRange()

ilMDTypicalAgeRange::getTypicalAgeRange ( )

Definition at line 39 of file class.ilMDTypicalAgeRange.php.

39 : string
40 {
42 }

References $typical_age_range.

Referenced by __getFields(), __parseTypicalAgeRange(), and toXML().

+ Here is the caller graph for this function:

◆ getTypicalAgeRangeLanguage()

ilMDTypicalAgeRange::getTypicalAgeRangeLanguage ( )

Definition at line 49 of file class.ilMDTypicalAgeRange.php.

50 {
51 return is_object($this->typical_age_range_language) ? $this->typical_age_range_language : null;
52 }

◆ getTypicalAgeRangeLanguageCode()

ilMDTypicalAgeRange::getTypicalAgeRangeLanguageCode ( )

Definition at line 54 of file class.ilMDTypicalAgeRange.php.

54 : string
55 {
56 return is_object($this->typical_age_range_language) ? $this->typical_age_range_language->getLanguageCode() : '';
57 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getTypicalAgeRangeMaximum()

ilMDTypicalAgeRange::getTypicalAgeRangeMaximum ( )

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

74 : string
75 {
77 }

References $typical_age_range_maximum.

Referenced by __getFields().

+ Here is the caller graph for this function:

◆ getTypicalAgeRangeMinimum()

ilMDTypicalAgeRange::getTypicalAgeRangeMinimum ( )

Definition at line 64 of file class.ilMDTypicalAgeRange.php.

64 : string
65 {
67 }

References $typical_age_range_minimum.

Referenced by __getFields().

+ Here is the caller graph for this function:

◆ read()

ilMDTypicalAgeRange::read ( )

Reimplemented from ilMDBase.

Definition at line 131 of file class.ilMDTypicalAgeRange.php.

131 : bool
132 {
133 if ($this->getMetaId()) {
134 $query = "SELECT * FROM il_meta_tar " .
135 "WHERE meta_tar_id = " . $this->db->quote($this->getMetaId(), 'integer');
136
137 $res = $this->db->query($query);
138 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
139 $this->setRBACId((int) $row->rbac_id);
140 $this->setObjId((int) $row->obj_id);
141 $this->setObjType($row->obj_type);
142 $this->setParentId((int) $row->parent_id);
143 $this->setParentType((string) $row->parent_type);
144 $this->setTypicalAgeRange((string) $row->typical_age_range);
145 $this->setTypicalAgeRangeLanguage(new ilMDLanguageItem($row->tar_language ?? ''));
146 $this->setTypicalAgeRangeMinimum((string) $row->tar_min);
147 $this->setTypicalAgeRangeMaximum((string) $row->tar_max);
148 }
149 }
150 return true;
151 }
setObjType(string $a_type)
setParentType(string $a_parent_type)
setObjId(int $a_id)
setRBACId(int $a_id)
setParentId(int $a_id)
setTypicalAgeRangeLanguage(ilMDLanguageItem $lng_obj)
setTypicalAgeRange(string $a_typical_age_range)

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), ilMDBase\setRBACId(), setTypicalAgeRange(), setTypicalAgeRangeLanguage(), setTypicalAgeRangeMaximum(), and setTypicalAgeRangeMinimum().

+ Here is the call graph for this function:

◆ save()

ilMDTypicalAgeRange::save ( )

Reimplemented from ilMDBase.

Definition at line 79 of file class.ilMDTypicalAgeRange.php.

79 : int
80 {
81 $fields = $this->__getFields();
82 $fields['meta_tar_id'] = array('integer', $next_id = $this->db->nextId('il_meta_tar'));
83
84 if ($this->db->insert('il_meta_tar', $fields)) {
85 $this->setMetaId($next_id);
86 return $this->getMetaId();
87 }
88 return 0;
89 }
setMetaId(int $a_meta_id, bool $a_read_data=true)

References __getFields(), ilMDBase\getMetaId(), and ilMDBase\setMetaId().

+ Here is the call graph for this function:

◆ setTypicalAgeRange()

ilMDTypicalAgeRange::setTypicalAgeRange ( string  $a_typical_age_range)

Definition at line 34 of file class.ilMDTypicalAgeRange.php.

34 : void
35 {
36 $this->typical_age_range = $a_typical_age_range;
37 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTypicalAgeRangeLanguage()

ilMDTypicalAgeRange::setTypicalAgeRangeLanguage ( ilMDLanguageItem  $lng_obj)

Definition at line 44 of file class.ilMDTypicalAgeRange.php.

44 : void
45 {
46 $this->typical_age_range_language = $lng_obj;
47 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTypicalAgeRangeMaximum()

ilMDTypicalAgeRange::setTypicalAgeRangeMaximum ( string  $a_max)

Definition at line 69 of file class.ilMDTypicalAgeRange.php.

69 : void
70 {
71 $this->typical_age_range_maximum = $a_max;
72 }

Referenced by __parseTypicalAgeRange(), and read().

+ Here is the caller graph for this function:

◆ setTypicalAgeRangeMinimum()

ilMDTypicalAgeRange::setTypicalAgeRangeMinimum ( string  $a_min)

Definition at line 59 of file class.ilMDTypicalAgeRange.php.

59 : void
60 {
61 $this->typical_age_range_minimum = $a_min;
62 }

Referenced by __parseTypicalAgeRange(), and read().

+ Here is the caller graph for this function:

◆ toXML()

ilMDTypicalAgeRange::toXML ( ilXmlWriter  $writer)

Reimplemented from ilMDBase.

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

153 : void
154 {
155 $writer->xmlElement(
156 'TypicalAgeRange',
157 array(
158 'Language' => $this->getTypicalAgeRangeLanguageCode() ?: 'en'
159 ),
160 $this->getTypicalAgeRange()
161 );
162 }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)

References getTypicalAgeRange(), getTypicalAgeRangeLanguageCode(), and ilXmlWriter\xmlElement().

+ Here is the call graph for this function:

◆ update()

ilMDTypicalAgeRange::update ( )

Reimplemented from ilMDBase.

Definition at line 91 of file class.ilMDTypicalAgeRange.php.

91 : bool
92 {
94
95 return $this->getMetaId() && $this->db->update(
96 'il_meta_tar',
97 $this->__getFields(),
98 array("meta_tar_id" => array('integer', $this->getMetaId()))
99 );
100 }

References __getFields(), __parseTypicalAgeRange(), and ilMDBase\getMetaId().

+ Here is the call graph for this function:

Field Documentation

◆ $typical_age_range

string ilMDTypicalAgeRange::$typical_age_range = ''
private

Definition at line 28 of file class.ilMDTypicalAgeRange.php.

Referenced by getTypicalAgeRange().

◆ $typical_age_range_language

ilMDLanguageItem ilMDTypicalAgeRange::$typical_age_range_language = null
private

Definition at line 29 of file class.ilMDTypicalAgeRange.php.

◆ $typical_age_range_maximum

string ilMDTypicalAgeRange::$typical_age_range_maximum = ''
private

Definition at line 31 of file class.ilMDTypicalAgeRange.php.

Referenced by getTypicalAgeRangeMaximum().

◆ $typical_age_range_minimum

string ilMDTypicalAgeRange::$typical_age_range_minimum = ''
private

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

Referenced by getTypicalAgeRangeMinimum().


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