ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilLOTestAssignmentTableGUI Class Reference

Class ilLOTestAssignmentTableGUI. More...

+ Collaboration diagram for ilLOTestAssignmentTableGUI:

Public Member Functions

 __construct (protected int $assignment_type, protected int $test_type, protected int $container_id, protected ilLanguage $lng, protected ilUIServices $ui_services, protected ilHTTPServices $http_services, protected ilLOTestAssignmentTableDataRetrieval $data_retrieval, protected ilRefineryFactory $refinery, protected ilCtrl $ctrl, protected object $parent_object)
 
 getHTML ()
 
 getAssignmentType ()
 
 getSettings ()
 
 getParentObject ()
 
 getTestType ()
 
 handleCommands ()
 

Data Fields

const int TYPE_MULTIPLE_ASSIGNMENTS = 1
 
const int TYPE_SINGLE_ASSIGNMENTS = 2
 
const string TABLE_COL_TITLE = 'title'
 
const string TABLE_COL_COURSE_OBJECTIVES = 'objective'
 
const string TABLE_COL_SELECTION_OF_TEST_QUESTIONS = 'ttype'
 
const string TABLE_COL_QESTIONS = 'qstqpl'
 
array $id_map
 
array string $url_action: void { $items = []
 
 foreach ( $id_map as $id=> $obj_id)
 

Protected Member Functions

 getColumns ()
 
 getActions ()
 
 getTitleLangVar ()
 
 initTable ()
 
 allIds ()
 
 readIdsFromQuery ()
 
 deleteTests (array $ids)
 
 deleteTest (array $ids)
 

Protected Attributes

const string ALL_OBJECTS = "ALL_OBJECTS"
 
const string TABLE_ID = 'lotstasstbl'
 
const string ROW_ID = 'row_ids'
 
const string TABLE_ACTION_ID = 'table_action'
 
const string TABLE_ACTION_CONFIRM_DELETE_TESTS = 'confirmDeleteTests'
 
const string TABLE_ACTION_CONFIRM_DELETE_TEST = 'confirmDeleteTest'
 
const string ACTION_CONFIRM_DELETE_TEST = "delete_selected_test"
 
const string ACTION_CONFIRM_DELETE_TESTS = "delete_selected_tests"
 
const string LNG_TABLE_COL_TITLE = 'title'
 
const string LNG_TABLE_COL_COURSE_OBJECTIVES = 'crs_objectives'
 
const string LNG_TABLE_COL_SELECTION_OF_TEST_QUESTIONS = 'crs_loc_tbl_tst_type'
 
const string LNG_TABLE_COL_QESTIONS = 'crs_loc_tbl_tst_qst_qpl'
 
const string LNG_TABLE_ACTION_CONFIRM_DELETE_TESTS = 'crs_loc_delete_assignment'
 
const string LNG_TABLE_ACTION_CONFIRM_DELETE_TEST = 'crs_loc_delete_assignment'
 
URLBuilder $url_builder
 
ilDataFactory $data_factory
 
ilURLBuilderToken $action_parameter_token
 
ilURLBuilderToken $row_id_token
 
ilDataTable $table
 
ilLOSettings $settings
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLOTestAssignmentTableGUI::__construct ( protected int  $assignment_type,
protected int  $test_type,
protected int  $container_id,
protected ilLanguage  $lng,
protected ilUIServices  $ui_services,
protected ilHTTPServices  $http_services,
protected ilLOTestAssignmentTableDataRetrieval  $data_retrieval,
protected ilRefineryFactory  $refinery,
protected ilCtrl  $ctrl,
protected object  $parent_object 
)

Definition at line 64 of file class.ilLOTestAssignmentTableGUI.php.

75 {
76 $this->data_factory = new ilDataFactory();
77 $this->settings = ilLOSettings::getInstanceByObjId($container_id);
78 }
static getInstanceByObjId(int $a_obj_id)

References ilLOSettings\getInstanceByObjId(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ allIds()

ilLOTestAssignmentTableGUI::allIds ( )
protected

Definition at line 178 of file class.ilLOTestAssignmentTableGUI.php.

178 : array
179 {
180 return $this->data_retrieval->allIds();
181 }

Referenced by handleCommands().

+ Here is the caller graph for this function:

◆ deleteTest()

ilLOTestAssignmentTableGUI::deleteTest ( array  $ids)
protected

Definition at line 241 of file class.ilLOTestAssignmentTableGUI.php.

241 : void
242 {
244 foreach ($ids as $tst_id) {
245 switch ($this->getTestType()) {
248 break;
249
252 break;
253 }
254 $settings->update();
255
256 // finally delete start object assignment
257 $start = new ilContainerStartObjects(
258 $this->getParentObject()->getRefId(),
259 $this->getParentObject()->getId()
260 );
261 $start->deleteItem($tst_id);
262
263 // ... and assigned questions
265 }
266 $this->ctrl->redirectByClass('ilLOEditorGUI', 'testOverview');
267 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setInitialTest(int $a_id)
setQualifiedTest(int $a_id)

References $settings, ILIAS\Repository\ctrl(), ilCourseObjectiveQuestion\deleteTest(), ILIAS\Survey\Mode\getId(), ilLOSettings\getInstanceByObjId(), getParentObject(), getTestType(), ilLOSettings\setInitialTest(), ilLOSettings\setQualifiedTest(), ilLOSettings\TYPE_TEST_INITIAL, ilLOSettings\TYPE_TEST_QUALIFIED, and ilLOSettings\update().

Referenced by handleCommands().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteTests()

ilLOTestAssignmentTableGUI::deleteTests ( array  $ids)
protected

Definition at line 222 of file class.ilLOTestAssignmentTableGUI.php.

222 : void
223 {
224 foreach ($ids as $assign_id) {
225 $assignment = new ilLOTestAssignment($assign_id);
226 $assignment->delete();
227
228 // finally delete start object assignment
229 $start = new ilContainerStartObjects(
230 $this->getParentObject()->getRefId(),
231 $this->getParentObject()->getId()
232 );
233 $start->deleteItem($assignment->getTestRefId());
234
235 // ... and assigned questions
236 ilCourseObjectiveQuestion::deleteTest($assignment->getTestRefId());
237 }
238 $this->ctrl->redirectByClass('ilLOEditorGUI', 'testOverview');
239 }
Settings for LO courses.

References ILIAS\Repository\ctrl(), ilCourseObjectiveQuestion\deleteTest(), ILIAS\Survey\Mode\getId(), and getParentObject().

Referenced by handleCommands().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActions()

ilLOTestAssignmentTableGUI::getActions ( )
protected

Definition at line 100 of file class.ilLOTestAssignmentTableGUI.php.

100 : array
101 {
102 $this->url_builder = new URLBuilder($this->data_factory->uri($this->http_services->request()->getUri()->__toString()));
103 list($this->url_builder, $this->action_parameter_token, $this->row_id_token) =
104 $this->url_builder->acquireParameters(
105 ['datatable', self::TABLE_ID],
106 self::TABLE_ACTION_ID,
107 self::ROW_ID
108 );
109 $actions = [];
110 if ($this->getAssignmentType() === self::TYPE_MULTIPLE_ASSIGNMENTS) {
111 $actions[self::TABLE_ACTION_CONFIRM_DELETE_TESTS] = $this->ui_services->factory()->table()->action()->multi(
112 $this->lng->txt(self::LNG_TABLE_ACTION_CONFIRM_DELETE_TESTS),
113 $this->url_builder->withParameter($this->action_parameter_token, self::TABLE_ACTION_CONFIRM_DELETE_TESTS),
114 $this->row_id_token,
115 )->withAsync();
116 }
117 if ($this->getAssignmentType() !== self::TYPE_MULTIPLE_ASSIGNMENTS) {
118 $actions[self::TABLE_ACTION_CONFIRM_DELETE_TESTS] = $this->ui_services->factory()->table()->action()->multi(
119 $this->lng->txt(self::LNG_TABLE_ACTION_CONFIRM_DELETE_TEST),
120 $this->url_builder->withParameter($this->action_parameter_token, self::TABLE_ACTION_CONFIRM_DELETE_TEST),
121 $this->row_id_token,
122 )->withAsync();
123 }
124 return $actions;
125 }

References getAssignmentType(), ILIAS\Repository\lng(), and TABLE_ACTION_CONFIRM_DELETE_TESTS.

Referenced by initTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignmentType()

ilLOTestAssignmentTableGUI::getAssignmentType ( )

Definition at line 275 of file class.ilLOTestAssignmentTableGUI.php.

275 : int
276 {
277 return $this->assignment_type;
278 }

Referenced by getActions(), getColumns(), and getTitleLangVar().

+ Here is the caller graph for this function:

◆ getColumns()

ilLOTestAssignmentTableGUI::getColumns ( )
protected

Definition at line 80 of file class.ilLOTestAssignmentTableGUI.php.

80 : array
81 {
82 $columns = [];
83 $columns[self::TABLE_COL_TITLE] = $this->ui_services->factory()->table()->column()->link(
84 $this->lng->txt(self::LNG_TABLE_COL_TITLE)
85 )->withIsSortable(true);
86 if ($this->getAssignmentType() == self::TYPE_MULTIPLE_ASSIGNMENTS) {
87 $columns[self::TABLE_COL_COURSE_OBJECTIVES] = $this->ui_services->factory()->table()->column()->text(
88 $this->lng->txt(self::LNG_TABLE_COL_COURSE_OBJECTIVES)
89 )->withIsSortable(false);
90 }
91 $columns[self::TABLE_COL_SELECTION_OF_TEST_QUESTIONS] = $this->ui_services->factory()->table()->column()->text(
92 $this->lng->txt(self::LNG_TABLE_COL_SELECTION_OF_TEST_QUESTIONS)
93 )->withIsSortable(false);
94 $columns[self::TABLE_COL_QESTIONS] = $this->ui_services->factory()->table()->column()->text(
95 $this->lng->txt(self::LNG_TABLE_COL_QESTIONS)
96 )->withIsSortable(false);
97 return $columns;
98 }

References getAssignmentType(), ILIAS\Repository\lng(), TABLE_COL_COURSE_OBJECTIVES, TABLE_COL_QESTIONS, TABLE_COL_SELECTION_OF_TEST_QUESTIONS, and TABLE_COL_TITLE.

+ Here is the call graph for this function:

◆ getHTML()

ilLOTestAssignmentTableGUI::getHTML ( )

Definition at line 269 of file class.ilLOTestAssignmentTableGUI.php.

269 : string
270 {
271 $this->initTable();
272 return $this->ui_services->renderer()->render([$this->table]);
273 }

References initTable().

+ Here is the call graph for this function:

◆ getParentObject()

ilLOTestAssignmentTableGUI::getParentObject ( )

Definition at line 285 of file class.ilLOTestAssignmentTableGUI.php.

285 : object
286 {
287 return $this->parent_object;
288 }

Referenced by deleteTest(), and deleteTests().

+ Here is the caller graph for this function:

◆ getSettings()

ilLOTestAssignmentTableGUI::getSettings ( )

Definition at line 280 of file class.ilLOTestAssignmentTableGUI.php.

281 {
282 return $this->settings;
283 }
Settings for LO courses.

References $settings.

Referenced by getTitleLangVar().

+ Here is the caller graph for this function:

◆ getTestType()

ilLOTestAssignmentTableGUI::getTestType ( )

Definition at line 290 of file class.ilLOTestAssignmentTableGUI.php.

290 : int
291 {
292 return $this->test_type;
293 }

Referenced by deleteTest().

+ Here is the caller graph for this function:

◆ getTitleLangVar()

ilLOTestAssignmentTableGUI::getTitleLangVar ( )
protected

Definition at line 127 of file class.ilLOTestAssignmentTableGUI.php.

127 : string
128 {
129 switch ($this->test_type) {
131 if (
132 $this->getAssignmentType() === self::TYPE_SINGLE_ASSIGNMENTS &&
133 $this->getSettings()->isInitialTestQualifying()
134 ) {
135 return 'crs_loc_settings_tbl_its_q_all';
136 }
137 if (
138 $this->getAssignmentType() === self::TYPE_SINGLE_ASSIGNMENTS &&
139 !$this->getSettings()->isInitialTestQualifying()
140 ) {
141 return 'crs_loc_settings_tbl_its_nq_all';
142 }
143 if ($this->getSettings()->isInitialTestQualifying()) {
144 return 'crs_loc_settings_tbl_it_q';
145 }
146 if (!$this->getSettings()->isInitialTestQualifying()) {
147 return 'crs_loc_settings_tbl_it_nq';
148 }
149 break;
150
152 if ($this->getAssignmentType() === self::TYPE_SINGLE_ASSIGNMENTS) {
153 return 'crs_loc_settings_tbl_qts_all';
154 }
155 if ($this->getAssignmentType() !== self::TYPE_SINGLE_ASSIGNMENTS) {
156 return 'crs_loc_settings_tbl_qt';
157 }
158 break;
159 }
160 return 'lng_title_missing';
161 }

References getAssignmentType(), getSettings(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

+ Here is the call graph for this function:

◆ handleCommands()

ilLOTestAssignmentTableGUI::handleCommands ( )

Definition at line 295 of file class.ilLOTestAssignmentTableGUI.php.

295 : void
296 {
297 $this->initTable();
298 if (!$this->http_services->wrapper()->query()->has($this->action_parameter_token->getName())) {
299 return;
300 }
301 $action = $this->http_services->wrapper()->query()->retrieve(
302 $this->action_parameter_token->getName(),
303 $this->refinery->to()->string()
304 );
305 $tokens = $this->http_services->wrapper()->query()->retrieve(
306 $this->row_id_token->getName(),
307 $this->refinery->custom()->transformation(fn($v) => $v)
308 );
309 $all_entries = ($tokens[0] ?? "") === self::ALL_OBJECTS;
310 $ids = [];
311 if ($all_entries) {
312 $ids = $this->allIds();
313 }
314 if (!$all_entries) {
315 $ids = $this->readIdsFromQuery();
316 }
317 if (is_null($ids[0]) || count($ids) === 0) {
318 return;
319 }
320 switch ($action) {
322 $id_map = [];
323 foreach ($ids as $id) {
325 ;
326 }
327 $this->showDeleteModal($id_map, self::ACTION_CONFIRM_DELETE_TEST);
328 break;
330 $id_map = [];
331 foreach ($ids as $id) {
332 $assignment = new ilLOTestAssignment($id);
333 $id_map[$id] = ilObject::_lookupObjId($assignment->getTestRefId());
334 }
335 $this->showDeleteModal($id_map, self::ACTION_CONFIRM_DELETE_TESTS);
336 break;
338 $this->deleteTest($ids);
339 break;
341 $this->deleteTests($ids);
342 break;
343 }
344 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _lookupObjId(int $ref_id)

References $id, $id_map, ilObject\_lookupObjId(), ACTION_CONFIRM_DELETE_TEST, ACTION_CONFIRM_DELETE_TESTS, allIds(), deleteTest(), deleteTests(), initTable(), readIdsFromQuery(), TABLE_ACTION_CONFIRM_DELETE_TEST, and TABLE_ACTION_CONFIRM_DELETE_TESTS.

+ Here is the call graph for this function:

◆ initTable()

ilLOTestAssignmentTableGUI::initTable ( )
protected

Definition at line 163 of file class.ilLOTestAssignmentTableGUI.php.

163 : void
164 {
165 if (isset($this->table)) {
166 return;
167 }
168 $this->table = $this->ui_services->factory()->table()->data(
169 $this->data_retrieval,
170 $this->lng->txt($this->getTitleLangVar()),
171 $this->getColumns()
172 )
173 ->withId(self::TABLE_ID)
174 ->withActions($this->getActions())
175 ->withRequest($this->http_services->request());
176 }

References getActions(), and ILIAS\Repository\lng().

Referenced by getHTML(), and handleCommands().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readIdsFromQuery()

ilLOTestAssignmentTableGUI::readIdsFromQuery ( )
protected

Definition at line 183 of file class.ilLOTestAssignmentTableGUI.php.

183 : array
184 {
185 $tokens = $this->http_services->wrapper()->query()->retrieve(
186 $this->row_id_token->getName(),
187 $this->refinery->custom()->transformation(fn($v) => $v)
188 );
189 return is_null($tokens)
190 ? []
191 : (is_array($tokens) ? $tokens : [$tokens]);
192 }
193
194 #[NoReturn] protected function showDeleteModal(
195 array $id_map,
196 string $url_action
197 ): void {
198 $items = [];
199 foreach ($id_map as $id => $obj_id) {
200 $items[] = $this->ui_services->factory()->modal()->interruptiveItem()->standard(
201 $id,
202 ilObject::_lookupTitle($obj_id),
203 );
204 }
static _lookupTitle(int $obj_id)

Referenced by handleCommands().

+ Here is the caller graph for this function:

Field Documentation

◆ $action_parameter_token

ilURLBuilderToken ilLOTestAssignmentTableGUI::$action_parameter_token
protected

Definition at line 59 of file class.ilLOTestAssignmentTableGUI.php.

◆ $data_factory

ilDataFactory ilLOTestAssignmentTableGUI::$data_factory
protected

Definition at line 58 of file class.ilLOTestAssignmentTableGUI.php.

◆ $id_map

array ilLOTestAssignmentTableGUI::$id_map

Definition at line 195 of file class.ilLOTestAssignmentTableGUI.php.

Referenced by handleCommands().

◆ $row_id_token

ilURLBuilderToken ilLOTestAssignmentTableGUI::$row_id_token
protected

Definition at line 60 of file class.ilLOTestAssignmentTableGUI.php.

◆ $settings

ilLOSettings ilLOTestAssignmentTableGUI::$settings
protected

Definition at line 62 of file class.ilLOTestAssignmentTableGUI.php.

Referenced by deleteTest(), and getSettings().

◆ $table

ilDataTable ilLOTestAssignmentTableGUI::$table
protected

Definition at line 61 of file class.ilLOTestAssignmentTableGUI.php.

◆ $url_action

array string ilLOTestAssignmentTableGUI::$url_action

Definition at line 196 of file class.ilLOTestAssignmentTableGUI.php.

◆ $url_builder

URLBuilder ilLOTestAssignmentTableGUI::$url_builder
protected

Definition at line 57 of file class.ilLOTestAssignmentTableGUI.php.

◆ ACTION_CONFIRM_DELETE_TEST

const string ilLOTestAssignmentTableGUI::ACTION_CONFIRM_DELETE_TEST = "delete_selected_test"
protected

Definition at line 48 of file class.ilLOTestAssignmentTableGUI.php.

Referenced by handleCommands().

◆ ACTION_CONFIRM_DELETE_TESTS

const string ilLOTestAssignmentTableGUI::ACTION_CONFIRM_DELETE_TESTS = "delete_selected_tests"
protected

Definition at line 49 of file class.ilLOTestAssignmentTableGUI.php.

Referenced by handleCommands().

◆ ALL_OBJECTS

const string ilLOTestAssignmentTableGUI::ALL_OBJECTS = "ALL_OBJECTS"
protected

Definition at line 42 of file class.ilLOTestAssignmentTableGUI.php.

◆ foreach

ilLOTestAssignmentTableGUI::foreach($id_map as $id=> $obj_id)

Definition at line 199 of file class.ilLOTestAssignmentTableGUI.php.

◆ LNG_TABLE_ACTION_CONFIRM_DELETE_TEST

const string ilLOTestAssignmentTableGUI::LNG_TABLE_ACTION_CONFIRM_DELETE_TEST = 'crs_loc_delete_assignment'
protected

Definition at line 55 of file class.ilLOTestAssignmentTableGUI.php.

◆ LNG_TABLE_ACTION_CONFIRM_DELETE_TESTS

const string ilLOTestAssignmentTableGUI::LNG_TABLE_ACTION_CONFIRM_DELETE_TESTS = 'crs_loc_delete_assignment'
protected

Definition at line 54 of file class.ilLOTestAssignmentTableGUI.php.

◆ LNG_TABLE_COL_COURSE_OBJECTIVES

const string ilLOTestAssignmentTableGUI::LNG_TABLE_COL_COURSE_OBJECTIVES = 'crs_objectives'
protected

Definition at line 51 of file class.ilLOTestAssignmentTableGUI.php.

◆ LNG_TABLE_COL_QESTIONS

const string ilLOTestAssignmentTableGUI::LNG_TABLE_COL_QESTIONS = 'crs_loc_tbl_tst_qst_qpl'
protected

Definition at line 53 of file class.ilLOTestAssignmentTableGUI.php.

◆ LNG_TABLE_COL_SELECTION_OF_TEST_QUESTIONS

const string ilLOTestAssignmentTableGUI::LNG_TABLE_COL_SELECTION_OF_TEST_QUESTIONS = 'crs_loc_tbl_tst_type'
protected

Definition at line 52 of file class.ilLOTestAssignmentTableGUI.php.

◆ LNG_TABLE_COL_TITLE

const string ilLOTestAssignmentTableGUI::LNG_TABLE_COL_TITLE = 'title'
protected

Definition at line 50 of file class.ilLOTestAssignmentTableGUI.php.

◆ ROW_ID

const string ilLOTestAssignmentTableGUI::ROW_ID = 'row_ids'
protected

Definition at line 44 of file class.ilLOTestAssignmentTableGUI.php.

◆ TABLE_ACTION_CONFIRM_DELETE_TEST

const string ilLOTestAssignmentTableGUI::TABLE_ACTION_CONFIRM_DELETE_TEST = 'confirmDeleteTest'
protected

Definition at line 47 of file class.ilLOTestAssignmentTableGUI.php.

Referenced by handleCommands().

◆ TABLE_ACTION_CONFIRM_DELETE_TESTS

const string ilLOTestAssignmentTableGUI::TABLE_ACTION_CONFIRM_DELETE_TESTS = 'confirmDeleteTests'
protected

Definition at line 46 of file class.ilLOTestAssignmentTableGUI.php.

Referenced by getActions(), and handleCommands().

◆ TABLE_ACTION_ID

const string ilLOTestAssignmentTableGUI::TABLE_ACTION_ID = 'table_action'
protected

Definition at line 45 of file class.ilLOTestAssignmentTableGUI.php.

◆ TABLE_COL_COURSE_OBJECTIVES

const string ilLOTestAssignmentTableGUI::TABLE_COL_COURSE_OBJECTIVES = 'objective'

Definition at line 39 of file class.ilLOTestAssignmentTableGUI.php.

Referenced by getColumns().

◆ TABLE_COL_QESTIONS

const string ilLOTestAssignmentTableGUI::TABLE_COL_QESTIONS = 'qstqpl'

Definition at line 41 of file class.ilLOTestAssignmentTableGUI.php.

Referenced by getColumns().

◆ TABLE_COL_SELECTION_OF_TEST_QUESTIONS

const string ilLOTestAssignmentTableGUI::TABLE_COL_SELECTION_OF_TEST_QUESTIONS = 'ttype'

Definition at line 40 of file class.ilLOTestAssignmentTableGUI.php.

Referenced by getColumns().

◆ TABLE_COL_TITLE

const string ilLOTestAssignmentTableGUI::TABLE_COL_TITLE = 'title'

Definition at line 38 of file class.ilLOTestAssignmentTableGUI.php.

Referenced by getColumns().

◆ TABLE_ID

const string ilLOTestAssignmentTableGUI::TABLE_ID = 'lotstasstbl'
protected

Definition at line 43 of file class.ilLOTestAssignmentTableGUI.php.

◆ TYPE_MULTIPLE_ASSIGNMENTS

const int ilLOTestAssignmentTableGUI::TYPE_MULTIPLE_ASSIGNMENTS = 1

◆ TYPE_SINGLE_ASSIGNMENTS

const int ilLOTestAssignmentTableGUI::TYPE_SINGLE_ASSIGNMENTS = 2

Definition at line 37 of file class.ilLOTestAssignmentTableGUI.php.

Referenced by ilLOEditorGUI\testOverview().


The documentation for this class was generated from the following file: