ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMDTypicalAgeRange Class Reference
+ Inheritance diagram for ilMDTypicalAgeRange:
+ Collaboration diagram for ilMDTypicalAgeRange:

Public Member Functions

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

Static Public Member Functions

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

Additional Inherited Members

- Data Fields inherited from ilMDBase
 $rbac_id
 
 $obj_id
 
 $obj_type
 
 $export_mode = false
 
- Protected Attributes inherited from ilMDBase
 $log
 

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDTypicalAgeRange::__getFields ( )

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

References array, ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), ilMDBase\getRBACId(), getTypicalAgeRange(), getTypicalAgeRangeLanguageCode(), and ilUtil\prepareDBString().

107  {
108  return array('rbac_id' => $this->getRBACId(),
109  'obj_id' => $this->getObjId(),
110  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
111  'parent_type' => $this->getParentType(),
112  'parent_id' => $this->getParentId(),
113  'typical_age_range' => ilUtil::prepareDBString($this->getTypicalAgeRange()),
114  'typical_age_range_language' => ilUtil::prepareDBString($this->getTypicalAgeRangeLanguageCode()));
115  }
Create styles array
The data for the language used.
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ Here is the call graph for this function:

◆ __getFields() [2/2]

ilMDTypicalAgeRange::__getFields ( )

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

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

Referenced by save().

