ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestSkillLevelThresholdImportFails.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
11 {
15  protected $settings;
16 
20  protected $parentObjId;
21 
26  public function __construct($parentObjId)
27  {
28  $this->parentObjId = $parentObjId;
29  }
30 
34  protected function getSettings()
35  {
36  if ($this->settings === null) {
37  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionAssignedSkillList.php';
38 
39  $this->settings = new ilSetting('assimportfails');
40  }
41 
42  return $this->settings;
43  }
44 
48  protected function getParentObjId()
49  {
50  return $this->parentObjId;
51  }
52 
56  protected function buildSettingsKey()
57  {
58  return 'failed_imp_slt_parentobj_' . $this->getParentObjId();
59  }
60 
64  public function getFailedImports()
65  {
66  $value = $this->getSettings()->get($this->buildSettingsKey(), null);
67 
68  if ($value !== null) {
69  return unserialize($value);
70  }
71 
72  return null;
73  }
74 
79  {
80  $this->getSettings()->set($this->buildSettingsKey(), serialize($skillList));
81  }
82 
85  public function deleteRegisteredImportFails()
86  {
87  $this->getSettings()->delete($this->buildSettingsKey());
88  }
89 
93  public function failedImportsRegistered()
94  {
95  return $this->getFailedImports() !== null;
96  }
97 
103  {
104  require_once 'Services/Skill/classes/class.ilBasicSkill.php';
105 
106  $msg = $lng->txt('tst_failed_imp_skl_thresholds');
107 
108  $msg .= '<ul>';
109  foreach ($this->getFailedImports() as $skillKey) {
110  list($skillBaseId, $skillTrefId) = explode(':', $skillKey);
111  $skillTitle = ilBasicSkill::_lookupTitle($skillBaseId, $skillTrefId);
112 
113  $msg .= '<li>' . $skillTitle . '</li>';
114  }
115  $msg .= '</ul>';
116 
117  return $msg;
118  }
119 }
settings()
Definition: settings.php:2
registerFailedImports(ilAssQuestionAssignedSkillList $skillList)
$lng
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
__construct($parentObjId)
ilTestSkillLevelThresholdImportFails constructor.
language handling
txt($a_topic, $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...