plugin->assessments->getAssessmentByUserToken($token); $candidate_id = $TeKe->plugin->assessments->getCandidateByToken($token); $items = $assessment->getItems(); $candidate = $TeKe->plugin->loadType("candidate", $candidate_id); $answered_count = $candidate->getAnsweredCount(); $item = $items[$answered_count]; $item_obj = $TeKe->plugin->loadType($item->type, $item->id); $chosen = get_input($item->id."_choice"); $answer_data = array(); $answer_data ["candidate"]= $candidate_id; $answer_data ["chosen"] = $chosen; $item_obj->answer($answer_data); $answered_count++; $candidate->updateAnsweredCount($answered_count); if ($assessment->getTimeLimit() && $candidate->getRemainingTime() == "00:00:00") { $i = 0; foreach ($items as $item) { if ($i >= $answered_count) { $item = $items[$i]; $item_obj = $TeKe->plugin->loadType($item->type, $item->id); $answer_data = array(); $answer_data ["candidate"]= $candidate_id; $answer_data ["chosen"] = ""; $item_obj->answer($answer_data); } $i++; } $candidate->finishAssessment(); } if ($answered_count == count($items)) { $candidate->finishAssessment(); } } forward(WWW_ROOT."assessment?token=${token}"); ?>