ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.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.ilTestRandomQuestionSetSourcePoolDefinition.php';
5 
13 {
17  private $db = null;
18 
22  private $testOBJ = null;
23 
29  {
30  $this->db = $db;
31  $this->testOBJ = $testOBJ;
32  }
33 
37  public function getSourcePoolDefinitionByOriginalPoolData($originalPoolData)
38  {
39  $sourcePoolDefinition = $this->buildDefinitionInstance();
40 
41  $sourcePoolDefinition->setPoolId($originalPoolData['qpl_id']);
42  $sourcePoolDefinition->setPoolRefId($originalPoolData['qpl_ref_id']);
43  $sourcePoolDefinition->setPoolTitle($originalPoolData['qpl_title']);
44  $sourcePoolDefinition->setPoolPath($originalPoolData['qpl_path']);
45  $sourcePoolDefinition->setPoolQuestionCount($originalPoolData['count']);
46 
47  return $sourcePoolDefinition;
48  }
49 
53  public function getSourcePoolDefinitionByDefinitionId($definitionId)
54  {
55  $sourcePoolDefinition = $this->buildDefinitionInstance();
56 
57  $sourcePoolDefinition->loadFromDb($definitionId);
58 
59  return $sourcePoolDefinition;
60  }
61 
65  public function getEmptySourcePoolDefinition()
66  {
67  return $this->buildDefinitionInstance();
68  }
69 
73  private function buildDefinitionInstance()
74  {
75  return new ilTestRandomQuestionSetSourcePoolDefinition($this->db, $this->testOBJ);
76  }
77 }