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

References getFormat(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

Referenced by save(), and update().

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

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

Referenced by ilMDTechnical\getFormatIds().

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  }
$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()

ilMDFormat::delete ( )

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

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

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

◆ getFormat()

ilMDFormat::getFormat ( )

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

References $format.

Referenced by __getFields(), and toXML().

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

◆ read()

ilMDFormat::read ( )

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

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

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

◆ save()

ilMDFormat::save ( )

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

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

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

◆ setFormat()

ilMDFormat::setFormat ( string  $a_format)

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

Referenced by read().

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

◆ toXML()

ilMDFormat::toXML ( ilXmlWriter  $writer)

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

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

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

◆ update()

ilMDFormat::update ( )

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

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

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