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

Public Member Functions

 setFormat (string $a_format)
 
 getFormat ()
 
 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 $format = ''
 

Additional Inherited Members

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

Detailed Description

Definition at line 27 of file class.ilMDFormat.php.

Member Function Documentation

◆ __getFields()

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

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

78 : array
79 {
80 return array(
81 'rbac_id' => array('integer', $this->getRBACId()),
82 'obj_id' => array('integer', $this->getObjId()),
83 'obj_type' => array('text', $this->getObjType()),
84 'format' => array('text', $this->getFormat())
85 );
86 }

References getFormat(), 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 ilMDFormat::_getIds ( int  $a_rbac_id,
int  $a_obj_id 
)
static
Returns
int[]

Definition at line 117 of file class.ilMDFormat.php.

117 : array
118 {
119 global $DIC;
120
121 $ilDB = $DIC->database();
122
123 $query = "SELECT meta_format_id FROM il_meta_format " .
124 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
125 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
126
127 $res = $ilDB->query($query);
128 $ids = [];
129 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
130 $ids[] = (int) $row->meta_format_id;
131 }
132 return $ids;
133 }
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 ilMDTechnical\getFormatIds().

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

◆ delete()

ilMDFormat::delete ( )

Reimplemented from ilMDBase.

Definition at line 63 of file class.ilMDFormat.php.

63 : bool
64 {
65 if ($this->getMetaId()) {
66 $query = "DELETE FROM il_meta_format " .
67 "WHERE meta_format_id = " . $this->db->quote($this->getMetaId(), 'integer');
68 $res = $this->db->manipulate($query);
69
70 return true;
71 }
72 return false;
73 }

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

+ Here is the call graph for this function:

◆ getFormat()

ilMDFormat::getFormat ( )

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

37 : string
38 {
39 return $this->format;
40 }

References $format.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ read()

ilMDFormat::read ( )

Reimplemented from ilMDBase.

Definition at line 88 of file class.ilMDFormat.php.

88 : bool
89 {
90 if ($this->getMetaId()) {
91 $query = "SELECT * FROM il_meta_format " .
92 "WHERE meta_format_id = " . $this->db->quote($this->getMetaId(), 'integer');
93
94 $res = $this->db->query($query);
95 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
96 $this->setRBACId((int) $row->rbac_id);
97 $this->setObjId((int) $row->obj_id);
98 $this->setObjType($row->obj_type);
99 $this->setFormat($row->format ?? '');
100 }
101 }
102 return true;
103 }
setObjType(string $a_type)
setObjId(int $a_id)
setRBACId(int $a_id)
setFormat(string $a_format)

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

+ Here is the call graph for this function:

◆ save()

ilMDFormat::save ( )

Reimplemented from ilMDBase.

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

42 : int
43 {
44 $fields = $this->__getFields();
45 $fields['meta_format_id'] = array('integer', $next_id = $this->db->nextId('il_meta_format'));
46
47 if ($this->db->insert('il_meta_format', $fields)) {
48 $this->setMetaId($next_id);
49 return $this->getMetaId();
50 }
51 return 0;
52 }
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:

◆ setFormat()

ilMDFormat::setFormat ( string  $a_format)

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

32 : void
33 {
34 $this->format = $a_format;
35 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toXML()

ilMDFormat::toXML ( ilXmlWriter  $writer)

Reimplemented from ilMDBase.

Definition at line 105 of file class.ilMDFormat.php.

105 : void
106 {
107 if ($this->getFormat()) {
108 $writer->xmlElement('Format', null, $this->getFormat());
109 }
110 }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)

References getFormat(), and ilXmlWriter\xmlElement().

+ Here is the call graph for this function:

◆ update()

ilMDFormat::update ( )

Reimplemented from ilMDBase.

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

54 : bool
55 {
56 return $this->getMetaId() && $this->db->update(
57 'il_meta_format',
58 $this->__getFields(),
59 array("meta_format_id" => array('integer', $this->getMetaId()))
60 );
61 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $format

string ilMDFormat::$format = ''
private

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

Referenced by getFormat().


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