ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 27 of file class.ilMDDescription.php.

Member Function Documentation

◆ __getFields()

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

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

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

Referenced by save(), and update().

94  : array
95  {
96  return array(
97  'rbac_id' => array('integer', $this->getRBACId()),
98  'obj_id' => array('integer', $this->getObjId()),
99  'obj_type' => array('text', $this->getObjType()),
100  'parent_type' => array('text', $this->getParentType()),
101  'parent_id' => array('integer', $this->getParentId()),
102  'description' => array('clob', $this->getDescription()),
103  'description_language' => array('text', $this->getDescriptionLanguageCode())
104  );
105  }
+ 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 143 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().

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

◆ delete()

ilMDDescription::delete ( )

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

References $res, and ilMDBase\getMetaId().

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

◆ getDescription()

ilMDDescription::getDescription ( )

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

References $description.

Referenced by __getFields(), and toXML().

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

◆ getDescriptionLanguage()

ilMDDescription::getDescriptionLanguage ( )

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

References null.

49  {
50  return is_object($this->description_language) ? $this->description_language : null;
51  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getDescriptionLanguageCode()

ilMDDescription::getDescriptionLanguageCode ( )

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

Referenced by __getFields(), and toXML().

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

◆ read()

ilMDDescription::read ( )

Definition at line 107 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().

107  : bool
108  {
109  if ($this->getMetaId()) {
110  $query = "SELECT * FROM il_meta_description " .
111  "WHERE meta_description_id = " . $this->db->quote($this->getMetaId(), 'integer');
112 
113  $res = $this->db->query($query);
114  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
115  $this->setRBACId((int) $row->rbac_id);
116  $this->setObjId((int) $row->obj_id);
117  $this->setObjType($row->obj_type ?? '');
118  $this->setParentId((int) $row->parent_id);
119  $this->setParentType($row->parent_type ?? '');
120  $this->setDescription($row->description ?? '');
121  $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language ?? ''));
122  }
123  }
124  return true;
125  }
$res
Definition: ltiservices.php:66
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 58 of file class.ilMDDescription.php.

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

58  : int
59  {
60  $fields = $this->__getFields();
61  $fields['meta_description_id'] = array('integer', $next_id = $this->db->nextId('il_meta_description'));
62 
63  if ($this->db->insert('il_meta_description', $fields)) {
64  $this->setMetaId($next_id);
65  return $this->getMetaId();
66  }
67  return 0;
68  }
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 33 of file class.ilMDDescription.php.

Referenced by read().

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

◆ setDescriptionLanguage()

ilMDDescription::setDescriptionLanguage ( ilMDLanguageItem  $lng_obj)

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

Referenced by read().

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

◆ toXML()

ilMDDescription::toXML ( ilXmlWriter  $writer)

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

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

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

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

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

Field Documentation

◆ $description

string ilMDDescription::$description = ''
private

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

Referenced by getDescription().

◆ $description_language

ilMDLanguageItem ilMDDescription::$description_language = null
private

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


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