ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilMDDescription Class Reference
+ Inheritance diagram for ilMDDescription:
+ Collaboration diagram for ilMDDescription:

Public Member Functions

 setDescription (string $a_description)
 
 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, int $a_parent_id, string $a_parent_type)
 

Private Attributes

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

Member Function Documentation

◆ __getFields()

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

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

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

Referenced by save(), and update().

93  : array
94  {
95  return array(
96  'rbac_id' => array('integer', $this->getRBACId()),
97  'obj_id' => array('integer', $this->getObjId()),
98  'obj_type' => array('text', $this->getObjType()),
99  'parent_type' => array('text', $this->getParentType()),
100  'parent_id' => array('integer', $this->getParentId()),
101  'description' => array('clob', $this->getDescription()),
102  'description_language' => array('text', $this->getDescriptionLanguageCode())
103  );
104  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIds()

static ilMDDescription::_getIds ( int  $a_rbac_id,
int  $a_obj_id,
int  $a_parent_id,
string  $a_parent_type 
)
static
Returns
int[]

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

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

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

142  : array
143  {
144  global $DIC;
145 
146  $ilDB = $DIC->database();
147 
148  $query = "SELECT meta_description_id FROM il_meta_description " .
149  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, ilDBConstants::T_INTEGER) . " " .
150  "AND obj_id = " . $ilDB->quote($a_obj_id, ilDBConstants::T_INTEGER) . " " .
151  "AND parent_id = " . $ilDB->quote($a_parent_id, ilDBConstants::T_INTEGER) . " " .
152  "AND parent_type = " . $ilDB->quote($a_parent_type, ilDBConstants::T_INTEGER) . " " .
153  "ORDER BY meta_description_id";
154 
155  $res = $ilDB->query($query);
156  $ids = [];
157  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
158  $ids[] = (int) $row->meta_description_id;
159  }
160  return $ids;
161  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMDDescription::delete ( )

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

References $res, and ilMDBase\getMetaId().

78  : bool
79  {
80  if ($this->getMetaId()) {
81  $query = "DELETE FROM il_meta_description " .
82  "WHERE meta_description_id = " . $this->db->quote($this->getMetaId(), 'integer');
83  $res = $this->db->manipulate($query);
84 
85  return true;
86  }
87  return false;
88  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ getDescription()

ilMDDescription::getDescription ( )

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

References $description.

Referenced by __getFields(), and toXML().

37  : string
38  {
39  return $this->description;
40  }
+ Here is the caller graph for this function:

◆ getDescriptionLanguage()

ilMDDescription::getDescriptionLanguage ( )

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

48  {
49  return is_object($this->description_language) ? $this->description_language : null;
50  }

◆ getDescriptionLanguageCode()

ilMDDescription::getDescriptionLanguageCode ( )

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

Referenced by __getFields(), and toXML().

52  : string
53  {
54  return is_object($this->description_language) ? $this->description_language->getLanguageCode() : '';
55  }
+ Here is the caller graph for this function:

◆ read()

ilMDDescription::read ( )

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

References $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setDescription(), setDescriptionLanguage(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), and ilMDBase\setRBACId().

106  : bool
107  {
108  if ($this->getMetaId()) {
109  $query = "SELECT * FROM il_meta_description " .
110  "WHERE meta_description_id = " . $this->db->quote($this->getMetaId(), 'integer');
111 
112  $res = $this->db->query($query);
113  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
114  $this->setRBACId((int) $row->rbac_id);
115  $this->setObjId((int) $row->obj_id);
116  $this->setObjType($row->obj_type ?? '');
117  $this->setParentId((int) $row->parent_id);
118  $this->setParentType($row->parent_type ?? '');
119  $this->setDescription($row->description ?? '');
120  $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language ?? ''));
121  }
122  }
123  return true;
124  }
$res
Definition: ltiservices.php:69
setRBACId(int $a_id)
setDescriptionLanguage(ilMDLanguageItem $lng_obj)
setObjId(int $a_id)
setDescription(string $a_description)
setParentId(int $a_id)
setParentType(string $a_parent_type)
setObjType(string $a_type)
+ Here is the call graph for this function:

◆ save()

ilMDDescription::save ( )

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

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

57  : int
58  {
59  $fields = $this->__getFields();
60  $fields['meta_description_id'] = array('integer', $next_id = $this->db->nextId('il_meta_description'));
61 
62  if ($this->db->insert('il_meta_description', $fields)) {
63  $this->setMetaId($next_id);
64  return $this->getMetaId();
65  }
66  return 0;
67  }
setMetaId(int $a_meta_id, bool $a_read_data=true)
+ Here is the call graph for this function:

◆ setDescription()

ilMDDescription::setDescription ( string  $a_description)

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

Referenced by read().

32  : void
33  {
34  $this->description = $a_description;
35  }
+ Here is the caller graph for this function:

◆ setDescriptionLanguage()

ilMDDescription::setDescriptionLanguage ( ilMDLanguageItem  $lng_obj)

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

Referenced by read().

42  : void
43  {
44  $this->description_language = $lng_obj;
45  }
+ Here is the caller graph for this function:

◆ toXML()

ilMDDescription::toXML ( ilXmlWriter  $writer)

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

References getDescription(), getDescriptionLanguageCode(), and ilXmlWriter\xmlElement().

126  : void
127  {
128  $writer->xmlElement(
129  'Description',
130  array(
131  'Language' => $this->getDescriptionLanguageCode() ?: 'en'
132  ),
133  $this->getDescription()
134  );
135  }
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()

ilMDDescription::update ( )

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

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

69  : bool
70  {
71  return $this->getMetaId() && $this->db->update(
72  'il_meta_description',
73  $this->__getFields(),
74  array("meta_description_id" => array('integer', $this->getMetaId()))
75  );
76  }
+ Here is the call graph for this function:

Field Documentation

◆ $description

string ilMDDescription::$description = ''
private

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

Referenced by getDescription().

◆ $description_language

ilMDLanguageItem ilMDDescription::$description_language = null
private

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


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