18 declare(strict_types=0);
33 private \ILIAS\TestQuestionPool\Questions\PublicInterface
$questioninfo;
38 public function __construct(
object $a_parent_obj,
ilObject $a_course_obj,
int $a_objective_id,
int $a_mode)
42 $this->objective_id = $a_objective_id;
43 $this->course_obj = $a_course_obj;
45 $this->objDefinition = $DIC[
'objDefinition'];
46 $this->tree = $DIC->repositoryTree();
47 $this->questioninfo = $DIC->testQuestion();
50 $this->
lng->loadLanguageModule(
'crs');
53 $this->
addColumn($this->
lng->txt(
'type'),
'type',
"20px");
57 $this->
setRowTemplate(
"tpl.crs_objective_list_questions_row.html",
"components/ILIAS/Course");
63 #$this->setDefaultOrderField('title'); 66 $this->mode = $a_mode;
85 protected function fillRow(array $a_set): void
87 foreach ($a_set[
'sub'] as $sub_data) {
88 if ($sub_data[
'description']) {
89 $this->tpl->setVariable(
'QST_DESCRIPTION', $sub_data[
'description']);
91 if ($sub_data[
'qst_txt']) {
92 $txt = $sub_data[
'qst_txt'];
93 if ($sub_data[
'qst_points']) {
94 $this->
lng->loadLanguageModule(
'assessment');
95 $txt .= (
' (' . $sub_data[
'qst_points'] .
' ' . $this->
lng->txt(
'points') .
')');
98 $this->tpl->setVariable(
'QST_DESCRIPTION',
$txt);
100 $this->tpl->setCurrentBlock(
'qst');
101 $this->tpl->setVariable(
'QST_TITLE', $sub_data[
'title']);
102 $this->tpl->setVariable(
'QST_ID', $a_set[
'id'] .
'_' . $sub_data[
'id']);
104 switch ($this->mode) {
106 if ($this->objective_qst_obj->isSelfAssessmentQuestion($sub_data[
'id'])) {
107 $this->tpl->setVariable(
'QST_CHECKED',
'checked="checked"');
112 if ($this->objective_qst_obj->isFinalTestQuestion($sub_data[
'id'])) {
113 $this->tpl->setVariable(
'QST_CHECKED',
'checked="checked"');
117 $this->tpl->parseCurrentBlock();
119 if (count($a_set[
'sub'])) {
120 $this->tpl->setVariable(
'TXT_QUESTIONS', $this->
lng->txt(
'objs_qst'));
122 $this->tpl->setVariable(
'VAL_ID', $a_set[
'id']);
124 $this->tpl->setVariable(
'ROW_TYPE_IMG',
ilObject::_getIcon($a_set[
'obj_id'],
"tiny", $a_set[
'type']));
125 $this->tpl->setVariable(
'ROW_TYPE_ALT', $this->
lng->txt(
'obj_' . $a_set[
'type']));
127 $this->tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
128 if (strlen($a_set[
'description'])) {
129 $this->tpl->setVariable(
'VAL_DESC', $a_set[
'description']);
133 public function parse(array $a_assignable): void
137 foreach ($a_assignable as $node) {
139 $subobjects = array();
145 foreach ($qst = $this->
sortQuestions($tmp_tst->getAllQuestions()) as $question_data) {
147 #$sub['qst_txt'] = $tmp_question->_getQuestionText($question_data['question_id']); 148 $sub[
'qst_txt'] =
'';
149 $sub[
'qst_points'] = $this->questioninfo->getGeneralQuestionProperties($question_data[
'question_id'])->getAvailablePoints();
151 $sub[
'title'] = $tmp_question->getTitle();
152 $sub[
'description'] = $tmp_question->getComment();
153 $sub[
'id'] = $question_data[
'question_id'];
155 $subobjects[] = $sub;
157 $tmp_data[
'title'] = $node[
'title'];
158 $tmp_data[
'description'] = $node[
'description'];
159 $tmp_data[
'type'] = $node[
'type'];
160 $tmp_data[
'id'] = $node[
'child'];
161 $tmp_data[
'obj_id'] = $node[
'obj_id'];
162 $tmp_data[
'sub'] = $subobjects;
163 $tests[] = $tmp_data;
171 $tst_ref_id = $this->
getSettings()->getInitialTest();
173 return array($this->tree->getNodeData($tst_ref_id));
177 $tst_ref_id = $this->
getSettings()->getQualifiedTest();
179 return array($this->tree->getNodeData($tst_ref_id));
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
const TYPE_SELF_ASSESSMENT
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="")
ILIAS TestQuestionPool Questions PublicInterface $questioninfo
setFormName(string $a_name="")
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
sortQuestions(array $a_qst_ids)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(object $a_parent_obj, ilObject $a_course_obj, int $a_objective_id, int $a_mode)
parse(array $a_assignable)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
ilObjectDefinition $objDefinition
initQuestionAssignments()
static getInstanceByObjId(int $a_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)
TableGUI for question assignments of course objectives.
ilCourseObjectiveQuestion $objective_qst_obj
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)