ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilContainerSkills Class Reference

Skills of a container. More...

+ Collaboration diagram for ilContainerSkills:

Public Member Functions

 __construct ($a_obj_id)
 Constrictor. More...
 
 setId ($a_val)
 Set id. More...
 
 getId ()
 Get id. More...
 
 resetSkills ()
 Reset skills. More...
 
 addSkill ($a_skill_id, $a_tref_id)
 Add skill. More...
 
 removeSkill ($a_skill_id, $a_tref_id)
 Remove skill. More...
 
 getSkills ()
 Get skills. More...
 
 getOrderedSkills ()
 Get odered skills. More...
 
 read ()
 Read. More...
 
 delete ()
 Delete. More...
 
 save ()
 Save. More...
 

Protected Attributes

 $db
 
 $skills = array()
 
 $id
 

Detailed Description

Skills of a container.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilContainerSkills::__construct (   $a_obj_id)

Constrictor.

Parameters
int$a_obj_id

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

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

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

Member Function Documentation

◆ addSkill()

ilContainerSkills::addSkill (   $a_skill_id,
  $a_tref_id 
)

Add skill.

Parameters
int$a_skill_idskill id
int$a_valtref id

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

References array.

80  {
81  $this->skills[$a_skill_id . "-" . $a_tref_id] = array(
82  "skill_id" => $a_skill_id,
83  "tref_id" => $a_tref_id
84  );
85  }
Create styles array
The data for the language used.

◆ delete()

ilContainerSkills::delete ( )

Delete.

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

References $db.

142  {
143  $db = $this->db;
144 
145  $db->manipulate("DELETE FROM cont_skills WHERE " .
146  " id = " . $db->quote($this->getId(), "integer"));
147  }

◆ getId()

ilContainerSkills::getId ( )

Get id.

Returns
int object id

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

References $id.

Referenced by ilContSkillMemberTableGUI\__construct().

61  {
62  return $this->id;
63  }
+ Here is the caller graph for this function:

◆ getOrderedSkills()

ilContainerSkills::getOrderedSkills ( )

Get odered skills.

Parameters

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

References getSkills().

116  {
117  include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
118  $vtree = new ilVirtualSkillTree();
119  return $vtree->getOrderedNodeset($this->getSkills(), "skill_id", "tref_id");
120  }
+ Here is the call graph for this function:

◆ getSkills()

ilContainerSkills::getSkills ( )

Get skills.

Returns

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

References $skills.

Referenced by getOrderedSkills().

105  {
106  return $this->skills;
107  }
+ Here is the caller graph for this function:

◆ read()

ilContainerSkills::read ( )

Read.

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

References $db, and array.

Referenced by __construct().

127  {
128  $db = $this->db;
129 
130  $this->skills = array();
131  $set = $db->query("SELECT * FROM cont_skills " .
132  " WHERE id = " . $db->quote($this->getId(), "integer"));
133  while ($rec = $db->fetchAssoc($set)) {
134  $this->skills[$rec["skill_id"] . "-" . $rec["tref_id"]] = $rec;
135  }
136  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ removeSkill()

ilContainerSkills::removeSkill (   $a_skill_id,
  $a_tref_id 
)

Remove skill.

Parameters
int$a_skill_idskill id
int$a_valtref id

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

94  {
95  unset($this->skills[$a_skill_id . "-" . $a_tref_id]);
96  }

◆ resetSkills()

ilContainerSkills::resetSkills ( )

Reset skills.

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

References array.

69  {
70  $this->skills = array();
71  }
Create styles array
The data for the language used.

◆ save()

ilContainerSkills::save ( )

Save.

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

References $db, and $s.

153  {
154  $db = $this->db;
155 
156  $this->delete();
157  foreach ($this->skills as $s) {
158  $db->manipulate("INSERT INTO cont_skills " .
159  "(id, skill_id, tref_id) VALUES (" .
160  $db->quote($this->getId(), "integer") . "," .
161  $db->quote($s["skill_id"], "integer") . "," .
162  $db->quote($s["tref_id"], "integer") . ")");
163  }
164  }
$s
Definition: pwgen.php:45

◆ setId()

ilContainerSkills::setId (   $a_val)

Set id.

Parameters
int$a_valobject id

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

Referenced by __construct().

51  {
52  $this->id = $a_val;
53  }
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilContainerSkills::$db
protected

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

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

◆ $id

ilContainerSkills::$id
protected

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

Referenced by getId().

◆ $skills

ilContainerSkills::$skills = array()
protected

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

Referenced by getSkills().


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