ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilMDAnnotation Class Reference
+ Inheritance diagram for ilMDAnnotation:
+ Collaboration diagram for ilMDAnnotation:

Public Member Functions

 setEntity ($a_entity)
 
 getEntity ()
 
 setDate ($a_date)
 
 getDate ()
 
 setDescription ($a_desc)
 
 getDescription ()
 
 setDescriptionLanguage ($lng_obj)
 
getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 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
 __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)
 

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.ilMDAnnotation.php.

Member Function Documentation

◆ __getFields() [1/2]

ilMDAnnotation::__getFields ( )

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

130 {
131 return array('rbac_id' => array('integer',$this->getRBACId()),
132 'obj_id' => array('integer',$this->getObjId()),
133 'obj_type' => array('text',$this->getObjType()),
134 'entity' => array('clob',$this->getEntity()),
135 'a_date' => array('clob',$this->getDate()),
136 'description' => array('clob',$this->getDescription()),
137 'description_language' => array('text',$this->getDescriptionLanguageCode()));
138 }

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

Referenced by save().

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

◆ __getFields() [2/2]

ilMDAnnotation::__getFields ( )

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

126 {
127 return array('rbac_id' => $this->getRBACId(),
128 'obj_id' => $this->getObjId(),
129 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
130 'entity' => ilUtil::prepareDBString($this->getEntity()),
131 'date' => ilUtil::prepareDBString($this->getDate()),
132 'description' => ilUtil::prepareDBString($this->getDescription()),
133 'description_language' => ilUtil::prepareDBString($this->getDescriptionLanguageCode()));
134 }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)

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

+ Here is the call graph for this function:

◆ _getIds() [1/2]

static ilMDAnnotation::_getIds (   $a_rbac_id,
  $a_obj_id 
)
static

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

190 {
191 global $DIC;
192
193 $ilDB = $DIC['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(ilDBConstants::FETCHMODE_OBJECT)) {
202 $ids[] = $row->meta_annotation_id;
203 }
204 return $ids ? $ids : array();
205 }
$query
foreach($_POST as $key=> $value) $res
global $ilDB
$DIC
Definition: xapitoken.php:46

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMD\getAnnotationIds().

+ Here is the caller graph for this function:

◆ _getIds() [2/2]

ilMDAnnotation::_getIds (   $a_rbac_id,
  $a_obj_id 
)

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

178 {
179 global $ilDB;
180
181 $query = "SELECT meta_annotation_id FROM il_meta_annotation " .
182 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
183 "AND obj_id = " . $ilDB->quote($a_obj_id);
184
185
186 $res = $ilDB->query($query);
187 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
188 $ids[] = $row->meta_annotation_id;
189 }
190 return $ids ? $ids : array();
191 }

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

◆ delete() [1/2]

ilMDAnnotation::delete ( )

Reimplemented from ilMDBase.

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

113 {
114 global $DIC;
115
116 $ilDB = $DIC['ilDB'];
117
118 if ($this->getMetaId()) {
119 $query = "DELETE FROM il_meta_annotation " .
120 "WHERE meta_annotation_id = " . $ilDB->quote($this->getMetaId(), 'integer');
121 $res = $ilDB->manipulate($query);
122
123 return true;
124 }
125 return false;
126 }

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

+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDAnnotation::delete ( )

Reimplemented from ilMDBase.

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

110 {
111 global $ilDB;
112
113 if ($this->getMetaId()) {
114 $query = "DELETE FROM il_meta_annotation " .
115 "WHERE meta_annotation_id = " . $ilDB->quote($this->getMetaId());
116
117 $this->db->query($query);
118
119 return true;
120 }
121 return false;
122 }

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

+ Here is the call graph for this function:

◆ getDate() [1/2]

ilMDAnnotation::getDate ( )

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

49 {
50 return $this->date;
51 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDate() [2/2]

ilMDAnnotation::getDate ( )

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

49 {
50 return $this->date;
51 }

◆ getDescription() [1/2]

ilMDAnnotation::getDescription ( )

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

57 {
58 return $this->description;
59 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescription() [2/2]

ilMDAnnotation::getDescription ( )

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

57 {
58 return $this->description;
59 }

◆ getDescriptionLanguage() [1/2]

& ilMDAnnotation::getDescriptionLanguage ( )

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

67 {
68 return $this->description_language;
69 }

◆ getDescriptionLanguage() [2/2]

& ilMDAnnotation::getDescriptionLanguage ( )

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

67 {
68 return $this->description_language;
69 }

◆ getDescriptionLanguageCode() [1/2]

ilMDAnnotation::getDescriptionLanguageCode ( )

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

71 {
72 if (is_object($this->description_language)) {
73 return $this->description_language->getLanguageCode();
74 }
75 return false;
76 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescriptionLanguageCode() [2/2]

ilMDAnnotation::getDescriptionLanguageCode ( )

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

71 {
72 if (is_object($this->description_language)) {
73 return $this->description_language->getLanguageCode();
74 }
75 return false;
76 }

◆ getEntity() [1/2]

ilMDAnnotation::getEntity ( )

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

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getEntity() [2/2]

ilMDAnnotation::getEntity ( )

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

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

◆ read() [1/2]

ilMDAnnotation::read ( )

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

141 {
142 global $DIC;
143
144 $ilDB = $DIC['ilDB'];
145
146 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
147
148 if ($this->getMetaId()) {
149 $query = "SELECT * FROM il_meta_annotation " .
150 "WHERE meta_annotation_id = " . $ilDB->quote($this->getMetaId(), 'integer');
151
152 $res = $this->db->query($query);
153 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
154 $this->setRBACId($row->rbac_id);
155 $this->setObjId($row->obj_id);
156 $this->setObjType($row->obj_type);
157 $this->setEntity($row->entity);
158 $this->setDate($row->a_date);
159 $this->setDescription($row->description);
160 $this->description_language = new ilMDLanguageItem($row->description_language);
161 }
162 }
163 return true;
164 }
setObjId($a_id)
setObjType($a_type)
setRBACId($a_id)

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setDate(), setDescription(), setEntity(), ilMDBase\setObjId(), ilMDBase\setObjType(), and ilMDBase\setRBACId().

+ Here is the call graph for this function:

◆ read() [2/2]

ilMDAnnotation::read ( )

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

137 {
138 global $ilDB;
139
140 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
141
142 if ($this->getMetaId()) {
143 $query = "SELECT * FROM il_meta_annotation " .
144 "WHERE meta_annotation_id = " . $ilDB->quote($this->getMetaId());
145
146 $res = $this->db->query($query);
147 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
148 $this->setRBACId($row->rbac_id);
149 $this->setObjId($row->obj_id);
150 $this->setObjType($row->obj_type);
151 $this->setEntity(ilUtil::stripSlashes($row->entity));
152 $this->setDate(ilUtil::stripSlashes($row->date));
153 $this->setDescription(ilUtil::stripSlashes($row->description));
154 $this->description_language = new ilMDLanguageItem($row->description_language);
155 }
156 }
157 return true;
158 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

+ Here is the call graph for this function:

◆ save() [1/2]

ilMDAnnotation::save ( )

Reimplemented from ilMDBase.

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

79 {
80 global $DIC;
81
82 $ilDB = $DIC['ilDB'];
83
84 $fields = $this->__getFields();
85 $fields['meta_annotation_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_annotation'));
86
87 if ($this->db->insert('il_meta_annotation', $fields)) {
88 $this->setMetaId($next_id);
89 return $this->getMetaId();
90 }
91 return false;
92 }
setMetaId($a_meta_id, $a_read_data=true)

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

+ Here is the call graph for this function:

◆ save() [2/2]

ilMDAnnotation::save ( )

Reimplemented from ilMDBase.

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

79 {
80 if ($this->db->autoExecute(
81 'il_meta_annotation',
82 $this->__getFields(),
84 )) {
85 $this->setMetaId($this->db->getLastInsertId());
86
87 return $this->getMetaId();
88 }
89 return false;
90 }

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

+ Here is the call graph for this function:

◆ setDate() [1/2]

ilMDAnnotation::setDate (   $a_date)

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

45 {
46 $this->date = $a_date;
47 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDate() [2/2]

ilMDAnnotation::setDate (   $a_date)

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

45 {
46 $this->date = $a_date;
47 }

◆ setDescription() [1/2]

ilMDAnnotation::setDescription (   $a_desc)

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

53 {
54 $this->description = $a_desc;
55 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription() [2/2]

ilMDAnnotation::setDescription (   $a_desc)

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

53 {
54 $this->description = $a_desc;
55 }

◆ setDescriptionLanguage() [1/2]

ilMDAnnotation::setDescriptionLanguage (   $lng_obj)

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

61 {
62 if (is_object($lng_obj)) {
63 $this->description_language = &$lng_obj;
64 }
65 }

◆ setDescriptionLanguage() [2/2]

ilMDAnnotation::setDescriptionLanguage (   $lng_obj)

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

61 {
62 if (is_object($lng_obj)) {
63 $this->description_language = &$lng_obj;
64 }
65 }

◆ setEntity() [1/2]

ilMDAnnotation::setEntity (   $a_entity)

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

37 {
38 $this->entity = $a_entity;
39 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setEntity() [2/2]

ilMDAnnotation::setEntity (   $a_entity)

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

37 {
38 $this->entity = $a_entity;
39 }

◆ toXML() [1/2]

ilMDAnnotation::toXML ( $writer)

Reimplemented from ilMDBase.

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

172 {
173 $writer->xmlStartTag('Annotation');
174 $writer->xmlElement('Entity', null, $this->getEntity());
175 $writer->xmlElement('Date', null, $this->getDate());
176 $writer->xmlElement(
177 'Description',
178 array('Language' => $this->getDescriptionLanguageCode()
180 : 'en'),
181 $this->getDescription()
182 );
183 $writer->xmlEndTag('Annotation');
184 }

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

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDAnnotation::toXML ( $writer)

Reimplemented from ilMDBase.

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

166 {
167 $writer->xmlStartTag('Annotation');
168 $writer->xmlElement('Entity', null, $this->getEntity());
169 $writer->xmlElement('Date', null, $this->getDate());
170 $writer->xmlElement('Description', array('Language' => $this->getDescriptionLanguageCode()), $this->getDescription());
171 $writer->xmlEndTag('Annotation');
172 }

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

+ Here is the call graph for this function:

◆ update() [1/2]

ilMDAnnotation::update ( )

Reimplemented from ilMDBase.

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

95 {
96 global $DIC;
97
98 $ilDB = $DIC['ilDB'];
99
100 if ($this->getMetaId()) {
101 if ($this->db->update(
102 'il_meta_annotation',
103 $this->__getFields(),
104 array("meta_annotation_id" => array('integer',$this->getMetaId()))
105 )) {
106 return true;
107 }
108 }
109 return false;
110 }

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

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDAnnotation::update ( )

Reimplemented from ilMDBase.

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

93 {
94 global $ilDB;
95
96 if ($this->getMetaId()) {
97 if ($this->db->autoExecute(
98 'il_meta_annotation',
99 $this->__getFields(),
101 "meta_annotation_id = " . $ilDB->quote($this->getMetaId())
102 )) {
103 return true;
104 }
105 }
106 return false;
107 }

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

+ Here is the call graph for this function:

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