ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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() )
31 {
33 }
34 else
35 {
37 }
38 }
39
40 private function isTestRefId()
41 {
42 $objectType = ilObject::_lookupType($this->contextRefId, true);
43
44 return $objectType == 'tst';
45 }
46
47 private function initSettingsWithTestObject()
48 {
49 $testOBJ = ilObjectFactory::getInstanceByRefId($this->contextRefId);
50 $testOBJ->loadFromDb();
51
52 $this->setGenericFeedbackEnabled($testOBJ->getGenericAnswerFeedback());
53 $this->setSpecificFeedbackEnabled($testOBJ->getSpecificAnswerFeedback());
54 $this->setHintProvidingEnabled($testOBJ->isOfferingQuestionHintsEnabled());
55 $this->setBestSolutionEnabled($testOBJ->getInstantFeedbackSolution());
56 }
57
59 {
60 // get from post or from toolbar instance if possible
61
62 $this->setGenericFeedbackEnabled(true);
63 $this->setSpecificFeedbackEnabled(true);
64 $this->setHintProvidingEnabled(true);
65 $this->setBestSolutionEnabled(true);
66 }
67
69 {
70 $this->contextRefId = $contextRefId;
71 }
72
73 public function getContextRefId()
74 {
76 }
77
79 {
80 $this->genericFeedbackEnabled = $genericFeedbackEnabled;
81 }
82
83 public function isGenericFeedbackEnabled()
84 {
86 }
87
89 {
90 $this->specificFeedbackEnabled = $specificFeedbackEnabled;
91 }
92
93 public function isSpecificFeedbackEnabled()
94 {
96 }
97
99 {
100 $this->hintProvidingEnabled = $hintProvidingEnabled;
101 }
102
103 public function isHintProvidingEnabled()
104 {
106 }
107
109 {
110 $this->bestSolutionEnabled = $bestSolutionEnabled;
111 }
112
113 public function isBestSolutionEnabled()
114 {
116 }
117
119 {
120 if( $this->isGenericFeedbackEnabled() )
121 {
122 return true;
123 }
124
125 if( $this->isSpecificFeedbackEnabled() )
126 {
127 return true;
128 }
129
130 if( $this->isBestSolutionEnabled() )
131 {
132 return true;
133 }
134
135 return false;
136 }
137
139 {
140 return $this->isHintProvidingEnabled();
141 }
142}
setSpecificFeedbackEnabled($specificFeedbackEnabled)
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupType($a_id, $a_reference=false)
lookup object type