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        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
   59                $this->q_skill[$rec[
"q_id"]] = array(
"q_id" => $rec[
"q_id"],
 
   60                    "base_skill_id" => $rec[
"base_skill_id"],
 
   61                    "tref_id" => $rec[
"tref_id"]);
 
   74        if (isset($this->q_skill[$a_question_id])) {
 
   75            return $this->q_skill[$a_question_id];
 
   89        foreach ($this->q_skill as $q_id => $s) {
 
   90            if ($s[
"base_skill_id"] == $a_base_skill_id &&
 
   91                $s[
"tref_id"] == $a_tref_id) {
 
  112            array(
"q_id" => array(
"integer", $a_question_id)),
 
  114                "survey_id" => array(
"integer", $this->survey->getId()),
 
  115                "base_skill_id" => array(
"integer", $a_base_skill_id),
 
  116                "tref_id" => array(
"integer", $a_tref_id)
 
  119        $this->q_skill[$a_question_id] = array(
"q_id" => $a_question_id,
 
  120            "base_skill_id" => $a_base_skill_id,
 
  121            "tref_id" => $a_tref_id);
 
  138            "SELECT * FROM svy_quest_skill " .
 
  139            " WHERE q_id = " . 
$ilDB->quote($a_question_id, 
"integer")
 
  142        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  143            $skills[] = array(
"skill_id" => $rec[
"base_skill_id"],
 
  144                "tref_id" => $rec[
"tref_id"]);
 
  149            "DELETE FROM svy_quest_skill WHERE " .
 
  150            " q_id = " . 
$ilDB->quote($a_question_id, 
"integer")
 
  152        unset($this->q_skill[$a_question_id]);
 
  171            $svy_skill->removeQuestionSkillAssignment($a_question_id);
 
  183        $used_skills = array();
 
  184        foreach ($a_skills as $skill) {
 
  186                $used_skills[] = $skill[
"skill_id"] . 
":" . $skill[
"tref_id"];
 
  192        foreach ($a_skills as $skill) {
 
  193            if (!in_array($skill[
"skill_id"] . 
":" . $skill[
"tref_id"], $used_skills)) {
 
  210            "SELECT * FROM svy_quest_skill " .
 
  211            " WHERE base_skill_id = " . 
$ilDB->quote($a_skill_id, 
"integer") .
 
  212            " AND tref_id = " . 
$ilDB->quote($a_tref_id, 
"integer") .
 
  213            " AND survey_id = " . 
$ilDB->quote($this->survey->getId(), 
"integer")
 
  215        if ($rec = 
$ilDB->fetchAssoc($set)) {
 
  231        foreach ($this->q_skill as $sk) {
 
  232            $skills[$sk[
"base_skill_id"] . 
":" . $sk[
"tref_id"]] =
 
  250        foreach ($opts as $k => $title) {
 
  251            $k = explode(
":", $k);
 
  254            $ld = $bs->getLevelData();
 
  257                "base_skill_id" => (
int) $k[0],
 
  258                "tref_id" => (
int) $k[1],
 
  259                "skill_title" => $title,
 
  265            $finished_ids = $this->survey->getFinishedIdsForAppraiseeId($a_appraisee_id, 
true);
 
  267            $finished_id = $this->survey->getFinishedIdForAppraiseeIdAndRaterId($a_appraisee_id, $a_appraisee_id);
 
  268            if ($finished_id > 0) {
 
  269                $finished_ids = array($finished_id);
 
  273        if (!is_array($finished_ids)) {
 
  274            $finished_ids = array(-1);
 
  277        $results = $this->survey->getUserSpecificResults($finished_ids);
 
  278        $this->log->debug(
"Finished IDS: " . print_r($finished_ids, 
true));
 
  279        foreach ($skills as $k => $s) {
 
  281            $this->log->debug(
"Skill: " . $s[
"base_skill_id"] . 
":" . $s[
"tref_id"] . 
", Questions: " . implode(
",", $q_ids));
 
  283            foreach ($q_ids as $q_id) {
 
  288                    foreach (
$results[$q_id] as $uid => $answer) {      
 
  293                        $scale_values = array_keys($answer); 
 
  294                        $this->log->debug(
"User answer (scale values): " . print_r($scale_values, 
true));
 
  295                        $sum += array_sum($scale_values);
 
  296                        $cnt += 
sizeof($scale_values); 
 
  299                        $qmean = $sum / $cnt;
 
  301                    $this->log->debug(
"MEAN: " . $qmean);
 
  304                $this->log->debug(
"MEAN SUM: " . $mean_sum);
 
  306            $skills[$k][
"mean_sum"] = $mean_sum;
 
  309            $thresholds = $skthr->getThresholds();
 
  310            foreach ($skills[$k][
"level_data"] as $l) {
 
  311                $t = $thresholds[$l[
"id"]][$s[
"tref_id"]];
 
  312                if ($t > 0 && $mean_sum >= $t) {
 
  313                    $skills[$k][
"new_level"] = $l[
"title"];
 
  314                    $skills[$k][
"new_level_id"] = $l[
"id"];
 
  331        $question_ids = $ssk->getQuestionsForSkill($a_base_skill, $a_tref_id);
 
  333        foreach ($question_ids as $q_id) {
 
  335            if (!is_object($q)) {
 
  338            $cats = $q->getCategories();
 
  340            for (
$i = 0; 
$i <= $cats->getCategoryCount(); 
$i++) {
 
  341                $c = $cats->getCategory(
$i);
 
  345                    if (
$c->scale > $max_scale) {
 
  346                        $max_scale = 
$c->scale;
 
  350            $scale_sum += $max_scale;
 
  365        foreach ($new_levels as $nl) {
 
  366            if ($nl[
"new_level_id"] > 0) {
 
  370                    $this->survey->getRefId(),
 
  376                if ($nl[
"tref_id"] > 0) {
 
  397            foreach ($new_levels as $nl) {
 
  398                if ($nl[
"new_level_id"] > 0) {
 
  402                        $this->survey->getRefId(),
 
  409                    if ($nl[
"tref_id"] > 0) {
 
An exception for terminatinating execution or to throw for unit testing.
static _questionExists($question_id)
Returns true if the question already exists in the database.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
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.
static getLogger($a_component_id)
Get component logger.
static _lookupType($a_id, $a_reference=false)
lookup object type
static addPersonalSkill($a_user_id, $a_skill_node_id)
Add personal skill.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
static setUsage($a_obj_id, $a_skill_id, $a_tref_id, $a_use=true)
Set usage.
Skill tresholds for 360 surveys.
Skill/Competence handling in surveys.
isSkillAssignedToQuestion($a_skill_id, $a_tref_id)
Is skill assigned to any question?
removeUsagesOfSkills($a_skills)
Remove usages of skills.
writeAndAddAppraiseeSkills(int $user_id)
Write appraisee skills and add them to user's competence records.
__construct(ilObjSurvey $a_survey)
Constructor.
determineSkillLevelsForAppraisee($a_appraisee_id, $a_self_eval=false)
Determine skill levels for appraisee.
static handleQuestionDeletion($a_question_id, $a_obj_id)
Remove question skill assignment.
getAllAssignedSkillsAsOptions()
Get skill for question.
writeAndAddSelfEvalSkills(int $user_id)
Write skills on self evaluation and add them to user's competence records.
getQuestionsForSkill($a_base_skill_id, $a_tref_id)
Get questions for skill.
removeQuestionSkillAssignment($a_question_id)
Remove question skill assignment.
determineMaxScale($a_base_skill, $a_tref_id=0)
Determine max scales and questions.
addQuestionSkillAssignment($a_question_id, $a_base_skill_id, $a_tref_id)
Add survey question to skill assignment.
getSkillForQuestion($a_question_id)
Get skill for question.