ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSurveySkillThresholdsTableGUI.php
Go to the documentation of this file.
1<?php
2
24{
26 protected array $question_ids;
27 protected array $thresholds;
28 protected int $tref_id = 0;
29 protected int $base_skill_id = 0;
31 protected int $scale_sum;
34
35 public function __construct(
36 object $a_parent_obj,
37 string $a_parent_cmd,
38 ilObjSurvey $a_survey,
39 int $a_base_skill_id,
40 int $a_tref_id
41 ) {
42 global $DIC;
43 $main_tpl = $DIC->ui()->mainTemplate();
44
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $DIC->language();
47 $ilCtrl = $DIC->ctrl();
48 $lng = $DIC->language();
49
50 $this->object = $a_survey;
51 $this->base_skill_id = $a_base_skill_id;
52 $this->tref_id = $a_tref_id;
53
54
56
57 $main_tpl->setOnScreenMessage('info', $lng->txt("survey_skill_nr_q") . ": " . count($this->question_ids) .
58 ", " . $lng->txt("survey_skill_max_scale_points") . ": " . $this->scale_sum);
59
60 $this->skill_thres = new ilSurveySkillThresholds($this->object);
61 $this->thresholds = $this->skill_thres->getThresholds();
62
63 parent::__construct($a_parent_obj, $a_parent_cmd);
64
65 $this->skill_survey = new ilSurveySkill($a_survey);
66 $this->setData($this->getLevels());
67 $this->setTitle(ilBasicSkill::_lookupTitle($this->base_skill_id, $this->tref_id));
68
69 $this->addColumn($this->lng->txt("survey_skill_level"));
70 $this->addColumn($this->lng->txt("survey_up_to_x_points"));
71
72 $this->setRowTemplate("tpl.svy_skill_threshold_row.html", "components/ILIAS/Survey");
73
74 // $this->addMultiCommand("saveThresholds", $lng->txt("save"));
75 $this->addCommandButton("saveThresholds", $lng->txt("save"));
76 $this->setFormAction($ilCtrl->getFormAction($this->parent_obj));
77 }
78
79 public function determineMaxScalesAndQuestions(): void
80 {
81 $ssk = new ilSurveySkill($this->object);
82 $this->question_ids = $ssk->getQuestionsForSkill(
83 $this->base_skill_id,
84 $this->tref_id
85 );
86 $this->scale_sum = $ssk->determineMaxScale(
87 $this->base_skill_id,
88 $this->tref_id
89 );
90 }
91
92 public function getLevels(): array
93 {
94 $bs = new ilBasicSkill($this->base_skill_id);
95 return $bs->getLevelData();
96 }
97
98 protected function fillRow(array $a_set): void
99 {
101 $ilCtrl = $this->ctrl;
102
103 $this->tpl->setVariable("LEVEL", $a_set["title"]);
104 $this->tpl->setVariable("LEVEL_ID", $a_set["id"]);
105
106 $tr = $this->thresholds[$a_set["id"]][$this->tref_id] ?? 0;
107 if ((int) $tr !== 0) {
108 $this->tpl->setVariable("THRESHOLD", (int) $tr);
109 } else {
110 $this->tpl->setVariable("THRESHOLD", "");
111 }
112 }
113}
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd, ilObjSurvey $a_survey, int $a_base_skill_id, int $a_tref_id)
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="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
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)
ilGlobalTemplateInterface $main_tpl
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
ilLanguage $lng
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26