ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilContainerSkills Class Reference

Skills of a container. More...

+ Collaboration diagram for ilContainerSkills:

Public Member Functions

 __construct (int $a_obj_id)
 
 setId (int $a_val)
 
 getId ()
 
 resetSkills ()
 
 addSkill (int $a_skill_id, int $a_tref_id)
 
 removeSkill (int $a_skill_id, int $a_tref_id)
 
 getSkills ()
 
 getOrderedSkills ()
 
 read ()
 
 delete ()
 
 save ()
 

Protected Attributes

ilDBInterface $db
 
SkillTreeService $tree_service
 
array $skills = []
 
int $id = 0
 

Detailed Description

Skills of a container.

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilContainerSkills::__construct ( int  $a_obj_id)

Definition at line 34 of file class.ilContainerSkills.php.

References $DIC, read(), and setId().

35  {
36  global $DIC;
37 
38  $this->db = $DIC->database();
39  $this->tree_service = $DIC->skills()->tree();
40 
41  $this->setId($a_obj_id);
42  if ($a_obj_id > 0) {
43  $this->read();
44  }
45  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ addSkill()

ilContainerSkills::addSkill ( int  $a_skill_id,
int  $a_tref_id 
)

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

62  : void
63  {
64  $this->skills[$a_skill_id . "-" . $a_tref_id] = [
65  "skill_id" => $a_skill_id,
66  "tref_id" => $a_tref_id
67  ];
68  }

◆ delete()

ilContainerSkills::delete ( )

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

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

101  : void
102  {
103  $db = $this->db;
104 
105  $db->manipulate("DELETE FROM cont_skills WHERE " .
106  " id = " . $db->quote($this->getId(), "integer"));
107  }
quote($value, string $type)
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:

◆ getId()

ilContainerSkills::getId ( )

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

References $id.

Referenced by ilContSkillMemberTableGUI\__construct().

52  : int
53  {
54  return $this->id;
55  }
+ Here is the caller graph for this function:

◆ getOrderedSkills()

ilContainerSkills::getOrderedSkills ( )
Returns
array[]|string[]

Definition at line 83 of file class.ilContainerSkills.php.

References getSkills().

83  : array
84  {
85  $vtree = $this->tree_service->getGlobalVirtualSkillTree();
86  return $vtree->getOrderedNodeset($this->getSkills(), "skill_id", "tref_id");
87  }
+ Here is the call graph for this function:

◆ getSkills()

ilContainerSkills::getSkills ( )

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

References $skills.

Referenced by getOrderedSkills().

75  : array
76  {
77  return $this->skills;
78  }
+ Here is the caller graph for this function:

◆ read()

ilContainerSkills::read ( )

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

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

Referenced by __construct().

89  : void
90  {
91  $db = $this->db;
92 
93  $this->skills = [];
94  $set = $db->query("SELECT * FROM cont_skills " .
95  " WHERE id = " . $db->quote($this->getId(), "integer"));
96  while ($rec = $db->fetchAssoc($set)) {
97  $this->skills[$rec["skill_id"] . "-" . $rec["tref_id"]] = $rec;
98  }
99  }
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:

◆ removeSkill()

ilContainerSkills::removeSkill ( int  $a_skill_id,
int  $a_tref_id 
)

Definition at line 70 of file class.ilContainerSkills.php.

70  : void
71  {
72  unset($this->skills[$a_skill_id . "-" . $a_tref_id]);
73  }

◆ resetSkills()

ilContainerSkills::resetSkills ( )

Definition at line 57 of file class.ilContainerSkills.php.

57  : void
58  {
59  $this->skills = [];
60  }

◆ save()

ilContainerSkills::save ( )

Definition at line 109 of file class.ilContainerSkills.php.

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

109  : void
110  {
111  $db = $this->db;
112 
113  $this->delete();
114  foreach ($this->skills as $s) {
115  $db->manipulate("INSERT INTO cont_skills " .
116  "(id, skill_id, tref_id) VALUES (" .
117  $db->quote($this->getId(), "integer") . "," .
118  $db->quote($s["skill_id"], "integer") . "," .
119  $db->quote($s["tref_id"], "integer") . ")");
120  }
121  }
quote($value, string $type)
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:

◆ setId()

ilContainerSkills::setId ( int  $a_val)

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

Referenced by __construct().

47  : void
48  {
49  $this->id = $a_val;
50  }
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilContainerSkills::$db
protected

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

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

◆ $id

int ilContainerSkills::$id = 0
protected

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

Referenced by getId().

◆ $skills

array ilContainerSkills::$skills = []
protected

Definition at line 31 of file class.ilContainerSkills.php.

Referenced by getSkills().

◆ $tree_service

SkillTreeService ilContainerSkills::$tree_service
protected

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


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