ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
CopySelfAssQuestionTableBuilder.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2023 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5declare(strict_types=1);
6
8
14use ilObject;
15
21{
22 protected \ILIAS\TestQuestionPool\Questions\PublicInterface $test_question;
23
24 public function __construct(
25 protected InternalDomainService $domain,
26 protected InternalGUIService $gui,
27 protected int $pool_ref_id,
28 protected int $pool_obj_id,
29 object $parent_gui,
30 string $parent_cmd
31 ) {
32 $this->test_question = $domain->testQuestion();
33 parent::__construct($parent_gui, $parent_cmd);
34 }
35
36 protected function getId(): string
37 {
38 return "cont_qpl";
39 }
40
41 protected function getTitle(): string
42 {
43 return ilObject::_lookupTitle($this->pool_obj_id);
44 }
45
46 protected function getRetrieval(): RetrievalInterface
47 {
48 return $this->domain->pc()->selfAssQuestionRetrieval($this->pool_ref_id, $this->pool_obj_id);
49 }
50
51 protected function transformRow(array $data_row): array
52 {
53 $lng = $this->domain->lng();
54
55 return [
56 "question_id" => $data_row["question_id"],
57 "title" => $data_row["title"],
58 "ttype" => $this->test_question->getGeneralQuestionProperties($data_row["question_id"])->getTypeName($lng)
59 ];
60 }
61
63 {
64 $lng = $this->domain->lng();
65
67 ->textColumn("title", $lng->txt("title"), true)
68 ->textColumn("ttype", $lng->txt("cont_question_type"), true)
69 ->singleAction("copyQuestion", $lng->txt("cont_copy_question_into_page"));
70
71 return $table;
72 }
73}
Table builder for self assessment questions from a pool.
ILIAS TestQuestionPool Questions PublicInterface $test_question
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui, protected int $pool_ref_id, protected int $pool_obj_id, object $parent_gui, string $parent_cmd)
transformRow(array $data_row)
transform raw data array to table row data array
textColumn(string $key, string $title, bool $sortable=false)
Class ilObject Basic functions for all objects.
static _lookupTitle(int $obj_id)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:26