ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMDLocation Class Reference
+ Inheritance diagram for ilMDLocation:
+ Collaboration diagram for ilMDLocation:

Public Member Functions

 setLocation (string $a_location)
 
 getLocation ()
 
 setLocationType (string $a_location_type)
 
 getLocationType ()
 
 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 $location = ''
 
string $location_type = ''
 

Additional Inherited Members

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

Detailed Description

Definition at line 26 of file class.ilMDLocation.php.

Member Function Documentation

◆ __getFields()

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

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

References getLocation(), getLocationType(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), and ilMDBase\getRBACId().

Referenced by save(), and update().

88  : array
89  {
90  return array(
91  'rbac_id' => array('integer', $this->getRBACId()),
92  'obj_id' => array('integer', $this->getObjId()),
93  'obj_type' => array('text', $this->getObjType()),
94  'parent_type' => array('text', $this->getParentType()),
95  'parent_id' => array('integer', $this->getParentId()),
96  'location' => array('text', $this->getLocation()),
97  'location_type' => array('text', $this->getLocationType())
98  );
99  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIds()

static ilMDLocation::_getIds ( int  $a_rbac_id,
int  $a_obj_id,
int  $a_parent_id,
string  $a_parent_type 
)
static
Returns
int[]

Definition at line 137 of file class.ilMDLocation.php.

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

Referenced by ilMDTechnical\getLocationIds().

137  : array
138  {
139  global $DIC;
140 
141  $ilDB = $DIC->database();
142 
143  $query = "SELECT meta_location_id FROM il_meta_location " .
144  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
145  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
146  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
147  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
148 
149  $res = $ilDB->query($query);
150  $ids = [];
151  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
152  $ids[] = (int) $row->meta_location_id;
153  }
154  return $ids;
155  }
$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()

ilMDLocation::delete ( )

Definition at line 73 of file class.ilMDLocation.php.

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

73  : bool
74  {
75  if ($this->getMetaId()) {
76  $query = "DELETE FROM il_meta_location " .
77  "WHERE meta_location_id = " . $this->db->quote($this->getMetaId(), 'integer');
78  $res = $this->db->manipulate($query);
79 
80  return true;
81  }
82  return false;
83  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:

◆ getLocation()

ilMDLocation::getLocation ( )

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

References $location.

Referenced by __getFields(), and toXML().

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

◆ getLocationType()

ilMDLocation::getLocationType ( )

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

References $location_type.

Referenced by __getFields(), and toXML().

47  : string
48  {
49  return $this->location_type;
50  }
+ Here is the caller graph for this function:

◆ read()

ilMDLocation::read ( )

Definition at line 101 of file class.ilMDLocation.php.

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

101  : bool
102  {
103  if ($this->getMetaId()) {
104  $query = "SELECT * FROM il_meta_location " .
105  "WHERE meta_location_id = " . $this->db->quote($this->getMetaId(), 'integer');
106 
107  $res = $this->db->query($query);
108  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
109  $this->setRBACId((int) $row->rbac_id);
110  $this->setObjId((int) $row->obj_id);
111  $this->setObjType($row->obj_type);
112  $this->setParentId((int) $row->parent_id);
113  $this->setParentType($row->parent_type);
114  $this->setLocation($row->location ?? '');
115  $this->setLocationType($row->location_type ?? '');
116  }
117  }
118  return true;
119  }
$res
Definition: ltiservices.php:69
setLocationType(string $a_location_type)
setRBACId(int $a_id)
setObjId(int $a_id)
$query
setParentId(int $a_id)
setParentType(string $a_parent_type)
setObjType(string $a_type)
setLocation(string $a_location)
+ Here is the call graph for this function:

◆ save()

ilMDLocation::save ( )

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

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

52  : int
53  {
54  $fields = $this->__getFields();
55  $fields['meta_location_id'] = array('integer', $next_id = $this->db->nextId('il_meta_location'));
56 
57  if ($this->db->insert('il_meta_location', $fields)) {
58  $this->setMetaId($next_id);
59  return $this->getMetaId();
60  }
61  return 0;
62  }
setMetaId(int $a_meta_id, bool $a_read_data=true)
+ Here is the call graph for this function:

◆ setLocation()

ilMDLocation::setLocation ( string  $a_location)

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

Referenced by read().

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

◆ setLocationType()

ilMDLocation::setLocationType ( string  $a_location_type)

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

Referenced by read().

42  : void
43  {
44  $this->location_type = $a_location_type;
45  }
+ Here is the caller graph for this function:

◆ toXML()

ilMDLocation::toXML ( ilXmlWriter  $writer)

Definition at line 121 of file class.ilMDLocation.php.

References getLocation(), getLocationType(), and ilXmlWriter\xmlElement().

121  : void
122  {
123  $writer->xmlElement(
124  'Location',
125  array(
126  'Type' => $this->getLocationType() ?: 'LocalFile'
127  ),
128  $this->getLocation()
129  );
130  }
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()

ilMDLocation::update ( )

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

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

64  : bool
65  {
66  return $this->getMetaId() && $this->db->update(
67  'il_meta_location',
68  $this->__getFields(),
69  array("meta_location_id" => array('integer', $this->getMetaId()))
70  );
71  }
+ Here is the call graph for this function:

Field Documentation

◆ $location

string ilMDLocation::$location = ''
private

Definition at line 28 of file class.ilMDLocation.php.

Referenced by getLocation().

◆ $location_type

string ilMDLocation::$location_type = ''
private

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

Referenced by getLocationType().


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