ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSurveySkillTableGUI.php
Go to the documentation of this file.
1<?php
2
20
26{
32 protected array $thresholds;
33
34 public function __construct(
35 object $a_parent_obj,
36 string $a_parent_cmd,
37 ilObjSurvey $a_survey
38 ) {
39 global $DIC;
40
41 $this->ctrl = $DIC->ctrl();
42 $this->lng = $DIC->language();
43 $ilCtrl = $DIC->ctrl();
44 $lng = $DIC->language();
45
46 $this->survey = $a_survey;
47
48 parent::__construct($a_parent_obj, $a_parent_cmd);
49 $this->getSkills();
50 $this->setTitle($lng->txt("survey_competences"));
51
52 $this->skill_tree_service = $DIC->skills()->tree();
53 $this->skill_tree = $this->skill_tree_service->getGlobalSkillTree();
54
55 $this->skill_thres = new ilSurveySkillThresholds($a_survey);
56 $this->thresholds = $this->skill_thres->getThresholds();
57
58 $this->addColumn($this->lng->txt("survey_skill"));
59 $this->addColumn($this->lng->txt("survey_skill_nr_q"));
60 $this->addColumn($this->lng->txt("survey_skill_max_scale_points"));
61 $this->addColumn($this->lng->txt("survey_up_to_x_points"));
62 $this->addColumn($this->lng->txt("actions"));
63
64 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
65 $this->setRowTemplate("tpl.svy_skill_row.html", "components/ILIAS/Survey");
66 }
67
68 public function getSkills(): void
69 {
70 $sskill = new ilSurveySkill($this->survey);
71 $opts = $sskill->getAllAssignedSkillsAsOptions();
72 $data = array();
73 foreach ($opts as $k => $o) {
74 $v = explode(":", $k);
75
76 $question_ids = $sskill->getQuestionsForSkill($v[0], $v[1]);
77 $scale_sum = $sskill->determineMaxScale($v[0], $v[1]);
78
79 $data[] = array("title" => ilBasicSkill::_lookupTitle($v[0], $v[1]),
80 "base_skill" => $v[0],
81 "tref_id" => $v[1],
82 "nr_of_q" => count($question_ids),
83 "scale_sum" => $scale_sum
84 );
85 }
86
87 $this->setData($data);
88 }
89
90 protected function fillRow(array $a_set): void
91 {
93 $ilCtrl = $this->ctrl;
94
95 $ilCtrl->setParameter($this->parent_obj, "sk_id", $a_set["base_skill"]);
96 $ilCtrl->setParameter($this->parent_obj, "tref_id", $a_set["tref_id"]);
97
98 $this->tpl->setVariable(
99 "COMPETENCE",
100 ilBasicSkill::_lookupTitle($a_set["base_skill"], $a_set["tref_id"])
101 );
102 $path = $this->skill_tree->getSkillTreePath($a_set["base_skill"], $a_set["tref_id"]);
103 $path_nodes = array();
104 foreach ($path as $p) {
105 if ($p["child"] > 1 && $p["skill_id"] != $a_set["base_skill"]) {
106 $path_nodes[] = ilBasicSkill::_lookupTitle($p["skill_id"], $p["tref_id"]);
107 }
108 }
109 $this->tpl->setVariable("PATH", implode(" > ", $path_nodes));
110
111
112
113 $this->tpl->setVariable("NR_OF_QUESTIONS", $a_set["nr_of_q"]);
114 $this->tpl->setVariable("MAX_SCALE_POINTS", $a_set["scale_sum"]);
115 $this->tpl->setVariable("CMD", $ilCtrl->getLinkTarget($this->parent_obj, "listSkillThresholds"));
116 $this->tpl->setVariable("ACTION", $lng->txt("edit"));
117
118 $bs = new ilBasicSkill($a_set["base_skill"]);
119 $ld = $bs->getLevelData();
120 foreach ($ld as $l) {
121 $this->tpl->setCurrentBlock("points");
122 $this->tpl->setVariable("LEV", $l["title"]);
123
124 $tr = $this->thresholds[$l["id"]][$a_set["tref_id"]] ?? 0;
125 if ((int) $tr !== 0) {
126 $this->tpl->setVariable("THRESHOLD", (int) $tr);
127 } else {
128 $this->tpl->setVariable("THRESHOLD", "");
129 }
130 $this->tpl->parseCurrentBlock();
131 }
132 }
133}
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
TableGUI class for skill list in survey.
ilSurveySkillThresholds $skill_thres
__construct(object $a_parent_obj, string $a_parent_cmd, ilObjSurvey $a_survey)
fillRow(array $a_set)
Standard Version of Fill Row.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
ilLanguage $lng
$path
Definition: ltiservices.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26