• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

assessment/classes/class.ilTestEvaluationUserData.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00034 include_once "./classes/class.ilObject.php";
00035 include_once "./assessment/classes/inc.AssessmentConstants.php";
00036 
00037 class ilTestEvaluationUserData
00038 {
00044         var $name;
00045 
00051         var $login;
00052         
00058         var $user_id;
00059 
00065         var $reached;
00066 
00072         var $maxpoints;
00073 
00079         var $mark;
00080 
00086         var $mark_official;
00087 
00093         var $markECTS;
00094 
00100         var $questionsWorkedThrough;
00101 
00107         var $numberOfQuestions;
00108 
00114         var $timeOfWork;
00115 
00121         var $firstVisit;
00122 
00128         var $lastVisit;
00129         
00135         var $passed;
00136         
00142         var $passes;
00143 
00149         var $questions;
00150 
00156         function ilTestEvaluationUserData()
00157         {
00158                 $this->passes = array();
00159                 $this->questions = array();
00160                 $this->passed = FALSE;
00161         }
00162         
00163         function getPassed()
00164         {
00165                 return $this->passed;
00166         }
00167         
00168         function setPassed($a_passed)
00169         {
00170                 $this->passed = ($a_passed ? TRUE : FALSE);
00171         }
00172         
00173         function getName()
00174         {
00175                 return $this->name;
00176         }
00177         
00178         function setName($a_name)
00179         {
00180                 $this->name = $a_name;
00181         }
00182         
00183         function getLogin()
00184         {
00185                 return $this->login;
00186         }
00187         
00188         function setLogin($a_login)
00189         {
00190                 $this->login = $a_login;
00191         }
00192         
00193         function getReached()
00194         {
00195                 return $this->reached;
00196         }
00197         
00198         function setReached($a_reached)
00199         {
00200                 $this->reached = $a_reached;
00201         }
00202         
00203         function getMaxpoints()
00204         {
00205                 return $this->maxpoints;
00206         }
00207         
00208         function setMaxpoints($a_max_points)
00209         {
00210                 $this->maxpoints = $a_max_points;
00211         }
00212         
00213         function getReachedPointsInPercent()
00214         {
00215                 return $this->getMaxPoints() ? $this->getReached() / $this->getMaxPoints() * 100.0 : 0;
00216         }
00217         
00218         function getMark()
00219         {
00220                 return $this->mark;
00221         }
00222         
00223         function setMark($a_mark)
00224         {
00225                 $this->mark = $a_mark;
00226         }
00227         
00228         function getECTSMark()
00229         {
00230                 return $this->markECTS;
00231         }
00232         
00233         function setECTSMark($a_mark_ects)
00234         {
00235                 $this->markECTS = $a_mark_ects;
00236         }
00237         
00238         function getQuestionsWorkedThrough()
00239         {
00240                 return $this->questionsWorkedThrough;
00241         }
00242         
00243         function setQuestionsWorkedThrough($a_nr)
00244         {
00245                 $this->questionsWorkedThrough = $a_nr;
00246         }
00247 
00248         function getNumberOfQuestions()
00249         {
00250                 return $this->numberOfQuestions;
00251         }
00252         
00253         function setNumberOfQuestions($a_nr)
00254         {
00255                 $this->numberOfQuestions = $a_nr;
00256         }
00257         
00258         function getQuestionsWorkedThroughInPercent()
00259         {
00260                 return $this->getNumberOfQuestions() ? $this->getQuestionsWorkedThrough() / $this->getNumberOfQuestions() * 100.0 : 0;
00261         }
00262         
00263         function getTimeOfWork()
00264         {
00265                 return $this->timeOfWork;
00266         }
00267         
00268         function setTimeOfWork($a_time_of_work)
00269         {
00270                 $this->timeOfWork = $a_time_of_work;
00271         }
00272         
00273         function getFirstVisit()
00274         {
00275                 return $this->firstVisit;
00276         }
00277         
00278         function setFirstVisit($a_time)
00279         {
00280                 $this->firstVisit = $a_time;
00281         }
00282         
00283         function getLastVisit()
00284         {
00285                 return $this->lastVisit;
00286         }
00287         
00288         function setLastVisit($a_time)
00289         {
00290                 $this->lastVisit = $a_time;
00291         }
00292         
00293         function getPasses()
00294         {
00295                 return $this->passes;
00296         }
00297         
00298         function addPass($pass_nr, $pass)
00299         {
00300                 $this->passes[$pass_nr] =& $pass;
00301         }
00302         
00303         function &getPass($pass_nr)
00304         {
00305                 if (array_key_exists($pass_nr, $this->passes))
00306                 {
00307                         return $this->passes[$pass_nr];
00308                 }
00309                 else
00310                 {
00311                         return NULL;
00312                 }
00313         }
00314         
00315         function getPassCount()
00316         {
00317                 return count($this->passes);
00318         }
00319         
00320         function getBestPass()
00321         {
00322                 $bestpoints = 0;
00323                 $bestpass = 0;
00324                 foreach ($this->passes as $pass)
00325                 {
00326                         if (is_object($pass))
00327                         {
00328                                 $reached = $this->getReachedPointsInPercentForPass($pass->getPass());
00329                                 if ($reached > $bestpoints)
00330                                 {
00331                                         $bestpoints = $reached;
00332                                         $bestpass = $pass->getPass();
00333                                 }
00334                         }
00335                 }
00336                 return $bestpass;
00337         }
00338         
00339         function getLastPass()
00340         {
00341                 $lastpass = 0;
00342                 foreach (array_keys($this->passes) as $pass)
00343                 {
00344                         if ($pass > $lastpass) $lastpass = $pass;
00345                 }
00346                 return $lastpass;
00347         }
00348         
00349         function addQuestionTitle($question_id, $question_title)
00350         {
00351                 $this->questionTitles[$question_id] = $question_title;
00352         }
00353         
00354         function getQuestionTitles()
00355         {
00356                 return $this->questionTitles;
00357         }
00358 
00359         function &getQuestions($pass = 0)
00360         {
00361                 if (array_key_exists($pass, $this->questions))
00362                 {
00363                         return $this->questions[$pass];
00364                 }
00365                 else
00366                 {
00367                         return NULL;
00368                 }
00369         }
00370         
00371         function addQuestion($question_id, $max_points, $sequence = NULL, $pass = 0, $type = "", $copy_id = "")
00372         {
00373                 if (!array_key_exists($pass, $this->questions)) $this->questions[$pass] = array();
00374                 array_push($this->questions[$pass], array("id" => $question_id, "points" => $max_points, "sequence" => $sequence, "type" => $type, "copy_id" => $copy_id));
00375         }
00376         
00377         function &getQuestion($index, $pass = 0)
00378         {
00379                 if (array_key_exists($index, $this->questions[$pass]))
00380                 {
00381                         return $this->questions[$pass][$index];
00382                 }
00383                 else
00384                 {
00385                         return NULL;
00386                 }
00387         }
00388         
00389         function getQuestionCount($pass = 0)
00390         {
00391                 return count($this->questions[$pass]);
00392         }
00393 
00394         function getReachedPoints($pass = 0)
00395         {
00396                 $reached = 0;
00397                 $userpass =& $this->passes[$pass];
00398                 if (is_object($userpass))
00399                 {
00400                         foreach ($userpass->getAnsweredQuestions() as $question)
00401                         {
00402                                 $reached += $question["reached"];
00403                         }
00404                 }
00405                 $reached = ($reached < 0) ? 0 : $reached;
00406                 return $reached;
00407         }
00408 
00409         function getAvailablePoints($pass = 0)
00410         {
00411                 $available = 0;
00412                 if (!is_array($this->questions[$pass])) $pass = 0;
00413                 foreach ($this->questions[$pass] as $question)
00414                 {
00415                         $available += $question["points"];
00416                 }
00417                 return $available;
00418         }
00419         
00420         function getReachedPointsInPercentForPass($pass = 0)
00421         {
00422                 $reached = $this->getReachedPoints($pass);
00423                 $available = $this->getAvailablePoints($pass);
00424                 $percent = ($available > 0 ) ? $reached / $available : 0;
00425                 return $percent;
00426         }
00427         
00428         function setUserID($a_usr_id)
00429         {
00430                 $this->user_id = $a_usr_id;
00431         }
00432         
00433         function getUserID()
00434         {
00435                 return $this->user_id;
00436         }
00437         
00438         function setMarkOfficial($a_mark_official)
00439         {
00440                 $this->mark_official = $a_mark_official;
00441         }
00442         
00443         function getMarkOfficial()
00444         {
00445                 return $this->mark_official;
00446         }
00447         
00448 } // END ilTestEvaluationUserData
00449 
00450 ?>

Generated on Fri Dec 13 2013 13:52:06 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1