ILIAS  release_8 Revision v8.24
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 31 of file class.ilMDDescription.php.

Member Function Documentation

◆ __getFields()

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

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

98 : array
99 {
100 return array(
101 'rbac_id' => array('integer', $this->getRBACId()),
102 'obj_id' => array('integer', $this->getObjId()),
103 'obj_type' => array('text', $this->getObjType()),
104 'parent_type' => array('text', $this->getParentType()),
105 'parent_id' => array('integer', $this->getParentId()),
106 'description' => array('clob', $this->getDescription()),
107 'description_language' => array('text', $this->getDescriptionLanguageCode())
108 );
109 }

References getDescription(), getDescriptionLanguageCode(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), 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 ilMDDescription::_getIds ( int  $a_rbac_id,
int  $a_obj_id,
int  $a_parent_id,
string  $a_parent_type 
)
static
Returns
int[]

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

147 : array
148 {
149 global $DIC;
150
151 $ilDB = $DIC->database();
152
153 $query = "SELECT meta_description_id FROM il_meta_description " .
154 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, ilDBConstants::T_INTEGER) . " " .
155 "AND obj_id = " . $ilDB->quote($a_obj_id, ilDBConstants::T_INTEGER) . " " .
156 "AND parent_id = " . $ilDB->quote($a_parent_id, ilDBConstants::T_INTEGER) . " " .
157 "AND parent_type = " . $ilDB->quote($a_parent_type, ilDBConstants::T_INTEGER) . " " .
158 "ORDER BY meta_description_id";
159
160 $res = $ilDB->query($query);
161 $ids = [];
162 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
163 $ids[] = (int) $row->meta_description_id;
164 }
165 return $ids;
166 }
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$query

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

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

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

◆ delete()

ilMDDescription::delete ( )

Reimplemented from ilMDBase.

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

83 : bool
84 {
85 if ($this->getMetaId()) {
86 $query = "DELETE FROM il_meta_description " .
87 "WHERE meta_description_id = " . $this->db->quote($this->getMetaId(), 'integer');
88 $res = $this->db->manipulate($query);
89
90 return true;
91 }
92 return false;
93 }

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

+ Here is the call graph for this function:

◆ getDescription()

ilMDDescription::getDescription ( )

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

42 : string
43 {
44 return $this->description;
45 }

References $description.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescriptionLanguage()

ilMDDescription::getDescriptionLanguage ( )

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

53 {
54 return is_object($this->description_language) ? $this->description_language : null;
55 }

◆ getDescriptionLanguageCode()

ilMDDescription::getDescriptionLanguageCode ( )

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

57 : string
58 {
59 return is_object($this->description_language) ? $this->description_language->getLanguageCode() : '';
60 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ read()

ilMDDescription::read ( )

Reimplemented from ilMDBase.

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

111 : bool
112 {
113 if ($this->getMetaId()) {
114 $query = "SELECT * FROM il_meta_description " .
115 "WHERE meta_description_id = " . $this->db->quote($this->getMetaId(), 'integer');
116
117 $res = $this->db->query($query);
118 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
119 $this->setRBACId((int) $row->rbac_id);
120 $this->setObjId((int) $row->obj_id);
121 $this->setObjType($row->obj_type);
122 $this->setParentId((int) $row->parent_id);
123 $this->setParentType($row->parent_type);
124 $this->setDescription((string) $row->description);
125 $this->setDescriptionLanguage(new ilMDLanguageItem((string) $row->description_language));
126 }
127 }
128 return true;
129 }
setObjType(string $a_type)
setParentType(string $a_parent_type)
setObjId(int $a_id)
setRBACId(int $a_id)
setParentId(int $a_id)
setDescriptionLanguage(ilMDLanguageItem $lng_obj)
setDescription(string $a_description)

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

+ Here is the call graph for this function:

◆ save()

ilMDDescription::save ( )

Reimplemented from ilMDBase.

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

62 : int
63 {
64 $fields = $this->__getFields();
65 $fields['meta_description_id'] = array('integer', $next_id = $this->db->nextId('il_meta_description'));
66
67 if ($this->db->insert('il_meta_description', $fields)) {
68 $this->setMetaId($next_id);
69 return $this->getMetaId();
70 }
71 return 0;
72 }
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:

◆ setDescription()

ilMDDescription::setDescription ( string  $a_description)

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

37 : void
38 {
39 $this->description = $a_description;
40 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescriptionLanguage()

ilMDDescription::setDescriptionLanguage ( ilMDLanguageItem  $lng_obj)

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

47 : void
48 {
49 $this->description_language = $lng_obj;
50 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toXML()

ilMDDescription::toXML ( ilXmlWriter  $writer)

Reimplemented from ilMDBase.

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

131 : void
132 {
133 $writer->xmlElement(
134 'Description',
135 array(
136 'Language' => $this->getDescriptionLanguageCode() ?: 'en'
137 ),
138 $this->getDescription()
139 );
140 }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)

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

+ Here is the call graph for this function:

◆ update()

ilMDDescription::update ( )

Reimplemented from ilMDBase.

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

74 : bool
75 {
76 return $this->getMetaId() && $this->db->update(
77 'il_meta_description',
78 $this->__getFields(),
79 array("meta_description_id" => array('integer', $this->getMetaId()))
80 );
81 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $description

string ilMDDescription::$description = ''
private

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

Referenced by getDescription().

◆ $description_language

ilMDLanguageItem ilMDDescription::$description_language = null
private

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


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