ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

Referenced by save(), and update().

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  }
+ 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.

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

Referenced by ilMD\getAnnotationIds().

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  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMDAnnotation::delete ( )

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

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

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  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:

◆ getDate()

ilMDAnnotation::getDate ( )

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

References $date.

Referenced by __getFields(), and toXML().

49  : string
50  {
51  return $this->date;
52  }
+ Here is the caller graph for this function:

◆ getDescription()

ilMDAnnotation::getDescription ( )

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

References $description.

Referenced by __getFields(), and toXML().

59  : string
60  {
61  return $this->description;
62  }
+ 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.

Referenced by __getFields(), and toXML().

74  : string
75  {
76  if (is_object($this->description_language)) {
77  return $this->description_language->getLanguageCode();
78  }
79  return '';
80  }
+ Here is the caller graph for this function:

◆ getEntity()

ilMDAnnotation::getEntity ( )

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

References $entity.

Referenced by __getFields(), and toXML().

39  : string
40  {
41  return $this->entity;
42  }
+ Here is the caller graph for this function:

◆ read()

ilMDAnnotation::read ( )

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

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

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  }
$res
Definition: ltiservices.php:69
setEntity(string $a_entity)
setRBACId(int $a_id)
setObjId(int $a_id)
setDate(string $a_date)
$query
setDescription(string $a_desc)
setObjType(string $a_type)
+ Here is the call graph for this function:

◆ save()

ilMDAnnotation::save ( )

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

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

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)
+ Here is the call graph for this function:

◆ setDate()

ilMDAnnotation::setDate ( string  $a_date)

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

Referenced by read().

44  : void
45  {
46  $this->date = $a_date;
47  }
+ Here is the caller graph for this function:

◆ setDescription()

ilMDAnnotation::setDescription ( string  $a_desc)

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

Referenced by read().

54  : void
55  {
56  $this->description = $a_desc;
57  }
+ 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.

Referenced by read().

34  : void
35  {
36  $this->entity = $a_entity;
37  }
+ Here is the caller graph for this function:

◆ toXML()

ilMDAnnotation::toXML ( ilXmlWriter  $writer)

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

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

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  }
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

◆ update()

ilMDAnnotation::update ( )

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

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

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  }
+ 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: