19 declare(strict_types=1);
29 private ?
int $id = null;
59 public function setId(
int $id): void
126 $this->original_taxonomy_filter = $filter;
131 return empty($this->original_taxonomy_filter) ? null : serialize($this->original_taxonomy_filter);
136 $this->original_taxonomy_filter = empty($value) ? [] : unserialize($value);
152 $this->mapped_taxonomy_filter = $filter;
157 return empty($this->mapped_taxonomy_filter) ? null : serialize($this->mapped_taxonomy_filter);
162 $this->mapped_taxonomy_filter = empty($value) ? [] : unserialize($value);
167 $this->mapped_taxonomy_filter = [];
168 foreach ($this->original_taxonomy_filter as $tax_id => $node_ids) {
170 if ($mapped_taxonomy_id === null) {
174 foreach ($node_ids as $node_id) {
176 if ($mapped_node_id !== null) {
177 $this->mapped_taxonomy_filter[$mapped_taxonomy_id][] = $mapped_node_id;
198 return empty($this->type_filter) ? null : serialize($this->type_filter);
206 $this->type_filter = empty($value) ? [] : unserialize($value);
221 return empty($this->lifecycle_filter) ? null : serialize($this->lifecycle_filter);
226 $this->lifecycle_filter = empty($db_value) ? [] : unserialize($db_value);
237 $map[$row[
'question_type_id']] = $row[
'type_tag'];
241 foreach ($this->type_filter as $type_id) {
242 if (isset($map[$type_id])) {
243 $tags[] = $map[$type_id];
258 $map[$row[
'type_tag']] = $row[
'question_type_id'];
261 $this->type_filter = [];
262 foreach ($tags as $type_tag) {
263 if (isset($map[$type_tag])) {
264 $this->type_filter[] = $map[$type_tag];
293 foreach ($data_array as $field => $value) {
296 $this->
setId($value);
310 case 'pool_quest_count':
313 case 'origin_tax_filter':
316 case 'mapped_tax_filter':
322 case 'lifecycle_filter':
338 $res = $this->db->queryF(
339 "SELECT * FROM tst_rnd_quest_set_qpls WHERE def_id = %s",
344 while ($row = $this->db->fetchAssoc(
$res)) {
355 if ($this->
getId()) {
370 $this->db->manipulateF(
371 "DELETE FROM tst_rnd_quest_set_qpls WHERE def_id = %s",
380 'tst_rnd_quest_set_qpls',
382 'test_fi' => [
'integer', $test_id],
383 'pool_fi' => [
'integer', $this->
getPoolId()],
396 'def_id' => [
'integer', $this->
getId()]
403 $next_id = $this->db->nextId(
'tst_rnd_quest_set_qpls');
405 $this->db->insert(
'tst_rnd_quest_set_qpls', [
406 'def_id' => [
'integer', $next_id],
407 'test_fi' => [
'integer', $test_id],
408 'pool_fi' => [
'integer', $this->
getPoolId()],
421 $this->
setId($next_id);
431 $path->enableTextOnly(
true);
435 $poolInfoLabel = sprintf(
436 $lng->
txt(
'tst_random_question_set_source_questionpool_summary_string'),
442 return $poolInfoLabel;
mapTaxonomyFilter(ilQuestionPoolDuplicatedTaxonomiesKeysMap $taxonomies_keys_map)
updateDbRecord(int $test_id)
setLifecycleFilterFromDbValue(?string $db_value)
setOriginalTaxonomyFilter(array $filter=[])
getPoolInfoLabel(ilLanguage $lng)
txt(string $a_topic, string $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...
setPoolTitle(string $pool_title)
setPoolQuestionCount(?int $pool_question_count)
setOriginalTaxonomyFilterFromDbValue(?string $value)
setQuestionAmount(?int $question_amount)
getTypeFilterAsTypeTags()
Get the type filter as a list of type tags.
setTypeFilterFromDbValue(?string $value)
get the question type filter from database value
static _lookupObjId(int $ref_id)
setMappedTaxonomyFilter(array $filter=[])
__construct(protected ilDBInterface $db, protected ilObjTest $test_obj)
getOriginalTaxonomyFilterForDbValue()
initFromArray(array $data_array)
insertDbRecord(int $test_id)
array $original_taxonomy_filter
setSequencePosition(int $sequence_position)
array $mapped_taxonomy_filter
setPoolPath(?string $pool_path)
setMappedTaxonomyFilterFromDbValue(?string $value)
cloneToDbForTestId(int $test_id)
getMappedTaxonomyId(int $original_taxonomy_id)
setTypeFilter(array $type_filter=[])
setLifecycleFilter(array $lifecycle_filter)
getTypeFilterForDbValue()
get the question type filter for insert into the database
getMappedTaxNodeId(int $original_tax_node_id)
setPoolRefId(?int $pool_ref_id)
getMappedTaxonomyFilterForDbValue()
setTypeFilterFromTypeTags(array $tags)
Set the type filter from a list of type tags.
getMappedTaxonomyFilter()
getLifecycleFilterForDbValue()
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
getOriginalTaxonomyFilter()