26    public function __construct($a_crs_id, $a_user_id, $a_test_id, $a_objective_id)
 
   30        $this->logger = 
$DIC->logger()->crs();
 
   32        $this->container_id = $a_crs_id;
 
   33        $this->user_id = $a_user_id;
 
   34        $this->test_id = $a_test_id;
 
   35        $this->objective_id = $a_objective_id;
 
   54        $query = 
'SELECT * FROM loc_tst_run ' .
 
   55                'WHERE test_id = ' . 
$ilDB->quote($a_test_id, 
'integer') . 
' ' .
 
   56                'AND objective_id = ' . 
$ilDB->quote($a_objective_id, 
'integer') . 
' ' .
 
   57                'AND user_id = ' . 
$ilDB->quote($a_user_id, 
'integer');
 
   72    public static function deleteRuns($a_container_id, $a_user_id)
 
   78        $query = 
'DELETE FROM loc_tst_run ' .
 
   79                'WHERE container_id = ' . 
$ilDB->quote($a_container_id, 
'integer') . 
' ' .
 
   80                'AND user_id = ' . 
$ilDB->quote($a_user_id, 
'integer') . 
' ';
 
   84    public static function deleteRun($a_container_id, $a_user_id, $a_test_id)
 
   90        $query = 
'DELETE FROM loc_tst_run ' .
 
   91                'WHERE container_id = ' . 
$ilDB->quote($a_container_id, 
'integer') . 
' ' .
 
   92                'AND user_id = ' . 
$ilDB->quote($a_user_id, 
'integer') . 
' ' .
 
   93                'AND test_id = ' . 
$ilDB->quote($a_test_id, 
'integer') . 
' ';
 
  103        $query = 
'SELECT objective_id FROM loc_tst_run ' .
 
  104                'WHERE container_id = ' . 
$ilDB->quote($a_container_id, 
'integer') . 
' ' .
 
  105                'AND user_id = ' . 
$ilDB->quote($a_user_id, 
'integer') . 
' ' .
 
  106                'AND test_id = ' . 
$ilDB->quote($a_test_id, 
'integer');
 
  109        $objectives = array();
 
  111            $objectives[] = $row->objective_id;
 
  120    public static function getRun($a_container_id, $a_user_id, $a_test_id)
 
  126        $query = 
'SELECT objective_id FROM loc_tst_run ' .
 
  127                'WHERE container_id = ' . 
$ilDB->quote($a_container_id, 
'integer') . 
' ' .
 
  128                'AND user_id = ' . 
$ilDB->quote($a_user_id, 
'integer') . 
' ' .
 
  129                'AND test_id = ' . 
$ilDB->quote($a_test_id, 
'integer') . 
' ';
 
  134            $run[] = 
new ilLOTestRun($a_container_id, $a_user_id, $a_test_id, $row->objective_id);
 
  166        $this->max_points = $a_points;
 
  176        $this->questions = array();
 
  181        $this->questions[$a_id] = 0;
 
  186        return array_key_exists($a_question_id, (array) $this->questions);
 
  195        $this->logger->debug($a_qst_id . 
' ' . $a_points);
 
  196        $this->questions[$a_qst_id] = $a_points;
 
  206        foreach ($this->questions as $qid => $points) {
 
  207            $sum_points += $points;
 
  217            'reached' => $sum_points,
 
  218            'percentage' => $percentage
 
  227    public function delete()
 
  233        $query = 
'DELETE FROM loc_tst_run ' .
 
  235                'AND user_id = ' . 
$ilDB->quote($this->getUserId(), 
'integer') . 
' ' .
 
  236                'AND test_id = ' . 
$ilDB->quote($this->getTestId(), 
'integer') . 
' ' .
 
  237                'AND objective_id = ' . 
$ilDB->quote($this->getObjectiveId(), 
'integer');
 
  247        $query = 
'INSERT INTO loc_tst_run ' .
 
  248                '(container_id, user_id, test_id, objective_id,max_points,questions) ' .
 
  266        $query = 
'UPDATE loc_tst_run SET ' .
 
  269                'WHERE container_id = ' . 
$ilDB->quote($this->container_id, 
'integer') . 
' ' .
 
  270                'AND user_id = ' . 
$ilDB->quote($this->
getUserId(), 
'integer') . 
' ' .
 
  271                'AND test_id = ' . 
$ilDB->quote($this->
getTestId(), 
'integer') . 
' ' .
 
  286        $query = 
'SELECT * FROM loc_tst_run ' .
 
  288                'AND user_id = ' . 
$ilDB->quote($this->
getUserId(), 
'integer') . 
' ' .
 
  289                'AND test_id = ' . 
$ilDB->quote($this->
getTestId(), 
'integer') . 
' ' .
 
  293            $this->max_points = $row->max_points;
 
  294            if ($row->questions) {
 
  295                $this->questions = unserialize($row->questions);
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
Stores current objective, questions and max points.
setQuestionResult($a_qst_id, $a_points)
__construct($a_crs_id, $a_user_id, $a_test_id, $a_objective_id)
getResult()
Get result for objective run.
questionExists($a_question_id)
static lookupObjectives($a_container_id, $a_user_id, $a_test_id)
static lookupRunExistsForObjective($a_test_id, $a_objective_id, $a_user_id)
@global type $ilDB
static deleteRuns($a_container_id, $a_user_id)
Delete runs @global type $ilDB.
static deleteRun($a_container_id, $a_user_id, $a_test_id)
static getRun($a_container_id, $a_user_id, $a_test_id)
foreach($_POST as $key=> $value) $res