ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.

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

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

+ 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.

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 }

◆ delete()

ilContainerSkills::delete ( )

Delete.

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

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

References $db.

◆ getId()

ilContainerSkills::getId ( )

Get id.

Returns
int object id

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

References $id.

Referenced by ilContSkillMemberTableGUI\__construct().

+ Here is the caller graph for this function:

◆ getOrderedSkills()

ilContainerSkills::getOrderedSkills ( )

Get odered skills.

Parameters

return

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

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 }

References getSkills().

+ Here is the call graph for this function:

◆ getSkills()

ilContainerSkills::getSkills ( )

Get skills.

Returns

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

105 {
106 return $this->skills;
107 }

References $skills.

Referenced by getOrderedSkills().

+ Here is the caller graph for this function:

◆ read()

ilContainerSkills::read ( )

Read.

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

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 }

References $db.

Referenced by __construct().

+ 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.

69 {
70 $this->skills = array();
71 }

◆ save()

ilContainerSkills::save ( )

Save.

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

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

References $db, and $s.

◆ setId()

ilContainerSkills::setId (   $a_val)

Set id.

Parameters
int$a_valobject id

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

51 {
52 $this->id = $a_val;
53 }

Referenced by __construct().

+ 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: