|
|
|
@ -66,6 +66,9 @@ class ExerciseLink extends AbstractLink |
|
|
|
|
{ |
|
|
|
|
$TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT); |
|
|
|
|
$TBL_ITEM_PROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
|
|
|
$exerciseTable = $this->get_exercise_table(); |
|
|
|
|
$lpItemTable = Database :: get_course_table(TABLE_LP_ITEM); |
|
|
|
|
|
|
|
|
|
$documentPath = api_get_path(SYS_COURSE_PATH).$this->course_code."/document"; |
|
|
|
|
if (empty($this->course_code)) { |
|
|
|
|
die('Error in get_not_created_links() : course code not set'); |
|
|
|
@ -80,9 +83,14 @@ class ExerciseLink extends AbstractLink |
|
|
|
|
// @todo |
|
|
|
|
$uploadPath = null; |
|
|
|
|
|
|
|
|
|
$sql = 'SELECT id,title from '.$this->get_exercise_table().' |
|
|
|
|
$sql = 'SELECT id,title FROM '.$exerciseTable.' |
|
|
|
|
WHERE c_id = '.$this->course_id.' AND active=1 '.$session_condition; |
|
|
|
|
|
|
|
|
|
$sqlLp = "SELECT e.id, e.title FROM $exerciseTable e INNER JOIN $lpItemTable i |
|
|
|
|
ON (e.c_id = i.c_id AND e.id = i.path) |
|
|
|
|
WHERE e.c_id = $this->course_id AND active = 0 AND item_type = 'quiz' |
|
|
|
|
$session_condition"; |
|
|
|
|
|
|
|
|
|
$sql2 = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility, d.id |
|
|
|
|
FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip |
|
|
|
|
WHERE |
|
|
|
@ -94,12 +102,17 @@ class ExerciseLink extends AbstractLink |
|
|
|
|
d.path LIKE '".Database :: escape_string($uploadPath.'/%/%')."' AND |
|
|
|
|
ip.visibility='1' |
|
|
|
|
"; |
|
|
|
|
|
|
|
|
|
require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php'; |
|
|
|
|
$exerciseInLP = array(); |
|
|
|
|
if (!$this->is_hp) { |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$resultLp = Database::query($sqlLp); |
|
|
|
|
$exerciseInLP = Database::store_result($resultLp); |
|
|
|
|
} else { |
|
|
|
|
$result2 = Database::query($sql2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$cats = array(); |
|
|
|
|
if (isset($result)) { |
|
|
|
|
if (Database::num_rows($result) > 0) { |
|
|
|
@ -108,6 +121,7 @@ class ExerciseLink extends AbstractLink |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (isset($result2)) { |
|
|
|
|
if (Database::num_rows($result2) > 0) { |
|
|
|
|
while ($row=Database::fetch_array($result2)) { |
|
|
|
@ -125,13 +139,22 @@ class ExerciseLink extends AbstractLink |
|
|
|
|
if ($title == '') { |
|
|
|
|
$title = basename($path); |
|
|
|
|
} |
|
|
|
|
$cats[] = array ($attribute['id'], $title.'(HP)'); |
|
|
|
|
$cats[] = array($attribute['id'], $title.'(HP)'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($exerciseInLP)) { |
|
|
|
|
foreach ($exerciseInLP as $exercise) { |
|
|
|
|
$cats[] = array( |
|
|
|
|
$exercise['id'], |
|
|
|
|
$exercise['title'].' ('.get_lang('ToolLearnpath').')' |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $cats; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|