Fixing fulltext indexer tool - refs #3166

skala
Yannick Warnier 14 years ago
parent 00e88168ac
commit 4807477e39
  1. 5
      main/inc/lib/search/tool_processors/document_processor.class.php
  2. 5
      main/inc/lib/search/tool_processors/learnpath_processor.class.php
  3. 7
      main/inc/lib/search/tool_processors/link_processor.class.php
  4. 8
      main/newscorm/aicc_api.php
  5. 8
      main/newscorm/learnpath.class.php
  6. 2
      main/newscorm/lp_list_search.php

@ -68,6 +68,7 @@ class document_processor extends search_processor {
private function get_information($course_id, $doc_id) {
$course_information = api_get_course_info($course_id);
$course_id = $course_information['real_id'];
$course_path = $course_information['path'];
if (!empty($course_information)) {
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
@ -85,7 +86,7 @@ class document_processor extends search_processor {
if ($row = Database::fetch_array ($dk_result)) {
$name = $row['title'];
$url = api_get_path(WEB_PATH) . 'courses/%s/document%s';
$url = sprintf($url, api_get_course_path($course_id), $row['path']);
$url = sprintf($url, $course_path, $row['path']);
// Get the image path
include_once api_get_path(LIBRARY_PATH). 'fileDisplay.lib.php';
$icon = choose_image(basename($row['path']));
@ -105,4 +106,4 @@ class document_processor extends search_processor {
return array();
}
}
}
}

@ -89,6 +89,7 @@ class learnpath_processor extends search_processor {
private function get_information($course_id, $lp_id, $has_document_id=TRUE) {
$course_information = api_get_course_info($course_id);
$course_id = $course_information['real_id'];
$course_path = $course_information['path'];
if (!empty($course_information)) {
$lpi_table = Database::get_course_table(TABLE_LP_ITEM);
@ -125,7 +126,7 @@ class learnpath_processor extends search_processor {
$name = '';
if ($row = Database::fetch_array ($dk_result)) {
// Get the image path
$img_location = api_get_path(WEB_COURSE_PATH).api_get_course_path($course_id)."/document/";
$img_location = api_get_path(WEB_COURSE_PATH).$course_path."/document/";
$thumbnail_path = str_replace ('.png.html', '_thumb.png', $row['path']);
$big_img_path = str_replace ('.png.html', '.png', $row['path']);
$thumbnail = '';
@ -143,4 +144,4 @@ class learnpath_processor extends search_processor {
return array();
}
}
}
}

@ -40,7 +40,7 @@ class link_processor extends search_processor {
$results = array();
foreach ($this->links as $courseid => $one_course_links) {
$course_info = api_get_course_info($courseid);
$course_info = api_get_course_info($courseid);
$search_show_unlinked_results = (api_get_setting('search_show_unlinked_results') == 'true');
$course_visible_for_user = api_is_course_visible_for_user(NULL, $courseid);
// can view course?
@ -97,6 +97,7 @@ class link_processor extends search_processor {
private function get_information($course_id, $link_id) {
$course_information = api_get_course_info($course_id);
$course_id = $course_information['real_id'];
$course_id_alpha = $course_information['id'];
if (!empty($course_information)) {
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
@ -107,7 +108,7 @@ class link_processor extends search_processor {
$name = get_lang('Links');
$url = api_get_path(WEB_PATH) . 'main/link/link.php?cidReq=%s';
$url = sprintf($url, $course_id);
$url = sprintf($url, $course_id_alpha);
// Get the image path
$thumbnail = api_get_path(WEB_CODE_PATH) .'img/link.gif';
$image = $thumbnail; //FIXME: use big images
@ -124,4 +125,4 @@ class link_processor extends search_processor {
return array();
}
}
}
}

@ -389,7 +389,7 @@ function addListeners(){
// when something is loaded in there.
var myelem = document.getElementById('content_id');
if(!myelem){logit_lms("Impossible to find content_id element in document",2);}
addEvent(myelem,'unload',dokeos_save_asset,false);
addEvent(myelem,'unload',chamilo_save_asset,false);
logit_lms('Added event listener on content_id for unload',2);
}
logit_lms('Quitting addListeners()',2);
@ -410,7 +410,7 @@ function load_item(item_id,url){
var lms_new_item_id = item_id;
//load new content page into content frame
if(lms_lp_type==1 || lms_item_type=='asset'){
dokeos_save_asset();
chamilo_save_asset();
}
cont_f.src = url;
update_toc('unhighlight',lms_old_item_id);
@ -432,10 +432,10 @@ function load_item(item_id,url){
* Save a Chamilo learnpath item's time and mark as completed upon
* leaving it
*/
function dokeos_save_asset(){
function chamilo_save_asset(){
//var linkparams = 'id='+lms_item_id+'&score='+score+'&max='+max+'&min='+min+'&lesson_status='+lesson_status+'&time='+session_time+'&suspend_data='+suspend_data;
//var url = "<?php echo api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php'; ?>?action=save&" + linkparams + "";
logit_lms('dokeos_save_asset: '+url,0);
logit_lms('chamilo_save_asset: '+url,0);
//frames["message_name"].src = url;
xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, session_time, suspend_data, lesson_location);
}

@ -1027,8 +1027,8 @@ class learnpath {
$res = Database::query($sql);
if (Database :: num_rows($res) > 0) {
$row2 = Database :: fetch_array($res);
require_once api_get_path(LIBRARY_PATH).'search/DokeosIndexer.class.php';
$di = new DokeosIndexer();
require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
$di = new ChamiloIndexer();
$di->remove_document((int) $row2['search_did']);
}
$sql = 'DELETE FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level=%d LIMIT 1';
@ -3967,7 +3967,7 @@ class learnpath {
return false;
require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API.
require_once api_get_path(LIBRARY_PATH).'search/DokeosIndexer.class.php';
require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
require_once api_get_path(LIBRARY_PATH).'search/xapian/XapianQuery.php';
require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
@ -3976,7 +3976,7 @@ class learnpath {
$lp_id = intval($_POST['lp_id']);
$sql = "SELECT * FROM $items_table WHERE c_id = $course_id AND lp_id = $lp_id";
$result = Database::query($sql);
$di = new DokeosIndexer();
$di = new ChamiloIndexer();
while ($lp_item = Database :: fetch_array($result)) {
// Get search_did.

@ -13,7 +13,7 @@
* Code
*/
require api_get_path(LIBRARY_PATH).'search/search_widget.php';
require api_get_path(LIBRARY_PATH).'search/DokeosQuery.php';
require api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php';
require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';

Loading…
Cancel
Save