ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestProcessLockerFactory.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/Test/classes/class.ilTestProcessLocker.php';
6 require_once 'Modules/Test/classes/class.ilTestProcessLockerNone.php';
7 require_once 'Modules/Test/classes/class.ilTestProcessLockerFile.php';
8 require_once 'Modules/Test/classes/class.ilTestProcessLockerDb.php';
9 
17 {
21  protected $settings;
22 
26  protected $db;
27 
31  protected $activeId;
32 
38  {
39  $this->settings = $settings;
40  $this->db = $db;
41 
42  $this->activeId = null;
43  }
44 
48  public function setActiveId($activeId)
49  {
50  $this->activeId = $activeId;
51  }
52 
56  public function getActiveId()
57  {
58  return $this->activeId;
59  }
60 
61  private function getLockModeSettingValue()
62  {
63  return $this->settings->get('ass_process_lock_mode', ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE);
64  }
65 
69  public function getLocker()
70  {
71  switch ($this->getLockModeSettingValue()) {
73 
74  $locker = new ilTestProcessLockerNone();
75  break;
76 
78 
79  require_once 'Modules/Test/classes/class.ilTestProcessLockFileStorage.php';
80  $storage = new ilTestProcessLockFileStorage($this->getActiveId());
81  $storage->create();
82 
83  $locker = new ilTestProcessLockerFile($storage);
84  break;
85 
87 
88  $locker = new ilTestProcessLockerDb($this->db);
89  break;
90  }
91 
92  return $locker;
93  }
94 }
__construct(ilSetting $settings, ilDBInterface $db)
settings()
Definition: settings.php:2