mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
- Fixed some bugs detected with Jeff's glossary (mostly with dynalink link feature)
This commit is contained in:
parent
e0234384f4
commit
4d4c38f3fe
@ -12,7 +12,7 @@
|
||||
$GLOSSARY_CONCEPT_IS_ENTRY = 0;
|
||||
$GLOSSARY_CONCEPT_IS_CATEGORY = 1;
|
||||
|
||||
$glossarieslist = get_records_select("glossary", "usedynalink = 1 and course = $courseid","id");
|
||||
$glossarieslist = get_records_select("glossary", "usedynalink != 0 and course = $courseid","id");
|
||||
if ( $glossarieslist ) {
|
||||
$glossaries = "";
|
||||
foreach ( $glossarieslist as $glossary ) {
|
||||
@ -20,7 +20,7 @@
|
||||
}
|
||||
$glossaries=substr($glossaries,0,-1);
|
||||
|
||||
$entries = get_records_select("glossary_entries", "glossaryid IN ($glossaries) AND usedynalink = 1 and approved != 0","glossaryid","id,glossaryid,concept,casesensitive,$GLOSSARY_CONCEPT_IS_ENTRY category,fullmatch");
|
||||
$entries = get_records_select("glossary_entries", "glossaryid IN ($glossaries) AND usedynalink != 0 and approved != 0","glossaryid","id,glossaryid,concept,casesensitive,$GLOSSARY_CONCEPT_IS_ENTRY category,fullmatch");
|
||||
$categories = get_records_select("glossary_categories", "glossaryid IN ($glossaries)", "glossaryid,id","id,glossaryid,name concept, 1 casesensitive,$GLOSSARY_CONCEPT_IS_CATEGORY category, 1 fullmatch");
|
||||
if ( $entries and $categories ) {
|
||||
$concepts = array_merge($entries, $categories);
|
||||
@ -80,11 +80,13 @@
|
||||
$regexp = '/' . $invalidprefixs . "(" . $list_of_words_cp . ")" . "|" . "(" . $list_of_words_cp . ")". $invalidsufixs . '/is';
|
||||
preg_match_all($regexp,$text,$list_of_words);
|
||||
|
||||
foreach (array_unique($list_of_words[0]) as $key=>$value) {
|
||||
$words['<*'.$key.'*>'] = $value;
|
||||
}
|
||||
if ( $words ) {
|
||||
$text = str_replace($words,array_keys($words),$text);
|
||||
if ($list_of_words) {
|
||||
foreach (array_unique($list_of_words[0]) as $key=>$value) {
|
||||
$words['<*'.$key.'*>'] = $value;
|
||||
}
|
||||
if ( $words ) {
|
||||
$text = str_replace($words,array_keys($words),$text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,9 +110,9 @@ if ( $confirm ) {
|
||||
|
||||
delete_records("glossary_entries_categories","entryid",$e);
|
||||
|
||||
if ( $categories ) {
|
||||
if ( isset($form->categories) ) {
|
||||
$newcategory->entryid = $newentry->id;
|
||||
foreach ($categories as $category) {
|
||||
foreach ($form->categories as $category) {
|
||||
if ( $category > 0 ) {
|
||||
$newcategory->categoryid =$category;
|
||||
insert_record("glossary_entries_categories",$newcategory);
|
||||
|
@ -418,8 +418,8 @@ function glossary_search_entries($searchterms, $glossary, $includedefinition) {
|
||||
|
||||
// $totalcount = count_records_sql("SELECT COUNT(*) FROM $selectsql");
|
||||
|
||||
return get_records_sql("SELECT e.concept, e.definition, e.userid, e.timemodified, e.id, e.format
|
||||
FROM $selectsql ORDER BY e.concept ASC $limit");
|
||||
return get_records_sql("SELECT e.*
|
||||
FROM $selectsql ORDER BY e.concept ASC");
|
||||
}
|
||||
|
||||
function glossary_file_area_name($entry) {
|
||||
|
@ -8,10 +8,10 @@
|
||||
print_header();
|
||||
$entries = get_records_sql("select e.* from {$CFG->prefix}glossary_entries e, {$CFG->prefix}glossary g".
|
||||
" where e.glossaryid = g.id and".
|
||||
" (e.casesensitive = 1 and ucase(concept) = '" . strtoupper(trim($concept)). "' or".
|
||||
" (e.casesensitive != 0 and ucase(concept) = '" . strtoupper(trim($concept)). "' or".
|
||||
" e.casesensitive = 0 and concept = '$concept') and".
|
||||
" g.course = $courseid and".
|
||||
" e.usedynalink = 1 and g.usedynalink = 1");
|
||||
" e.usedynalink != 0 and g.usedynalink != 0");
|
||||
|
||||
glossary_print_dynaentry($courseid, $entries);
|
||||
|
||||
|
@ -296,8 +296,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
$dumptoscreen = 1;
|
||||
}
|
||||
$dumptoscreen = 1;
|
||||
} elseif ($l == "SPECIAL" and ord($firstletter) != ord("Ñ") and
|
||||
(ord($firstletter) < ord("A") or ord($firstletter) > ord("Z"))) {
|
||||
$dumptoscreen = 1;
|
||||
@ -328,9 +328,9 @@
|
||||
if ( $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS ) {
|
||||
echo "</center><p>";
|
||||
}
|
||||
$dumptoscreen = 1;
|
||||
}
|
||||
}
|
||||
$dumptoscreen = 1;
|
||||
|
||||
if ($glossary->displayformat == GLOSSARY_FORMAT_SIMPLE) {
|
||||
echo "\n</center></td></tr></table></center>";
|
||||
|
Loading…
x
Reference in New Issue
Block a user