19 declare(strict_types=0);
40 $this->course_obj = $a_course_obj;
43 $this->
http = $DIC->http();
46 $this->
lng->loadLanguageModule(
'crs');
48 $this->
addColumn($this->
lng->txt(
'title'),
'title',
'33%');
49 $this->
addColumn($this->
lng->txt(
'crs_objective_self_assessment'),
'self',
'33%%');
50 $this->
addColumn($this->
lng->txt(
'crs_objective_final_test'),
'final',
'33%');
53 $this->
setRowTemplate(
"tpl.crs_questions_table_row.html",
"components/ILIAS/Course");
57 $this->
enable(
'select_all');
62 protected function fillRow(array $a_set): void
64 static $row_counter = 1;
66 $this->tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
67 if (strlen($a_set[
'description']) !== 0) {
68 $this->tpl->setVariable(
'VAL_DESC', $a_set[
'description']);
71 foreach ($a_set[
'self_tests'] as $tst) {
72 foreach ($tst[
'questions'] as $qst) {
73 $this->tpl->setCurrentBlock(
'self_qst');
74 $this->tpl->setVariable(
'SELF_QST_TITLE', $qst[
'title']);
75 if (strlen($qst[
'description']) !== 0) {
76 $this->tpl->setVariable(
'SELF_QST_DESCRIPTION', $qst[
'description']);
78 $this->tpl->setVariable(
'SELF_QST_POINTS', $qst[
'points']);
79 $this->tpl->setVariable(
'SELF_QST_TXT_POINTS', $this->
lng->txt(
'crs_objective_points'));
80 $this->tpl->parseCurrentBlock();
82 $this->tpl->setCurrentBlock(
'self_tst');
83 $this->tpl->setVariable(
'SELF_TST_TITLE', $tst[
'title']);
84 if (strlen($tst[
'description']) !== 0) {
85 $this->tpl->setVariable(
'SELF_TST_DESC', $tst[
'description']);
88 $this->tpl->setVariable(
'SELF_TYPE_ALT', $this->
lng->txt(
'obj_tst'));
89 $this->tpl->parseCurrentBlock();
91 if (count($a_set[
'self_tests']) > 0) {
92 $this->tpl->setVariable(
'SELF_TXT_ALL_POINTS', $this->
lng->txt(
'crs_objective_all_points'));
93 $this->tpl->setVariable(
'SELF_TXT_POINTS', $this->
lng->txt(
'crs_objective_points'));
94 $this->tpl->setVariable(
'SELF_TXT_REQ_POINTS', $this->
lng->txt(
'crs_obj_required_points'));
95 $this->tpl->setVariable(
'SELF_POINTS', $a_set[
'self_max_points']);
96 $this->tpl->setVariable(
'SELF_ID', $a_set[
'id']);
97 $this->tpl->setVariable(
'SELF_LIMIT', $a_set[
'self_limit']);
100 foreach ($a_set[
'final_tests'] as $tst) {
101 foreach ($tst[
'questions'] as $qst) {
102 $this->tpl->setCurrentBlock(
'final_qst');
103 $this->tpl->setVariable(
'FINAL_QST_TITLE', $qst[
'title']);
104 if (strlen($qst[
'description']) !== 0) {
105 $this->tpl->setVariable(
'FINAL_QST_DESCRIPTION', $qst[
'description']);
107 $this->tpl->setVariable(
'FINAL_QST_POINTS', $qst[
'points']);
108 $this->tpl->setVariable(
'FINAL_QST_TXT_POINTS', $this->
lng->txt(
'crs_objective_points'));
109 $this->tpl->parseCurrentBlock();
111 $this->tpl->setCurrentBlock(
'final_tst');
112 $this->tpl->setVariable(
'FINAL_TST_TITLE', $tst[
'title']);
113 if (strlen($tst[
'description']) !== 0) {
114 $this->tpl->setVariable(
'FINAL_TST_DESC', $tst[
'description']);
117 $this->tpl->setVariable(
'FINAL_TYPE_ALT', $this->
lng->txt(
'obj_tst'));
118 $this->tpl->parseCurrentBlock();
120 if (count($a_set[
'final_tests']) > 0) {
121 $this->tpl->setVariable(
'FINAL_TXT_ALL_POINTS', $this->
lng->txt(
'crs_objective_all_points'));
122 $this->tpl->setVariable(
'FINAL_TXT_POINTS', $this->
lng->txt(
'crs_objective_points'));
123 $this->tpl->setVariable(
'FINAL_TXT_REQ_POINTS', $this->
lng->txt(
'crs_obj_required_points'));
124 $this->tpl->setVariable(
'FINAL_POINTS', $a_set[
'final_max_points']);
125 $this->tpl->setVariable(
'FINAL_ID', $a_set[
'id']);
126 $this->tpl->setVariable(
'FINAL_LIMIT', $a_set[
'final_limit']);
130 public function parse(array $a_objective_ids): void
132 $post_self_limits = [];
133 if ($this->
http->wrapper()->post()->has(
'self')) {
134 $post_self_limits = $this->
http->wrapper()->post()->retrieve(
136 $this->
refinery->kindlyTo()->dictOf(
137 $this->
refinery->kindlyTo()->float()
141 $post_final_limits = [];
142 if ($this->
http->wrapper()->post()->has(
'final')) {
143 $post_final_limits = $this->
http->wrapper()->post()->retrieve(
145 $this->
refinery->kindlyTo()->dictOf(
146 $this->
refinery->kindlyTo()->float()
152 foreach ($a_objective_ids as $objective_id) {
159 foreach ($question_obj->getSelfAssessmentTests() as $tmp_test) {
160 if (isset($post_self_limits[$objective_id])) {
161 $objective_data[
'self_limit'] = (float) $post_self_limits[$objective_id];
163 $objective_data[
'self_limit'] = $tmp_test[
'limit'];
165 $questions = array();
166 foreach ($question_obj->getQuestionsOfTest($tmp_test[
'obj_id']) as $tmp_question) {
167 $qst[
'title'] = $tmp_question[
'title'];
168 $qst[
'description'] = $tmp_question[
'description'];
169 $qst[
'points'] = $tmp_question[
'points'];
173 $tst[
'questions'] = $questions;
179 $objective_data[
'self_tests'] = $tests;
180 $objective_data[
'self_max_points'] = $question_obj->getSelfAssessmentPoints();
184 foreach ($question_obj->getFinalTests() as $tmp_test) {
185 if (isset($post_final_limits[$objective_id])) {
186 $objective_data[
'final_limit'] = (float) $post_final_limits[$objective_id];
188 $objective_data[
'final_limit'] = $tmp_test[
'limit'];
191 $questions = array();
192 foreach ($question_obj->getQuestionsOfTest($tmp_test[
'obj_id']) as $tmp_question) {
193 $qst[
'title'] = $tmp_question[
'title'];
194 $qst[
'description'] = $tmp_question[
'description'];
195 $qst[
'points'] = $tmp_question[
'points'];
199 $tst[
'questions'] = $questions;
206 $objective_data[
'final_tests'] = $tests;
207 $objective_data[
'final_max_points'] = $question_obj->getFinalTestPoints();
209 $objective_data[
'id'] = $objective_id;
210 $objective_data[
'title'] = $objective->getTitle();
212 $objective_data[
'description'] = $objective->getDescription();
enable(string $a_module_name)
setFormAction(string $a_form_action, bool $a_multipart=false)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setFormName(string $a_name="")
__construct(object $a_parent_obj, ilObject $a_course_obj)
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static _lookupDescription(int $obj_id)
__construct(Container $dic, ilPlugin $plugin)
setLimit(int $a_limit=0, int $a_default_limit=0)
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)
disable(string $a_module_name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
parse(array $a_objective_ids)