123  {
124  return array('rbac_id' => array('integer',$this->getRBACId()),
125  'obj_id' => array('integer',$this->getObjId()),
126  'obj_type' => array('text',$this->getObjType()),
127  'parent_type' => array('text',$this->getParentType()),
128  'parent_id' => array('integer',$this->getParentId()),
129  'typical_age_range' => array('text',$this->getTypicalAgeRange()),
130  'tar_language' => array('text',$this->getTypicalAgeRangeLanguageCode()),
131  'tar_min' => array('text',$this->getTypicalAgeRangeMinimum()),
132  'tar_max' => array('text',$this->getTypicalAgeRangeMaximum()));
133  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __parseTypicalAgeRange()

ilMDTypicalAgeRange::__parseTypicalAgeRange ( )

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

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

Referenced by update().

198  {
199  if (preg_match("/\s*(\d*)\s*(-?)\s*(\d*)/", $this->getTypicalAgeRange(), $matches)) {
200  if (!$matches[2] and !$matches[3]) {
201  $min = $max = $matches[1];
202  } elseif ($matches[2] and !$matches[3]) {
203  $min = $matches[1];
204  $max = 99;
205  } else {
206  $min = $matches[1];
207  $max = $matches[3];
208  }
209  $this->setTypicalAgeRangeMaximum($max);
210  $this->setTypicalAgeRangeMinimum($min);
211 
212  return true;
213  }
214 
215  if (!$this->getTypicalAgeRange()) {
216  $this->setTypicalAgeRangeMinimum(-1);
217  $this->setTypicalAgeRangeMaximum(-1);
218  }
219  return true;
220  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIds() [1/2]

ilMDTypicalAgeRange::_getIds (   $a_rbac_id,
  $a_obj_id,
  $a_parent_id,
  $a_parent_type 
)

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

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

154  {
155  global $ilDB;
156 
157  $query = "SELECT meta_typical_age_range_id FROM il_meta_typical_age_range " .
158  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
159  "AND obj_id = " . $ilDB->quote($a_obj_id) . " " .
160  "AND parent_id = " . $ilDB->quote($a_parent_id) . " " .
161  "AND parent_type = " . $ilDB->quote($a_parent_type) . "";
162 
163  $res = $ilDB->query($query);
164  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
165  $ids[] = $row->meta_typical_age_range_id;
166  }
167  return $ids ? $ids : array();
168  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB

◆ _getIds() [2/2]

static ilMDTypicalAgeRange::_getIds (   $a_rbac_id,
  $a_obj_id,
  $a_parent_id,
  $a_parent_type 
)
static

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

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMDEducational\getTypicalAgeRangeIds().

180  {
181  global $ilDB;
182 
183  $query = "SELECT meta_tar_id FROM il_meta_tar " .
184  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
185  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
186  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
187  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
188 
189  $res = $ilDB->query($query);
190  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
191  $ids[] = $row->meta_tar_id;
192  }
193  return $ids ? $ids : array();
194  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDTypicalAgeRange::delete ( )

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

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

91  {
92  global $ilDB;
93 
94  if ($this->getMetaId()) {
95  $query = "DELETE FROM il_meta_typical_age_range " .
96  "WHERE meta_typical_age_range_id = " . $ilDB->quote($this->getMetaId());
97 
98  $this->db->query($query);
99 
100  return true;
101  }
102  return false;
103  }
$query
global $ilDB
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDTypicalAgeRange::delete ( )

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

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

109  {
110  global $ilDB;
111 
112  if ($this->getMetaId()) {
113  $query = "DELETE FROM il_meta_tar " .
114  "WHERE meta_tar_id = " . $ilDB->quote($this->getMetaId(), 'integer');
115  $res = $ilDB->manipulate($query);
116  return true;
117  }
118  return false;
119  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ getTypicalAgeRange() [1/2]

ilMDTypicalAgeRange::getTypicalAgeRange ( )

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

41  {
42  return $this->typical_age_range;
43  }

◆ getTypicalAgeRange() [2/2]

ilMDTypicalAgeRange::getTypicalAgeRange ( )

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

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

41  {
42  return $this->typical_age_range;
43  }
+ Here is the caller graph for this function:

◆ getTypicalAgeRangeLanguage() [1/2]

& ilMDTypicalAgeRange::getTypicalAgeRangeLanguage ( )

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

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

◆ getTypicalAgeRangeLanguage() [2/2]

& ilMDTypicalAgeRange::getTypicalAgeRangeLanguage ( )

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

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

◆ getTypicalAgeRangeLanguageCode() [1/2]

ilMDTypicalAgeRange::getTypicalAgeRangeLanguageCode ( )

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

Referenced by __getFields(), and toXML().

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

◆ getTypicalAgeRangeLanguageCode() [2/2]

ilMDTypicalAgeRange::getTypicalAgeRangeLanguageCode ( )

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

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

◆ getTypicalAgeRangeMaximum()

ilMDTypicalAgeRange::getTypicalAgeRangeMaximum ( )

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

Referenced by __getFields().

72  {
73  return $this->typical_age_range_maximum;
74  }
+ Here is the caller graph for this function:

◆ getTypicalAgeRangeMinimum()

ilMDTypicalAgeRange::getTypicalAgeRangeMinimum ( )

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

Referenced by __getFields().

64  {
65  return $this->typical_age_range_minimum;
66  }
+ Here is the caller graph for this function:

◆ read() [1/2]

ilMDTypicalAgeRange::read ( )

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

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), ilMDBase\setRBACId(), setTypicalAgeRange(), setTypicalAgeRangeLanguage(), and ilUtil\stripSlashes().

118  {
119  global $ilDB;
120 
121  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
122 
123  if ($this->getMetaId()) {
124  $query = "SELECT * FROM il_meta_typical_age_range " .
125  "WHERE meta_typical_age_range_id = " . $ilDB->quote($this->getMetaId());
126 
127  $res = $this->db->query($query);
128  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
129  $this->setRBACId($row->rbac_id);
130  $this->setObjId($row->obj_id);
131  $this->setObjType($row->obj_type);
132  $this->setParentId($row->parent_id);
133  $this->setParentType($row->parent_type);
134  $this->setTypicalAgeRange(ilUtil::stripSlashes($row->typical_age_range));
135  $this->setTypicalAgeRangeLanguage(new ilMDLanguageItem($row->typical_age_range_language));
136  }
137  }
138  return true;
139  }
setObjType($a_type)
foreach($_POST as $key=> $value) $res
setObjId($a_id)
setRBACId($a_id)
setTypicalAgeRange($a_typical_age_range)
$query
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDTypicalAgeRange::read ( )

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

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

136  {
137  global $ilDB;
138 
139  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
140 
141  if ($this->getMetaId()) {
142  $query = "SELECT * FROM il_meta_tar " .
143  "WHERE meta_tar_id = " . $ilDB->quote($this->getMetaId(), 'integer');
144 
145  $res = $ilDB->query($query);
146  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
147  $this->setRBACId($row->rbac_id);
148  $this->setObjId($row->obj_id);
149  $this->setObjType($row->obj_type);
150  $this->setParentId($row->parent_id);
151  $this->setParentType($row->parent_type);
152  $this->setTypicalAgeRange($row->typical_age_range);
153  $this->setTypicalAgeRangeLanguage(new ilMDLanguageItem($row->tar_language));
154  $this->setTypicalAgeRangeMinimum($row->tar_min);
155  $this->setTypicalAgeRangeMaximum($row->tar_max);
156  }
157  }
158  return true;
159  }
setObjType($a_type)
foreach($_POST as $key=> $value) $res
setObjId($a_id)
setRBACId($a_id)
setTypicalAgeRange($a_typical_age_range)
$query
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ save() [1/2]

