ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
class.ilTestSkillLevelThresholdList.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
29 private $db;
30
34 private $testId;
35
39 private $thresholds = [];
40
41 public function __construct(ilDBInterface $db)
42 {
43 $this->db = $db;
44 }
45
49 public function setTestId($testId)
50 {
51 $this->testId = $testId;
52 }
53
57 public function getTestId(): int
58 {
59 return $this->testId;
60 }
61
62 public function resetThresholds()
63 {
64 $this->thresholds = [];
65 }
66
67 public function loadFromDb()
68 {
69 $this->resetThresholds();
70
71 $query = "
72 SELECT test_fi, skill_base_fi, skill_tref_fi, skill_level_fi, threshold
73 FROM tst_skl_thresholds
74 WHERE test_fi = %s
75 ";
76
77 $res = $this->db->queryF($query, ['integer'], [$this->getTestId()]);
78
79 while ($row = $this->db->fetchAssoc($res)) {
80 $threshold = $this->buildSkillLevelThresholdByArray($row);
81 $this->addThreshold($threshold);
82 }
83 }
84
87 public function saveToDb()
88 {
89 foreach ($this->thresholds as $skillKey => $skillLevels) {
90 foreach ($skillLevels as $levelThreshold) {
91 /* @var ilTestSkillLevelThreshold $levelThreshold */
92 $levelThreshold->saveToDb();
93 }
94 }
95 }
96
100 public function addThreshold($threshold)
101 {
102 $skillKey = $threshold->getSkillBaseId() . ':' . $threshold->getSkillTrefId();
103 $this->thresholds[$skillKey][$threshold->getSkillLevelId()] = $threshold;
104 }
105
111 {
112 $threshold = new ilTestSkillLevelThreshold($this->db);
113
114 $threshold->setTestId($data['test_fi']);
115 $threshold->setSkillBaseId($data['skill_base_fi']);
116 $threshold->setSkillTrefId($data['skill_tref_fi']);
117 $threshold->setSkillLevelId($data['skill_level_fi']);
118 $threshold->setThreshold($data['threshold']);
119
120 return $threshold;
121 }
122
123 public function getThreshold(
124 $skill_base_id,
125 $skill_tref_id,
126 $skill_level_id,
127 $force_object = false
129 $skillKey = $skill_base_id . ':' . $skill_tref_id;
130
131 if (isset($this->thresholds[$skillKey]) && isset($this->thresholds[$skillKey][$skill_level_id])) {
132 return $this->thresholds[$skillKey][$skill_level_id];
133 }
134
135 if ($force_object) {
136 $threshold = new ilTestSkillLevelThreshold($this->db);
137
138 $threshold->setTestId($this->getTestId());
139 $threshold->setSkillBaseId($skill_base_id);
140 $threshold->setSkillTrefId($skill_tref_id);
141 $threshold->setSkillLevelId($skill_level_id);
142
143 return $threshold;
144 }
145
146 return null;
147 }
148
150 int $skill_base_id,
151 int $skill_tref_id
152 ): array {
153 return $this->thresholds["{$skill_base_id}:{$skill_tref_id}"] ?? [];
154 }
155
156 public function cloneListForTest($testId)
157 {
158 foreach ($this->thresholds as $data) {
159 foreach ($data as $threshold) {
160 /* @var ilTestSkillLevelThreshold $threshold */
161
162 $threshold->setTestId($testId);
163 $threshold->saveToDb();
164
165 $threshold->setTestId($this->getTestId());
166 }
167 }
168 }
169}
getThreshold( $skill_base_id, $skill_tref_id, $skill_level_id, $force_object=false)
getThesholdsOfBaseAndTrefId(int $skill_base_id, int $skill_tref_id)
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilDBInterface.
foreach($_POST as $key=> $value) $res
$data
Definition: storeScorm.php:45