19 declare(strict_types=1);
29 private ?
int $id = null;
59 public function setId(
int $id): void
126 $this->original_taxonomy_filter = $filter;
132 return empty($this->original_taxonomy_filter) ? null : serialize($this->original_taxonomy_filter);
138 $this->original_taxonomy_filter = empty($value) ? [] : unserialize($value);
156 $this->mapped_taxonomy_filter = $filter;
161 return empty($this->mapped_taxonomy_filter) ? null : serialize($this->mapped_taxonomy_filter);
166 $this->mapped_taxonomy_filter = empty($value) ? [] : unserialize($value);
171 $this->mapped_taxonomy_filter = [];
172 foreach ($this->original_taxonomy_filter as $tax_id => $node_ids) {
174 if ($mapped_taxonomy_id === null) {
178 foreach ($node_ids as $node_id) {
180 if ($mapped_node_id !== null) {
181 $this->mapped_taxonomy_filter[$mapped_taxonomy_id][] = $mapped_node_id;
202 return empty($this->type_filter) ? null : serialize($this->type_filter);
210 $this->type_filter = empty($value) ? [] : unserialize($value);
225 return empty($this->lifecycle_filter) ? null : serialize($this->lifecycle_filter);
230 $this->lifecycle_filter = empty($db_value) ? [] : unserialize($db_value);
241 $map[$row[
'question_type_id']] = $row[
'type_tag'];
245 foreach ($this->type_filter as $type_id) {
246 if (isset($map[$type_id])) {
247 $tags[] = $map[$type_id];
262 $map[$row[
'type_tag']] = $row[
'question_type_id'];
265 $this->type_filter = [];
266 foreach ($tags as $type_tag) {
267 if (isset($map[$type_tag])) {
268 $this->type_filter[] = $map[$type_tag];
297 foreach ($data_array as $field => $value) {
300 $this->
setId($value);
314 case 'pool_quest_count':
317 case 'origin_tax_filter':
320 case 'mapped_tax_filter':
326 case 'lifecycle_filter':
342 $res = $this->db->queryF(
343 "SELECT * FROM tst_rnd_quest_set_qpls WHERE def_id = %s",
348 while ($row = $this->db->fetchAssoc(
$res)) {
359 if ($this->
getId()) {
374 $this->db->manipulateF(
375 "DELETE FROM tst_rnd_quest_set_qpls WHERE def_id = %s",
384 'tst_rnd_quest_set_qpls',
386 'test_fi' => [
'integer', $test_id],
387 'pool_fi' => [
'integer', $this->
getPoolId()],
400 'def_id' => [
'integer', $this->
getId()]
407 $next_id = $this->db->nextId(
'tst_rnd_quest_set_qpls');
409 $this->db->insert(
'tst_rnd_quest_set_qpls', [
410 'def_id' => [
'integer', $next_id],
411 'test_fi' => [
'integer', $test_id],
412 'pool_fi' => [
'integer', $this->
getPoolId()],
425 $this->
setId($next_id);
435 $path->enableTextOnly(
true);
439 $poolInfoLabel = sprintf(
440 $lng->
txt(
'tst_random_question_set_source_questionpool_summary_string'),
446 return $poolInfoLabel;
mapTaxonomyFilter(ilQuestionPoolDuplicatedTaxonomiesKeysMap $taxonomies_keys_map)
updateDbRecord(int $test_id)
Creates a path for a start and endnode.
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=[])
set the original taxonomy filter condition
__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()
get the mapped taxonomy filter conditions
getLifecycleFilterForDbValue()
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
getOriginalTaxonomyFilter()