ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilContainerGlobalProfiles Class Reference

Global competence profiles of a container. More...

+ Collaboration diagram for ilContainerGlobalProfiles:

Public Member Functions

 __construct (int $a_obj_id)
 Constructor. More...
 
 resetProfiles ()
 Reset profiles. More...
 
 addProfile (int $a_profile_id)
 Add profile. More...
 
 removeProfile (int $a_profile_id)
 Remove profile. More...
 
 getProfiles ()
 Get profiles. More...
 
 save ()
 Save. More...
 

Protected Member Functions

 setObjId (int $a_obj_id)
 Set object id. More...
 
 getObjId ()
 Get object id. More...
 
 setMemberRoleId ()
 Set member role id of object. More...
 
 getMemberRoleId ()
 Get member role id of object. More...
 
 read ()
 Read. More...
 
 delete ()
 Delete. More...
 

Protected Attributes

 $db
 
 $profiles = array()
 
 $obj_id
 
 $mem_rol_id
 

Detailed Description

Global competence profiles of a container.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilContainerGlobalProfiles::__construct ( int  $a_obj_id)

Constructor.

Parameters
int$a_obj_id

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

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

38  {
39  global $DIC;
40 
41  $this->db = $DIC->database();
42  $this->setObjId($a_obj_id);
43 
44  if ($this->getObjId() > 0) {
45  $this->setMemberRoleId();
46  $this->read();
47  }
48  }
setMemberRoleId()
Set member role id of object.
global $DIC
Definition: goto.php:24
setObjId(int $a_obj_id)
Set object id.
+ Here is the call graph for this function:

Member Function Documentation

◆ addProfile()

ilContainerGlobalProfiles::addProfile ( int  $a_profile_id)

Add profile.

Parameters
int$a_profile_id

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

106  {
107  $this->profiles[$a_profile_id] = array(
108  "profile_id" => $a_profile_id
109  );
110  }

◆ delete()

ilContainerGlobalProfiles::delete ( )
protected

Delete.

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

References $db.

155  {
156  $db = $this->db;
157 
158  $db->manipulate(
159  "DELETE spr FROM skl_profile_role spr INNER JOIN skl_profile sp " .
160  " ON spr.profile_id = sp.id " .
161  " WHERE sp.ref_id = 0 " .
162  " AND role_id = " . $db->quote($this->getMemberRoleId(), "integer")
163  );
164  }

◆ getMemberRoleId()

ilContainerGlobalProfiles::getMemberRoleId ( )
protected

Get member role id of object.

Returns
int member role id

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

References $mem_rol_id.

87  : int
88  {
89  return $this->mem_rol_id;
90  }

◆ getObjId()

ilContainerGlobalProfiles::getObjId ( )
protected

Get object id.

Returns
int object id

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

References $obj_id.

Referenced by __construct(), and setMemberRoleId().

65  : int
66  {
67  return $this->obj_id;
68  }
+ Here is the caller graph for this function:

◆ getProfiles()

ilContainerGlobalProfiles::getProfiles ( )

Get profiles.

Returns
array

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

References $profiles.

Referenced by ilPersonalSkillsGUI\setObjectSkillProfiles().

127  : array
128  {
129  return $this->profiles;
130  }
+ Here is the caller graph for this function:

◆ read()

ilContainerGlobalProfiles::read ( )
protected

Read.

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

References $db.

Referenced by __construct().

136  {
137  $db = $this->db;
138 
139  $this->profiles = array();
140  $set = $db->query(
141  "SELECT spr.profile_id, spr.role_id, sp.title FROM skl_profile_role spr INNER JOIN skl_profile sp " .
142  " ON spr.profile_id = sp.id " .
143  " WHERE sp.ref_id = 0 " .
144  " AND role_id = " . $db->quote($this->getMemberRoleId(), "integer")
145  );
146  while ($rec = $db->fetchAssoc($set)) {
147  $this->profiles[$rec["profile_id"]] = $rec;
148  }
149  }
+ Here is the caller graph for this function:

◆ removeProfile()

ilContainerGlobalProfiles::removeProfile ( int  $a_profile_id)

Remove profile.

Parameters
int$a_profile_id

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

118  {
119  unset($this->profiles[$a_profile_id]);
120  }

◆ resetProfiles()

ilContainerGlobalProfiles::resetProfiles ( )

Reset profiles.

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

96  {
97  $this->profiles = array();
98  }

◆ save()

ilContainerGlobalProfiles::save ( )

Save.

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

References $db.

170  {
171  $db = $this->db;
172 
173  $this->delete();
174  foreach ($this->profiles as $p) {
175  $db->manipulate("INSERT INTO skl_profile_role " .
176  "(role_id, profile_id) VALUES (" .
177  $db->quote($this->getMemberRoleId(), "integer") . "," .
178  $db->quote($p["profile_id"], "integer") . ")");
179  }
180  }

◆ setMemberRoleId()

ilContainerGlobalProfiles::setMemberRoleId ( )
protected

Set member role id of object.

Parameters
int$a_obj_idobject id

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

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

Referenced by __construct().

76  {
77  $refs = ilObject::_getAllReferences($this->getObjId());
78  $ref_id = end($refs);
79  $this->mem_rol_id = ilParticipants::getDefaultMemberRole($ref_id);
80  }
static getDefaultMemberRole($a_ref_id)
static _getAllReferences($a_id)
get all reference ids of object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setObjId()

ilContainerGlobalProfiles::setObjId ( int  $a_obj_id)
protected

Set object id.

Parameters
int$a_obj_idobject id

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

Referenced by __construct().

56  {
57  $this->obj_id = $a_obj_id;
58  }
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilContainerGlobalProfiles::$db
protected

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

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

◆ $mem_rol_id

int ilContainerGlobalProfiles::$mem_rol_id
protected

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

Referenced by getMemberRoleId().

◆ $obj_id

ilContainerGlobalProfiles::$obj_id
protected

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

Referenced by getObjId().

◆ $profiles

ilContainerGlobalProfiles::$profiles = array()
protected

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

Referenced by getProfiles().


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