[svn r22169] allow show tooltip,when the option "is manual" is enabled - (partial FS#4337)

skala
Isaac Flores 16 years ago
parent 16bf4ad138
commit 18db374d29
  1. 18
      main/glossary/glossary.class.php
  2. 17
      main/glossary/glossary_ajax_request.php

@ -26,7 +26,7 @@ class GlossaryManager {
/**
* Get glossary term by glossary id
* @author Isaac Flores <florespaz@bidsoftperu.com>
* @param Integer The glossay id
* @param Integer The glossary id
* @return String The glossary description
*/
public static function get_glossary_term_by_glossary_id ($glossary_id) {
@ -36,6 +36,20 @@ class GlossaryManager {
$rs=Database::query($sql,__FILE__,__LINE__);
$row=Database::fetch_array($rs);
return $row['description'];
}
}
/**
* Get glossary term by glossary id
* @author Isaac Flores <florespaz_isaac@hotmail.com>
* @param String The glossary term name
* @return String The glossary description
*/
public static function get_glossary_term_by_glossary_name ($glossary_name) {
global $course;
$glossary_table = Database::get_course_table(TABLE_GLOSSARY);
$sql='SELECT description FROM '.$glossary_table.' WHERE name like trim("'.Database::escape_string($glossary_name).'") ';
$rs=Database::query($sql,__FILE__,__LINE__);
$row=Database::fetch_array($rs);
return $row['description'];
}
}
?>

@ -7,15 +7,19 @@ require_once '../glossary/glossary.class.php';
/*
* search a term and return description from a glossary
*/
$glossary_id=Security::remove_XSS($_POST['glossary_id']);
global $charset;
$glossary_id=Security::remove_XSS($_POST['glossary_id']);
$glossary_description=GlossaryManager::get_glossary_term_by_glossary_id($glossary_id);
$glossary_data=GlossaryManager::get_glossary_terms();
$my_glossary_name=Security::remove_XSS($_POST['glossary_name']);
$my_glossary_name=api_convert_encoding($my_glossary_name,$charset,'UTF-8');
$my_glossary_name=trim($my_glossary_name);
$glossary_description=GlossaryManager::get_glossary_term_by_glossary_name($my_glossary_name);
$glossary_all_data=array();
foreach ($glossary_data as $glossary_index=>$glossary_value) {
$glossary_all_data[]=$glossary_value['id'].'__|__|'.$glossary_value['name'];
}
$glossary_all_data=implode('[|.|_|.|-|.|]',$glossary_all_data);
//get_glossary_terms
@ -23,6 +27,13 @@ $glossary_all_data=implode('[|.|_|.|-|.|]',$glossary_all_data);
echo api_xml_http_response_encode($glossary_description);
} elseif (isset($_POST['glossary_data']) && $_POST['glossary_data']=='true') {
echo api_xml_http_response_encode($glossary_all_data);
} elseif(isset($_POST['glossary_name'])) {
if (is_null($glossary_description)) {
echo api_xml_http_response_encode(get_lang('NoResults'));
} else {
echo api_xml_http_response_encode($glossary_description);
}
} else {
echo '';
echo api_xml_http_response_encode(get_lang('NoResults'));
}
Loading…
Cancel
Save