ILIAS  release_8 Revision v8.24
class.ilAssQuestionProcessLockerFactory.php
Go to the documentation of this file.
1<?php
2
26{
30 protected $settings;
31
35 protected $db;
36
40 protected $questionId;
41
45 protected $userId;
46
51
57 {
58 $this->settings = $settings;
59 $this->db = $db;
60
61 $this->questionId = null;
62 $this->userId = null;
63 $this->assessmentLogEnabled = false;
64 }
65
69 public function setQuestionId($questionId): void
70 {
71 $this->questionId = $questionId;
72 }
73
77 public function getQuestionId(): ?int
78 {
79 return $this->questionId;
80 }
81
85 public function setUserId($userId): void
86 {
87 $this->userId = $userId;
88 }
89
93 public function getUserId(): ?int
94 {
95 return $this->userId;
96 }
97
102 {
103 $this->assessmentLogEnabled = $assessmentLogEnabled;
104 }
105
109 public function isAssessmentLogEnabled(): bool
110 {
112 }
113
114 private function getLockModeSettingValue(): ?string
115 {
116 return $this->settings->get('ass_process_lock_mode', ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE);
117 }
118
122 public function getLocker()
123 {
124 switch ($this->getLockModeSettingValue()) {
126
127 $locker = new ilAssQuestionProcessLockerNone();
128 break;
129
131
132 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockFileStorage.php';
133 $storage = new ilAssQuestionProcessLockFileStorage($this->getQuestionId(), $this->getUserId());
134 $storage->create();
135
136 $locker = new ilAssQuestionProcessLockerFile($storage);
137 break;
138
140
141 $locker = new ilAssQuestionProcessLockerDb($this->db);
142 $locker->setAssessmentLogEnabled($this->isAssessmentLogEnabled());
143 break;
144 }
145
146 return $locker;
147 }
148}
__construct(ilSetting $settings, ilDBInterface $db)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilDBInterface.