[svn r21662] logic changes - improvements in serach tool - (partial FS#4346)

skala
Isaac Flores 16 years ago
parent 610c4a4554
commit f3604eeabb
  1. 9
      main/exercice/admin.php
  2. 10
      main/exercice/exercise.class.php
  3. 3
      main/exercice/exercise_admin.php
  4. 8
      main/exercice/question.class.php
  5. 17
      main/link/link.php
  6. 3
      main/link/linkfunctions.php

@ -1,4 +1,4 @@
<?php // $Id: admin.php 20841 2009-05-19 16:31:28Z cvargas1 $
<?php // $Id: admin.php 21662 2009-06-29 14:55:09Z iflorespaz $
/*
==============================================================================
@ -67,7 +67,7 @@
*
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: admin.php 20841 2009-05-19 16:31:28Z cvargas1 $
* @version $Id: admin.php 21662 2009-06-29 14:55:09Z iflorespaz $
*/
@ -497,7 +497,10 @@ if(!$newQuestion && !$modifyQuestion && !$editQuestion && !isset($_GET['hotspota
$objExercise -> processCreation($form,'simple');
if($form -> getSubmitValue('edit') == 'true')
Display::display_confirmation_message(get_lang('ExerciseEdited'));
}
}
if(api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) {
Display::display_error_message(get_lang('SearchXapianModuleNotInstaled'));
}
$form -> display ();
echo '<br />';
// question list management

@ -25,7 +25,7 @@
* Exercise class: This class allows to instantiate an object of type Exercise
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: exercise.class.php 20975 2009-05-25 18:09:56Z cvargas1 $
* @version $Id: exercise.class.php 21662 2009-06-29 14:55:09Z iflorespaz $
*/
@ -598,7 +598,7 @@ class Exercise
// insert into the item_property table
api_item_property_update($_course, TOOL_QUIZ, $this->id,'QuizAdded',$_user['user_id']);
if (api_get_setting('search_enabled')=='true') {
if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
$this -> search_engine_save();
}
@ -846,7 +846,7 @@ class Exercise
api_sql_query($sql);
api_item_property_update($_course, TOOL_QUIZ, $this->id,'QuizDeleted',$_user['user_id']);
if (api_get_setting('search_enabled')=='true') {
if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian') ) {
$this -> search_engine_delete();
}
}
@ -1156,7 +1156,7 @@ class Exercise
function search_engine_edit() {
// update search enchine and its values table if enabled
if (api_get_setting('search_enabled')=='true') {
if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
$course_id = api_get_course_id();
// actually, it consists on delete terms from db, insert new ones, create a new search engine document, and remove the old one
@ -1230,7 +1230,7 @@ class Exercise
function search_engine_delete() {
// remove from search engine if enabled
if (api_get_setting('search_enabled') == 'true') {
if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian') ) {
$course_id = api_get_course_id();
$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 IS NULL LIMIT 1';

@ -141,6 +141,9 @@ if ($form -> validate()) {
Display::display_header($nameTools,"Exercise");
if ($objExercise->feedbacktype==1)
Display::display_normal_message(get_lang("DirectFeedbackCantModifyTypeQuestion"));
if(api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) {
Display::display_error_message(get_lang('SearchXapianModuleNotInstaled'));
}
$form -> display ();
}
Display::display_footer();

@ -1,4 +1,4 @@
<?php // $Id: question.class.php 20990 2009-05-26 14:20:05Z juliomontoya $
<?php // $Id: question.class.php 21662 2009-06-29 14:55:09Z iflorespaz $
/*
==============================================================================
@ -28,7 +28,7 @@
* File containing the Question class.
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: question.class.php 20990 2009-05-26 14:20:05Z juliomontoya $
* @version $Id: question.class.php 21662 2009-06-29 14:55:09Z iflorespaz $
*/
@ -672,7 +672,7 @@ abstract class Question
function search_engine_edit($exerciseId, $addQs=FALSE, $rmQs=FALSE) {
// update search engine and its values table if enabled
if (api_get_setting('search_enabled')=='true') {
if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
$course_id = api_get_course_id();
// get search_did
$tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
@ -887,7 +887,7 @@ abstract class Question
else
{
$this->removeFromList($deleteFromEx);
if (api_get_setting('search_enabled')=='true') {
if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
// disassociate question with this exercise
$this -> search_engine_edit($deleteFromEx, FALSE, TRUE);
}

@ -1,4 +1,4 @@
<?php // $Id: link.php 20716 2009-05-16 07:28:22Z ivantcholakov $
<?php // $Id: link.php 21662 2009-06-29 14:55:09Z iflorespaz $
/*
==============================================================================
Dokeos - elearning and course management software
@ -45,12 +45,12 @@
==============================================================================
*/
// name of the language file that needs to be included
$language_file = "link";
$language_file = array('link','admin');
// including libraries
include("../inc/global.inc.php");
include(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
include("linkfunctions.php");
require_once "../inc/global.inc.php";
require_once api_get_path(LIBRARY_PATH).'events.lib.inc.php';
require_once "linkfunctions.php";
$this_section=SECTION_COURSES;
@ -189,7 +189,11 @@ if (is_allowed_to_edit() and isset($_GET['action'])) {
echo '<div class="actions">';
echo '<a href="link.php?cidReq='.Security::remove_XSS($_GET['cidReq']).'&amp;urlview='.Security::remove_XSS($_GET['urlview']).'">'.Display::return_icon('back.png',get_lang('BackToLinksOverview')).get_lang('BackToLinksOverview').'</a>';
echo '</div>';
if(api_get_setting('search_enabled')=='true') {
if (!extension_loaded('xapian')) {
Display::display_error_message(get_lang('SearchXapianModuleNotInstaled'));
}
}
// Displaying the correct title and the form for adding a category or link. This is only shown when nothing
// has been submitted yet, hence !isset($submitLink)
if (($_GET['action']=="addlink" or $_GET['action']=="editlink") and empty($_POST['submitLink'])) {
@ -272,6 +276,7 @@ if (is_allowed_to_edit() and isset($_GET['action'])) {
</div>
</div>';
if(api_get_setting('search_enabled')=='true')
{
require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');

@ -115,7 +115,8 @@ function addlinkcategory($type)
api_sql_query($sql, __FILE__, __LINE__);
$link_id = Database::insert_id();
if ( (api_get_setting('search_enabled')=='true') && $link_id) {
if ( (api_get_setting('search_enabled')=='true') && $link_id && extension_loaded('xapian')) {
require_once(api_get_path(LIBRARY_PATH) .'search/DokeosIndexer.class.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