ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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.

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

Referenced by save(), and update().

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

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

Referenced by update().

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  }
setTypicalAgeRangeMaximum(string $a_max)
setTypicalAgeRangeMinimum(string $a_min)
+ 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.

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

Referenced by ilMDEducational\getTypicalAgeRangeIds().

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  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMDTypicalAgeRange::delete ( )

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

References $res, and ilMDBase\getMetaId().

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  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ getTypicalAgeRange()

ilMDTypicalAgeRange::getTypicalAgeRange ( )

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

References $typical_age_range.

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

39  : string
40  {
42  }
+ 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.

Referenced by __getFields(), and toXML().

54  : string
55  {
56  return is_object($this->typical_age_range_language) ? $this->typical_age_range_language->getLanguageCode() : '';
57  }
+ Here is the caller graph for this function:

◆ getTypicalAgeRangeMaximum()

ilMDTypicalAgeRange::getTypicalAgeRangeMaximum ( )

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

References $typical_age_range_maximum.

Referenced by __getFields().

74  : string
75  {
77  }
+ Here is the caller graph for this function:

◆ getTypicalAgeRangeMinimum()

ilMDTypicalAgeRange::getTypicalAgeRangeMinimum ( )

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

References $typical_age_range_minimum.

Referenced by __getFields().

64  : string
65  {
67  }
+ Here is the caller graph for this function:

◆ read()

ilMDTypicalAgeRange::read ( )

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

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

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  }
$res
Definition: ltiservices.php:69
setTypicalAgeRangeMaximum(string $a_max)
setRBACId(int $a_id)
setTypicalAgeRange(string $a_typical_age_range)
setTypicalAgeRangeLanguage(ilMDLanguageItem $lng_obj)
setObjId(int $a_id)
setParentId(int $a_id)
setParentType(string $a_parent_type)
setObjType(string $a_type)
setTypicalAgeRangeMinimum(string $a_min)
+ Here is the call graph for this function:

◆ save()

ilMDTypicalAgeRange::save ( )

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

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

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

Referenced by read().

34  : void
35  {
36  $this->typical_age_range = $a_typical_age_range;
37  }
+ Here is the caller graph for this function:

◆ setTypicalAgeRangeLanguage()

ilMDTypicalAgeRange::setTypicalAgeRangeLanguage ( ilMDLanguageItem  $lng_obj)

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

Referenced by read().

44  : void
45  {
46  $this->typical_age_range_language = $lng_obj;
47  }
+ Here is the caller graph for this function:

◆ setTypicalAgeRangeMaximum()

ilMDTypicalAgeRange::setTypicalAgeRangeMaximum ( string  $a_max)

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

Referenced by __parseTypicalAgeRange(), and read().

69  : void
70  {
71  $this->typical_age_range_maximum = $a_max;
72  }
+ Here is the caller graph for this function:

◆ setTypicalAgeRangeMinimum()

ilMDTypicalAgeRange::setTypicalAgeRangeMinimum ( string  $a_min)

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

Referenced by __parseTypicalAgeRange(), and read().

59  : void
60  {
61  $this->typical_age_range_minimum = $a_min;
62  }
+ Here is the caller graph for this function:

◆ toXML()

ilMDTypicalAgeRange::toXML ( ilXmlWriter  $writer)

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

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

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

◆ update()

ilMDTypicalAgeRange::update ( )

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

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

91  : bool
92  {
93  $this->__parseTypicalAgeRange();
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  }
+ 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: