ILIAS  release_8 Revision v8.24
ilMDAnnotation Class Reference
+ Inheritance diagram for ilMDAnnotation:
+ Collaboration diagram for ilMDAnnotation:

Public Member Functions

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

Private Attributes

string $entity = ''
 
string $date = ''
 
string $description = ''
 
ilMDLanguageItem $description_language = null
 

Additional Inherited Members

- Protected Attributes inherited from ilMDBase
ilLogger $log
 
ilDBInterface $db
 

Detailed Description

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

Member Function Documentation

◆ __getFields()

ilMDAnnotation::__getFields ( )
Returns
array<string, array<string, mixed>>

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

118 : array
119 {
120 return array(
121 'rbac_id' => array('integer', $this->getRBACId()),
122 'obj_id' => array('integer', $this->getObjId()),
123 'obj_type' => array('text', $this->getObjType()),
124 'entity' => array('clob', $this->getEntity()),
125 'a_date' => array('clob', $this->getDate()),
126 'description' => array('clob', $this->getDescription()),
127 'description_language' => array('text', $this->getDescriptionLanguageCode())
128 );
129 }

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

Referenced by save(), and update().

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

◆ _getIds()

static ilMDAnnotation::_getIds ( int  $a_rbac_id,
int  $a_obj_id 
)
static
Returns
int[]

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

171 : array
172 {
173 global $DIC;
174
175 $ilDB = $DIC['ilDB'];
176
177 $query = "SELECT meta_annotation_id FROM il_meta_annotation " .
178 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
179 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
180
181 $res = $ilDB->query($query);
182 $ids = [];
183 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
184 $ids[] = (int) $row->meta_annotation_id;
185 }
186 return $ids;
187 }
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$query

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

Referenced by ilMD\getAnnotationIds().

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

◆ delete()

ilMDAnnotation::delete ( )

Reimplemented from ilMDBase.

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

103 : bool
104 {
105 if ($this->getMetaId()) {
106 $query = "DELETE FROM il_meta_annotation " .
107 "WHERE meta_annotation_id = " . $this->db->quote($this->getMetaId(), 'integer');
108 $res = $this->db->manipulate($query);
109
110 return true;
111 }
112 return false;
113 }

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

+ Here is the call graph for this function:

◆ getDate()

ilMDAnnotation::getDate ( )

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

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

References $date.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescription()

ilMDAnnotation::getDescription ( )

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

59 : string
60 {
61 return $this->description;
62 }

References $description.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescriptionLanguage()

ilMDAnnotation::getDescriptionLanguage ( )

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

References $description_language.

◆ getDescriptionLanguageCode()

ilMDAnnotation::getDescriptionLanguageCode ( )

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

74 : string
75 {
76 if (is_object($this->description_language)) {
77 return $this->description_language->getLanguageCode();
78 }
79 return '';
80 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getEntity()

ilMDAnnotation::getEntity ( )

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

39 : string
40 {
41 return $this->entity;
42 }

References $entity.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ read()

ilMDAnnotation::read ( )

Reimplemented from ilMDBase.

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

131 : bool
132 {
133 if ($this->getMetaId()) {
134 $query = "SELECT * FROM il_meta_annotation " .
135 "WHERE meta_annotation_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->setEntity($row->entity ?? '');
143 $this->setDate($row->a_date ?? '');
144 $this->setDescription($row->description ?? '');
145 $this->description_language = new ilMDLanguageItem($row->description_language ?? '');
146 }
147 }
148 return true;
149 }
setEntity(string $a_entity)
setDescription(string $a_desc)
setDate(string $a_date)
setObjType(string $a_type)
setObjId(int $a_id)
setRBACId(int $a_id)

References $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:

◆ save()

ilMDAnnotation::save ( )

Reimplemented from ilMDBase.

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

82 : int
83 {
84 $fields = $this->__getFields();
85 $fields['meta_annotation_id'] = array('integer', $next_id = $this->db->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 0;
92 }
setMetaId(int $a_meta_id, bool $a_read_data=true)

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

+ Here is the call graph for this function:

◆ setDate()

ilMDAnnotation::setDate ( string  $a_date)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription()

ilMDAnnotation::setDescription ( string  $a_desc)

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

54 : void
55 {
56 $this->description = $a_desc;
57 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescriptionLanguage()

ilMDAnnotation::setDescriptionLanguage ( ilMDLanguageItem  $lng_obj)

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

64 : void
65 {
66 $this->description_language = $lng_obj;
67 }

◆ setEntity()

ilMDAnnotation::setEntity ( string  $a_entity)

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

34 : void
35 {
36 $this->entity = $a_entity;
37 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toXML()

ilMDAnnotation::toXML ( ilXmlWriter  $writer)

Reimplemented from ilMDBase.

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

151 : void
152 {
153 $writer->xmlStartTag('Annotation');
154 $writer->xmlElement('Entity', null, $this->getEntity());
155 $writer->xmlElement('Date', null, $this->getDate());
156 $writer->xmlElement(
157 'Description',
158 array(
159 'Language' => $this->getDescriptionLanguageCode() ?: 'en'
160 ),
161 $this->getDescription()
162 );
163 $writer->xmlEndTag('Annotation');
164 }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

References getDate(), getDescription(), getDescriptionLanguageCode(), getEntity(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

+ Here is the call graph for this function:

◆ update()

ilMDAnnotation::update ( )

Reimplemented from ilMDBase.

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

94 : bool
95 {
96 return $this->getMetaId() && $this->db->update(
97 'il_meta_annotation',
98 $this->__getFields(),
99 array("meta_annotation_id" => array('integer', $this->getMetaId()))
100 );
101 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $date

string ilMDAnnotation::$date = ''
private

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

Referenced by getDate().

◆ $description

string ilMDAnnotation::$description = ''
private

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

Referenced by getDescription().

◆ $description_language

ilMDLanguageItem ilMDAnnotation::$description_language = null
private

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

Referenced by getDescriptionLanguage().

◆ $entity

string ilMDAnnotation::$entity = ''
private

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

Referenced by getEntity().


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