ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
5require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLocker.php';
6require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerNone.php';
7require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFile.php';
8require_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() )
116 {
118
119 $locker = new ilAssQuestionProcessLockerNone();
120 break;
121
123
124 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockFileStorage.php';
125 $storage = new ilAssQuestionProcessLockFileStorage($this->getQuestionId(), $this->getUserId());
126 $storage->create();
127
128 $locker = new ilAssQuestionProcessLockerFile($storage);
129 break;
130
132
133 $locker = new ilAssQuestionProcessLockerDb($this->db);
134 $locker->setAssessmentLogEnabled($this->isAssessmentLogEnabled());
135 break;
136 }
137
138 return $locker;
139 }
140}
Database Wrapper.
Definition: class.ilDB.php:29
ILIAS Setting Class.