ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilContainerGlobalProfiles Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilContainerGlobalProfiles:

Public Member Functions

 __construct (int $a_obj_id)
 
 resetProfiles ()
 
 addProfile (int $a_profile_id)
 
 removeProfile (int $a_profile_id)
 
 getProfiles ()
 
 save ()
 

Protected Member Functions

 setObjId (int $a_obj_id)
 
 getObjId ()
 
 setMemberRoleId ()
 
 getMemberRoleId ()
 
 read ()
 
 delete ()
 

Protected Attributes

ilDBInterface $db
 
array $profiles = []
 
int $obj_id = 0
 
int $mem_rol_id = 0
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Global competence profiles of a container

Author
Thomas Famula famul.nosp@m.a@le.nosp@m.ifos..nosp@m.de

Definition at line 25 of file class.ilContainerGlobalProfiles.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerGlobalProfiles::__construct ( int  $a_obj_id)

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

References $DIC, getObjId(), read(), setMemberRoleId(), and setObjId().

33  {
34  global $DIC;
35 
36  $this->db = $DIC->database();
37  $this->setObjId($a_obj_id);
38 
39  if ($this->getObjId() > 0) {
40  $this->setMemberRoleId();
41  $this->read();
42  }
43  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ addProfile()

ilContainerGlobalProfiles::addProfile ( int  $a_profile_id)

Definition at line 72 of file class.ilContainerGlobalProfiles.php.

72  : void
73  {
74  $this->profiles[$a_profile_id] = [
75  "profile_id" => $a_profile_id
76  ];
77  }

◆ delete()

ilContainerGlobalProfiles::delete ( )
protected

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

References $db, ilDBInterface\manipulate(), and ilDBInterface\quote().

105  : void
106  {
107  $db = $this->db;
108 
109  $db->manipulate(
110  "DELETE spr FROM skl_profile_role spr INNER JOIN skl_profile sp " .
111  " ON spr.profile_id = sp.id " .
112  " WHERE sp.ref_id = 0 " .
113  " AND role_id = " . $db->quote($this->getMemberRoleId(), "integer")
114  );
115  }
quote($value, string $type)
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:

◆ getMemberRoleId()

ilContainerGlobalProfiles::getMemberRoleId ( )
protected

Definition at line 62 of file class.ilContainerGlobalProfiles.php.

References $mem_rol_id.

62  : int
63  {
64  return $this->mem_rol_id;
65  }

◆ getObjId()

ilContainerGlobalProfiles::getObjId ( )
protected

Definition at line 50 of file class.ilContainerGlobalProfiles.php.

References $obj_id.

Referenced by __construct(), and setMemberRoleId().

50  : int
51  {
52  return $this->obj_id;
53  }
+ Here is the caller graph for this function:

◆ getProfiles()

ilContainerGlobalProfiles::getProfiles ( )

Definition at line 84 of file class.ilContainerGlobalProfiles.php.

References $profiles.

Referenced by ilPersonalSkillsGUI\setObjectSkillProfiles().

84  : array
85  {
86  return $this->profiles;
87  }
+ Here is the caller graph for this function:

◆ read()

ilContainerGlobalProfiles::read ( )
protected

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

References $db, ilDBInterface\fetchAssoc(), ilDBInterface\query(), and ilDBInterface\quote().

Referenced by __construct().

89  : void
90  {
91  $db = $this->db;
92 
93  $this->profiles = [];
94  $set = $db->query(
95  "SELECT spr.profile_id, spr.role_id, sp.title, sp.skill_tree_id " .
96  " FROM skl_profile_role spr INNER JOIN skl_profile sp ON spr.profile_id = sp.id " .
97  " WHERE sp.ref_id = 0 " .
98  " AND role_id = " . $db->quote($this->getMemberRoleId(), "integer")
99  );
100  while ($rec = $db->fetchAssoc($set)) {
101  $this->profiles[$rec["profile_id"]] = $rec;
102  }
103  }
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeProfile()

ilContainerGlobalProfiles::removeProfile ( int  $a_profile_id)

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

79  : void
80  {
81  unset($this->profiles[$a_profile_id]);
82  }

◆ resetProfiles()

ilContainerGlobalProfiles::resetProfiles ( )

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

67  : void
68  {
69  $this->profiles = [];
70  }

◆ save()

ilContainerGlobalProfiles::save ( )

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

References $db, ilDBInterface\manipulate(), and ilDBInterface\quote().

117  : void
118  {
119  $db = $this->db;
120 
121  $this->delete();
122  foreach ($this->profiles as $p) {
123  $db->manipulate("INSERT INTO skl_profile_role " .
124  "(role_id, profile_id) VALUES (" .
125  $db->quote($this->getMemberRoleId(), "integer") . "," .
126  $db->quote($p["profile_id"], "integer") . ")");
127  }
128  }
quote($value, string $type)
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:

◆ setMemberRoleId()

ilContainerGlobalProfiles::setMemberRoleId ( )
protected

Definition at line 55 of file class.ilContainerGlobalProfiles.php.

References $ref_id, ilObject\_getAllReferences(), ilParticipants\getDefaultMemberRole(), and getObjId().

Referenced by __construct().

55  : void
56  {
57  $refs = ilObject::_getAllReferences($this->getObjId());
58  $ref_id = end($refs);
59  $this->mem_rol_id = ilParticipants::getDefaultMemberRole($ref_id);
60  }
static _getAllReferences(int $id)
get all reference ids for object ID
static getDefaultMemberRole(int $a_ref_id)
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setObjId()

ilContainerGlobalProfiles::setObjId ( int  $a_obj_id)
protected

Definition at line 45 of file class.ilContainerGlobalProfiles.php.

Referenced by __construct().

45  : void
46  {
47  $this->obj_id = $a_obj_id;
48  }
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilContainerGlobalProfiles::$db
protected

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

Referenced by delete(), read(), and save().

◆ $mem_rol_id

int ilContainerGlobalProfiles::$mem_rol_id = 0
protected

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

Referenced by getMemberRoleId().

◆ $obj_id

int ilContainerGlobalProfiles::$obj_id = 0
protected

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

Referenced by getObjId().

◆ $profiles

array ilContainerGlobalProfiles::$profiles = []
protected

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

Referenced by getProfiles().


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