ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilTestEvaluationPassData.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
35 {
42 
48  private $workingtime;
49 
55  private $questioncount;
56 
62  private $maxpoints;
63 
69  private $reachedpoints;
70 
77 
83  var $pass;
84 
85  public function __sleep()
86  {
87  return array('answeredQuestions', 'pass', 'nrOfAnsweredQuestions', 'reachedpoints',
88  'maxpoints', 'questioncount', 'workingtime');
89  }
90 
96  function __construct()
97  {
98  $this->answeredQuestions = array();
99  }
100 
101  function __destruct()
102  {
103  $this->unsetAnsweredQuestions();
104  }
105 
106  public function unsetAnsweredQuestions()
107  {
108  unset($this->answeredQuestions);
109  $this->answeredQuestions = array();
110  }
111 
112  public function getNrOfAnsweredQuestions()
113  {
115  }
116 
118  {
119  $this->nrOfAnsweredQuestions = $nrOfAnsweredQuestions;
120  }
121 
122  public function getReachedPoints()
123  {
124  return $this->reachedpoints;
125  }
126 
128  {
129  $this->reachedpoints = $reachedpoints;
130  }
131 
132  public function getMaxPoints()
133  {
134  return $this->maxpoints;
135  }
136 
137  public function setMaxPoints($maxpoints)
138  {
139  $this->maxpoints = $maxpoints;
140  }
141 
142  public function getQuestionCount()
143  {
144  return $this->questioncount;
145  }
146 
148  {
149  $this->questioncount = $questioncount;
150  }
151 
152  public function getWorkingTime()
153  {
154  return $this->workingtime;
155  }
156 
157  public function setWorkingTime($workingtime)
158  {
159  $this->workingtime = $workingtime;
160  }
161 
162  public function getPass()
163  {
164  return $this->pass;
165  }
166 
167  public function setPass($a_pass)
168  {
169  $this->pass = $a_pass;
170  }
171 
173  {
175  }
176 
177  function addAnsweredQuestion($question_id, $max_points, $reached_points, $sequence = NULL)
178  {
179  array_push($this->answeredQuestions, array("id" => $question_id, "points" => round($max_points, 2), "reached" => round($reached_points, 2), "sequence" => $sequence));
180  }
181 
182  function &getAnsweredQuestion($index)
183  {
184  if (array_key_exists($index, $this->answeredQuestions))
185  {
186  return $this->answeredQuestions[$index];
187  }
188  else
189  {
190  return NULL;
191  }
192  }
193 
194  function &getAnsweredQuestionByQuestionId($question_id)
195  {
196  foreach ($this->answeredQuestions as $question)
197  {
198  if ($question["id"] == $question_id)
199  {
200  return $question;
201  }
202  }
203  return NULL;
204  }
205 
207  {
208  return count($this->answeredQuestions);
209  }
210 
211 } // END ilTestEvaluationPassData
212 
213 ?>