ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAssQuestionProcessLockerFactory.php
Go to the documentation of this file.
1<?php
2
26{
30 protected $settings;
31
35 protected $db;
36
40 protected $question_id;
41
45 protected $userId;
46
52 {
53 $this->settings = $settings;
54 $this->db = $db;
55
56 $this->question_id = null;
57 $this->userId = null;
58 }
59
63 public function setQuestionId($questionId): void
64 {
65 $this->question_id = $questionId;
66 }
67
71 public function getQuestionId(): ?int
72 {
73 return $this->question_id;
74 }
75
79 public function setUserId($userId): void
80 {
81 $this->userId = $userId;
82 }
83
87 public function getUserId(): ?int
88 {
89 return $this->userId;
90 }
91
92 private function getLockModeSettingValue(): ?string
93 {
94 return $this->settings->get('ass_process_lock_mode', ilObjTestFolder::ASS_PROC_LOCK_MODE_NONE);
95 }
96
100 public function getLocker()
101 {
102 switch ($this->getLockModeSettingValue()) {
104
105 $locker = new ilAssQuestionProcessLockerNone();
106 break;
107
109 $storage = new ilAssQuestionProcessLockFileStorage($this->getQuestionId(), $this->getUserId());
110 $storage->create();
111
112 $locker = new ilAssQuestionProcessLockerFile($storage);
113 break;
114
116
117 $locker = new ilAssQuestionProcessLockerDb($this->db);
118 break;
119 }
120
121 return $locker;
122 }
123}
__construct(ilSetting $settings, ilDBInterface $db)
const ASS_PROC_LOCK_MODE_NONE
const ASS_PROC_LOCK_MODE_FILE
ILIAS Setting Class.
Interface ilDBInterface.