ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSkillProfile Class Reference

Skill profile. More...

+ Inheritance diagram for ilSkillProfile:
+ Collaboration diagram for ilSkillProfile:

Public Member Functions

 __construct ($a_id=0)
 Constructor.
 setId ($a_val)
 Set id.
 getId ()
 Get id.
 setTitle ($a_val)
 Set title.
 getTitle ()
 Get title.
 setDescription ($a_val)
 Set description.
 getDescription ()
 Get description.
 addSkillLevel ($a_base_skill_id, $a_tref_id, $a_level_id)
 Add skill level.
 removeSkillLevel ($a_base_skill_id, $a_tref_id, $a_level_id)
 Remove skill level.
 getSkillLevels ()
 Get skill levels.
 read ()
 Read skill profile from db.
 create ()
 Create skill profile.
 update ()
 Update skill profile.
 delete ()
 Delete skill profile.
 getAssignedUsers ()
 Get assigned users.
 addUserToProfile ($a_user_id)
 Add user to profile.
 removeUserFromProfile ($a_user_id)
 Remove user from profile.

Static Public Member Functions

static getProfiles ()
 Get profiles.
static lookupTitle ($a_id)
 Lookup title.
static getProfilesOfUser ($a_user_id)
 Get profiles of a user.
static countUsers ($a_profile_id)
 Get assigned users.
static getUsageInfo ($a_cskill_ids, &$a_usages)
 Get usage info.

Static Protected Member Functions

static lookup ($a_id, $a_field)
 Lookup.

Protected Attributes

 $id
 $title
 $description
 $skill_level = array()

Detailed Description

Skill profile.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ /

Definition at line 14 of file class.ilSkillProfile.php.

Constructor & Destructor Documentation

ilSkillProfile::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_idprofile id

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

References read(), and setId().

{
if ($a_id > 0)
{
$this->setId($a_id);
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilSkillProfile::addSkillLevel (   $a_base_skill_id,
  $a_tref_id,
  $a_level_id 
)

Add skill level.

Parameters
@return

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

Referenced by read().

{
//echo "-".$a_base_skill_id."-";
$this->skill_level[] = array(
"base_skill_id" => $a_base_skill_id,
"tref_id" => $a_tref_id,
"level_id" => $a_level_id
);
}

+ Here is the caller graph for this function:

ilSkillProfile::addUserToProfile (   $a_user_id)

Add user to profile.

Parameters
int$a_user_iduser id

Definition at line 337 of file class.ilSkillProfile.php.

References $ilDB, and getId().

{
global $ilDB;
$ilDB->replace("skl_profile_user",
array("profile_id" => array("integer", $this->getId()),
"user_id" => array("integer", (int) $a_user_id),
),
array()
);
}

+ Here is the call graph for this function:

static ilSkillProfile::countUsers (   $a_profile_id)
static

Get assigned users.

Definition at line 389 of file class.ilSkillProfile.php.

References $ilDB.

Referenced by ilSkillProfileTableGUI\fillRow().

{
global $ilDB;
$set = $ilDB->query("SELECT count(*) ucnt FROM skl_profile_user ".
" WHERE profile_id = ".$ilDB->quote($a_profile_id, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return (int) $rec["ucnt"];
}

+ Here is the caller graph for this function:

ilSkillProfile::create ( )

Create skill profile.

Definition at line 171 of file class.ilSkillProfile.php.

References $ilDB, getId(), and setId().

{
global $ilDB;
// profile
$this->setId($ilDB->nextId("skl_profile"));
$ilDB->manipulate("INSERT INTO skl_profile ".
"(id, title, description) VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($this->getTitle(), "text").",".
$ilDB->quote($this->getDescription(), "text").
")");
// profile levels
foreach ($this->skill_level as $level)
{
$ilDB->replace("skl_profile_level",
array("profile_id" => array("integer", $this->getId()),
"tref_id" => array("integer", (int) $level["tref_id"]),
"base_skill_id" => array("integer", (int) $level["base_skill_id"])
),
array("level_id" => array("integer", (int) $level["level_id"]))
);
}
}

+ Here is the call graph for this function:

ilSkillProfile::delete ( )

Delete skill profile.

Definition at line 238 of file class.ilSkillProfile.php.

References $ilDB.

{
global $ilDB;
// profile levels
$ilDB->manipulate("DELETE FROM skl_profile_level WHERE ".
" profile_id = ".$ilDB->quote($this->getId(), "integer")
);
// profile
$ilDB->manipulate("DELETE FROM skl_profile WHERE ".
" id = ".$ilDB->quote($this->getId(), "integer")
);
}
ilSkillProfile::getAssignedUsers ( )

Get assigned users.

Definition at line 311 of file class.ilSkillProfile.php.

References $ilDB, and ilObjUser\_lookupName().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM skl_profile_user ".
" WHERE profile_id = ".$ilDB->quote($this->getId(), "integer")
);
$users = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$name = ilObjUser::_lookupName($rec["user_id"]);
$users[$rec["user_id"]] = array(
"lastname" => $name["lastname"],
"firstname" => $name["firstname"],
"login" => $name["login"],
"id" => $name["user_id"]
);
}
return $users;
}

+ Here is the call graph for this function:

ilSkillProfile::getDescription ( )

Get description.

Returns
string description

Definition at line 90 of file class.ilSkillProfile.php.

References $description.

{
}
ilSkillProfile::getId ( )

Get id.

Returns
int id

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

References $id.

Referenced by addUserToProfile(), create(), and update().

{
return $this->id;
}

+ Here is the caller graph for this function:

static ilSkillProfile::getProfiles ( )
static

Get profiles.

Parameters
@return

Definition at line 260 of file class.ilSkillProfile.php.

References $ilDB.

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM skl_profile ".
" ORDER BY title "
);
$profiles = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$profiles[$rec["id"]] = $rec;
}
return $profiles;
}
static ilSkillProfile::getProfilesOfUser (   $a_user_id)
static

Get profiles of a user.

Parameters
int$a_user_iduser id

Definition at line 369 of file class.ilSkillProfile.php.

References $ilDB.

Referenced by ilSurveyEvaluationGUI\competenceEval(), ilPersonalSkillsGUI\executeCommand(), ilTestSkillEvaluation\getAssignedSkillMatchingSkillProfiles(), and ilPersonalSkillsGUI\listProfiles().

{
global $ilDB;
$profiles = array();
$set = $ilDB->query("SELECT p.id, p.title FROM skl_profile_user u JOIN skl_profile p ".
" ON (u.profile_id = p.id) ".
" WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
" ORDER BY p.title ASC"
);
while ($rec = $ilDB->fetchAssoc($set))
{
$profiles[] = $rec;
}
return $profiles;
}

+ Here is the caller graph for this function:

ilSkillProfile::getSkillLevels ( )

Get skill levels.

Parameters
@return

Definition at line 136 of file class.ilSkillProfile.php.

References $skill_level.

{
}
ilSkillProfile::getTitle ( )

Get title.

Returns
string title

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

References $title.

{
return $this->title;
}
static ilSkillProfile::getUsageInfo (   $a_cskill_ids,
$a_usages 
)
static

Get usage info.

Parameters
@return

Implements ilSkillUsageInfo.

Definition at line 406 of file class.ilSkillProfile.php.

References $ilDB, ilSkillUsage\getUsageInfoGeneric(), and ilSkillUsage\PROFILE.

{
global $ilDB;
include_once("./Services/Skill/classes/class.ilSkillUsage.php");
"skl_profile_level", "profile_id", "base_skill_id");
}

+ Here is the call graph for this function:

static ilSkillProfile::lookup (   $a_id,
  $a_field 
)
staticprotected

Lookup.

Parameters
@return

Definition at line 282 of file class.ilSkillProfile.php.

References $ilDB.

Referenced by lookupTitle().

