ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilAssQuestionProcessLockerFactory.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
5 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLocker.php';
6 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerNone.php';
7 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFile.php';
8 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerDb.php';
9 
17 {
21  protected $settings;
22 
26  protected $db;
27 
31  protected $questionId;
32 
36  protected $userId;
37 
42 
48  {
49  $this->settings = $settings;
50  $this->db = $db;
51 
52  $this->questionId = null;
53  $this->userId = null;
54  $this->assessmentLogEnabled = false;
55  }
56 
60  public function setQuestionId($questionId)
61  {
62  $this->questionId = $questionId;
63  }
64 
68  public function getQuestionId()
69  {
70  return $this->questionId;
71  }
72 
76  public function setUserId($userId)
77  {
78  $this->userId = $userId;
79  }
80 
84  public function getUserId()
85  {
86  return $this->userId;
87  }
88 
93  {
94  $this->assessmentLogEnabled = $assessmentLogEnabled;
95  }
96 
100  public function isAssessmentLogEnabled()
101  {
103  }
104 
105  private function getLockModeSettingValue()
106  {
107  return $this->settings->get('ass_process_lock_mode', ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE);
108  }
109 
113  public function getLocker()
114  {
115  switch ($this->getLockModeSettingValue()) {
117 
118  $locker = new ilAssQuestionProcessLockerNone();
119  break;
120 
122 
123  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockFileStorage.php';
124  $storage = new ilAssQuestionProcessLockFileStorage($this->getQuestionId(), $this->getUserId());
125  $storage->create();
126 
127  $locker = new ilAssQuestionProcessLockerFile($storage);
128  break;
129 
131 
132  $locker = new ilAssQuestionProcessLockerDb($this->db);
133  $locker->setAssessmentLogEnabled($this->isAssessmentLogEnabled());
134  break;
135  }
136 
137  return $locker;
138  }
139 }
__construct(ilSetting $settings, ilDBInterface $db)
Interface ilDBInterface.
settings()
Definition: settings.php:2