ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 22 of file class.ilTestPassFinishTasks.php.

23 {
24 $this->testSession = new ilTestSession();
25 $this->testSession->loadFromDb($active_id);
26 $this->obj_id = $obj_id;
27 $this->active_id = $active_id;
28 }
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 30 of file class.ilTestPassFinishTasks.php.

31 {
33
34 $processLocker->executeTestFinishOperation(function() use ($testSession) {
35
36 if( !$testSession->isSubmitted() )
37 {
38 $testSession->setSubmitted();
39 $testSession->setSubmittedTimestamp();
40 $testSession->saveToDb();
41 }
42
43 $lastStartedPass = (
44 $testSession->getLastStartedPass() === null ? -1 : $testSession->getLastStartedPass()
45 );
46
47 $lastFinishedPass = (
48 $testSession->getLastFinishedPass() === null ? -1 : $testSession->getLastFinishedPass()
49 );
50
51 if( $lastStartedPass > -1 && $lastFinishedPass < $lastStartedPass )
52 {
53 $testSession->setLastFinishedPass($testSession->getPass());
54 $testSession->increaseTestPass(); // saves to db
55 }
56 });
57
59 }
executeTestFinishOperation(callable $operation)

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

+ Here is the call graph for this function:

◆ updateLearningProgressAfterPassFinishedIsWritten()

ilTestPassFinishTasks::updateLearningProgressAfterPassFinishedIsWritten ( )
protected

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

62 {
63 require_once './Modules/Test/classes/class.ilObjTestAccess.php';
64 require_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
66 $this->obj_id, ilObjTestAccess::_getParticipantId($this->active_id)
67 );
68
69 $caller = $this->getCaller();
70 $lp = ilLPStatus::_lookupStatus($this->obj_id, $this->testSession->getUserId());
71 $debug = "finPass={$this->testSession->getLastFinishedPass()} / Lp={$lp}";
72
73 ilObjAssessmentFolder::_addLog( $this->testSession->getUserId(), $this->obj_id,
74 "updateLearningProgressAfterPassFinishedIsWritten has been called from {$caller} ({$debug})", 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 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 15 of file class.ilTestPassFinishTasks.php.

Referenced by __construct().

◆ $obj_id

ilTestPassFinishTasks::$obj_id
protected

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

Referenced by __construct().

◆ $testSession

ilTestPassFinishTasks::$testSession
protected

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

Referenced by performFinishTasks().


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