| Línea 471... |
Línea 471... |
| 471 |
if ($element == 'cmi.core.score.raw') {
|
471 |
if ($element == 'cmi.core.score.raw') {
|
| 472 |
$tracktest = scorm_get_sco_value($scoid, $userid, 'cmi.core.lesson_status', $attempt->attempt);
|
472 |
$tracktest = scorm_get_sco_value($scoid, $userid, 'cmi.core.lesson_status', $attempt->attempt);
|
| 473 |
if (!empty($tracktest)) {
|
473 |
if (!empty($tracktest)) {
|
| 474 |
if ($tracktest->value == "incomplete") {
|
474 |
if ($tracktest->value == "incomplete") {
|
| 475 |
$v = new stdClass();
|
475 |
$v = new stdClass();
|
| 476 |
$v->id = $track->valueid;
|
476 |
$v->id = $tracktest->valueid;
|
| 477 |
$v->value = "completed";
|
477 |
$v->value = "completed";
|
| 478 |
$DB->update_record('scorm_scoes_value', $v);
|
478 |
$DB->update_record('scorm_scoes_value', $v);
|
| 479 |
}
|
479 |
}
|
| 480 |
}
|
480 |
}
|
| 481 |
}
|
481 |
}
|
| Línea 702... |
Línea 702... |
| 702 |
*/
|
702 |
*/
|
| 703 |
function scorm_get_sco_runtime($scormid, $scoid, $userid, $attempt=1) {
|
703 |
function scorm_get_sco_runtime($scormid, $scoid, $userid, $attempt=1) {
|
| 704 |
global $DB;
|
704 |
global $DB;
|
| Línea 705... |
Línea 705... |
| 705 |
|
705 |
|
| 706 |
$params = array('userid' => $userid, 'scormid' => $scormid, 'attempt' => $attempt);
|
706 |
$params = array('userid' => $userid, 'scormid' => $scormid, 'attempt' => $attempt);
|
| 707 |
$sql = "SELECT min(timemodified) as start, max(timemodified) as finish
|
707 |
$sql = "SELECT MIN(timemodified) AS timemin, MAX(timemodified) AS timemax
|
| 708 |
FROM {scorm_scoes_value} v
|
708 |
FROM {scorm_scoes_value} v
|
| 709 |
JOIN {scorm_attempt} a on a.id = v.attemptid
|
709 |
JOIN {scorm_attempt} a on a.id = v.attemptid
|
| 710 |
WHERE a.userid = :userid AND a.scormid = :scormid AND a.attempt = :attempt";
|
710 |
WHERE a.userid = :userid AND a.scormid = :scormid AND a.attempt = :attempt";
|
| 711 |
if (!empty($scoid)) {
|
711 |
if (!empty($scoid)) {
|
| 712 |
$params['scoid'] = $scoid;
|
712 |
$params['scoid'] = $scoid;
|
| 713 |
$sql .= " AND v.scoid = :scoid";
|
713 |
$sql .= " AND v.scoid = :scoid";
|
| - |
|
714 |
}
|
| 714 |
}
|
715 |
|
| 715 |
$timedata = $DB->get_record_sql($sql, $params);
|
716 |
if ($timedata = $DB->get_record_sql($sql, $params)) {
|
| 716 |
if (!empty($timedata)) {
|
717 |
return (object) [
|
| - |
|
718 |
'start' => $timedata->timemin,
|
| - |
|
719 |
'finish' => $timedata->timemax,
|
| 717 |
return $timedata;
|
720 |
];
|
| 718 |
} else {
|
721 |
} else {
|
| 719 |
$timedata = new stdClass();
|
722 |
$timedata = new stdClass();
|
| Línea 720... |
Línea 723... |
| 720 |
$timedata->start = false;
|
723 |
$timedata->start = false;
|
| Línea 1002... |
Línea 1005... |
| 1002 |
echo html_writer::start_tag('form', array('id' => 'scormviewform',
|
1005 |
echo html_writer::start_tag('form', array('id' => 'scormviewform',
|
| 1003 |
'method' => 'post',
|
1006 |
'method' => 'post',
|
| 1004 |
'action' => $CFG->wwwroot.'/mod/scorm/player.php'));
|
1007 |
'action' => $CFG->wwwroot.'/mod/scorm/player.php'));
|
| 1005 |
if ($scorm->hidebrowse == 0) {
|
1008 |
if ($scorm->hidebrowse == 0) {
|
| 1006 |
echo html_writer::tag('button', get_string('browse', 'scorm'),
|
1009 |
echo html_writer::tag('button', get_string('browse', 'scorm'),
|
| 1007 |
['class' => 'btn btn-secondary mr-1', 'name' => 'mode',
|
1010 |
['class' => 'btn btn-secondary me-1', 'name' => 'mode',
|
| 1008 |
'type' => 'submit', 'id' => 'b', 'value' => 'browse'])
|
1011 |
'type' => 'submit', 'id' => 'b', 'value' => 'browse'])
|
| 1009 |
. html_writer::end_tag('button');
|
1012 |
. html_writer::end_tag('button');
|
| 1010 |
} else {
|
1013 |
} else {
|
| 1011 |
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'mode', 'value' => 'normal'));
|
1014 |
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'mode', 'value' => 'normal'));
|
| 1012 |
}
|
1015 |
}
|
| Línea 1020... |
Línea 1023... |
| 1020 |
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'newattempt', 'value' => 'on'));
|
1023 |
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'newattempt', 'value' => 'on'));
|
| 1021 |
}
|
1024 |
}
|
| 1022 |
} else if (!empty($attemptcount) && ($incomplete === false) && (($result->attemptleft > 0)||($scorm->maxattempt == 0))) {
|
1025 |
} else if (!empty($attemptcount) && ($incomplete === false) && (($result->attemptleft > 0)||($scorm->maxattempt == 0))) {
|
| 1023 |
echo html_writer::start_div('pt-1');
|
1026 |
echo html_writer::start_div('pt-1');
|
| 1024 |
echo html_writer::checkbox('newattempt', 'on', false, '', array('id' => 'a'));
|
1027 |
echo html_writer::checkbox('newattempt', 'on', false, '', array('id' => 'a'));
|
| 1025 |
echo html_writer::label(get_string('newattempt', 'scorm'), 'a', true, ['class' => 'pl-1']);
|
1028 |
echo html_writer::label(get_string('newattempt', 'scorm'), 'a', true, ['class' => 'ps-1']);
|
| 1026 |
echo html_writer::end_div();
|
1029 |
echo html_writer::end_div();
|
| 1027 |
}
|
1030 |
}
|
| 1028 |
if (!empty($scorm->popup)) {
|
1031 |
if (!empty($scorm->popup)) {
|
| 1029 |
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'display', 'value' => 'popup'));
|
1032 |
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'display', 'value' => 'popup'));
|
| 1030 |
}
|
1033 |
}
|