]> git.mjollnir.org Git - moodle.git/commitdiff
- Added a new frame: Browse by date.
authorwillcast <willcast>
Wed, 22 Oct 2003 04:15:08 +0000 (04:15 +0000)
committerwillcast <willcast>
Wed, 22 Oct 2003 04:15:08 +0000 (04:15 +0000)
- Removing unnecesary double quotes (not all of them yet)

lang/en/glossary.php
mod/glossary/approve.php
mod/glossary/dynalink.php
mod/glossary/edit.php
mod/glossary/editcategories.html
mod/glossary/editcategories.php
mod/glossary/lib.php
mod/glossary/view.php

index 770cb11a116c60b05e38af2f6654b85efa9cfb65..287ac2760886763c04196f2f01bfda594a92ee80 100644 (file)
@@ -27,6 +27,7 @@ $string['comments'] = "Comments";
 $string['commentson'] = "Comments on";
 $string['concept'] = "Concept";
 $string['concepts'] = "Concepts";
+$string['dateview'] = "Browse by date";
 $string['deletingcomment'] = "Deleting comment";
 $string['defaultapproval'] = "Default approval status";
 $string['definition'] = "Definition";
@@ -45,10 +46,10 @@ $string['editcategories'] = "Edit categories";
 $string['editentry'] = "Edit entry";
 $string['editingcomment'] = "Editing comment";
 $string['entries'] = "Entries";
-$string['entriesawaitingapproval'] = "All these entries are waiting for approval.";
 $string['entrieswithoutcategory'] = "Entries without category";
 $string['entry'] = "Entry";
 $string['entryalreadyexist'] = "Entry already exists";
+$string['entryapproved'] = "This entry has been approved";
 $string['entrydeleted'] = "Entry deleted";
 $string['entryishidden'] = "(this entry is currently hidden)";
 $string['entryusedynalink'] = "This entry should be<br>automatically linked";
index d65c9e31e793c9c8a018366f0748bbe2fa4145b8..5254bb70f2189b603d04bdeca37b6f0a15994eeb 100644 (file)
@@ -33,6 +33,6 @@
     } else {
         add_to_log($course->id, "glossary", "approve entry", "showentry.php?id=$cm->id&eid=$eid", "$eid");
     }
-    redirect("view.php?id=$cm->id&tab=$tab");
+    redirect("view.php?id=$cm->id&tab=$tab&l=ALL",get_string("entryapproved","glossary"),1);
     die;
 ?>
\ No newline at end of file
index 4cba38670619a2a08e9b2fb4867c9afb4add7e14..21504fbc2b2122e72b1c742173cf25be64bac8ea 100644 (file)
@@ -38,7 +38,7 @@
             $categories  = get_records_select("glossary_categories", "glossaryid IN ($glossaries)", "$cbylenght glossaryid,id","id,glossaryid,name concept, 1 casesensitive,$GLOSSARY_CONCEPT_IS_CATEGORY category, 1 fullmatch");
             if ( $entries and $categories ) {
                 $concepts = array_merge($entries, $categories);
-                usort($concepts,glossary_sort_entries_by_lenght);
+                usort($concepts,'glossary_sort_entries_by_lenght');
             } elseif ( $categories ) {
                 $concepts = $categories;
             } elseif ( $entries ) {
@@ -61,7 +61,7 @@
                         }
                         $cm = get_coursemodule_from_instance("glossary", $glossary->id, $courseid);                                            
                         $title = strip_tags("$glossary->name: " . get_string("category","glossary"). " $category->name");
