|
|
|
@ -2756,19 +2756,6 @@ class learnpathItem |
|
|
|
// in case it's a SCORM, we should get: |
|
|
|
// in case it's a SCORM, we should get: |
|
|
|
if ($this->type == 'sco' || $this->type == 'au') { |
|
|
|
if ($this->type == 'sco' || $this->type == 'au') { |
|
|
|
$status = $this->get_status(true); |
|
|
|
$status = $this->get_status(true); |
|
|
|
if ($this->prevent_reinit == 1 && |
|
|
|
|
|
|
|
$status != $this->possible_status[0] && // not attempted |
|
|
|
|
|
|
|
$status != $this->possible_status[1] //incomplete |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
if ($debug) { |
|
|
|
|
|
|
|
error_log( |
|
|
|
|
|
|
|
'learnpathItem::save() - save reinit blocked by setting', |
|
|
|
|
|
|
|
0 |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Do nothing because the status has already been set. Don't allow it to change. |
|
|
|
|
|
|
|
// TODO: Check there isn't a special circumstance where this should be saved. |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if ($debug) { |
|
|
|
if ($debug) { |
|
|
|
error_log( |
|
|
|
error_log( |
|
|
|
'learnpathItem::save() - SCORM save request received', |
|
|
|
'learnpathItem::save() - SCORM save request received', |
|
|
|
@ -2814,6 +2801,12 @@ class learnpathItem |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'lesson_status': |
|
|
|
case 'lesson_status': |
|
|
|
if (!empty($value)) { |
|
|
|
if (!empty($value)) { |
|
|
|
|
|
|
|
if ($this->prevent_reinit == 1 && |
|
|
|
|
|
|
|
$status != $this->possible_status[0] && // not attempted |
|
|
|
|
|
|
|
$status != $this->possible_status[1] // incomplete |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
// do nothing: status was already completed or similar and we don't want to allow the SCO to reinitialize |
|
|
|
|
|
|
|
} else { |
|
|
|
$this->set_status($value); |
|
|
|
$this->set_status($value); |
|
|
|
if ($debug) { |
|
|
|
if ($debug) { |
|
|
|
error_log( |
|
|
|
error_log( |
|
|
|
@ -2822,6 +2815,7 @@ class learnpathItem |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'time': |
|
|
|
case 'time': |
|
|
|
$this->set_time($value); |
|
|
|
$this->set_time($value); |
|
|
|
@ -2860,7 +2854,6 @@ class learnpathItem |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'interactions': |
|
|
|
case 'interactions': |
|
|
|
break; |
|
|
|
|
|
|
|
case 'objectives': |
|
|
|
case 'objectives': |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
@ -2877,7 +2870,6 @@ class learnpathItem |
|
|
|
} |
|
|
|
} |
|
|
|
// Do nothing, just let the local attributes be used. |
|
|
|
// Do nothing, just let the local attributes be used. |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// If not SCO, such messages should not be expected. |
|
|
|
// If not SCO, such messages should not be expected. |
|
|
|
$type = strtolower($this->type); |
|
|
|
$type = strtolower($this->type); |
|
|
|
@ -3702,26 +3694,14 @@ class learnpathItem |
|
|
|
$rs_verified = Database::query($sql); |
|
|
|
$rs_verified = Database::query($sql); |
|
|
|
$row_verified = Database::fetch_array($rs_verified); |
|
|
|
$row_verified = Database::fetch_array($rs_verified); |
|
|
|
|
|
|
|
|
|
|
|
$my_case_completed = [ |
|
|
|
|
|
|
|
'completed', |
|
|
|
|
|
|
|
'passed', |
|
|
|
|
|
|
|
'browsed', |
|
|
|
|
|
|
|
'failed', |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$oldTotalTime = $row_verified['total_time']; |
|
|
|
$oldTotalTime = $row_verified['total_time']; |
|
|
|
$this->oldTotalTime = $oldTotalTime; |
|
|
|
$this->oldTotalTime = $oldTotalTime; |
|
|
|
|
|
|
|
$inserted = false; |
|
|
|
|
|
|
|
|
|
|
|
$save = true; |
|
|
|
if ( |
|
|
|
if (isset($row_verified) && isset($row_verified['status'])) { |
|
|
|
$this->type === 'sco' && |
|
|
|
if (in_array($row_verified['status'], $my_case_completed)) { |
|
|
|
($credit === 'no-credit' || $mode === 'review' || $mode === 'browse') && |
|
|
|
$save = false; |
|
|
|
$this->seriousgame_mode != 1 |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((($save === false && $this->type === 'sco') || |
|
|
|
|
|
|
|
($this->type === 'sco' && ($credit === 'no-credit' || $mode === 'review' || $mode === 'browse'))) && |
|
|
|
|
|
|
|
($this->seriousgame_mode != 1 && $this->type === 'sco') |
|
|
|
|
|
|
|
) { |
|
|
|
) { |
|
|
|
if ($debug) { |
|
|
|
if ($debug) { |
|
|
|
error_log( |
|
|
|
error_log( |
|
|
|
@ -3735,7 +3715,6 @@ class learnpathItem |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// Check the row exists. |
|
|
|
// Check the row exists. |
|
|
|
$inserted = false; |
|
|
|
|
|
|
|
// This a special case for multiple attempts and Chamilo exercises. |
|
|
|
// This a special case for multiple attempts and Chamilo exercises. |
|
|
|
if ($this->type === 'quiz' && |
|
|
|
if ($this->type === 'quiz' && |
|
|
|
$this->get_prevent_reinit() == 0 && |
|
|
|
$this->get_prevent_reinit() == 0 && |
|
|
|
@ -3863,7 +3842,7 @@ class learnpathItem |
|
|
|
error_log('get_type_static: '.$my_type_lp); |
|
|
|
error_log('get_type_static: '.$my_type_lp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// This is a array containing values finished |
|
|
|
// This is an array containing values equivalent to a finished state |
|
|
|
$case_completed = [ |
|
|
|
$case_completed = [ |
|
|
|
'completed', |
|
|
|
'completed', |
|
|
|
'passed', |
|
|
|
'passed', |
|
|
|
|