ILIAS  release_8 Revision v8.23
ilTestPassFinishTasks Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilTestPassFinishTasks:

Public Member Functions

 __construct ($active_id, $obj_id)
 ilTestPassFinishTasks constructor. More...
 
 performFinishTasks (ilTestProcessLocker $processLocker)
 

Protected Member Functions

 updateLearningProgressAfterPassFinishedIsWritten ()
 
 getCaller ()
 

Protected Attributes

 $testSession
 
 $obj_id
 
 $active_id
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilTestPassFinishTasks

Author
Guido Vollbach gvoll.nosp@m.bach.nosp@m.@data.nosp@m.bay..nosp@m.de

Definition at line 23 of file class.ilTestPassFinishTasks.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestPassFinishTasks::__construct (   $active_id,
  $obj_id 
)

ilTestPassFinishTasks constructor.

Parameters
$active_id
$obj_id

Definition at line 36 of file class.ilTestPassFinishTasks.php.

References $active_id, and $obj_id.

37  {
38  $this->testSession = new ilTestSession();
39  $this->testSession->loadFromDb($active_id);
40  $this->obj_id = $obj_id;
41  $this->active_id = $active_id;
42  }

Member Function Documentation

◆ getCaller()

ilTestPassFinishTasks::getCaller ( )
protected

Definition at line 93 of file class.ilTestPassFinishTasks.php.

References Vendor\Package\$e.

Referenced by updateLearningProgressAfterPassFinishedIsWritten().

94  {
95  try {
96  throw new Exception();
97  } catch (Exception $e) {
98  $trace = $e->getTrace();
99  }
100 
101  return $trace[3]['class'];
102  }
+ Here is the caller graph for this function:

◆ performFinishTasks()

ilTestPassFinishTasks::performFinishTasks ( ilTestProcessLocker  $processLocker)

Definition at line 44 of file class.ilTestPassFinishTasks.php.

References $testSession, ilTestProcessLocker\executeTestFinishOperation(), and updateLearningProgressAfterPassFinishedIsWritten().

Referenced by ilTestPlayerAbstractGUI\performTestPassFinishedTasks().

45  {
47 
48  $processLocker->executeTestFinishOperation(function () use ($testSession) {
49  if (!$testSession->isSubmitted()) {
50  $testSession->setSubmitted();
51  $testSession->setSubmittedTimestamp();
52  $testSession->saveToDb();
53  }
54 
55  $lastStartedPass = (
56  $testSession->getLastStartedPass() === null ? -1 : $testSession->getLastStartedPass()
57  );
58 
59  $lastFinishedPass = (
60  $testSession->getLastFinishedPass() === null ? -1 : $testSession->getLastFinishedPass()
61  );
62 
63  if ($lastStartedPass > -1 && $lastFinishedPass < $lastStartedPass) {
64  $testSession->setLastFinishedPass($testSession->getPass());
65  $testSession->increaseTestPass(); // saves to db
66  }
67  });
68 
70  }
executeTestFinishOperation(callable $operation)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLearningProgressAfterPassFinishedIsWritten()

ilTestPassFinishTasks::updateLearningProgressAfterPassFinishedIsWritten ( )
protected

Definition at line 72 of file class.ilTestPassFinishTasks.php.

References $obj_id, ilObjAssessmentFolder\_addLog(), ilObjTestAccess\_getParticipantId(), ilLPStatus\_lookupStatus(), ilLPStatusWrapper\_updateStatus(), and getCaller().

Referenced by performFinishTasks().

73  {
74  require_once './Modules/Test/classes/class.ilObjTestAccess.php';
75  require_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
77  $this->obj_id,
78  ilObjTestAccess::_getParticipantId($this->active_id)
79  );
80 
81  $caller = $this->getCaller();
82  $lp = ilLPStatus::_lookupStatus($this->obj_id, $this->testSession->getUserId());
83  $debug = "finPass={$this->testSession->getLastFinishedPass()} / Lp={$lp}";
84 
86  $this->testSession->getUserId(),
88  "updateLearningProgressAfterPassFinishedIsWritten has been called from {$caller} ({$debug})",
89  true
90  );
91  }
static _addLog( $user_id, $object_id, $logtext, $question_id=0, $original_id=0, $test_only=false, $test_ref_id=0)
Add an assessment log entry.
static _getParticipantId($active_id)
Get user id for active id.
static _lookupStatus(int $a_obj_id, int $a_user_id, bool $a_create=true)
Lookup status.
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $active_id

ilTestPassFinishTasks::$active_id
protected

Definition at line 29 of file class.ilTestPassFinishTasks.php.

Referenced by __construct().

◆ $obj_id

ilTestPassFinishTasks::$obj_id
protected

◆ $testSession

ilTestPassFinishTasks::$testSession
protected

Definition at line 25 of file class.ilTestPassFinishTasks.php.

Referenced by performFinishTasks().


The documentation for this class was generated from the following file: