[svn r18064] fix: show results if search_show_unlinked_results is false, but have user access to resourse

skala
Marco Villegas 17 years ago
parent 5b0b78fbe5
commit 559634ccc4
  1. 4
      main/inc/lib/search/tool_processors/document_processor.class.php
  2. 2
      main/inc/lib/search/tool_processors/learnpath_processor.class.php
  3. 2
      main/inc/lib/search/tool_processors/link_processor.class.php
  4. 13
      main/inc/lib/search/tool_processors/quiz_processor.class.php

@ -25,7 +25,8 @@ class document_processor extends search_processor {
if ($search_show_unlinked_results) {
if (!$course_visible_for_user) {
$url = '';
}
}
}
$results[] = array(
'toolid' => TOOL_DOCUMENT,
'score' => $row_val['score'],
@ -35,7 +36,6 @@ class document_processor extends search_processor {
'title' => $name,
'author' => $author,
);
}
}
}
}

@ -47,6 +47,7 @@ class learnpath_processor extends search_processor {
if (!$course_visible_for_user) {
$url = '';
}
}
$results[] = array(
'toolid' => TOOL_LEARNPATH,
'score' => $lp['total_score']/(count($lp)-1), // not count total_score array item
@ -56,7 +57,6 @@ class learnpath_processor extends search_processor {
'title' => $name,
'author' => $author,
);
}
}
}
}

@ -48,6 +48,7 @@ class link_processor extends search_processor {
if (!$course_visible_for_user) {
$url = '';
}
}
$result = array(
'toolid' => TOOL_LINK,
'score' => $one_course_links['total_score']/(count($one_course_links)-1), // not count total_score array item
@ -57,7 +58,6 @@ class link_processor extends search_processor {
'title' => $name,
'author' => $author,
);
}
break;
}
}

@ -50,14 +50,21 @@ class quiz_processor extends search_processor {
public function process() {
$results = array();
foreach ($this->exercises as $courseid => $exercises) {
$search_show_unlinked_results = (api_get_setting('search_show_unlinked_results') == 'true');
$course_visible_for_user = api_is_course_visible_for_user(NULL, $row_val['courseid']);
// can view course?
if (api_is_course_visible_for_user(NULL, $courseid)) {
if ($course_visible_for_user || $search_show_unlinked_results) {
foreach ($exercises as $exercise_id => $exercise) {
// is visible?
$visibility = api_get_item_visibility(api_get_course_info($courseid), TOOL_QUIZ, $exercise_id);
if($visibility) {
if ($visibility) {
list($thumbnail, $image, $name, $author) = $this->get_information($courseid, $exercise_id);
$url = api_get_path(WEB_PATH) . 'main/exercice/exercice_submit.php?cidReq=%s&exerciseId=%s';
$url = api_get_path(WEB_PATH) . 'main/exercice/exercice_submit.php?cidReq=%s&exerciseId=%s';
if ($search_show_unlinked_results) {
if (!$course_visible_for_user) {
$url = '';
}
}
$results[] = array(
'toolid' => TOOL_QUIZ,
'score' => $exercise['total_score']/(count($exercise)-1), // not count total_score array item

Loading…
Cancel
Save