- Removing notices when debug is on

- Deleting entries with attachments now delete the attachments properly
This commit is contained in:
willcast 2003-10-20 16:42:49 +00:00
parent 54849831c2
commit 677038ee7d
3 changed files with 103 additions and 99 deletions

View file

@ -61,7 +61,7 @@
} }
} else { } else {
if ( $entry->attachment ) { if ( $entry->attachment ) {
glossary_delete_old_attachments($entry->id); glossary_delete_old_attachments($entry);
} }
delete_records("glossary_entries","id", $entry->id); delete_records("glossary_entries","id", $entry->id);
} }

View file

@ -1,8 +1,5 @@
<?PHP // $Id$ <?PHP // $Id$
define("GLOSSARY_CONCEPT_IS_ENTRY", "0");
define("GLOSSARY_CONCEPT_IS_CATEGORY", "1");
$textfilter_function = 'glossary_dynamic_link'; $textfilter_function = 'glossary_dynamic_link';
if (function_exists($textfilter_function)) { if (function_exists($textfilter_function)) {
@ -12,6 +9,9 @@
function glossary_dynamic_link($courseid, $text) { function glossary_dynamic_link($courseid, $text) {
global $CFG; global $CFG;
$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 = 1 and course = $courseid","id");
if ( $glossarieslist ) { if ( $glossarieslist ) {
$glossaries = ""; $glossaries = "";
@ -20,8 +20,8 @@
} }
$glossaries=substr($glossaries,0,-1); $glossaries=substr($glossaries,0,-1);
$entries = get_records_select("glossary_entries", "glossaryid IN ($glossaries) AND usedynalink = 1","glossaryid","id,glossaryid,concept,casesensitive,".GLOSSARY_CONCEPT_IS_ENTRY." category,fullmatch"); $entries = get_records_select("glossary_entries", "glossaryid IN ($glossaries) AND usedynalink = 1","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"); $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 ) { if ( $entries and $categories ) {
$concepts = array_merge($entries, $categories); $concepts = array_merge($entries, $categories);
} elseif ( $categories ) { } elseif ( $categories ) {
@ -118,7 +118,7 @@
$text = str_replace($final,array_keys($final),$text); $text = str_replace($final,array_keys($final),$text);
$list_of_words_cp = "(".$list_of_words_cp."$nocharsend)"; $list_of_words_cp = "(".$list_of_words_cp.")";
if ( $casesensitive ) { if ( $casesensitive ) {
$text = ereg_replace("$list_of_words_cp", "$href_tag_begin"."\\1"."$href_tag_end", $text); $text = ereg_replace("$list_of_words_cp", "$href_tag_begin"."\\1"."$href_tag_end", $text);
} else { } else {
@ -131,9 +131,11 @@
if ( $excludes ) { if ( $excludes ) {
$text = str_replace(array_keys($excludes),$excludes,$text); $text = str_replace(array_keys($excludes),$excludes,$text);
} }
if ( $words and $fullmatch ) { if ( isset($words) and $fullmatch ) {
if ($words) {
$text = str_replace(array_keys($words),$words,$text); $text = str_replace(array_keys($words),$words,$text);
} }
}
return stripslashes($text); return stripslashes($text);
} }

View file

@ -719,6 +719,7 @@ global $CFG, $THEME;
$strsortbycreation = get_string("sortbycreation", "glossary"); $strsortbycreation = get_string("sortbycreation", "glossary");
$strsortbylastupdate = get_string("sortbylastupdate", "glossary"); $strsortbylastupdate = get_string("sortbylastupdate", "glossary");
$output = "";
if ($glossary->showalphabet) { if ($glossary->showalphabet) {
$output .= get_string("explainalphabet","glossary").'<br />'; $output .= get_string("explainalphabet","glossary").'<br />';
} }
@ -810,6 +811,7 @@ global $CFG, $THEME;
echo "<br>$strsort: $ubtag<a title=\"$strsortbylastupdate $uordertitle\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&sortkey=UPDATE$uneworder\">$strsortbylastupdate$uicon</a>$uendbtag | ". echo "<br>$strsort: $ubtag<a title=\"$strsortbylastupdate $uordertitle\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&sortkey=UPDATE$uneworder\">$strsortbylastupdate$uicon</a>$uendbtag | ".
"$cbtag<a title=\"$strsortbycreation $cordertitle\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&sortkey=CREATION$cneworder\">$strsortbycreation$cicon</a>$cendbtag</p>"; "$cbtag<a title=\"$strsortbycreation $cordertitle\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&sortkey=CREATION$cneworder\">$strsortbycreation$cicon</a>$cendbtag</p>";
} }
function glossary_print_categories_menu($course, $cm, $glossary, $cat, $category) { function glossary_print_categories_menu($course, $cm, $glossary, $cat, $category) {
global $CFG, $THEME; global $CFG, $THEME;
echo "<table border=0 width=100%>"; echo "<table border=0 width=100%>";