Merge branch 'm24_MDL-36142_Incorrect_query_returns_HTTP_404' of https://github.com/scara/moodle

This commit is contained in:
Dan Poltawski 2012-11-20 15:57:53 +08:00
commit 109473368d

View File

@ -79,7 +79,11 @@ if (!empty($scoid)) {
if ($sco = scorm_get_sco($scoid)) {
if ($sco->launch == '') {
// Search for the next launchable sco
if ($scoes = $DB->get_records_select('scorm_scoes', "scorm = ? AND '.$DB->sql_isnotempty('scorm_scoes', 'launch', false, true).' AND id > ?", array($scorm->id, $sco->id), 'id ASC')) {
if ($scoes = $DB->get_records_select(
'scorm_scoes',
'scorm = ? AND '.$DB->sql_isnotempty('scorm_scoes', 'launch', false, true).' AND id > ?',
array($scorm->id, $sco->id),
'id ASC')) {
$sco = current($scoes);
}
}
@ -89,7 +93,12 @@ if (!empty($scoid)) {
// If no sco was found get the first of SCORM package
//
if (!isset($sco)) {
$scoes = $DB->get_records_select('scorm_scoes', "scorm = ? AND ".$DB->sql_isnotempty('scorm_scoes', 'launch', false, true), array($scorm->id), 'id ASC');
$scoes = $DB->get_records_select(
'scorm_scoes',
'scorm = ? AND '.$DB->sql_isnotempty('scorm_scoes', 'launch', false, true),
array($scorm->id),
'id ASC'
);
$sco = current($scoes);
}