]> git.mjollnir.org Git - moodle.git/commitdiff
- Removing notices when debug is on
authorwillcast <willcast>
Mon, 20 Oct 2003 16:42:49 +0000 (16:42 +0000)
committerwillcast <willcast>
Mon, 20 Oct 2003 16:42:49 +0000 (16:42 +0000)
- Deleting entries with attachments now delete the attachments properly

mod/glossary/deleteentry.php
mod/glossary/dynalink.php
mod/glossary/lib.php

index 3a59a765b70e0ecc13197f2a40ee5d13645077ed..5d01b6a8f17cc4ca5e3a18c3a83410505129a3c9 100644 (file)
@@ -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);                           
                     }
index 3b39bf3aaff8ca7678c6f56bc1a7849f40949ff0..2c1c27d1cfc3da9d6924b85353ca7d6d0b20bf61 100644 (file)
@@ -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 ) {
 
         $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 {
         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);
     }
index 07d3fa3afb04f08546ecc799b7c7c95eddf56a82..eac6a65870c25f45001318a3cf4af71cea238844 100644 (file)
@@ -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");
-
-     if ($glossary->showalphabet) {
-         $output .= get_string("explainalphabet","glossary").'<br />';
+    $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");
+
+    $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->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>";
+
+     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>";
+              }
           }
-      }
-      $cicon = "";
-      $cneworder = "";
-      $cbtag = "";
-      $cendbtag = "";
-
-      $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 ( $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 = "";
+
+     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%>";