ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilAssQuestionPreviewSettings.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 
12 {
13  private $contextRefId = null;
14 
15  private $genericFeedbackEnabled = false;
16 
17  private $specificFeedbackEnabled = false;
18 
19  private $hintProvidingEnabled = false;
20 
21  private $bestSolutionEnabled = false;
22 
23  public function __construct($contextRefId)
24  {
25  $this->contextRefId = $contextRefId;
26  }
27 
28  public function init()
29  {
30  if ($this->isTestRefId()) {
32  } else {
34  }
35  }
36 
37  private function isTestRefId()
38  {
39  $objectType = ilObject::_lookupType($this->contextRefId, true);
40 
41  return $objectType == 'tst';
42  }
43 
44  private function initSettingsWithTestObject()
45  {
46  $testOBJ = ilObjectFactory::getInstanceByRefId($this->contextRefId);
47  $testOBJ->loadFromDb();
48 
49  $this->setGenericFeedbackEnabled($testOBJ->getGenericAnswerFeedback());
50  $this->setSpecificFeedbackEnabled($testOBJ->getSpecificAnswerFeedback());
51  $this->setHintProvidingEnabled($testOBJ->isOfferingQuestionHintsEnabled());
52  $this->setBestSolutionEnabled($testOBJ->getInstantFeedbackSolution());
53  }
54 
55  private function initSettingsFromPostParameters()
56  {
57  // get from post or from toolbar instance if possible
58 
59  $this->setGenericFeedbackEnabled(true);
60  $this->setSpecificFeedbackEnabled(true);
61  $this->setHintProvidingEnabled(true);
62  $this->setBestSolutionEnabled(true);
63  }
64 
65  public function setContextRefId($contextRefId)
66  {
67  $this->contextRefId = $contextRefId;
68  }
69 
70  public function getContextRefId()
71  {
72  return $this->contextRefId;
73  }
74 
76  {
77  $this->genericFeedbackEnabled = $genericFeedbackEnabled;
78  }
79 
80  public function isGenericFeedbackEnabled()
81  {
83  }
84 
86  {
87  $this->specificFeedbackEnabled = $specificFeedbackEnabled;
88  }
89 
90  public function isSpecificFeedbackEnabled()
91  {
93  }
94 
96  {
97  $this->hintProvidingEnabled = $hintProvidingEnabled;
98  }
99 
100  public function isHintProvidingEnabled()
101  {
103  }
104 
106  {
107  $this->bestSolutionEnabled = $bestSolutionEnabled;
108  }
109 
110  public function isBestSolutionEnabled()
111  {
113  }
114 
116  {
117  if ($this->isGenericFeedbackEnabled()) {
118  return true;
119  }
120 
121  if ($this->isSpecificFeedbackEnabled()) {
122  return true;
123  }
124 
125  if ($this->isBestSolutionEnabled()) {
126  return true;
127  }
128 
129  return false;
130  }
131 
133  {
134  return $this->isHintProvidingEnabled();
135  }
136 }
setSpecificFeedbackEnabled($specificFeedbackEnabled)
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id