-                        $href_tag_begin = "<a class=\"autolink\" title=\"$title\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&currentview=categories&cat=$concept->id\">";
+                        $href_tag_begin = "<a class=\"autolink\" title=\"$title\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&tab=1&cat=$concept->id\">";
                     } else {
                         $title = strip_tags("$glossary->name: $concept->concept");
                         $href_tag_begin = "<a target=\"entry\" class=\"autolink\" title=\"$title\" href=\"$CFG->wwwroot/mod/glossary/showentry.php?courseid=$courseid&concept=$concept->concept\" ".
     
     function glossary_sort_entries_by_lenght ( $entry0, $entry1 ) {
         if ( strlen(trim($entry0->concept)) < strlen(trim($entry1->concept)) ) {
-            return -1;
-        } elseif ( strlen(trim($entry0->concept)) > strlen(trim($entry1->concept)) ) {
             return 1;
+        } elseif ( strlen(trim($entry0->concept)) > strlen(trim($entry1->concept)) ) {
+            return -1;
         } else {
             return 0;
         }
index 84152873239c819104fca5e8be8243bdee2030ef..76c8fcb8b3ac8e6a4af144f2495b7356a9ebf649 100644 (file)
@@ -53,7 +53,7 @@ if ( $confirm ) {
             if ($dupentries = get_records("glossary_entries","UCASE(concept)", strtoupper($newentry->concept))) {
                 foreach ($dupentries as $curentry) {
                     if ( $glossary->id == $curentry->glossaryid ) {
-                       if ( $curentry->id != $entry ) {
+                       if ( $curentry->id != $e ) {
                           $permissiongranted = 0;
                            break;
                        }
index 278776cfd3257fc63be0150aa5c3cb23e2299808..d5943d24afee4cb1f5d8e0173a8536e8a35a3b1d 100644 (file)
@@ -1,10 +1,9 @@
 <?PHP
        global $CFG, $THEME;
-       require_once("../../config.php");
-
+    require_once("../../config.php");
 ?>
 
-<FORM name="form" method="post" <?=$onsubmit ?> action="editcategories.php">
+<FORM name="form" method="post" action="editcategories.php">
 <table  class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
 <tr valign=top>
     <td align=right><p><b><?php echo get_string("name") ?>:</b></p></td>
index 47714b799a858f9f3abe8cbd3d6eaef3d28fa975..1c50206d983f8e7b8c8e6ae4e55b5d52a8834acf 100644 (file)
 
 <p align="center"><?php p(get_string("edit")) ?> <?php p(get_string("categories","glossary")) ?><font size="3">
 
-<FORM name="theform" method="post" <?=$onsubmit ?> action="editcategories.php">
+<FORM name="theform" method="post" action="editcategories.php">
 <table width="40%" class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
         <tr>
           <td width="90%" align="center"><b>
index 91dd3a53e075bc6b06169b9e8c1bb2733ca2b323..76fb8c2f05c429f69b8fdd717f4eb7755b5b962c 100644 (file)
@@ -10,7 +10,8 @@ define("GLOSSARY_SHOW_NOT_CATEGORISED", -1);
 
 define("GLOSSARY_STANDARD_VIEW", 0);
 define("GLOSSARY_CATEGORY_VIEW", 1);
-define("GLOSSARY_APPROVAL_VIEW", 2);
+define("GLOSSARY_DATE_VIEW", 2);
+define("GLOSSARY_APPROVAL_VIEW", 3);
 
 define("GLOSSARY_FORMAT_SIMPLE", 0);
 define("GLOSSARY_FORMAT_CONTINUOUS", 1);
@@ -216,7 +217,7 @@ global $CFG;
 function glossary_print_entry($course, $cm, $glossary, $entry, $tab="",$cat="") {
     global $THEME, $USER, $CFG;
 
-    if ($entry->approved or $USER->id == $entry->userid or $tab == GLOSSARY_APPROVAL_VIEW) {
+    if ($entry->approved or ($USER->id == $entry->userid and !isteacher($course->id)) or $tab == GLOSSARY_APPROVAL_VIEW) {
         $permissiongranted = 0;
         $formatfile = "$CFG->dirroot/mod/glossary/formats/$glossary->displayformat.php";
         $functionname = "glossary_print_entry_by_format";
@@ -313,7 +314,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab="",$cat
         echo "</a>";
     }
     echo "</font>";
-    if ( $glossary->allowcomments ) {
+    if ( $glossary->allowcomments and !isguest()) {
         echo " <a href=\"comment.php?id=$cm->id&eid=$entry->id\"><img  alt=\"" . get_string("addcomment","glossary") . "\" src=\"comment.gif\" height=16 width=16 border=0></a> ";
     }
 
@@ -382,9 +383,6 @@ function glossary_search_entries($searchterms, $glossary, $includedefinition) {
 
 
     foreach ($searchterms as $searchterm) {
-/*        if (strlen($searchterm) < 2) {
-            continue;
-        }*/
         if ($conceptsearch) {
             $conceptsearch.= " OR ";
         }
@@ -416,8 +414,6 @@ function glossary_search_entries($searchterms, $glossary, $includedefinition) {
                AND (e.glossaryid = g.id or e.sourceglossaryid = g.id) $onlyvisible
                AND g.id = $glossary->id AND e.approved != 0";
 
-//    $totalcount = count_records_sql("SELECT COUNT(*) FROM $selectsql");
-
     return get_records_sql("SELECT e.* 
                             FROM $selectsql ORDER BY e.concept ASC");
 }
@@ -749,11 +745,8 @@ function glossary_print_tabbed_table_end() {
 }
 
 function glossary_print_approval_menu($cm, $glossary, $l, $sortkey, $sortorder = "",$tab=GLOSSARY_STANDARD_VIEW) {
-    $entriesawaiting     = get_string("entriesawaitingapproval", "glossary");
-    echo "<center>$entriesawaiting<p>";
-
     if ($glossary->showalphabet and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS) {
-        echo '<center>' . get_string("explainalphabet","glossary") . '<br /><p>';
+        echo '<center>' . get_string("explainalphabet","glossary") . '<p>';
     }
     glossary_print_special_links($cm, $glossary,$l, $tab);
 
@@ -765,39 +758,42 @@ function glossary_print_approval_menu($cm, $glossary, $l, $sortkey, $sortorder =
 }
 
 function glossary_print_alphabet_menu($cm, $glossary, $l, $sortkey, $sortorder = "", $tab=GLOSSARY_STANDARD_VIEW) {
-    if ($glossary->showalphabet and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS) {
-        echo '<center>' . get_string("explainalphabet","glossary") . '<br /><p>';
-    }
-    glossary_print_special_links($cm, $glossary,$l, $tab);
+    if ( $tab != GLOSSARY_DATE_VIEW ) {
+        if ($glossary->showalphabet and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS) {
+            echo '<center>' . get_string("explainalphabet","glossary") . '<p>';
+        }
 
-    glossary_print_alphabet_links($cm, $glossary,$l, $tab);
+        glossary_print_special_links($cm, $glossary,$l, $tab);
 
-    glossary_print_all_links($cm, $glossary,$l, $tab);
-        
-    glossary_print_sorting_links($cm, $sortkey,$sortorder, $tab);
+        glossary_print_alphabet_links($cm, $glossary,$l, $tab);
+
+        glossary_print_all_links($cm, $glossary,$l, $tab);
+    } else {
+        glossary_print_sorting_links($cm, $sortkey,$sortorder, $tab);
+    }
 }
 
 function glossary_print_categories_menu($course, $cm, $glossary, $cat, $category) {
 global $CFG, $THEME;
-     echo "<table border=0 width=100%>";
-     echo "<tr>";
+     echo '<table border=0 width=100%>';
+     echo '<tr>';
 
-     echo "<td align=center width=20%>";
+     echo '<td align=center width=20%>';
      if ( isteacher($course->id) ) {
              $options['id'] = $cm->id;
              $options['cat'] = $cat;
              echo print_single_button("editcategories.php", $options, get_string("editcategories","glossary"), "get");
      }
-     echo "</td>";
+     echo '</td>';
 
-     echo "<td align=center width=60%>";
-     echo "<b>";
+     echo '<td align=center width=60%>';
+     echo '<b>';
 
      $menu[GLOSSARY_SHOW_ALL_CATEGORIES] = get_string("allcategories","glossary");
      $menu[GLOSSARY_SHOW_NOT_CATEGORISED] = get_string("notcategorised","glossary");
 
      $categories = get_records("glossary_categories", "glossaryid", $glossary->id, "name ASC");
-     $selected = "";
+     $selected = '';
      if ( $categories ) {
           foreach ($categories as $currentcategory) {
                  $url = $currentcategory->id;
@@ -828,24 +824,23 @@ global $CFG, $THEME;
 
         }
      }
-     echo "</b></td>";
-     echo "<td align=center width=20%>";
+     echo '</b></td>';
+     echo '<td align=center width=20%>';
 
      echo popup_form("$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&tab=" . GLOSSARY_CATEGORY_VIEW . "&cat=", $menu, "catmenu", $selected, "",
                       "", "", false);
 
-     echo "</td>";
-     echo "</tr>";
+     echo '</td>';
+     echo '</tr>';
 
-     echo "<tr><td colspan=3><hr></td></tr>";
-     echo "</table>";
+     echo '</table>';
 }
 
 function glossary_print_all_links($cm, $glossary, $l, $tab) {
 global $CFG;  
      if ( $glossary->showall and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS) {
          $strallentries       = get_string("allentries", "glossary");
-         if ( $l == "ALL" ) {
+         if ( $l == 'ALL' ) {
               echo "<b>$strallentries</b>";
          } else {
               $strexplainall = strip_tags(get_string("explainall","glossary"));
@@ -858,7 +853,7 @@ function glossary_print_special_links($cm, $glossary, $l, $tab) {
 global $CFG;
      if ( $glossary->showspecial and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS ) {
          $strspecial          = get_string("special", "glossary");
-         if ( $l == "SPECIAL" ) {
+         if ( $l == 'SPECIAL' ) {
               echo "<b>$strspecial</b> | ";
          } else {
               $strexplainspecial = strip_tags(get_string("explainspecial","glossary"));
@@ -879,9 +874,9 @@ global $CFG;
                    echo "<a href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=$alphabet[$i]&tab=$tab\">$alphabet[$i]</a>";
               }
               if ((int) ($i % $letters_by_line) != 0 or $i == 0) {
-                   echo " | ";
+                   echo ' | ';
               } else {
-                   echo "<br>";
+                   echo '<br>';
               }
           }
      }
@@ -893,50 +888,50 @@ global $CFG;
     $strsortbycreation   = get_string("sortbycreation", "glossary");
     $strsortbylastupdate = get_string("sortbylastupdate", "glossary");
 
-     $neworder = "";
+     $neworder = '';
      if ( $sortorder ) {
-         if ( $sortorder == "asc" ) {
-             $neworder = "&sortorder=desc";
+         if ( $sortorder == 'asc' ) {
+             $neworder = '&sortorder=desc';
              $ordertitle = get_string("descending","glossary");
          } else {
-             $neworder = "&sortorder=asc";
+             $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" ) {
+         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>";
+             $neworder = '&sortorder=desc';
+             $icon = ' <img src="asc.gif" border=0 width=16 height=16>';
          }
      }
-     $cicon = "";
-     $cneworder = "";
-     $cbtag = "";
-     $cendbtag = "";
+     $cicon = '';
+     $cneworder = '';
+     $cbtag = '';
+     $cendbtag = '';
 
-     $uicon = "";
-     $uneworder = "";
-     $ubtag = "";
-     $uendbtag = "";
+     $uicon = '';
+     $uneworder = '';
+     $ubtag = '';
+     $uendbtag = '';
 
-     if ( $sortkey == "CREATION" ) {
+     if ( $sortkey == 'CREATION' ) {
          $cicon = $icon;
          $cneworder = $neworder;
          $cordertitle = $ordertitle;
          $uordertitle = get_string("ascending","glossary");
-         $cbtag = "<b>";
-         $cendbtag = "</b>";
-     } elseif ($sortkey == "UPDATE") {
+         $cbtag = '<b>';
+         $cendbtag = '</b>';
+     } elseif ($sortkey == 'UPDATE') {
          $uicon = $icon;
          $uneworder = $neworder;
          $cordertitle = get_string("ascending","glossary");
          $uordertitle = $ordertitle;
-         $ubtag = "<b>";
-         $uendbtag = "</b>";
+         $ubtag = '<b>';
+         $uendbtag = '</b>';
      } else {
          $cordertitle = get_string("ascending","glossary");
          $uordertitle = get_string("ascending","glossary");
@@ -976,25 +971,25 @@ function glossary_print_comment($course, $cm, $glossary, $entry, $comment) {
     echo "<br><FONT SIZE=2>$strby $user->firstname $user->lastname</font>";
     echo "<br><FONT SIZE=1>(".get_string("lastedited").": ".userdate($comment->timemodified).")</FONT></small><br>";
     echo "</TD>";
-       
+
     echo "<TD NOWRAP valign=top WIDTH=75% BGCOLOR=\"$THEME->cellcontent\">";
     if ($comment) {
-           echo format_text($comment->comment, $comment->format);
+        echo format_text($comment->comment, $comment->format);
     } else {
-         echo "<center>";
+      echo "<center>";
         print_string("nocomment", "glossary");
-         echo "</center>";
+      echo "</center>";
     }
 
     echo "<p align=right>";
-       if ( (time() - $comment->timemodified <  $CFG->maxeditingtime and $USER->id == $comment->userid)  or isteacher($course->id) ) {
+    if ( (time() - $comment->timemodified <  $CFG->maxeditingtime and $USER->id == $comment->userid)  or isteacher($course->id) ) {
         echo "<a href=\"comment.php?id=$cm->id&eid=$entry->id&cid=$comment->id&action=edit\"><img  alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a> ";
-       }
-       if ( $USER->id == $comment->userid or isteacher($course->id) ) {
+    }
+    if ( $USER->id == $comment->userid or isteacher($course->id) ) {
         echo "<a href=\"comment.php?id=$cm->id&eid=$entry->id&cid=$comment->id&action=delete\"><img  alt=\"" . get_string("delete") . "\" src=\"../../pix/t/delete.gif\" height=11 width=11 border=0></a>";
-       }
+    }
     echo "</td>";
-       
+    
     echo "</tr></TABLE>\n";
 
     echo "</td></tr></table>";
index f5b2786b2473aafe01f06cd895f8a907cd2641eb..ac4ac238ae0c2025c33b0b92d0c1441194e8f2d5 100644 (file)
     } 
     
     require_login($course->id);
-    
     if (!$cm->visible and !isteacher($course->id)) {
         notice(get_string("activityiscurrentlyhidden"));
     } 
+    add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id&tab=$tab", "$glossary->id");
     
-    add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id");
-    
+
 /// checking for valid values for sortorder and sortkey
     if ( $sortorder = strtolower($sortorder) ) {
-        if ($sortorder != "asc" and $sortorder != "desc") {
-            $sortorder = "";
+        if ($sortorder != 'asc' and $sortorder != 'desc') {
+            $sortorder = '';
         } else {
-            $l = "";
-            $search ="";
+            $l = '';
+            $search = '';
         }
     }
     if ( $sortkey = strtoupper($sortkey) ) {
-        if ($sortkey != "CREATION" and $sortkey != "UPDATE") {
-            $sortkey = "";
+        if ($sortkey != 'CREATION' and $sortkey != 'UPDATE') {
+            $sortkey = '';
         }
     }
 
     if ( $sortkey or $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS) {
         if ( !$sortkey and $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS) {
-            $sortkey = "CREATION";
-            $sortorder = "asc";
+            $sortkey = 'CREATION';
+            $sortorder = 'asc';
         } 
         if ( !$sortorder ) {
-            $sortorder = "asc";
-        }
-        if ($sortkey == "CREATION") {
-            $orderby = "timecreated $sortorder";
-        } else {
-            $orderby = "timemodified $sortorder";
+            $sortorder = 'asc';
         }
     } else {
-        $orderby = "concept ASC";
+        $orderby = 'concept ASC';
     }
 
 // creating matrix of words to search if apply
     $search = trim(strip_tags($search));
     if ($search and !$eid) {
-        $l = "";
-        $searchterms = explode(" ", $search); // Search for words independently
+        $l = '';
+        $searchterms = explode(' ', $search); // Search for words independently
         foreach ($searchterms as $key => $searchterm) {
             if (strlen($searchterm) < 2) {
                 unset($searchterms[$key]);
             } 
         } 
-        $search = trim(implode(" ", $searchterms));
+        $search = trim(implode(' ', $searchterms));
         $tab = GLOSSARY_STANDARD_VIEW;
     } elseif ($eid) {
-        $search = "";
+        $search = '';
     } 
 
-    $alphabet = explode("|", get_string("alphabet","glossary"));
-    if ($l == "" and $search == "" and $sortkey == "" and !$eid) {
+    $alphabet = explode('|', get_string("alphabet","glossary"));
+    if ($l == '' and $search == '' and $sortkey == '' and !$eid) {
         // if the user is just entering the glossary...
-        $l = $alphabet[0];
+        if ($tab != GLOSSARY_APPROVAL_VIEW) {
+            $l = $alphabet[0];
+        } else {
+            $l = 'ALL';
+        }
     } elseif ($eid) {
-        $l = "";
+        $l = '';
     } 
     
-    $category = "";
+    $category = '';
     if ($tab == GLOSSARY_CATEGORY_VIEW) {
-        $l = "";
+        $l = '';
         if ($cat > 0) {
             $category = get_record("glossary_categories", "id", $cat);
             if (!$category) {
-                $cat = "";
+                $cat = '';
             } 
         } 
     } 
 /// Info box
 
     if ( $glossary->intro ) {
-        print_simple_box_start("center","70%");
+        print_simple_box_start('center','70%');
         echo '<p align="center">';
         echo $glossary->intro;
         echo '</p>';
             $options = array ("id" => "$cm->id");
             echo '<center><p>';
             print_single_button("edit.php", $options, $straddentry);
-            echo '</p></center><p>';
+            echo '</p></center>';
         }
     } 
-    
+    echo '<p>';
 
 /// Search box
 
 
 
 /// Tabbed browsing sections
-    
+    echo '<p align="center">';
     $glossary_tCFG->TabTableBGColor = $THEME->cellheading;
     $glossary_tCFG->ActiveTabColor = $THEME->cellheading;
     $glossary_tCFG->InactiveTabColor = $THEME->cellcontent2;
     $glossary_tCFG->InactiveFontColor= $THEME->hidden;
-       
     $glossary_tCFG->TabTableWidth = "70%";
-    $glossary_tCFG->TabsPerRow = 5;
+    $glossary_tCFG->TabsPerRow = 4;
     $glossary_tCFG->TabSeparation = 4;
 
-    echo '<p align="center">';
-    $data[0]->link = "view.php?id=$id";
-    $data[0]->caption = get_string("standardview", "glossary");
+    $data[GLOSSARY_STANDARD_VIEW]->link = "view.php?id=$id";
+    $data[GLOSSARY_STANDARD_VIEW]->caption = get_string("standardview", "glossary");
     
-    $data[1]->link = "view.php?id=$id&tab=".GLOSSARY_CATEGORY_VIEW;
-    $data[1]->caption = get_string("categoryview", "glossary");
+    $data[GLOSSARY_CATEGORY_VIEW]->link = "view.php?id=$id&tab=".GLOSSARY_CATEGORY_VIEW;
+    $data[GLOSSARY_CATEGORY_VIEW]->caption = get_string("categoryview", "glossary");
     
+    $data[GLOSSARY_DATE_VIEW]->link = "view.php?id=$id&tab=".GLOSSARY_DATE_VIEW;
+    $data[GLOSSARY_DATE_VIEW]->caption = get_string("dateview", "glossary");
+
     if (isteacher($course->id)) {
-        $data[2]->link = "view.php?id=$id&tab=".GLOSSARY_APPROVAL_VIEW;
-        $data[2]->caption = get_string("waitingapproval", "glossary");
-    }
+        $data[GLOSSARY_APPROVAL_VIEW]->caption = get_string("waitingapproval", "glossary");
+        $data[GLOSSARY_APPROVAL_VIEW]->link = "";
 
-    if ($tab == GLOSSARY_APPROVAL_VIEW and !isteacher($course->id)) {
+        $hiddenentries = get_records_select("glossary_entries","glossaryid  = $glossary->id and approved = 0");
+        if ($hiddenentries) {
+            $data[GLOSSARY_APPROVAL_VIEW]->caption .= "<br><font size=1>(" . count($hiddenentries) . " " . get_string("entries","glossary") . ")</font>";
+            $data[GLOSSARY_APPROVAL_VIEW]->link = "view.php?id=$id&tab=".GLOSSARY_APPROVAL_VIEW;
+        } elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) {
+           $tab = GLOSSARY_STANDARD_VIEW;
+        }
+    } elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) {
         $tab = GLOSSARY_STANDARD_VIEW;
     }
 
 /// printing header of the current tab
-    echo "<center>";
+    echo '<center>';
     glossary_print_tabbed_table_start($data, $tab, $glossary_tCFG);
     switch ($tab) {
         case GLOSSARY_CATEGORY_VIEW:
             glossary_print_categories_menu($course, $cm, $glossary, $cat, $category);
         break;
-        case GLOSSARY_APPROVAL_VIEW:           
+        case GLOSSARY_APPROVAL_VIEW:
             glossary_print_approval_menu($cm, $glossary, $l, $sortkey, $sortorder,$tab);
         break;
+        case GLOSSARY_DATE_VIEW:
+            if (!$sortkey) {
+                $sortkey = 'UPDATE';
+            }
+            if (!$sortorder) {
+                $sortorder = 'desc';
+            }
         case GLOSSARY_STANDARD_VIEW:
         default:
             glossary_print_alphabet_menu($cm, $glossary, $l, $sortkey, $sortorder,$tab);
             } 
         break;
     } 
-    echo "<hr>";
+    echo '<hr>';
     
 /// Printing the entries
 
                               gc.id = gec.categoryid";
 
                 if ( $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS ) {
-                    $sql .= " ORDER BY gc.name, ge.timecreated";
+                    $sql .= ' ORDER BY gc.name, ge.timecreated';
                 } else {
-                    $sql .= " ORDER BY gc.name, ge.concept";
+                    $sql .= ' ORDER BY gc.name, ge.concept';
                 }
                 $allentries = get_records_sql($sql);
             } else {
                 if ( $cat == GLOSSARY_SHOW_NOT_CATEGORISED ) {
-                    $allentries = glossary_get_entries_sorted($glossary, "",$orderby);
+                    $allentries = glossary_get_entries_sorted($glossary, '',$orderby);
                 } else {
-                    $allentries = glossary_get_entries_by_category($glossary, $cat, "",$orderby);
+                    $allentries = glossary_get_entries_by_category($glossary, $cat, '',$orderby);
                 }
             }
             $currentcategory = "";
         break;
         case GLOSSARY_APPROVAL_VIEW:
-            $allentries = glossary_get_entries_sorted($glossary, "approved = 0",$orderby);
-            $currentletter = "";
+            $allentries = glossary_get_entries_sorted($glossary, 'approved = 0',$orderby);
+            $currentletter = '';
         break;
+        case GLOSSARY_DATE_VIEW:
+            $l = 'ALL';
         case GLOSSARY_STANDARD_VIEW:
+        default:
             if ($search) { // looking for a term
                 $allentries = glossary_search_entries($searchterms, $glossary, $includedefinition);
             } elseif ($eid) { // looking for an entry
                 $allentries = get_records_select("glossary_entries", "id = $eid");
             } elseif ( $l or $sortkey ) {
-                $where = "";
-                if ($l != "ALL" and $l != "SPECIAL") {
+                if ($sortkey == 'CREATION') {
+                    $orderby = "timecreated $sortorder";
+                } else {
+                    $orderby = "timemodified $sortorder";
+                }
+                $where = '';
+                if ($l != 'ALL' and $l != 'SPECIAL') {
                     switch ($CFG->dbtype) {
-                        case "postgres7":
-                            $where = "substr(ucase(concept),1," .  strlen($l) . ") = '" . strtoupper($l) . "'";
+                        case 'postgres7':
+                            $where = 'substr(ucase(concept),1,' .  strlen($l) . ') = \'' . strtoupper($l) . '\'';
                         break;
-                        case "mysql":
-                            $where = "left(ucase(concept)," .  strlen($l) . ") = '$l'";
+                        case 'mysql':
+                            $where = 'left(ucase(concept),' .  strlen($l) . ") = '$l'";
                         break;
                         default:
-                            $where = "";
+                            $where = '';
                     }
                 }
                 $allentries = glossary_get_entries_sorted($glossary, $where,$orderby);
             }
-            $currentletter = "";
+            $currentletter = '';
         break;
     } 
     
     $dumpeddefinitions = 0;
     if ($allentries) {
         if ($glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS) {
-            echo "<table border=0 cellspacing=0 width=95% valign=top cellpadding=5><tr><td align=left bgcolor=\"#FFFFFF\">";
+            echo '<table border=0 cellspacing=0 width=95% valign=top cellpadding=5><tr><td align=left bgcolor="#FFFFFF">';
         }
         foreach ($allentries as $entry) {
             $dumptoscreen = 0;
             $firstletter = strtoupper(substr(ltrim($entry->concept), 0, strlen($l)));
             if ($l) {
-                if ($l == "ALL" or $sortkey == "CREATION" or $sortkey == "UPDATE" or $firstletter == $l) {
+                if ($l == 'ALL' or $sortkey == 'CREATION' or $sortkey == 'UPDATE' or $firstletter == $l) {
                     if ($currentletter != $firstletter[0]) {
-                        if ($entry->approved or $USER->id == $entry->userid or $tab == GLOSSARY_APPROVAL_VIEW) {
+                        if ($entry->approved or ($USER->id == $entry->userid and !isteacher($course->id)) or $tab == GLOSSARY_APPROVAL_VIEW) {
                             $currentletter = $firstletter[0];
     
                             if ($glossary->displayformat == GLOSSARY_FORMAT_SIMPLE) {
                                 if ($dumpeddefinitions > 0) {
-                                    echo "</table></center><p>";
+                                    echo '</table></center><p>';
                                 } 
                                 echo "\n<center><table border=0 cellspacing=0 width=95% valign=top cellpadding=5><tr><td align=center bgcolor=\"$THEME->cellheading2\">";
                             }
-                            if ($l == "ALL" and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS) {
+                            if ($l == 'ALL' and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS) {
                                 echo "<b>$currentletter</b>";
                             } 
     
                             if ($glossary->displayformat == GLOSSARY_FORMAT_SIMPLE) {
-                                echo "\n</center></td></tr></table></center>";
+                                echo '</center></td></tr></table></center>';
                                     if ($dumpeddefinitions > 0) {
-                                        echo "\n<center><table border=0 cellspacing=0 width=95% valign=top cellpadding=5>";
+                                        echo '<center><table border=0 cellspacing=0 width=95% valign=top cellpadding=5>';
                                 } 
                             } 
                         } 
                     }
                     $dumptoscreen = 1;
-                } elseif ($l == "SPECIAL" and ord($firstletter) != ord("Ñ") and 
-                         (ord($firstletter) < ord("A") or ord($firstletter) > ord("Z"))) {
+                } elseif ($l == 'SPECIAL' and ord($firstletter) != ord('Ñ') and 
+                         (ord($firstletter) < ord('A') or ord($firstletter) > ord('Z'))) {
                     $dumptoscreen = 1;
                 } 
             } else {
                             } 
                         } else { // All categories
                             if ($currentcategory != $entry->CID) {
-                                if ($entry->approved or $USER->id == $entry->userid or $tab == GLOSSARY_APPROVAL_VIEW) {
+                                if ($entry->approved or ($USER->id == $entry->userid and !isteacher($course->id)) or $tab == GLOSSARY_APPROVAL_VIEW) {
                                     $currentcategory = $entry->CID;
                                     if ($glossary->displayformat == GLOSSARY_FORMAT_SIMPLE) {
                                         if ($dumpeddefinitions > 0) {
-                                            echo "</table></center><p>";
+                                            echo '</table></center><p>';
                                         } 
                                         echo "\n<center><table border=0 cellspacing=0 width=95% valign=top cellpadding=10><tr><td align=center bgcolor=\"$THEME->cellheading2\">";
                                     } 
                                     if ( $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS ) {
-                                        echo "<center>";
+                                        echo '<center>';
                                     }
                                     echo "<b>$entry->name</b>";
                                     if ( $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS ) {
-                                        echo "</center><p>";
+                                        echo '</center><p>';
                                     }
                                 }
                             } 
                             $dumptoscreen = 1;
     
                             if ($glossary->displayformat == GLOSSARY_FORMAT_SIMPLE) {
-                                echo "\n</center></td></tr></table></center>";
+                                echo '</center></td></tr></table></center>';
                                 if ($dumpeddefinitions > 0) {
-                                    echo "\n<center><table border=1 cellspacing=0 width=95% valign=top cellpadding=10>";
+                                    echo '<center><table border=1 cellspacing=0 width=95% valign=top cellpadding=10>';
                                 } 
                             } 
     
     
                 if ($dumpeddefinitions == 1) {
                     if ($glossary->displayformat == GLOSSARY_FORMAT_SIMPLE) {
-                        echo "\n<center><table border=1 cellspacing=0 width=95% valign=top cellpadding=10>";
+                        echo '<center><table border=1 cellspacing=0 width=95% valign=top cellpadding=10>';
                     } 
                 } 
                 if ($search) {
                 glossary_print_entry($course, $cm, $glossary, $entry, $tab, $cat);
     
                 if ($glossary->displayformat != GLOSSARY_FORMAT_SIMPLE) {
-                    echo "<p>";
+                    echo '<p>';
                 } 
             } 
         } 
         if (!$search) {
             echo "<center>$strnoentries</center>";
         } else {
-            echo "<center>";
+            echo '<center>';
             print_string("searchhelp");
-            echo "</center>";
+            echo '</center>';
         } 
         print_simple_box_end();
     } else {
         switch ($glossary->displayformat) {
             case GLOSSARY_FORMAT_CONTINUOUS:
-                echo "</td></tr></table>";
+                echo '</td></tr></table>';
             break;
             case GLOSSARY_FORMAT_SIMPLE:
-                echo "\n</table></center>";
+                echo '</table></center>';
             break;
         } 
     } 
     
-    echo "</center>";
+    echo '</center>';
     glossary_print_tabbed_table_end();
 
 /// Finish the page