ilMDTypicalAgeRange::save ( )

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

References ilMDBase\getMetaId(), ilDBConstants\MDB2_AUTOQUERY_INSERT, and ilMDBase\setMetaId().

60  {
61  if ($this->db->autoExecute(
62  'il_meta_typical_age_range',
63  $this->__getFields(),
65  )) {
66  $this->setMetaId($this->db->getLastInsertId());
67 
68  return $this->getMetaId();
69  }
70  return false;
71  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDTypicalAgeRange::save ( )

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

References $ilDB, __getFields(), array, ilMDBase\getMetaId(), and ilMDBase\setMetaId().

78  {
79  global $ilDB;
80 
81  $fields = $this->__getFields();
82  $fields['meta_tar_id'] = array('integer',$next_id = $ilDB->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 false;
89  }
setMetaId($a_meta_id, $a_read_data=true)
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ setTypicalAgeRange() [1/2]

ilMDTypicalAgeRange::setTypicalAgeRange (   $a_typical_age_range)

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

37  {
38  $this->typical_age_range = $a_typical_age_range;
39  }

◆ setTypicalAgeRange() [2/2]

ilMDTypicalAgeRange::setTypicalAgeRange (   $a_typical_age_range)

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

Referenced by read().

37  {
38  $this->typical_age_range = $a_typical_age_range;
39  }
+ Here is the caller graph for this function:

◆ setTypicalAgeRangeLanguage() [1/2]

ilMDTypicalAgeRange::setTypicalAgeRangeLanguage ( $lng_obj)

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

45  {
46  if (is_object($lng_obj)) {
47  $this->typical_age_range_language = $lng_obj;
48  }
49  }

◆ setTypicalAgeRangeLanguage() [2/2]

ilMDTypicalAgeRange::setTypicalAgeRangeLanguage ( $lng_obj)

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

Referenced by read().

45  {
46  if (is_object($lng_obj)) {
47  $this->typical_age_range_language = $lng_obj;
48  }
49  }
+ Here is the caller graph for this function:

◆ setTypicalAgeRangeMaximum()

ilMDTypicalAgeRange::setTypicalAgeRangeMaximum (   $a_max)

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

Referenced by __parseTypicalAgeRange(), and read().

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

◆ setTypicalAgeRangeMinimum()

ilMDTypicalAgeRange::setTypicalAgeRangeMinimum (   $a_min)

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

Referenced by __parseTypicalAgeRange(), and read().

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

◆ toXML() [1/2]

ilMDTypicalAgeRange::toXML ( $writer)

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

References array, getTypicalAgeRange(), and getTypicalAgeRangeLanguageCode().

147  {
148  $writer->xmlElement('TypicalAgeRange', array('Language' => $this->getTypicalAgeRangeLanguageCode()), $this->getTypicalAgeRange());
149  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDTypicalAgeRange::toXML ( $writer)

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

References array, getTypicalAgeRange(), and getTypicalAgeRangeLanguageCode().

167  {
168  $writer->xmlElement(
169  'TypicalAgeRange',
170  array('Language' => $this->getTypicalAgeRangeLanguageCode()
172  : 'en'),
173  $this->getTypicalAgeRange()
174  );
175  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDTypicalAgeRange::update ( )

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

References $ilDB, ilMDBase\getMetaId(), and ilDBConstants\MDB2_AUTOQUERY_UPDATE.

74  {
75  global $ilDB;
76 
77  if ($this->getMetaId()) {
78  if ($this->db->autoExecute(
79  'il_meta_typical_age_range',
80  $this->__getFields(),
82  "meta_typical_age_range_id = " . $ilDB->quote($this->getMetaId())
83  )) {
84  return true;
85  }
86  }
87  return false;
88  }
global $ilDB
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDTypicalAgeRange::update ( )

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

References $ilDB, __parseTypicalAgeRange(), array, and ilMDBase\getMetaId().

92  {
93  global $ilDB;
94 
95  $this->__parseTypicalAgeRange();
96  if ($this->getMetaId()) {
97  if ($this->db->update(
98  'il_meta_tar',
99  $this->__getFields(),
100  array("meta_tar_id" => array('integer',$this->getMetaId()))
101  )) {
102  return true;
103  }
104  }
105  return false;
106  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

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