Fix fatal error due an query see BT#13031

pull/2487/head
jmontoyaa 8 years ago
parent 94c85054f0
commit c58d0f5dfb
  1. 60
      main/lp/learnpathItem.class.php

@ -161,42 +161,36 @@ class learnpathItem
$this->children[] = $row['id'];
}
}
}
//$this->seriousgame_mode = $this->get_seriousgame_mode();
$this->seriousgame_mode = 0;
// Get search_did.
if (api_get_setting('search_enabled') == 'true') {
$tbl_se_ref = Database::get_main_table(
TABLE_MAIN_SEARCH_ENGINE_REF
);
$sql = 'SELECT *
FROM %s
WHERE course_code=\'%s\'
AND tool_id=\'%s\'
AND ref_id_high_level=%s
AND ref_id_second_level=%d
LIMIT 1';
// TODO: Verify if it's possible to assume the actual course instead
// of getting it from db.
$sql = sprintf(
$sql,
$tbl_se_ref,
api_get_course_id(),
TOOL_LEARNPATH,
$this->lp_id,
$id
);
if (self::DEBUG > 0) {
error_log($sql);
};
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$se_ref = Database::fetch_array($res);
$this->search_did = (int) $se_ref['search_did'];
// Get search_did.
if (api_get_setting('search_enabled') == 'true') {
$tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
$sql = 'SELECT *
FROM %s
WHERE
course_code=\'%s\' AND
tool_id=\'%s\' AND
ref_id_high_level=%s AND
ref_id_second_level=%d
LIMIT 1';
// TODO: Verify if it's possible to assume the actual course instead
// of getting it from db.
$sql = sprintf(
$sql,
$tbl_se_ref,
api_get_course_id(),
TOOL_LEARNPATH,
$this->lp_id,
$id
);
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$se_ref = Database::fetch_array($res);
$this->search_did = (int) $se_ref['search_did'];
}
}
}
$this->seriousgame_mode = 0;
$this->audio = $row['audio'];
if (self::DEBUG > 0) {
error_log(

Loading…
Cancel
Save