ILIAS  release_8 Revision v8.23
ilMDOrComposite Class Reference
+ Inheritance diagram for ilMDOrComposite:
+ Collaboration diagram for ilMDOrComposite:

Public Member Functions

 setOrCompositeId (int $a_or_composite_id)
 
 getOrCompositeId ()
 
 getRequirementIds ()
 
 getRequirement (int $a_requirement_id)
 
 addRequirement ()
 
 save ()
 
 delete ()
 
 toXML (ilXmlWriter $writer)
 
- Public Member Functions inherited from ilMDRequirement
 setOrCompositeId (int $a_or_composite_id)
 
 getOrCompositeId ()
 
 setOperatingSystemName (string $a_val)
 
 getOperatingSystemName ()
 
 setOperatingSystemMinimumVersion (string $a_val)
 
 getOperatingSystemMinimumVersion ()
 
 setOperatingSystemMaximumVersion (string $a_val)
 
 getOperatingSystemMaximumVersion ()
 
 setBrowserName (string $a_val)
 
 getBrowserName ()
 
 setBrowserMinimumVersion (string $a_val)
 
 getBrowserMinimumVersion ()
 
 setBrowserMaximumVersion (string $a_val)
 
 getBrowserMaximumVersion ()
 
 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, int $a_or_composite_id=0)
 
- Static Public Member Functions inherited from ilMDRequirement
static _getIds (int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type, int $a_or_composite_id=0)
 

Private Attributes

int $or_composite_id = 0
 

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

◆ _getIds()

static ilMDOrComposite::_getIds ( int  $a_rbac_id,
int  $a_obj_id,
int  $a_parent_id,
string  $a_parent_type,
int  $a_or_composite_id = 0 
)
static
Returns
int[]

Definition at line 125 of file class.ilMDOrComposite.php.

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

Referenced by ilMDTechnical\getOrCompositeIds().

131  : array {
132  global $DIC;
133 
134  $ilDB = $DIC->database();
135 
136  $query = "SELECT DISTINCT(or_composite_id) or_composite_id FROM il_meta_requirement " .
137  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
138  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
139  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
140  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text') . " " .
141  "AND or_composite_id > 0 ";
142 
143  $res = $ilDB->query($query);
144  $ids = [];
145  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
146  $ids[] = (int) $row->or_composite_id;
147  }
148  return $ids;
149  }
$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:

◆ addRequirement()

ilMDOrComposite::addRequirement ( )

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

References XapiProxy\$req, ilMDBase\getObjId(), ilMDBase\getObjType(), getOrCompositeId(), ilMDBase\getParentId(), and ilMDBase\getRBACId().

79  {
80  $req = new ilMDRequirement($this->getRBACId(), $this->getObjId(), $this->getObjType());
81  $req->setParentId($this->getParentId());
82  $req->setParentType('meta_technical');
83  $req->setOrCompositeId($this->getOrCompositeId());
84 
85  return $req;
86  }
catch(\Exception $e) $req
Definition: xapiproxy.php:93
+ Here is the call graph for this function:

◆ delete()

ilMDOrComposite::delete ( )

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

References $id, XapiProxy\$req, getRequirement(), and getRequirementIds().

94  : bool
95  {
96  foreach ($this->getRequirementIds() as $id) {
97  $req = $this->getRequirement($id);
98  $req->delete();
99  }
100  return true;
101  }
catch(\Exception $e) $req
Definition: xapiproxy.php:93
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getRequirement(int $a_requirement_id)
+ Here is the call graph for this function:

◆ getOrCompositeId()

ilMDOrComposite::getOrCompositeId ( )

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

References $or_composite_id, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getObjId(), ilMDBase\getRBACId(), and ILIAS\Repository\int().

Referenced by addRequirement(), and getRequirementIds().

37  : int
38  {
39  if (!$this->or_composite_id) {
40  $query = "SELECT MAX(or_composite_id) orc FROM il_meta_requirement " .
41  "WHERE rbac_id = " . $this->db->quote($this->getRBACId(), 'integer') . " " .
42  "AND obj_id = " . $this->db->quote($this->getObjId(), 'integer') . " ";
43 
44  $res = $this->db->query($query);
45  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
46  $this->or_composite_id = (int) $row->orc;
47  }
49  }
51  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRequirement()

ilMDOrComposite::getRequirement ( int  $a_requirement_id)

Definition at line 67 of file class.ilMDOrComposite.php.

References XapiProxy\$req.

Referenced by delete(), and toXML().

68  {
69  if (!$a_requirement_id) {
70  return null;
71  }
72  $req = new ilMDRequirement();
73  $req->setMetaId($a_requirement_id);
74 
75  return $req;
76  }
catch(\Exception $e) $req
Definition: xapiproxy.php:93
+ Here is the caller graph for this function:

◆ getRequirementIds()

ilMDOrComposite::getRequirementIds ( )
Returns
int[]

Definition at line 56 of file class.ilMDOrComposite.php.

References ilMDRequirement\_getIds(), ilMDBase\getObjId(), getOrCompositeId(), ilMDBase\getParentId(), and ilMDBase\getRBACId().

Referenced by delete(), and toXML().

56  : array
57  {
59  $this->getRBACId(),
60  $this->getObjId(),
61  $this->getParentId(),
62  'meta_technical',
63  $this->getOrCompositeId()
64  );
65  }
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type, int $a_or_composite_id=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilMDOrComposite::save ( )

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

88  : int
89  {
90  echo 'Use ilMDOrcomposite::addRequirement()';
91  return 0;
92  }

◆ setOrCompositeId()

ilMDOrComposite::setOrCompositeId ( int  $a_or_composite_id)

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

32  : void
33  {
34  $this->or_composite_id = $a_or_composite_id;
35  }

◆ toXML()

ilMDOrComposite::toXML ( ilXmlWriter  $writer)

Definition at line 103 of file class.ilMDOrComposite.php.

References $id, XapiProxy\$req, ilMDBase\getObjId(), ilMDBase\getRBACId(), getRequirement(), getRequirementIds(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

103  : void
104  {
105  // For all requirements
106  $writer->xmlStartTag('OrComposite');
107 
108  $reqs = $this->getRequirementIds();
109  foreach ($reqs as $id) {
110  $req = $this->getRequirement($id);
111  $req->toXML($writer);
112  }
113  if (!count($reqs)) {
114  $req = new ilMDRequirement($this->getRBACId(), $this->getObjId());
115  $req->toXML($writer);
116  }
117  $writer->xmlEndTag('OrComposite');
118  }
catch(\Exception $e) $req
Definition: xapiproxy.php:93
xmlEndTag(string $tag)
Writes an endtag.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getRequirement(int $a_requirement_id)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
+ Here is the call graph for this function:

Field Documentation

◆ $or_composite_id

int ilMDOrComposite::$or_composite_id = 0
private

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

Referenced by getOrCompositeId().


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