ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
ilMDDescription Class Reference
+ Inheritance diagram for ilMDDescription:
+ Collaboration diagram for ilMDDescription:

Public Member Functions

 ilMDDescription ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 setDescription ($a_description)
 
 getDescription ()
 
 setDescriptionLanguage (&$lng_obj)
 
getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
 ilMDDescription ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 setDescription ($a_description)
 
 getDescription ()
 
 setDescriptionLanguage (&$lng_obj)
 
getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 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
 ilMDBase ($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)
 
 ilMDBase ($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)
 

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDDescription::__getFields ( )

Definition at line 114 of file class.ilMDDescription.php.

References getDescription(), getDescriptionLanguageCode(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), and ilMDBase\getRBACId().

Referenced by save().

115  {
116  return array('rbac_id' => array('integer',$this->getRBACId()),
117  'obj_id' => array('integer',$this->getObjId()),
118  'obj_type' => array('text',$this->getObjType()),
119  'parent_type' => array('text',$this->getParentType()),
120  'parent_id' => array('integer',$this->getParentId()),
121  'description' => array('clob',$this->getDescription()),
122  'description_language' => array('text',$this->getDescriptionLanguageCode()));
123  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getFields() [2/2]

ilMDDescription::__getFields ( )

Definition at line 114 of file class.ilMDDescription.php.

References getDescription(), getDescriptionLanguageCode(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), ilMDBase\getRBACId(), and ilUtil\prepareDBString().

115  {
116  return array('rbac_id' => $this->getRBACId(),
117  'obj_id' => $this->getObjId(),
118  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
119  'parent_type' => $this->getParentType(),
120  'parent_id' => $this->getParentId(),
121  'description' => ilUtil::prepareDBString($this->getDescription()),
122  'description_language' => ilUtil::prepareDBString($this->getDescriptionLanguageCode()));
123  }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ Here is the call graph for this function:

◆ _getIds() [1/2]

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

Definition at line 163 of file class.ilMDDescription.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

164  {
165  global $ilDB;
166 
167  $query = "SELECT meta_description_id FROM il_meta_description ".
168  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
169  "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
170  "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
171  "AND parent_type = ".$ilDB->quote($a_parent_type)." ".
172  "ORDER BY meta_description_id";
173 
174  $res = $ilDB->query($query);
175  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
176  {
177  $ids[] = $row->meta_description_id;
178  }
179  return $ids ? $ids : array();
180  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

◆ _getIds() [2/2]

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

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

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilMDEducational\getDescriptionIds(), and ilMDGeneral\getDescriptionIds().

167  {
168  global $ilDB;
169 
170  $query = "SELECT meta_description_id FROM il_meta_description ".
171  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
172  "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
173  "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
174  "AND parent_type = ".$ilDB->quote($a_parent_type)." ".
175  "ORDER BY meta_description_id";
176 
177  $res = $ilDB->query($query);
178  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
179  {
180  $ids[] = $row->meta_description_id;
181  }
182  return $ids ? $ids : array();
183  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDDescription::delete ( )

Definition at line 97 of file class.ilMDDescription.php.

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

98  {
99  global $ilDB;
100 
101  if($this->getMetaId())
102  {
103  $query = "DELETE FROM il_meta_description ".
104  "WHERE meta_description_id = ".$ilDB->quote($this->getMetaId());
105 
106  $this->db->query($query);
107 
108  return true;
109  }
110  return false;
111  }
global $ilDB
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDDescription::delete ( )

Definition at line 98 of file class.ilMDDescription.php.

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

99  {
100  global $ilDB;
101 
102  if($this->getMetaId())
103  {
104  $query = "DELETE FROM il_meta_description ".
105  "WHERE meta_description_id = ".$ilDB->quote($this->getMetaId() ,'integer');
106  $res = $ilDB->manipulate($query);
107 
108  return true;
109  }
110  return false;
111  }
global $ilDB
+ Here is the call graph for this function:

◆ getDescription() [1/2]

ilMDDescription::getDescription ( )

Definition at line 47 of file class.ilMDDescription.php.

48  {
49  return $this->description;
50  }

◆ getDescription() [2/2]

ilMDDescription::getDescription ( )

Definition at line 47 of file class.ilMDDescription.php.

Referenced by __getFields(), and toXML().

48  {
49  return $this->description;
50  }
+ Here is the caller graph for this function:

◆ getDescriptionLanguage() [1/2]

& ilMDDescription::getDescriptionLanguage ( )

Definition at line 58 of file class.ilMDDescription.php.

59  {
60  return is_object($this->description_language) ? $this->description_language : false;
61  }

◆ getDescriptionLanguage() [2/2]

& ilMDDescription::getDescriptionLanguage ( )

Definition at line 58 of file class.ilMDDescription.php.

59  {
60  return is_object($this->description_language) ? $this->description_language : false;
61  }

◆ getDescriptionLanguageCode() [1/2]

ilMDDescription::getDescriptionLanguageCode ( )

Definition at line 62 of file class.ilMDDescription.php.

63  {
64  return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
65  }

◆ getDescriptionLanguageCode() [2/2]

ilMDDescription::getDescriptionLanguageCode ( )

Definition at line 62 of file class.ilMDDescription.php.

Referenced by __getFields(), and toXML().

63  {
64  return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
65  }
+ Here is the caller graph for this function:

◆ ilMDDescription() [1/2]

ilMDDescription::ilMDDescription (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

Definition at line 35 of file class.ilMDDescription.php.

36  {
37  parent::ilMDBase($a_rbac_id,
38  $a_obj_id,
39  $a_obj_type);
40  }

◆ ilMDDescription() [2/2]

ilMDDescription::ilMDDescription (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

Definition at line 35 of file class.ilMDDescription.php.

36  {
37  parent::ilMDBase($a_rbac_id,
38  $a_obj_id,
39  $a_obj_type);
40  }

◆ read() [1/2]

ilMDDescription::read ( )

Definition at line 125 of file class.ilMDDescription.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, ilMDBase\getMetaId(), setDescription(), setDescriptionLanguage(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), and ilMDBase\setRBACId().

126  {
127  global $ilDB;
128 
129  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
130 
131  if($this->getMetaId())
132  {
133  $query = "SELECT * FROM il_meta_description ".
134  "WHERE meta_description_id = ".$ilDB->quote($this->getMetaId() ,'integer');
135 
136  $res = $this->db->query($query);
137  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
138  {
139  $this->setRBACId($row->rbac_id);
140  $this->setObjId($row->obj_id);
141  $this->setObjType($row->obj_type);
142  $this->setParentId($row->parent_id);
143  $this->setParentType($row->parent_type);
144  $this->setDescription($row->description);
145  $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
146  }
147  }
148  return true;
149  }
setObjType($a_type)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setDescription($a_description)
setObjId($a_id)
setRBACId($a_id)
setDescriptionLanguage(&$lng_obj)
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDDescription::read ( )

Definition at line 125 of file class.ilMDDescription.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, ilMDBase\getMetaId(), setDescription(), setDescriptionLanguage(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), ilMDBase\setRBACId(), and ilUtil\stripSlashes().

126  {
127  global $ilDB;
128 
129  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
130 
131  if($this->getMetaId())
132  {
133  $query = "SELECT * FROM il_meta_description ".
134  "WHERE meta_description_id = ".$ilDB->quote($this->getMetaId());
135 
136  $res = $this->db->query($query);
137  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
138  {
139  $this->setRBACId($row->rbac_id);
140  $this->setObjId($row->obj_id);
141  $this->setObjType($row->obj_type);
142  $this->setParentId($row->parent_id);
143  $this->setParentType($row->parent_type);
144  $this->setDescription(ilUtil::stripSlashes($row->description));
145  $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
146  }
147  }
148  return true;
149  }
setObjType($a_type)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setDescription($a_description)
setObjId($a_id)
setRBACId($a_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setDescriptionLanguage(&$lng_obj)
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ save() [1/2]

ilMDDescription::save ( )

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

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

68  {
69  if($this->db->autoExecute('il_meta_description',
70  $this->__getFields(),
71  DB_AUTOQUERY_INSERT))
72  {
73  $this->setMetaId($this->db->getLastInsertId());
74 
75  return $this->getMetaId();
76  }
77  return false;
78  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDDescription::save ( )

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

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

68  {
69  global $ilDB;
70 
71  $fields = $this->__getFields();
72  $fields['meta_description_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_description'));
73 
74  if($this->db->insert('il_meta_description',$fields))
75  {
76  $this->setMetaId($next_id);
77  return $this->getMetaId();
78  }
79  return false;
80  }
setMetaId($a_meta_id, $a_read_data=true)
global $ilDB
+ Here is the call graph for this function:

◆ setDescription() [1/2]

ilMDDescription::setDescription (   $a_description)

Definition at line 43 of file class.ilMDDescription.php.

44  {
45  $this->description = $a_description;
46  }

◆ setDescription() [2/2]

ilMDDescription::setDescription (   $a_description)

Definition at line 43 of file class.ilMDDescription.php.

Referenced by read().

44  {
45  $this->description = $a_description;
46  }
+ Here is the caller graph for this function:

◆ setDescriptionLanguage() [1/2]

ilMDDescription::setDescriptionLanguage ( $lng_obj)

Definition at line 51 of file class.ilMDDescription.php.

Referenced by read().

52  {
53  if(is_object($lng_obj))
54  {
55  $this->description_language = $lng_obj;
56  }
57  }
+ Here is the caller graph for this function:

◆ setDescriptionLanguage() [2/2]

ilMDDescription::setDescriptionLanguage ( $lng_obj)

Definition at line 51 of file class.ilMDDescription.php.

52  {
53  if(is_object($lng_obj))
54  {
55  $this->description_language = $lng_obj;
56  }
57  }

◆ toXML() [1/2]

ilMDDescription::toXML ( $writer)

Definition at line 156 of file class.ilMDDescription.php.

References getDescription(), and getDescriptionLanguageCode().

157  {
158  $writer->xmlElement('Description',array('Language' => $this->getDescriptionLanguageCode() ?
159  $this->getDescriptionLanguageCode() :
160  'en'),
161  $this->getDescription());
162  }
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDDescription::toXML ( $writer)

Definition at line 156 of file class.ilMDDescription.php.

References getDescription(), and getDescriptionLanguageCode().

157  {
158  $writer->xmlElement('Description',array('Language' => $this->getDescriptionLanguageCode()),$this->getDescription());
159  }
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDDescription::update ( )

Definition at line 80 of file class.ilMDDescription.php.

References $ilDB, and ilMDBase\getMetaId().

81  {
82  global $ilDB;
83 
84  if($this->getMetaId())
85  {
86  if($this->db->autoExecute('il_meta_description',
87  $this->__getFields(),
88  DB_AUTOQUERY_UPDATE,
89  "meta_description_id = ".$ilDB->quote($this->getMetaId())))
90  {
91  return true;
92  }
93  }
94  return false;
95  }
global $ilDB
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDDescription::update ( )

Definition at line 82 of file class.ilMDDescription.php.

References $ilDB, and ilMDBase\getMetaId().

83  {
84  global $ilDB;
85 
86  if($this->getMetaId())
87  {
88  if($this->db->update('il_meta_description',
89  $this->__getFields(),
90  array("meta_description_id" => array('integer',$this->getMetaId()))))
91  {
92  return true;
93  }
94  }
95  return false;
96  }
global $ilDB
+ Here is the call graph for this function:

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