ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTestPassFinishTasks Class Reference

Class ilTestPassFinishTasks. 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

Constructor & Destructor Documentation

◆ __construct()

ilTestPassFinishTasks::__construct (   $active_id,
  $obj_id 
)

ilTestPassFinishTasks constructor.

Parameters
$active_id
$obj_id

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

22 {
23 $this->testSession = new ilTestSession();
24 $this->testSession->loadFromDb($active_id);
25 $this->obj_id = $obj_id;
26 $this->active_id = $active_id;
27 }
Test session handler.

References $active_id, and $obj_id.

Member Function Documentation

◆ getCaller()

ilTestPassFinishTasks::getCaller ( )
protected

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

79 {
80 try {
81 throw new Exception();
82 } catch (Exception $e) {
83 $trace = $e->getTrace();
84 }
85
86 return $trace[3]['class'];
87 }

Referenced by updateLearningProgressAfterPassFinishedIsWritten().

+ Here is the caller graph for this function:

◆ performFinishTasks()

ilTestPassFinishTasks::performFinishTasks ( ilTestProcessLocker  $processLocker)

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

30 {
32
33 $processLocker->executeTestFinishOperation(function () use ($testSession) {
34 if (!$testSession->isSubmitted()) {
35 $testSession->setSubmitted();
36 $testSession->setSubmittedTimestamp();
37 $testSession->saveToDb();
38 }
39
40 $lastStartedPass = (
41 $testSession->getLastStartedPass() === null ? -1 : $testSession->getLastStartedPass()
42 );
43
44 $lastFinishedPass = (
45 $testSession->getLastFinishedPass() === null ? -1 : $testSession->getLastFinishedPass()
46 );
47
48 if ($lastStartedPass > -1 && $lastFinishedPass < $lastStartedPass) {
49 $testSession->setLastFinishedPass($testSession->getPass());
50 $testSession->increaseTestPass(); // saves to db
51 }
52 });
53
55 }
executeTestFinishOperation(callable $operation)
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Definition: confirmReg.php:12

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

+ Here is the call graph for this function:

◆ updateLearningProgressAfterPassFinishedIsWritten()

ilTestPassFinishTasks::updateLearningProgressAfterPassFinishedIsWritten ( )
protected

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

58 {
59 require_once './Modules/Test/classes/class.ilObjTestAccess.php';
60 require_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
62 $this->obj_id,
64 );
65
66 $caller = $this->getCaller();
67 $lp = ilLPStatus::_lookupStatus($this->obj_id, $this->testSession->getUserId());
68 $debug = "finPass={$this->testSession->getLastFinishedPass()} / Lp={$lp}";
69
71 $this->testSession->getUserId(),
72 $this->obj_id,
73 "updateLearningProgressAfterPassFinishedIsWritten has been called from {$caller} ({$debug})",
74 true
75 );
76 }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
static _addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=false, $test_ref_id=null)
Add an assessment log entry.
static _getParticipantId($active_id)
Get user id for active id.

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

Referenced by performFinishTasks().

+ 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 14 of file class.ilTestPassFinishTasks.php.

Referenced by __construct().

◆ $obj_id

ilTestPassFinishTasks::$obj_id
protected

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

Referenced by __construct().

◆ $testSession

ilTestPassFinishTasks::$testSession
protected

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

Referenced by performFinishTasks().


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