ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMDAnnotation Class Reference
+ Inheritance diagram for ilMDAnnotation:
+ Collaboration diagram for ilMDAnnotation:

Public Member Functions

 ilMDAnnotation ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 setEntity ($a_entity)
 
 getEntity ()
 
 setDate ($a_date)
 
 getDate ()
 
 setDescription ($a_desc)
 
 getDescription ()
 
 setDescriptionLanguage ($lng_obj)
 
getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getIds ($a_rbac_id, $a_obj_id)
 
 ilMDAnnotation ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 setEntity ($a_entity)
 
 getEntity ()
 
 setDate ($a_date)
 
 getDate ()
 
 setDescription ($a_desc)
 
 getDescription ()
 
 setDescriptionLanguage ($lng_obj)
 
getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getIds ($a_rbac_id, $a_obj_id)
 
- 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.ilMDAnnotation.php.

Member Function Documentation

◆ __getFields() [1/2]

ilMDAnnotation::__getFields ( )

Definition at line 134 of file class.ilMDAnnotation.php.

References getDate(), getDescription(), getDescriptionLanguageCode(), getEntity(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

Referenced by save().

135  {
136  return array('rbac_id' => array('integer',$this->getRBACId()),
137  'obj_id' => array('integer',$this->getObjId()),
138  'obj_type' => array('text',$this->getObjType()),
139  'entity' => array('clob',$this->getEntity()),
140  'a_date' => array('clob',$this->getDate()),
141  'description' => array('clob',$this->getDescription()),
142  'description_language' => array('text',$this->getDescriptionLanguageCode()));
143  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getFields() [2/2]

ilMDAnnotation::__getFields ( )

Definition at line 134 of file class.ilMDAnnotation.php.

References getDate(), getDescription(), getDescriptionLanguageCode(), getEntity(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getRBACId(), and ilUtil\prepareDBString().

135  {
136  return array('rbac_id' => $this->getRBACId(),
137  'obj_id' => $this->getObjId(),
138  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
139  'entity' => ilUtil::prepareDBString($this->getEntity()),
140  'date' => ilUtil::prepareDBString($this->getDate()),
141  'description' => ilUtil::prepareDBString($this->getDescription()),
142  'description_language' => ilUtil::prepareDBString($this->getDescriptionLanguageCode()));
143  }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ Here is the call graph for this function:

◆ _getIds() [1/2]

ilMDAnnotation::_getIds (   $a_rbac_id,
  $a_obj_id 
)

Definition at line 188 of file class.ilMDAnnotation.php.

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

189  {
190  global $ilDB;
191 
192  $query = "SELECT meta_annotation_id FROM il_meta_annotation ".
193  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
194  "AND obj_id = ".$ilDB->quote($a_obj_id);
195 
196 
197  $res = $ilDB->query($query);
198  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
199  {
200  $ids[] = $row->meta_annotation_id;
201  }
202  return $ids ? $ids : array();
203  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

◆ _getIds() [2/2]

ilMDAnnotation::_getIds (   $a_rbac_id,
  $a_obj_id 
)

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

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

Referenced by ilMD\getAnnotationIds().

192  {
193  global $ilDB;
194 
195  $query = "SELECT meta_annotation_id FROM il_meta_annotation ".
196  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
197  "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer');
198 
199 
200  $res = $ilDB->query($query);
201  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
202  {
203  $ids[] = $row->meta_annotation_id;
204  }
205  return $ids ? $ids : array();
206  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDAnnotation::delete ( )

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

References $query, and ilMDBase\getMetaId().

118  {
119  global $ilDB;
120 
121  if($this->getMetaId())
122  {
123  $query = "DELETE FROM il_meta_annotation ".
124  "WHERE meta_annotation_id = ".$ilDB->quote($this->getMetaId());
125 
126  $this->db->query($query);
127 
128  return true;
129  }
130  return false;
131  }
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDAnnotation::delete ( )

Definition at line 118 of file class.ilMDAnnotation.php.

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

119  {
120  global $ilDB;
121 
122  if($this->getMetaId())
123  {
124  $query = "DELETE FROM il_meta_annotation ".
125  "WHERE meta_annotation_id = ".$ilDB->quote($this->getMetaId() ,'integer');
126  $res = $ilDB->manipulate($query);
127 
128  return true;
129  }
130  return false;
131  }
+ Here is the call graph for this function:

◆ getDate() [1/2]

ilMDAnnotation::getDate ( )

Definition at line 55 of file class.ilMDAnnotation.php.

56  {
57  return $this->date;
58  }

◆ getDate() [2/2]

ilMDAnnotation::getDate ( )

Definition at line 55 of file class.ilMDAnnotation.php.

Referenced by __getFields(), and toXML().

56  {
57  return $this->date;
58  }
+ Here is the caller graph for this function:

◆ getDescription() [1/2]

ilMDAnnotation::getDescription ( )

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

Referenced by __getFields(), and toXML().

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

◆ getDescription() [2/2]

ilMDAnnotation::getDescription ( )

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

64  {
65  return $this->description;
66  }

◆ getDescriptionLanguage() [1/2]

& ilMDAnnotation::getDescriptionLanguage ( )

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

75  {
76  return $this->description_language;
77  }

◆ getDescriptionLanguage() [2/2]

& ilMDAnnotation::getDescriptionLanguage ( )

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

75  {
76  return $this->description_language;
77  }

◆ getDescriptionLanguageCode() [1/2]

ilMDAnnotation::getDescriptionLanguageCode ( )

Definition at line 78 of file class.ilMDAnnotation.php.

Referenced by __getFields(), and toXML().

79  {
80  if(is_object($this->description_language))
81  {
82  return $this->description_language->getLanguageCode();
83  }
84  return false;
85  }
+ Here is the caller graph for this function:

◆ getDescriptionLanguageCode() [2/2]

ilMDAnnotation::getDescriptionLanguageCode ( )

Definition at line 78 of file class.ilMDAnnotation.php.

79  {
80  if(is_object($this->description_language))
81  {
82  return $this->description_language->getLanguageCode();
83  }
84  return false;
85  }

◆ getEntity() [1/2]

ilMDAnnotation::getEntity ( )

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

Referenced by __getFields(), and toXML().

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

◆ getEntity() [2/2]

ilMDAnnotation::getEntity ( )

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

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

◆ ilMDAnnotation() [1/2]

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

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

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

◆ ilMDAnnotation() [2/2]

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

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

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

◆ read() [1/2]

ilMDAnnotation::read ( )

Definition at line 145 of file class.ilMDAnnotation.php.

References $query, $res, $row, DB_FETCHMODE_OBJECT, ilMDBase\getMetaId(), setDate(), setDescription(), setEntity(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setRBACId(), and ilUtil\stripSlashes().

146  {
147  global $ilDB;
148 
149  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
150 
151  if($this->getMetaId())
152  {
153  $query = "SELECT * FROM il_meta_annotation ".
154  "WHERE meta_annotation_id = ".$ilDB->quote($this->getMetaId());
155 
156  $res = $this->db->query($query);
157  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
158  {
159  $this->setRBACId($row->rbac_id);
160  $this->setObjId($row->obj_id);
161  $this->setObjType($row->obj_type);
162  $this->setEntity(ilUtil::stripSlashes($row->entity));
163  $this->setDate(ilUtil::stripSlashes($row->date));
164  $this->setDescription(ilUtil::stripSlashes($row->description));
165  $this->description_language =& new ilMDLanguageItem($row->description_language);
166  }
167  }
168  return true;
169  }
setObjType($a_type)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setObjId($a_id)
setRBACId($a_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDAnnotation::read ( )

Definition at line 145 of file class.ilMDAnnotation.php.

References $query, $res, $row, DB_FETCHMODE_OBJECT, ilMDBase\getMetaId(), setDate(), setDescription(), setEntity(), ilMDBase\setObjId(), ilMDBase\setObjType(), and ilMDBase\setRBACId().

146  {
147  global $ilDB;
148 
149  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
150 
151  if($this->getMetaId())
152  {
153  $query = "SELECT * FROM il_meta_annotation ".
154  "WHERE meta_annotation_id = ".$ilDB->quote($this->getMetaId() ,'integer');
155 
156  $res = $this->db->query($query);
157  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
158  {
159  $this->setRBACId($row->rbac_id);
160  $this->setObjId($row->obj_id);
161  $this->setObjType($row->obj_type);
162  $this->setEntity($row->entity);
163  $this->setDate($row->a_date);
164  $this->setDescription($row->description);
165  $this->description_language =& new ilMDLanguageItem($row->description_language);
166  }
167  }
168  return true;
169  }
setObjType($a_type)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setObjId($a_id)
setRBACId($a_id)
+ Here is the call graph for this function:

◆ save() [1/2]

ilMDAnnotation::save ( )

Definition at line 87 of file class.ilMDAnnotation.php.

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

88  {
89  global $ilDB;
90 
91  $fields = $this->__getFields();
92  $fields['meta_annotation_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_annotation'));
93 
94  if($this->db->insert('il_meta_annotation',$fields))
95  {
96  $this->setMetaId($next_id);
97  return $this->getMetaId();
98  }
99  return false;
100  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDAnnotation::save ( )

Definition at line 87 of file class.ilMDAnnotation.php.

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

88  {
89  if($this->db->autoExecute('il_meta_annotation',
90  $this->__getFields(),
91  DB_AUTOQUERY_INSERT))
92  {
93  $this->setMetaId($this->db->getLastInsertId());
94 
95  return $this->getMetaId();
96  }
97  return false;
98  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ setDate() [1/2]

ilMDAnnotation::setDate (   $a_date)

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

Referenced by read().

52  {
53  $this->date = $a_date;
54  }
+ Here is the caller graph for this function:

◆ setDate() [2/2]

ilMDAnnotation::setDate (   $a_date)

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

52  {
53  $this->date = $a_date;
54  }

◆ setDescription() [1/2]

ilMDAnnotation::setDescription (   $a_desc)

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

60  {
61  $this->description = $a_desc;
62  }

◆ setDescription() [2/2]

ilMDAnnotation::setDescription (   $a_desc)

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

Referenced by read().

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

◆ setDescriptionLanguage() [1/2]

ilMDAnnotation::setDescriptionLanguage (   $lng_obj)

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

68  {
69  if(is_object($lng_obj))
70  {
71  $this->description_language =& $lng_obj;
72  }
73  }

◆ setDescriptionLanguage() [2/2]

ilMDAnnotation::setDescriptionLanguage (   $lng_obj)

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

68  {
69  if(is_object($lng_obj))
70  {
71  $this->description_language =& $lng_obj;
72  }
73  }

◆ setEntity() [1/2]

ilMDAnnotation::setEntity (   $a_entity)

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

Referenced by read().

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

◆ setEntity() [2/2]

ilMDAnnotation::setEntity (   $a_entity)

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

44  {
45  $this->entity = $a_entity;
46  }

◆ toXML() [1/2]

ilMDAnnotation::toXML ( $writer)

Definition at line 176 of file class.ilMDAnnotation.php.

References getDate(), getDescription(), getDescriptionLanguageCode(), and getEntity().

177  {
178  $writer->xmlStartTag('Annotation');
179  $writer->xmlElement('Entity',null,$this->getEntity());
180  $writer->xmlElement('Date',null,$this->getDate());
181  $writer->xmlElement('Description',array('Language' => $this->getDescriptionLanguageCode()),$this->getDescription());
182  $writer->xmlEndTag('Annotation');
183  }
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDAnnotation::toXML ( $writer)

Definition at line 176 of file class.ilMDAnnotation.php.

References getDate(), getDescription(), getDescriptionLanguageCode(), and getEntity().

177  {
178  $writer->xmlStartTag('Annotation');
179  $writer->xmlElement('Entity',null,$this->getEntity());
180  $writer->xmlElement('Date',null,$this->getDate());
181  $writer->xmlElement('Description',array('Language' => $this->getDescriptionLanguageCode()
182  ? $this->getDescriptionLanguageCode()
183  : 'en'),
184  $this->getDescription());
185  $writer->xmlEndTag('Annotation');
186  }
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDAnnotation::update ( )

Definition at line 100 of file class.ilMDAnnotation.php.

References ilMDBase\getMetaId().

101  {
102  global $ilDB;
103 
104  if($this->getMetaId())
105  {
106  if($this->db->autoExecute('il_meta_annotation',
107  $this->__getFields(),
108  DB_AUTOQUERY_UPDATE,
109  "meta_annotation_id = ".$ilDB->quote($this->getMetaId())))
110  {
111  return true;
112  }
113  }
114  return false;
115  }
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDAnnotation::update ( )

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

References ilMDBase\getMetaId().

103  {
104  global $ilDB;
105 
106  if($this->getMetaId())
107  {
108  if($this->db->update('il_meta_annotation',
109  $this->__getFields(),
110  array("meta_annotation_id" => array('integer',$this->getMetaId()))))
111  {
112  return true;
113  }
114  }
115  return false;
116  }
+ Here is the call graph for this function:

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