mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
- Removing notices when debug is on
- Deleting entries with attachments now delete the attachments properly
This commit is contained in:
parent
54849831c2
commit
677038ee7d
@ -61,7 +61,7 @@
|
||||
}
|
||||
} else {
|
||||
if ( $entry->attachment ) {
|
||||
glossary_delete_old_attachments($entry->id);
|
||||
glossary_delete_old_attachments($entry);
|
||||
}
|
||||
delete_records("glossary_entries","id", $entry->id);
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
define("GLOSSARY_CONCEPT_IS_ENTRY", "0");
|
||||
define("GLOSSARY_CONCEPT_IS_CATEGORY", "1");
|
||||
|
||||
$textfilter_function = 'glossary_dynamic_link';
|
||||
|
||||
if (function_exists($textfilter_function)) {
|
||||
@ -12,6 +9,9 @@
|
||||
function glossary_dynamic_link($courseid, $text) {
|
||||
global $CFG;
|
||||
|
||||
$GLOSSARY_CONCEPT_IS_ENTRY = 0;
|
||||
$GLOSSARY_CONCEPT_IS_CATEGORY = 1;
|
||||
|
||||
$glossarieslist = get_records_select("glossary", "usedynalink = 1 and course = $courseid","id");
|
||||
if ( $glossarieslist ) {
|
||||
$glossaries = "";
|
||||
@ -20,8 +20,8 @@
|
||||
}
|
||||
$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");
|
||||
$categories = get_records_select("glossary_categories", "glossaryid IN ($glossaries)", "glossaryid,id","id,glossaryid,name concept, 1 casesensitive,".GLOSSARY_CONCEPT_IS_CATEGORY." category, 1 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");
|
||||
if ( $entries and $categories ) {
|
||||
$concepts = array_merge($entries, $categories);
|
||||
} elseif ( $categories ) {
|
||||
@ -118,7 +118,7 @@
|
||||
|
||||
$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 ) {
|
||||
$text = ereg_replace("$list_of_words_cp", "$href_tag_begin"."\\1"."$href_tag_end", $text);
|
||||
} else {
|
||||
@ -131,8 +131,10 @@
|
||||
if ( $excludes ) {
|
||||
$text = str_replace(array_keys($excludes),$excludes,$text);
|
||||
}
|
||||
if ( $words and $fullmatch ) {
|
||||
$text = str_replace(array_keys($words),$words,$text);
|
||||
if ( isset($words) and $fullmatch ) {
|
||||
if ($words) {
|
||||
$text = str_replace(array_keys($words),$words,$text);
|
||||
}
|
||||
}
|
||||
return stripslashes($text);
|
||||
}
|
||||
|
@ -712,104 +712,106 @@ function glossary_print_tabbed_table_end() {
|
||||
|
||||
function glossary_print_alphabet_menu($cm, $glossary, $l, $sortkey, $sortorder = "") {
|
||||
global $CFG, $THEME;
|
||||
$strselectletter = get_string("selectletter", "glossary");
|
||||
$strspecial = get_string("special", "glossary");
|
||||
$strallentries = get_string("allentries", "glossary");
|
||||
$strsort = get_string("sortchronogically", "glossary");
|
||||
$strsortbycreation = get_string("sortbycreation", "glossary");
|
||||
$strsortbylastupdate = get_string("sortbylastupdate", "glossary");
|
||||
$strselectletter = get_string("selectletter", "glossary");
|
||||
$strspecial = get_string("special", "glossary");
|
||||
$strallentries = get_string("allentries", "glossary");
|
||||
$strsort = get_string("sortchronogically", "glossary");
|
||||
$strsortbycreation = get_string("sortbycreation", "glossary");
|
||||
$strsortbylastupdate = get_string("sortbylastupdate", "glossary");
|
||||
|
||||
if ($glossary->showalphabet) {
|
||||
$output .= get_string("explainalphabet","glossary").'<br />';
|
||||
$output = "";
|
||||
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->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> | ";
|
||||
if ( $glossary->showalphabet ) {
|
||||
$alphabet = explode("|", get_string("alphabet","glossary"));
|
||||
$letters_by_line = 14;
|
||||
for ($i = 0; $i < count($alphabet); $i++) {
|
||||
if ( $l == $alphabet[$i] and $l) {
|
||||
echo "<b>$alphabet[$i]</b>";
|
||||
} else {
|
||||
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 ) {
|
||||
$alphabet = explode("|", get_string("alphabet","glossary"));
|
||||
$letters_by_line = 14;
|
||||
for ($i = 0; $i < count($alphabet); $i++) {
|
||||
if ( $l == $alphabet[$i] and $l) {
|
||||
echo "<b>$alphabet[$i]</b>";
|
||||
} else {
|
||||
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->showall ) {
|
||||
if ( $l == "ALL" ) {
|
||||
echo "<b>$strallentries</b>";
|
||||
} else {
|
||||
$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 = "";
|
||||
|
||||
if ( $glossary->showall ) {
|
||||
if ( $l == "ALL" ) {
|
||||
echo "<b>$strallentries</b>";
|
||||
} else {
|
||||
$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 = "";
|
||||
$uneworder = "";
|
||||
$ubtag = "";
|
||||
$uendbtag = "";
|
||||
|
||||
$uicon = "";
|
||||
$uneworder = "";
|
||||
$ubtag = "";
|
||||
$uendbtag = "";
|
||||
|
||||
if ( $sortkey == "CREATION" ) {
|
||||
$cicon = $icon;
|
||||
$cneworder = $neworder;
|
||||
$cordertitle = $ordertitle;
|
||||
$uordertitle = get_string("ascending","glossary");
|
||||
$cbtag = "<b>";
|
||||
$cendbtag = "</b>";
|
||||
} elseif ($sortkey == "UPDATE") {
|
||||
$uicon = $icon;
|
||||
$uneworder = $neworder;
|
||||
$cordertitle = get_string("ascending","glossary");
|
||||
$uordertitle = $ordertitle;
|
||||
$ubtag = "<b>";
|
||||
$uendbtag = "</b>";
|
||||
} else {
|
||||
$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>";
|
||||
if ( $sortkey == "CREATION" ) {
|
||||
$cicon = $icon;
|
||||
$cneworder = $neworder;
|
||||
$cordertitle = $ordertitle;
|
||||
$uordertitle = get_string("ascending","glossary");
|
||||
$cbtag = "<b>";
|
||||
$cendbtag = "</b>";
|
||||
} elseif ($sortkey == "UPDATE") {
|
||||
$uicon = $icon;
|
||||
$uneworder = $neworder;
|
||||
$cordertitle = get_string("ascending","glossary");
|
||||
$uordertitle = $ordertitle;
|
||||
$ubtag = "<b>";
|
||||
$uendbtag = "</b>";
|
||||
} else {
|
||||
$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) {
|
||||
global $CFG, $THEME;
|
||||
echo "<table border=0 width=100%>";
|
||||
|
Loading…
x
Reference in New Issue
Block a user