ILIAS  release_8 Revision v8.24
class.ilAssQuestionSkillAssignmentImportFails.php
Go to the documentation of this file.
1<?php
2
26{
30 protected $settings;
31
35 protected $parentObjId;
36
41 public function __construct($parentObjId)
42 {
43 $this->parentObjId = $parentObjId;
44 }
45
50 {
51 if ($this->settings === null) {
52 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportList.php';
53 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentRegistry.php';
54 $this->settings = new ilAssQuestionSkillAssignmentRegistry(new ilSetting('assimportfails'));
55 }
56
57 return $this->settings;
58 }
59
63 protected function getParentObjId(): int
64 {
65 return $this->parentObjId;
66 }
67
71 protected function buildSettingsKey(): string
72 {
73 return 'failed_imp_qsa_parentobj_' . $this->getParentObjId();
74 }
75
80 {
81 $value = $this->getSettings()->getStringifiedImports($this->buildSettingsKey(), null);
82
83 if ($value !== null) {
84 return unserialize($value);
85 }
86
87 return null;
88 }
89
94 {
95 $this->getSettings()->setStringifiedImports($this->buildSettingsKey(), serialize($assignmentList));
96 }
97
100 public function deleteRegisteredImportFails(): void
101 {
102 $this->getSettings()->deleteStringifiedImports($this->buildSettingsKey());
103 }
104
108 public function failedImportsRegistered(): bool
109 {
110 return $this->getFailedImports() !== null;
111 }
112
117 public function getFailedImportsMessage(ilLanguage $lng): string
118 {
119 $handledSkills = array();
120 $msg = $lng->txt('tst_failed_imp_qst_skl_assign');
121
122 $msg .= '<ul>';
123 foreach ($this->getFailedImports() as $assignmentImport) {
124 $sklBaseId = $assignmentImport->getImportSkillBaseId();
125 $sklTrefId = $assignmentImport->getImportSkillTrefId();
126
127 if (isset($handledSkills["$sklBaseId:$sklTrefId"])) {
128 continue;
129 }
130
131 $handledSkills["$sklBaseId:$sklTrefId"] = true;
132
133 $msg .= '<li>' . $assignmentImport->getImportSkillTitle() . '</li>';
134 }
135 $msg .= '</ul>';
136
137 return $msg;
138 }
139}
registerFailedImports(ilAssQuestionSkillAssignmentImportList $assignmentList)
__construct($parentObjId)
ilAssQuestionSkillAssignmentImportFails constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$lng