ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 28 of file class.ilMDFormat.php.

Member Function Documentation

◆ __getFields()

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

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

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

Referenced by save(), and update().

79  : array
80  {
81  return array(
82  'rbac_id' => array('integer', $this->getRBACId()),
83  'obj_id' => array('integer', $this->getObjId()),
84  'obj_type' => array('text', $this->getObjType()),
85  'format' => array('text', $this->getFormat())
86  );
87  }
+ 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 118 of file class.ilMDFormat.php.

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

Referenced by ilMDTechnical\getFormatIds().

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

ilMDFormat::delete ( )

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

References $res, and ilMDBase\getMetaId().

64  : bool
65  {
66  if ($this->getMetaId()) {
67  $query = "DELETE FROM il_meta_format " .
68  "WHERE meta_format_id = " . $this->db->quote($this->getMetaId(), 'integer');
69  $res = $this->db->manipulate($query);
70 
71  return true;
72  }
73  return false;
74  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ getFormat()

ilMDFormat::getFormat ( )

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

References $format.

Referenced by __getFields(), and toXML().

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

◆ read()

ilMDFormat::read ( )

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

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

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

◆ save()

ilMDFormat::save ( )

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

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

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

Referenced by read().

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

◆ toXML()

ilMDFormat::toXML ( ilXmlWriter  $writer)

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

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

106  : void
107  {
108  if ($this->getFormat()) {
109  $writer->xmlElement('Format', null, $this->getFormat());
110  }
111  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 55 of file class.ilMDFormat.php.

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

55  : bool
56  {
57  return $this->getMetaId() && $this->db->update(
58  'il_meta_format',
59  $this->__getFields(),
60  array("meta_format_id" => array('integer', $this->getMetaId()))
61  );
62  }
+ Here is the call graph for this function:

Field Documentation

◆ $format

string ilMDFormat::$format = ''
private

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

Referenced by getFormat().


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