19declare(strict_types=1);
47 $this->tree =
$DIC->repositoryTree();
48 $this->
http = $DIC->http();
50 $this->db =
$DIC->database();
55 if ($this->
http->wrapper()->query()->has(
'duplicate_id')) {
56 return $this->
http->wrapper()->query()->retrieve(
66 return $this->
getLang()->txt(
'sysc_grp_tree');
71 return $this->
getLang()->txt(
'sysc_grp_tree_desc');
76 switch ($this->
getTask()->getIdentifier()) {
78 return $this->
getLang()->txt(
'sysc_task_tree_dump');
81 return $this->
getLang()->txt(
'sysc_task_tree_duplicates');
84 return $this->
getLang()->txt(
'sysc_task_tree_missing_reference');
87 return $this->
getLang()->txt(
'sysc_task_tree_missing_tree');
90 return $this->
getLang()->txt(
'sysc_task_structure');
97 switch ($this->
getTask()->getIdentifier()) {
99 return $this->
getLang()->txt(
'sysc_task_tree_dump_desc');
102 return $this->
getLang()->txt(
'sysc_task_tree_duplicates_desc');
105 return $this->
getLang()->txt(
'sysc_task_tree_missing_reference_desc');
108 return $this->
getLang()->txt(
'sysc_task_tree_missing_tree_desc');
111 return $this->
getLang()->txt(
'sysc_task_structure_desc');
124 switch ($this->
getTask()->getIdentifier()) {
128 'txt' => $this->
getLang()->txt(
'sysc_action_validate'),
129 'command' =>
'validateDuplicates'
134 'txt' => $this->
getLang()->txt(
'sysc_action_repair'),
135 'command' =>
'repairDuplicates'
143 if ($validator->hasScanLog()) {
145 'txt' => $this->
getLang()->txt(
'sysc_action_show_tree'),
146 'command' =>
'showTree'
151 'txt' => $this->
getLang()->txt(
'sysc_action_list_tree'),
152 'command' =>
'listTree'
159 'txt' => $this->
getLang()->txt(
'sysc_action_validate'),
160 'command' =>
'findMissing'
165 'txt' => $this->
getLang()->txt(
'sysc_action_repair'),
166 'command' =>
'confirmRepairMissing'
174 'txt' => $this->
getLang()->txt(
'sysc_action_validate'),
175 'command' =>
'findMissingTreeEntries'
180 'txt' => $this->
getLang()->txt(
'sysc_action_repair'),
181 'command' =>
'confirmRepairMissingTreeEntries'
189 'txt' => $this->
getLang()->txt(
'sysc_action_validate'),
190 'command' =>
'analyzeStructure'
195 'txt' => $this->
getLang()->txt(
'sysc_action_repair'),
196 'command' =>
'confirmRepairStructure'
207 $num_failures = $tasks->validateStructure();
211 $this->tpl->setOnScreenMessage(
'failure', $this->
getLang()->txt(
'sysc_tree_structure_failures') .
' ' . $num_failures,
true);
213 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
215 $this->
getCtrl()->returnToParent($this);
221 $this->
getLang()->txt(
'sysc_message_tree_structure_confirm'),
222 $this->
getLang()->txt(
'sysc_btn_tree_structure'),
233 } elseif ($this->tree->getTreeImplementation() instanceof
ilNestedSetTree) {
241 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
242 $this->
getCtrl()->returnToParent($this);
248 $errors_count = $validator->dumpTree();
252 $this->tpl->setOnScreenMessage(
'failure', $this->
getLang()->txt(
'sysc_tree_list_failures') .
' ' . $errors_count,
true);
255 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
261 $this->
getCtrl()->returnToParent($this);
267 $scan_log = $validator->readScanLog();
269 if (is_array($scan_log)) {
270 $scan_log =
'<pre>' . implode(
"", $scan_log) .
'</pre>';
271 $this->tpl->setContent($scan_log);
278 $num_failures = $tasks->validateDuplicates();
282 $this->tpl->setOnScreenMessage(
'failure', $this->
getLang()->txt(
'sysc_tree_duplicate_failures') .
' ' . $num_failures,
true);
284 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
286 $this->
getCtrl()->returnToParent($this);
295 $table->parse($deepest_duplicate);
297 $this->tpl->setContent($table->getHTML());
305 if ($tasks->checkDuplicates()) {
309 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_deleted_duplicate'),
true);
310 $this->
getCtrl()->returnToParent($this);
318 if ($tasks->checkDuplicates()) {
322 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_deleted_duplicate'),
true);
323 $this->
getCtrl()->returnToParent($this);
329 $num_failures = $tasks->findMissing();
333 $this->tpl->setOnScreenMessage(
'failure', $this->
getLang()->txt(
'sysc_tree_missing_failures') .
' ' . $num_failures,
true);
335 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
337 $this->
getCtrl()->returnToParent($this);
343 $this->
getLang()->txt(
'sysc_message_tree_missing_confirm'),
344 $this->
getLang()->txt(
'sysc_btn_tree_missing'),
352 $tasks->repairMissing();
358 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
359 $this->
getCtrl()->returnToParent($this);
365 $num_failures = $tasks->findMissingTreeEntries();
369 $this->tpl->setOnScreenMessage(
'failure', $this->
getLang()->txt(
'sysc_tree_missing_tree_failures') .
' ' . $num_failures,
true);
371 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
373 $this->
getCtrl()->returnToParent($this);
379 $this->
getLang()->txt(
'sysc_message_tree_missing_confirm'),
380 $this->
getLang()->txt(
'sysc_btn_tree_missing'),
381 'repairMissingTreeEntries'
388 $tasks->repairMissingTreeEntries();
394 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
395 $this->
getCtrl()->returnToParent($this);
@classDescription Date and time handling
Base class for materialize path based trees Based on implementation of Werner Randelshofer.
static createFromParentRelation(ilDBInterface $db)
Base class for nested set path based trees.
Abstract class for component tasks.
showSimpleConfirmation(string $a_text, string $a_btn_text, string $a_cmd)
Defines a system check task.
Defines a system check task.
confirmRepairMissingTreeEntries()
getActions()
array( 'txt' => $lng->txt('sysc_action_repair') 'command' => 'repairTask' );
__construct(?ilSCTask $task=null)
repairMissingTreeEntries()
deleteDuplicatesFromTrash()
deleteDuplicatesFromRepository()
getDuplicateIdFromRequest()
Defines a system check task.
static findDeepestDuplicate()
static deleteDuplicateFromTree(int $a_duplicate_id, bool $a_delete_trash)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface GlobalHttpState.
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc