36 $this->db = $DIC->database();
37 $this->survey = $a_survey;
53 "SELECT * FROM svy_quest_skill " .
54 " WHERE survey_id = " .
$ilDB->quote($this->survey->getId(),
"integer")
57 include_once(
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php");
59 while ($rec =
$ilDB->fetchAssoc($set)) {
61 $this->q_skill[$rec[
"q_id"]] = array(
"q_id" => $rec[
"q_id"],
62 "base_skill_id" => $rec[
"base_skill_id"],
63 "tref_id" => $rec[
"tref_id"]);
76 if (isset($this->q_skill[$a_question_id])) {
77 return $this->q_skill[$a_question_id];
91 foreach ($this->q_skill as $q_id =>
$s) {
92 if (
$s[
"base_skill_id"] == $a_base_skill_id &&
93 $s[
"tref_id"] == $a_tref_id) {
114 array(
"q_id" => array(
"integer", $a_question_id)),
116 "survey_id" => array(
"integer", $this->survey->getId()),
117 "base_skill_id" => array(
"integer", $a_base_skill_id),
118 "tref_id" => array(
"integer", $a_tref_id)
121 $this->q_skill[$a_question_id] = array(
"q_id" => $a_question_id,
122 "base_skill_id" => $a_base_skill_id,
123 "tref_id" => $a_tref_id);
126 include_once(
"./Services/Skill/classes/class.ilSkillUsage.php");
141 "SELECT * FROM svy_quest_skill " .
142 " WHERE q_id = " .
$ilDB->quote($a_question_id,
"integer")
145 while ($rec =
$ilDB->fetchAssoc($set)) {
146 $skills[] = array(
"skill_id" => $rec[
"base_skill_id"],
147 "tref_id" => $rec[
"tref_id"]);
152 "DELETE FROM svy_quest_skill WHERE " .
153 " q_id = " .
$ilDB->quote($a_question_id,
"integer")
155 unset($this->q_skill[$a_question_id]);
169 $ilDB = $DIC->database();
172 include_once
'./Modules/Survey/classes/class.ilObjSurvey.php';
175 $svy_skill->removeQuestionSkillAssignment($a_question_id);
187 $used_skills = array();
188 foreach ($a_skills as $skill) {
190 $used_skills[] = $skill[
"skill_id"] .
":" . $skill[
"tref_id"];
196 include_once(
"./Services/Skill/classes/class.ilSkillUsage.php");
199 foreach ($a_skills as $skill) {
200 if (!in_array($skill[
"skill_id"] .
":" . $skill[
"tref_id"], $used_skills)) {
217 "SELECT * FROM svy_quest_skill " .
218 " WHERE base_skill_id = " .
$ilDB->quote($a_skill_id,
"integer") .
219 " AND tref_id = " .
$ilDB->quote($a_tref_id,
"integer") .
220 " AND survey_id = " .
$ilDB->quote($this->survey->getId(),
"integer")
222 if ($rec =
$ilDB->fetchAssoc($set)) {
238 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
239 foreach ($this->q_skill as $sk) {
240 $skills[$sk[
"base_skill_id"] .
":" . $sk[
"tref_id"]] =
258 foreach ($opts as $k =>
$title) {
259 $k = explode(
":", $k);
262 $ld = $bs->getLevelData();
265 "base_skill_id" => (
int) $k[0],
266 "tref_id" => (
int) $k[1],
273 $finished_ids = $this->survey->getFinishedIdsForAppraiseeId($a_appraisee_id,
true);
275 $finished_id = $this->survey->getFinishedIdForAppraiseeIdAndRaterId($a_appraisee_id, $a_appraisee_id);
276 if ($finished_id > 0) {
277 $finished_ids = array($finished_id);
281 if (!
sizeof($finished_ids)) {
282 $finished_ids = array(-1);
285 $results = $this->survey->getUserSpecificResults($finished_ids);
286 $this->log->debug(
"Finished IDS: " . print_r($finished_ids,
true));
287 foreach ($skills as $k =>
$s) {
289 $this->log->debug(
"Skill: " .
$s[
"base_skill_id"] .
":" .
$s[
"tref_id"] .
", Questions: " . implode(
",", $q_ids));
291 foreach ($q_ids as $q_id) {
296 foreach (
$results[$q_id] as $uid => $answer) {
301 $scale_values = array_keys($answer);
302 $this->log->debug(
"User answer (scale values): " . print_r($scale_values,
true));
303 $sum += array_sum($scale_values);
304 $cnt +=
sizeof($scale_values);
307 $qmean = $sum / $cnt;
309 $this->log->debug(
"MEAN: " . $qmean);
312 $this->log->debug(
"MEAN SUM: " . $mean_sum);
314 $skills[$k][
"mean_sum"] = $mean_sum;
316 include_once(
"./Modules/Survey/classes/class.ilSurveySkillThresholds.php");
318 $thresholds = $skthr->getThresholds();
319 foreach ($skills[$k][
"level_data"] as
$l) {
320 $t = $thresholds[$l[
"id"]][
$s[
"tref_id"]];
321 if (
$t > 0 && $mean_sum >=
$t) {
322 $skills[$k][
"new_level"] = $l[
"title"];
323 $skills[$k][
"new_level_id"] = $l[
"id"];
339 include_once(
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php");
340 include_once(
"./Modules/Survey/classes/class.ilSurveySkill.php");
342 $question_ids = $ssk->getQuestionsForSkill($a_base_skill, $a_tref_id);
344 foreach ($question_ids as $q_id) {
346 if (!is_object($q)) {
349 $cats = $q->getCategories();
351 for (
$i = 0;
$i <= $cats->getCategoryCount();
$i++) {
352 $c = $cats->getCategory(
$i);
356 if (
$c->scale > $max_scale) {
357 $max_scale =
$c->scale;
361 $scale_sum += $max_scale;
376 foreach ($new_levels as $nl) {
377 if ($nl[
"new_level_id"] > 0) {
381 $this->survey->getRefId(),
402 foreach ($new_levels as $nl) {
403 if ($nl[
"new_level_id"] > 0) {
407 $this->survey->getRefId(),
static handleQuestionDeletion($a_question_id, $a_obj_id)
Remove question skill assignment.
writeAppraiseeSkills($a_app_id)
Write appraisee skills.
__construct(ilObjSurvey $a_survey)
Constructor.
writeSelfEvalSkills(int $user_id)
Write skills on self evaluation.
determineSkillLevelsForAppraisee($a_appraisee_id, $a_self_eval=false)
Determine skill levels for appraisee.
static setUsage($a_obj_id, $a_skill_id, $a_tref_id, $a_use=true)
Set usage.
isSkillAssignedToQuestion($a_skill_id, $a_tref_id)
Is skill assigned to any question?
Skill/Competence handling in surveys.
Skill tresholds for 360 surveys.
removeQuestionSkillAssignment($a_question_id)
Remove question skill assignment.
static _questionExists($question_id)
Returns true if the question already exists in the database.
removeUsagesOfSkills($a_skills)
Remove usages of skills.
determineMaxScale($a_base_skill, $a_tref_id=0)
Determine max scales and questions.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
getSkillForQuestion($a_question_id)
Get skill for question.
getAllAssignedSkillsAsOptions()
Get skill for question.
static writeUserSkillLevelStatus( $a_level_id, $a_user_id, $a_trigger_ref_id, $a_tref_id=0, $a_status=ilBasicSkill::ACHIEVED, $a_force=false, $a_self_eval=false, $a_unique_identifier="")
Write skill level status.
addQuestionSkillAssignment($a_question_id, $a_base_skill_id, $a_tref_id)
Add survey question to skill assignment.
static getLogger($a_component_id)
Get component logger.
getQuestionsForSkill($a_base_skill_id, $a_tref_id)
Get questions for skill.