ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Survey\Sequence\SequenceManager Class Reference
+ Collaboration diagram for ILIAS\Survey\Sequence\SequenceManager:

Public Member Functions

 __construct (InternalRepoService $repo, InternalDomainService $domain, int $survey_id, \ilObjSurvey $survey)
 
 appendQuestion (int $survey_question_id, bool $duplicate=true, bool $force_duplicate=false)
 

Protected Attributes

ilObjSurvey $survey
 
ilLogger $log
 
int $survey_id
 
InternalDomainService $domain
 
SequenceDBRepository $question_repo
 

Detailed Description

Definition at line 26 of file SequenceManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Sequence\SequenceManager::__construct ( InternalRepoService  $repo,
InternalDomainService  $domain,
int  $survey_id,
\ilObjSurvey  $survey 
)

Definition at line 34 of file SequenceManager.php.

References ILIAS\Survey\Sequence\SequenceManager\$domain, ILIAS\Survey\Sequence\SequenceManager\$survey, ILIAS\Survey\Sequence\SequenceManager\$survey_id, ILIAS\Survey\InternalDomainService\log(), and ILIAS\Survey\InternalRepoService\sequence().

39  {
40  $this->question_repo = $repo->sequence();
41  $this->domain = $domain;
42  $this->survey_id = $survey_id; // not object id
43  $this->log = $domain->log();
44  $this->survey = $survey;
45  }
+ Here is the call graph for this function:

Member Function Documentation

◆ appendQuestion()

ILIAS\Survey\Sequence\SequenceManager::appendQuestion ( int  $survey_question_id,
bool  $duplicate = true,
bool  $force_duplicate = false 
)

Definition at line 47 of file SequenceManager.php.

51  : int {
52  $this->log->debug("append question, id: " . $survey_question_id . ", duplicate: " . $duplicate . ", force: " . $force_duplicate);
53 
54  // create duplicate if pool question (or forced for question blocks copy)
55  if ($duplicate) {
56  // this does nothing if this is not a pool question and $a_force_duplicate is false
57  $survey_question_id = $this->survey->duplicateQuestionForSurvey($survey_question_id, $force_duplicate);
58  }
59 
60  // check if question is not already in the survey, see #22018
61  if ($this->survey->isQuestionInSurvey($survey_question_id)) {
62  return $survey_question_id;
63  }
64 
65  // append to survey
66  $next_id = $this->question_repo->insert($this->survey_id, $survey_question_id);
67 
68  $this->log->debug("insert svy_svy_qst, id: " . $next_id . ", qfi: " . $survey_question_id);
69 
70  return $survey_question_id;
71  }

Field Documentation

◆ $domain

InternalDomainService ILIAS\Survey\Sequence\SequenceManager::$domain
protected

◆ $log

ilLogger ILIAS\Survey\Sequence\SequenceManager::$log
protected

Definition at line 29 of file SequenceManager.php.

◆ $question_repo

SequenceDBRepository ILIAS\Survey\Sequence\SequenceManager::$question_repo
protected

Definition at line 32 of file SequenceManager.php.

◆ $survey

ilObjSurvey ILIAS\Survey\Sequence\SequenceManager::$survey
protected

◆ $survey_id

int ILIAS\Survey\Sequence\SequenceManager::$survey_id
protected

The documentation for this class was generated from the following file: