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

Modules/Test/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 "./Modules/Test/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 
00151         public function __sleep()
00152         {
00153                 return array('questions', 'passes', 'passed', 'lastVisit', 'firstVisit', 'timeOfWork', 'numberOfQuestions', 
00154                 'questionsWorkedThrough', 'markECTS', 'mark_official', 'mark', 'maxpoints', 'reached', 'user_id', 'login', 'name');
00155         }
00156 
00162         function ilTestEvaluationUserData()
00163         {
00164                 $this->passes = array();
00165                 $this->questions = array();
00166                 $this->passed = FALSE;
00167         }
00168         
00169         function getPassed()
00170         {
00171                 return $this->passed;
00172         }
00173         
00174         function setPassed($a_passed)
00175         {
00176                 $this->passed = ($a_passed ? TRUE : FALSE);
00177         }
00178         
00179         function getName()
00180         {
00181                 return $this->name;
00182         }
00183         
00184         function setName($a_name)
00185         {
00186                 $this->name = $a_name;
00187         }
00188         
00189         function getLogin()
00190         {
00191                 return $this->login;
00192         }
00193         
00194         function setLogin($a_login)
00195         {
00196                 $this->login = $a_login;
00197         }
00198         
00199         function getReached()
00200         {
00201                 return $this->reached;
00202         }
00203         
00204         function setReached($a_reached)
00205         {
00206                 $this->reached = $a_reached;
00207         }
00208         
00209         function getMaxpoints()
00210         {
00211                 return $this->maxpoints;
00212         }
00213         
00214         function setMaxpoints($a_max_points)
00215         {
00216                 $this->maxpoints = $a_max_points;
00217         }
00218         
00219         function getReachedPointsInPercent()
00220         {
00221                 return $this->getMaxPoints() ? $this->getReached() / $this->getMaxPoints() * 100.0 : 0;
00222         }
00223         
00224         function getMark()
00225         {
00226                 return $this->mark;
00227         }
00228         
00229         function setMark($a_mark)
00230         {
00231                 $this->mark = $a_mark;
00232         }
00233         
00234         function getECTSMark()
00235         {
00236                 return $this->markECTS;
00237         }
00238         
00239         function setECTSMark($a_mark_ects)
00240         {
00241                 $this->markECTS = $a_mark_ects;
00242         }
00243         
00244         function getQuestionsWorkedThrough()
00245         {
00246                 return $this->questionsWorkedThrough;
00247         }
00248         
00249         function setQuestionsWorkedThrough($a_nr)
00250         {
00251                 $this->questionsWorkedThrough = $a_nr;
00252         }
00253 
00254         function getNumberOfQuestions()
00255         {
00256                 return $this->numberOfQuestions;
00257         }
00258         
00259         function setNumberOfQuestions($a_nr)
00260         {
00261                 $this->numberOfQuestions = $a_nr;
00262         }
00263         
00264         function getQuestionsWorkedThroughInPercent()
00265         {
00266                 return $this->getNumberOfQuestions() ? $this->getQuestionsWorkedThrough() / $this->getNumberOfQuestions() * 100.0 : 0;
00267         }
00268         
00269         function getTimeOfWork()
00270         {
00271                 return $this->timeOfWork;
00272         }
00273         
00274         function setTimeOfWork($a_time_of_work)
00275         {
00276                 $this->timeOfWork = $a_time_of_work;
00277         }
00278         
00279         function getFirstVisit()
00280         {
00281                 return $this->firstVisit;
00282         }
00283         
00284         function setFirstVisit($a_time)
00285         {
00286                 $this->firstVisit = $a_time;
00287         }
00288         
00289         function getLastVisit()
00290         {
00291                 return $this->lastVisit;
00292         }
00293         
00294         function setLastVisit($a_time)
00295         {
00296                 $this->lastVisit = $a_time;
00297         }
00298         
00299         function getPasses()
00300         {
00301                 return $this->passes;
00302         }
00303         
00304         function addPass($pass_nr, $pass)
00305         {
00306                 $this->passes[$pass_nr] = $pass;
00307         }
00308         
00309         function &getPass($pass_nr)
00310         {
00311                 if (array_key_exists($pass_nr, $this->passes))
00312                 {
00313                         return $this->passes[$pass_nr];
00314                 }
00315                 else
00316                 {
00317                         return NULL;
00318                 }
00319         }
00320         
00321         function getPassCount()
00322         {
00323                 return count($this->passes);
00324         }
00325         
00326         function getBestPass()
00327         {
00328                 $bestpoints = 0;
00329                 $bestpass = 0;
00330                 foreach ($this->passes as $pass)
00331                 {
00332                         $reached = $this->getReachedPointsInPercentForPass($pass->getPass());
00333                         if ($reached > $bestpoints)
00334                         {
00335                                 $bestpoints = $reached;
00336                                 $bestpass = $pass->getPass();
00337                         }
00338                 }
00339                 return $bestpass;
00340         }
00341         
00342         function getLastPass()
00343         {
00344                 $lastpass = 0;
00345                 foreach (array_keys($this->passes) as $pass)
00346                 {
00347                         if ($pass > $lastpass) $lastpass = $pass;
00348                 }
00349                 return $lastpass;
00350         }
00351         
00352         function addQuestionTitle($question_id, $question_title)
00353         {
00354                 $this->questionTitles[$question_id] = $question_title;
00355         }
00356         
00357         function getQuestionTitles()
00358         {
00359                 return $this->questionTitles;
00360         }
00361 
00362         function &getQuestions($pass = 0)
00363         {
00364                 if (array_key_exists($pass, $this->questions))
00365                 {
00366                         return $this->questions[$pass];
00367                 }
00368                 else
00369                 {
00370                         return NULL;
00371                 }
00372         }
00373         
00374         function addQuestion($question_id, $max_points, $sequence = NULL, $pass = 0)
00375         {
00376                 if (!array_key_exists($pass, $this->questions)) $this->questions[$pass] = array();
00377                 array_push($this->questions[$pass], array("id" => $question_id, "points" => $max_points, "sequence" => $sequence));
00378         }
00379         
00380         function &getQuestion($index, $pass = 0)
00381         {
00382                 if (array_key_exists($index, $this->questions[$pass]))
00383                 {
00384                         return $this->questions[$pass][$index];
00385                 }
00386                 else
00387                 {
00388                         return NULL;
00389                 }
00390         }
00391         
00392         function getQuestionCount($pass = 0)
00393         {
00394                 return count($this->questions[$pass]);
00395         }
00396 
00397         function getReachedPoints($pass = 0)
00398         {
00399                 $reached = 0;
00400                 if (array_key_exists($pass, $this->passes))
00401                 {
00402                         foreach ($this->passes[$pass]->getAnsweredQuestions() as $question)
00403                         {
00404                                 $reached += $question["reached"];
00405                         }
00406                 }
00407                 $reached = ($reached < 0) ? 0 : $reached;
00408                 return $reached;
00409         }
00410 
00411         function getAvailablePoints($pass = 0)
00412         {
00413                 $available = 0;
00414                 if (!is_array($this->questions[$pass])) $pass = 0;
00415                 if (!is_array($this->questions[$pass])) return 0;
00416                 foreach ($this->questions[$pass] as $question)
00417                 {
00418                         $available += $question["points"];
00419                 }
00420                 return $available;
00421         }
00422 
00423         function getReachedPointsInPercentForPass($pass = 0)
00424         {
00425                 $reached = $this->getReachedPoints($pass);
00426                 $available = $this->getAvailablePoints($pass);
00427                 $percent = ($available > 0 ) ? $reached / $available : 0;
00428                 return $percent;
00429         }
00430 
00431         function setUserID($a_usr_id)
00432         {
00433                 $this->user_id = $a_usr_id;
00434         }
00435         
00436         function getUserID()
00437         {
00438                 return $this->user_id;
00439         }
00440 
00441         function setMarkOfficial($a_mark_official)
00442         {
00443                 $this->mark_official = $a_mark_official;
00444         }
00445         
00446         function getMarkOfficial()
00447         {
00448                 return $this->mark_official;
00449         }
00450         
00451 } // END ilTestEvaluationUserData
00452 
00453 ?>

Generated on Fri Dec 13 2013 17:56:53 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1