- 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,8 +131,10 @@
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 ) {
$text = str_replace(array_keys($words),$words,$text); if ($words) {
$text = str_replace(array_keys($words),$words,$text);
}
} }
return stripslashes($text); return stripslashes($text);
} }

View file

@ -712,104 +712,106 @@ function glossary_print_tabbed_table_end() {
function glossary_print_alphabet_menu($cm, $glossary, $l, $sortkey, $sortorder = "") { function glossary_print_alphabet_menu($cm, $glossary, $l, $sortkey, $sortorder = "") {
global $CFG, $THEME; global $CFG, $THEME;
$strselectletter = get_string("selectletter", "glossary"); $strselectletter = get_string("selectletter", "glossary");
$strspecial = get_string("special", "glossary"); $strspecial = get_string("special", "glossary");
$strallentries = get_string("allentries", "glossary"); $strallentries = get_string("allentries", "glossary");
$strsort = get_string("sortchronogically", "glossary"); $strsort = get_string("sortchronogically", "glossary");
$strsortbycreation = get_string("sortbycreation", "glossary"); $strsortbycreation = get_string("sortbycreation", "glossary");
$strsortbylastupdate = get_string("sortbylastupdate", "glossary"); $strsortbylastupdate = get_string("sortbylastupdate", "glossary");
if ($glossary->showalphabet) { $output = "";
$output .= get_string("explainalphabet","glossary").'<br />'; if ($glossary->showalphabet) {
$output .= get_string("explainalphabet","glossary").'<br />';
}
echo "<center>$output<p>";
if ( $glossary->showspecial ) {
if ( $l == "SPECIAL" ) {
echo "<b>$strspecial</b> | ";
} else {
$strexplainspecial = strip_tags(get_string("explainspecial","glossary"));
echo "<a title=\"$strexplainspecial\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=SPECIAL\">$strspecial</a> | ";
}
} }
echo "<center>$output<p>"; if ( $glossary->showalphabet ) {
$alphabet = explode("|", get_string("alphabet","glossary"));
if ( $glossary->showspecial ) { $letters_by_line = 14;
if ( $l == "SPECIAL" ) { for ($i = 0; $i < count($alphabet); $i++) {
echo "<b>$strspecial</b> | "; if ( $l == $alphabet[$i] and $l) {
} else { echo "<b>$alphabet[$i]</b>";
$strexplainspecial = strip_tags(get_string("explainspecial","glossary")); } else {
echo "<a title=\"$strexplainspecial\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=SPECIAL\">$strspecial</a> | "; echo "<a href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=$alphabet[$i]\">$alphabet[$i]</a>";
}
if ((int) ($i % $letters_by_line) != 0 or $i == 0) {
echo " | ";
} else {
echo "<br>";
}
} }
} }
if ( $glossary->showalphabet ) { if ( $glossary->showall ) {
$alphabet = explode("|", get_string("alphabet","glossary")); if ( $l == "ALL" ) {
$letters_by_line = 14; echo "<b>$strallentries</b>";
for ($i = 0; $i < count($alphabet); $i++) { } else {
if ( $l == $alphabet[$i] and $l) { $strexplainall = strip_tags(get_string("explainall","glossary"));
echo "<b>$alphabet[$i]</b>"; echo "<a title=\"$strexplainall\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=ALL\">$strallentries</a>";
} else { }
echo "<a href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=$alphabet[$i]\">$alphabet[$i]</a>"; }
} $neworder = "";
if ((int) ($i % $letters_by_line) != 0 or $i == 0) { if ( $sortorder ) {
echo " | "; if ( $sortorder == "asc" ) {
} else { $neworder = "&sortorder=desc";
echo "<br>"; $ordertitle = get_string("descending","glossary");
} } else {
} $neworder = "&sortorder=asc";
} $ordertitle = get_string("ascending","glossary");
}
$icon = " <img src=\"$sortorder.gif\" border=0 width=16 height=16>";
} else {
if ( $sortkey != "CREATION" and $sortkey != "UPDATE" ) {
$icon = "";
$ordertitle = get_string("ascending","glossary");
} else {
$ordertitle = get_string("descending","glossary");
$neworder = "&sortorder=desc";
$icon = " <img src=\"asc.gif\" border=0 width=16 height=16>";
}
}
$cicon = "";
$cneworder = "";
$cbtag = "";
$cendbtag = "";
if ( $glossary->showall ) { $uicon = "";
if ( $l == "ALL" ) { $uneworder = "";
echo "<b>$strallentries</b>"; $ubtag = "";
} else { $uendbtag = "";
$strexplainall = strip_tags(get_string("explainall","glossary"));
echo "<a title=\"$strexplainall\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=ALL\">$strallentries</a>";
}
}
$neworder = "";
if ( $sortorder ) {
if ( $sortorder == "asc" ) {
$neworder = "&sortorder=desc";
$ordertitle = get_string("descending","glossary");
} else {
$neworder = "&sortorder=asc";
$ordertitle = get_string("ascending","glossary");
}
$icon = " <img src=\"$sortorder.gif\" border=0 width=16 height=16>";
} else {
if ( $sortkey != "CREATION" and $sortkey != "UPDATE" ) {
$icon = "";
$ordertitle = get_string("ascending","glossary");
} else {
$ordertitle = get_string("descending","glossary");
$neworder = "&sortorder=desc";
$icon = " <img src=\"asc.gif\" border=0 width=16 height=16>";
}
}
$cicon = "";
$cneworder = "";
$cbtag = "";
$cendbtag = "";
$uicon = ""; if ( $sortkey == "CREATION" ) {
$uneworder = ""; $cicon = $icon;
$ubtag = ""; $cneworder = $neworder;
$uendbtag = ""; $cordertitle = $ordertitle;
$uordertitle = get_string("ascending","glossary");
if ( $sortkey == "CREATION" ) { $cbtag = "<b>";
$cicon = $icon; $cendbtag = "</b>";
$cneworder = $neworder; } elseif ($sortkey == "UPDATE") {
$cordertitle = $ordertitle; $uicon = $icon;
$uordertitle = get_string("ascending","glossary"); $uneworder = $neworder;
$cbtag = "<b>"; $cordertitle = get_string("ascending","glossary");
$cendbtag = "</b>"; $uordertitle = $ordertitle;
} elseif ($sortkey == "UPDATE") { $ubtag = "<b>";
$uicon = $icon; $uendbtag = "</b>";
$uneworder = $neworder; } else {
$cordertitle = get_string("ascending","glossary"); $cordertitle = get_string("ascending","glossary");
$uordertitle = $ordertitle; $uordertitle = get_string("ascending","glossary");
$ubtag = "<b>"; }
$uendbtag = "</b>"; 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 | ".
} else { "$cbtag<a title=\"$strsortbycreation $cordertitle\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&sortkey=CREATION$cneworder\">$strsortbycreation$cicon</a>$cendbtag</p>";
$cordertitle = get_string("ascending","glossary");
$uordertitle = get_string("ascending","glossary");
}
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>";
} }
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%>";