ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilAssQuestionSkillAssignmentImportFails.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  {
38  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportList.php';
39  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentRegistry.php';
40  $this->settings = new ilAssQuestionSkillAssignmentRegistry(new ilSetting('assimportfails'));
41  }
42 
43  return $this->settings;
44  }
45 
49  protected function getParentObjId()
50  {
51  return $this->parentObjId;
52  }
53 
57  protected function buildSettingsKey()
58  {
59  return 'failed_imp_qsa_parentobj_'.$this->getParentObjId();
60  }
61 
65  public function getFailedImports()
66  {
67  $value = $this->getSettings()->getStringifiedImports($this->buildSettingsKey(), null);
68 
69  if( $value !== null )
70  {
71  return unserialize($value);
72  }
73 
74  return null;
75  }
76 
81  {
82  $this->getSettings()->setStringifiedImports($this->buildSettingsKey(), serialize($assignmentList));
83  }
84 
87  public function deleteRegisteredImportFails()
88  {
89  $this->getSettings()->deleteStringifiedImports($this->buildSettingsKey());
90  }
91 
95  public function failedImportsRegistered()
96  {
97  return $this->getFailedImports() !== null;
98  }
99 
105  {
106  $handledSkills = array();
107  $msg = $lng->txt('tst_failed_imp_qst_skl_assign');
108 
109  $msg .= '<ul>';
110  foreach($this->getFailedImports() as $assignmentImport)
111  {
112  $sklBaseId = $assignmentImport->getImportSkillBaseId();
113  $sklTrefId = $assignmentImport->getImportSkillTrefId();
114 
115  if( isset($handledSkills["$sklBaseId:$sklTrefId"]) )
116  {
117  continue;
118  }
119 
120  $handledSkills["$sklBaseId:$sklTrefId"] = true;
121 
122  $msg .= '<li>'.$assignmentImport->getImportSkillTitle().'</li>';
123  }
124  $msg .= '</ul>';
125 
126  return $msg;
127  }
128 }
ILIAS Setting Class.
__construct($parentObjId)
ilAssQuestionSkillAssignmentImportFails constructor.
Class ilAssQuestionSkillAssignmentRegistry.
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
global $lng
Definition: privfeed.php:17
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...
registerFailedImports(ilAssQuestionSkillAssignmentImportList $assignmentList)