{
global $ilDB;
$set = $ilDB->query("SELECT ".$a_field." FROM skl_profile ".
" WHERE id = ".$ilDB->quote($a_id, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return $rec[$a_field];
}

+ Here is the caller graph for this function:

static ilSkillProfile::lookupTitle (   $a_id)
static

Lookup title.

Parameters
@return

Definition at line 299 of file class.ilSkillProfile.php.

References lookup().

Referenced by ilSkillProfileGUI\confirmDeleteProfiles().

{
return self::lookup($a_id, "title");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSkillProfile::read ( )

Read skill profile from db.

Parameters
@return

Definition at line 147 of file class.ilSkillProfile.php.

References $ilDB, addSkillLevel(), setDescription(), and setTitle().

Referenced by __construct().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM skl_profile ".
" WHERE id = ".$ilDB->quote($this->getId(), "integer")
);
$rec = $ilDB->fetchAssoc($set);
$this->setTitle($rec["title"]);
$this->setDescription($rec["description"]);
$set = $ilDB->query("SELECT * FROM skl_profile_level ".
" WHERE profile_id = ".$ilDB->quote($this->getId(), "integer")
);
while ($rec = $ilDB->fetchAssoc($set))
{
$this->addSkillLevel((int) $rec["base_skill_id"], (int) $rec["tref_id"],
(int) $rec["level_id"]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSkillProfile::removeSkillLevel (   $a_base_skill_id,
  $a_tref_id,
  $a_level_id 
)

Remove skill level.

Parameters
@return

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

{
foreach ($this->skill_level as $k => $sl)
{
if ((int) $sl["base_skill_id"] == (int) $a_base_skill_id &&
(int) $sl["tref_id"] == (int) $a_tref_id &&
(int) $sl["level_id"] == (int) $a_level_id)
{
unset($this->skill_level[$k]);
}
}
}
ilSkillProfile::removeUserFromProfile (   $a_user_id)

Remove user from profile.

Parameters
int$a_user_iduser id

Definition at line 354 of file class.ilSkillProfile.php.

References $ilDB.

{
global $ilDB;
$ilDB->manipulate("DELETE FROM skl_profile_user WHERE ".
" profile_id = ".$ilDB->quote($this->getId(), "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer")
);
}
ilSkillProfile::setDescription (   $a_val)

Set description.

Parameters
string$a_valdescription

Definition at line 80 of file class.ilSkillProfile.php.

Referenced by read().

{
$this->description = $a_val;
}

+ Here is the caller graph for this function:

ilSkillProfile::setId (   $a_val)

Set id.

Parameters
int$a_valid

Definition at line 40 of file class.ilSkillProfile.php.

Referenced by __construct(), and create().

{
$this->id = $a_val;
}

+ Here is the caller graph for this function:

ilSkillProfile::setTitle (   $a_val)

Set title.

Parameters
string$a_valtitle

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

Referenced by read().

{
$this->title = $a_val;
}

+ Here is the caller graph for this function:

ilSkillProfile::update ( )

Update skill profile.

Definition at line 200 of file class.ilSkillProfile.php.

References $ilDB, and getId().

{
global $ilDB;
// profile
$ilDB->manipulate("UPDATE skl_profile SET ".
" title = ".$ilDB->quote($this->getTitle(), "text").",".
" description = ".$ilDB->quote($this->getDescription(), "text").
" WHERE id = ".$ilDB->quote($this->getId(), "integer")
);
// profile levels
$ilDB->manipulate("DELETE FROM skl_profile_level WHERE ".
" profile_id = ".$ilDB->quote($this->getId(), "integer")
);
foreach ($this->skill_level as $level)
{
$ilDB->replace("skl_profile_level",
array("profile_id" => array("integer", $this->getId()),
"tref_id" => array("integer", (int) $level["tref_id"]),
"base_skill_id" => array("integer", (int) $level["base_skill_id"])
),
array("level_id" => array("integer", (int) $level["level_id"]))
);
/*$ilDB->manipulate("INSERT INTO skl_profile_level ".
"(profile_id, base_skill_id, tref_id, level_id) VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote((int) $level["base_skill_id"], "integer").",".
$ilDB->quote((int) $level["tref_id"], "integer").",".
$ilDB->quote((int) $level["level_id"], "integer").
")");*/
}
}

+ Here is the call graph for this function:

Field Documentation

ilSkillProfile::$description
protected

Definition at line 18 of file class.ilSkillProfile.php.

Referenced by getDescription().

ilSkillProfile::$id
protected

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

Referenced by getId().

ilSkillProfile::$skill_level = array()
protected

Definition at line 19 of file class.ilSkillProfile.php.

Referenced by getSkillLevels().

ilSkillProfile::$title
protected

Definition at line 17 of file class.ilSkillProfile.php.

Referenced by getTitle().


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