Exemplo n.º 1
0
 function resetObject()
 {
     global $ilUser;
     include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
     $usr_results = new ilLOUserResults($this->object->getId(), $GLOBALS['ilUser']->getId());
     $usr_results->delete();
     include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
     include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
     ilLOTestRun::deleteRuns($this->object->getId(), $GLOBALS['ilUser']->getId());
     include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
     $tmp_obj_res = new ilCourseObjectiveResult($ilUser->getId());
     $tmp_obj_res->reset($this->object->getId());
     $ilUser->deletePref('crs_objectives_force_details_' . $this->object->getId());
     ilUtil::sendSuccess($this->lng->txt('crs_objectives_reseted'));
     $this->viewObject();
 }
 protected function updateResult($a_res, $a_item_ref_id, $a_objective_id, $a_user_id)
 {
     if ($this->loc_settings->getQualifiedTest() == $a_item_ref_id) {
         // Check for existing test run, and decrease tries, reset final if run exists
         include_once './Modules/Test/classes/class.ilObjTest.php';
         include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
         $active = ilObjTest::isParticipantsLastPassActive($a_item_ref_id, $a_user_id);
         if ($active) {
             include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
             if (ilLOTestRun::lookupRunExistsForObjective(ilObject::_lookupObjId($a_item_ref_id), $a_objective_id, $a_user_id)) {
                 $a_res['tries'] > 0 ? --$a_res['tries'] : 0;
                 $a_res['is_final'] = 0;
             }
         }
     }
     return $a_res;
 }
Exemplo n.º 3
0
 public static function hasActiveRun($a_container_id, $a_test_ref_id, $a_objective_id)
 {
     // check if pass exists
     include_once './Modules/Test/classes/class.ilObjTest.php';
     if (!ilObjTest::isParticipantsLastPassActive($a_test_ref_id, $GLOBALS['ilUser']->getId())) {
         return false;
     }
     // check if multiple pass exists
     include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
     $last_objectives = ilLOTestRun::lookupObjectives($a_container_id, $GLOBALS['ilUser']->getId(), ilObject::_lookupObjId($a_test_ref_id));
     if (count((array) $last_objectives) and in_array((int) $a_objective_id, (array) $last_objectives)) {
         return true;
     }
     return false;
 }
 protected function initTestRun(ilTestSession $session)
 {
     include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
     $this->run = ilLOTestRun::getRun($this->container_id, $this->user_id, ilObject::_lookupObjId($session->getRefId()));
     #$GLOBALS['ilLog']->write(__METHOD__.': '.print_r($this->run,true));
 }
Exemplo n.º 5
0
 /**
  * 
  * @param type $a_test_ref_id
  * @param type $a_objective_id
  * @return int 1 confirmation is shown, 2 new pass must be forced, 3 if no new pass must be forced 
  */
 protected function handleActivePass($a_test_ref_id, $a_objective_id)
 {
     // check if pass exists
     include_once './Modules/Test/classes/class.ilObjTest.php';
     if (!ilObjTest::isParticipantsLastPassActive($a_test_ref_id, $GLOBALS['ilUser']->getId())) {
         $GLOBALS['ilLog']->write(__METHOD__ . ' No previous pass exists.');
         return 2;
     }
     $GLOBALS['ilLog']->write(__METHOD__ . ' Active test pass exists... ');
     // check if multiple pass exists
     include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
     $last_objectives = ilLOTestRun::lookupObjectives($this->object->getId(), $GLOBALS['ilUser']->getId(), ilObject::_lookupObjId($a_test_ref_id));
     if (count((array) $last_objectives) > 1) {
         // if multi objective call and last run is multi call
         // => force no new run
         if (!$a_objective_id) {
             $GLOBALS['ilLog']->write(__METHOD__ . ': Continuing multi objective test pass.');
             return 3;
         } else {
             $this->redirectLocToTestConfirmation($a_objective_id, $a_test_ref_id);
             return 1;
         }
     }
     if (count((array) $last_objectives) == 1) {
         // continue old run =>
         if ($a_objective_id && in_array($a_objective_id, (array) $last_objectives)) {
             return 3;
         } elseif ($a_objective_id && !in_array($a_objective_id, (array) $last_objectives)) {
             $this->redirectLocToTestConfirmation($a_objective_id, $a_test_ref_id);
             return 1;
         }
     }
     $this->redirectLocToTestConfirmation($a_objective_id, $a_test_ref_id);
     return 1;
 }
 protected function initTestRun(ilTestSession $session)
 {
     include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
     $this->run = ilLOTestRun::getRun($this->container_id, $this->user_id, ilObject::_lookupObjId($session->getRefId()));
 }
 private function getObjectiveTitle(ilLOTestRun $loRun)
 {
     require_once 'Modules/Course/classes/class.ilCourseObjective.php';
     return ilCourseObjective::lookupObjectiveTitle($loRun->getObjectiveId());
 }