Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

- Exported entries are now linked instead of copied to the main gloss…

…ary.

- Short tags are gone.
- Little changes in ES language.
  • Loading branch information...
commit ad58adac109d37179ed223c926d4e740b7ad17a8 1 parent e75547e
authored September 29, 2003
4  lang/en/glossary.php
@@ -34,6 +34,7 @@
34 34
 $string['explainspecial'] = "<b>Special</b> will show all concepts that do not begin with a letter.<br>";
35 35
 $string['explainalphabet'] = "Select the letter you want to look for.<p>";
36 36
 $string['explainall'] = "<b>ALL</b> will show all entries in one page.";
  37
+$string['exportedentry'] = "Exported entry";
37 38
 $string['exporttomainglossary'] = "Export to main glossary";
38 39
 $string['glossarytype'] = "Glossary Type";
39 40
 $string['mainglossary'] = "Main glossary";
@@ -45,13 +46,14 @@
45 46
 $string['noentry'] = "No entry found.";
46 47
 $string['searchconcept'] = "Search:";
47 48
 $string['searchindefinition'] = "Search in concept AND definitions?";
48  
-$string['secundaryglossary'] = "Secondary glossary";
  49
+$string['secondaryglossary'] = "Secondary glossary";
49 50
 $string['showspecial'] = "Show 'Special' link";
50 51
 $string['showalphabet'] = "Show alphabet";
51 52
 $string['showall'] = "Show 'ALL' link";
52 53
 $string['special'] = "Special";
53 54
 $string['standardview'] = "Standard View";
54 55
 $string['studentcanpost'] = "Students can add entries";
  56
+$string['warningstudentcapost'] = "(This apply only if the glossary is not the main one)";
55 57
 $string['writtenby'] = "By";
56 58
 
57 59
 ?>
2  lang/en/help/glossary/mainglossary.html
@@ -2,4 +2,4 @@
2 2
 
3 3
 <P>The system allows to export entries from any secondary glossary to the main one of the course.
4 4
 <p>In order to do this, you should specify which glossary is the main one.
5  
-<p>Note: You can have only one main glossary per course.
  5
+<p>Note: You can have only one main glossary per course and its entries could be updated or deleted by teachers only.
5  lang/en/help/glossary/studentcanpost.html
... ...
@@ -1,4 +1,5 @@
1 1
 <P ALIGN=CENTER><B>Students can post entries</B></P>
2 2
 
3  
-<P>You can specify whether a user can or cannot add, edit or delete his/her own entries in this glossary.
4  
-<p><b>Note:</b> A teacher can edit or delete any entry at any time.
  3
+<P>You can specify whether a user can or cannot add, edit or delete his/her own entries.
  4
+Entries exported to a main glossary can be updated or deleted by teachers only.
  5
+<p><b>Note:</b> A teacher can edit or delete any entry at any time. This variable is not used if the glossary is the main one.
50  lang/es/glossary.php
... ...
@@ -1,58 +1,58 @@
1 1
 <?PHP // $Id$ 
2 2
       // glossary.php - created with Moodle 1.1 (2003082800)
3  
-
4  
-
5 3
 $string['addentry'] = "Agregar entrada";
6  
-$string['allcategories'] = "Todas las categorías";
7 4
 $string['allentries'] = "TODAS";
  5
+$string['allcategories'] = "Todas las categorías";
8 6
 $string['allowduplicatedentries'] = "Permitir entradas duplicadas";
9  
-$string['alphabet'] = "A|B|C|CH|D|E|F|G|H|I|J|K|L|LL|M|N|Ñ|O|P|Q|R|S|T|U|V|W|X|Y|Z";
10  
-$string['areyousuredelete'] = "¿Está seguro que desea borrar esta entrada?";
  7
+$string['alphabet'] = "A|B|C|D|E|F|G|H|I|J|K|L|M|N|Ñ|O|P|Q|R|S|T|U|V|W|X|Y|Z";
  8
+$string['areyousuredelete'] = "¿Está seguro que desea borrarla?";
11 9
 $string['attachment'] = "Adjunto";
12  
-$string['back'] = "Atrás";
  10
+$string['back'] = "Volver";
13 11
 $string['categories'] = "Categorías";
  12
+$string['categoryview'] = "Vista por Categoría";
14 13
 $string['category'] = "Categoría";
15  
-$string['categorydeleted'] = "Categoría borrada";
16  
-$string['categoryview'] = "Por categoría";
  14
+$string['categorydeleted'] = "Categoría eliminada";
17 15
 $string['concept'] = "Concepto";
18 16
 $string['concepts'] = "Conceptos";
19 17
 $string['definition'] = "Definición";
20 18
 $string['definitions'] = "Definiciones";
21 19
 $string['deleteentry'] = "Borrar entrada";
22  
-$string['deletingnoneemptycategory'] = "Borrar una categoría no borrará las entradas. Si desea borrar las entradas tendrá que hacerlo manualmente.";
23  
-$string['displayformat'] = "¿Formato de muestra?";
24  
-$string['displayformat1'] = "Completo con autor.";
25  
-$string['displayformat2'] = "Completo sin autor.";
  20
+$string['deletingnoneemptycategory'] = "Si una categoría es eliminada por consiguiente su relación con las entradas también lo será. Si desea eliminar las entradas, tendrá que hacerlo manualmente.";
  21
+$string['displayformat'] = "Formato de muestra de entradas";
26 22
 $string['displayformatdefault'] = "Simple, estilo diccionario";
27  
-$string['editcategories'] = "Editar categorías";
  23
+$string['displayformat1'] = "Completo sin autor.";
  24
+$string['displayformat2'] = "Completo con autor.";
28 25
 $string['editentry'] = "Editar entrada";
  26
+$string['editcategories'] = "Editar categorías";
29 27
 $string['entries'] = "Entradas";
30  
-$string['entrieswithoutcategory'] = "Entradas sin categorías";
  28
+$string['entrieswithoutcategory'] = "Entradas sin categoría";
31 29
 $string['entry'] = "Entrada";
32 30
 $string['entryalreadyexist'] = "Esta entrada ya existe.";
33 31
 $string['entrydeleted'] = "Entrada borrada.";
34 32
 $string['entryexported'] = "Entrada exportada con éxito.";
35  
-$string['explainall'] = "<b>Todas</b> mostrará todas las entradas en una página.";
36  
-$string['explainalphabet'] = "Seleccione la letra inicial que usted desea buscar.<p> ";
37  
-$string['explainspecial'] = "<b>Especial</b> mostrará todos los conceptos que no comienzan con una letra.<br>";
38  
-$string['exporttomainglossary'] = "Exportar todo el glosario";
  33
+$string['explainspecial'] = "<b>Especial</b> mostrará todos los conceptos que comiencen con símbolos.<br>";
  34
+$string['explainalphabet'] = "Seleccione la letra que desea buscar.<p>";
  35
+$string['explainall'] = "<b>TODAS</b> mostrará todas las entradas en una página.";
  36
+$string['exporttomainglossary'] = "Exportar al glosario principal";
  37
+$string['exportedentry'] = "Entrada exportada";
39 38
 $string['glossarytype'] = "Tipo de glosario";
40 39
 $string['mainglossary'] = "Glosario principal";
41 40
 $string['modulename'] = "Glosario";
42 41
 $string['modulenameplural'] = "Glosarios";
43 42
 $string['newglossaryentries'] = "Nuevas entradas en el glosario:";
44 43
 $string['nocategorized'] = "Sin categoría";
45  
-$string['noentries'] = "No se encontraron entradas en esta sección";
  44
+$string['noentries'] = "No se encontraro entradas en esta sección";
46 45
 $string['noentry'] = "No se econtró ninguna entrada.";
47 46
 $string['searchconcept'] = "Buscar:";
48  
-$string['searchindefinition'] = "¿Buscar en conceptos Y definiciones?";
49  
-$string['secundaryglossary'] = "Glosario secundario";
50  
-$string['showall'] = "Mostrar el enlace 'Todas'";
51  
-$string['showalphabet'] = "Mostrar el alfabeto";
52  
-$string['showspecial'] = "Mostrar el enlace 'Especial'";
  47
+$string['searchindefinition'] = "¿Buscar en conceptos y definiciones?";
  48
+$string['secondaryglossary'] = "Glosario secundario";
  49
+$string['showspecial'] = "Mostrar enlace 'Especial'";
  50
+$string['showalphabet'] = "Mostrar alfabeto";
  51
+$string['showall'] = "Mostrar enlace 'TODAS'";
53 52
 $string['special'] = "Especial";
54  
-$string['standardview'] = "Visualización estándar";
  53
+$string['standardview'] = "Vista Normal";
55 54
 $string['studentcanpost'] = "Los estudiantes pueden agregar entradas";
  55
+$string['warningstudentcapost'] = "(Esto sólo aplica si el glosario no es principal)";
56 56
 $string['writtenby'] = "Por";
57 57
 
58 58
 ?>
9  lang/es/help/glossary/mainglossary.html
... ...
@@ -1,4 +1,5 @@
1  
-<P ALIGN=CENTER><B>Es este el glosario principal del curso?</B></P>
2  
-
3  
-<P>El sistema permite exportar definiciones de los glosarios secundarios al glosario principal del sistema.
4  
-<p>Para hacer esto, usted debe especificar cual de los glosarios es el principal. Note que sólo puede tener un glosario principal por curso.
  1
+<P ALIGN=CENTER><B>Es este el glosario principal del curso?</B></P>
  2
+
  3
+<P>El sistema permite exportar definiciones de los glosarios secundarios al glosario principal del sistema.
  4
+<p>Para hacer esto, usted debe especificar cual de los glosarios es el principal.
  5
+<p>Note que sólo puede tener un glosario principal por curso y sus entradas sólo podrán ser editadas o borradas por un profesor.
12  lang/es/help/glossary/studentcanpost.html
... ...
@@ -1,5 +1,7 @@
1  
-<P ALIGN=CENTER><B>Los estudiantes podrán agregar definiciones?</B></P>
2  
-
3  
-<P>Indique si desea que los estudiantes puedan o no agregar definiciones al glosario.
4  
-
5  
-<p>Si seleccionan que en efecto pueden hacerlo, el sistema le permitirá, además, modificar y eliminar sus propias definiciones.
  1
+<P ALIGN=CENTER><B>Los estudiantes podrán agregar definiciones?</B></P>
  2
+
  3
+<P>Puede especificar si los estudiantes pueden o no agregar, modificar y eliminar sus propias definiciones al glosario.
  4
+Las entradas exportadas a un glosario principal, sólo podrán ser editadas o borradas por un profesor.
  5
+<p>Un profesor puede modificar o borrar cualquier entrada.
  6
+<p>Esta variable no tiene efecto si el glosario es principal.
  7
+
5  mod/glossary/backuplib.php
@@ -28,7 +28,7 @@ function glossary_backup_mods($bf,$preferences) {
28 28
         $status = true;
29 29
 
30 30
         //Iterate over glossary table
31  
-        $glossaries = get_records ("glossary","course",$preferences->backup_course,"id");
  31
+        $glossaries = get_records ("glossary","course",$preferences->backup_course,"mainglossary");
32 32
         if ($glossaries) {
33 33
             foreach ($glossaries as $glossary) {
34 34
                 //Start mod
@@ -80,7 +80,7 @@ function backup_glossary_categories ($bf,$preferences,$glossary, $userinfo) {
80 80
                 fwrite ($bf,full_tag("GLOSSARYID",6,false,$glo_cat->glossaryid));
81 81
                 fwrite ($bf,full_tag("NAME",6,false,$glo_cat->name));
82 82
 
83  
-                $entries = get_records("glossary_entries_categories","categoryid",$glo_cat->id,"entryid");
  83
+                $entries = get_records("glossary_entries_categories","categoryid",$glo_cat->id,"mainglossary");
84 84
                 if ($entries) {
85 85
                     $status =fwrite ($bf,start_tag("ENTRIES",6,true));
86 86
                     foreach ($entries as $entry) {
@@ -129,6 +129,7 @@ function backup_glossary_entries ($bf,$preferences,$glossary, $userinfo) {
129 129
                     fwrite ($bf,full_tag("DEFINITION",6,false,$glo_ent->definition));
130 130
                     fwrite ($bf,full_tag("FORMAT",6,false,$glo_ent->format));
131 131
                     fwrite ($bf,full_tag("ATTACHMENT",6,false,$glo_ent->attachment));
  132
+                    fwrite ($bf,full_tag("SOURCEGLOSSARYID",6,false,$glo_ent->sourceglossaryid));
132 133
                     fwrite ($bf,full_tag("TIMECREATED",6,false,$glo_ent->timecreated));
133 134
                     fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$glo_ent->timemodified));
134 135
                     fwrite ($bf,full_tag("TEACHERENTRY",6,false,$glo_ent->teacherentry));
6  mod/glossary/db/mysql.php
@@ -59,6 +59,12 @@ function glossary_upgrade($oldversion) {
59 59
         execute_sql("ALTER TABLE `{$CFG->prefix}glossary_entries_categories` DROP PRIMARY KEY ");
60 60
         execute_sql("ALTER TABLE `{$CFG->prefix}glossary_entries_categories` ADD `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST");
61 61
     }
  62
+    
  63
+    if ( $oldversion < 2003092400 ) {
  64
+        execute_sql( "ALTER TABLE `{$CFG->prefix}glossary_entries` " .
  65
+                    "ADD `sourceglossaryid` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `attachment` " );
  66
+
  67
+    }
62 68
 
63 69
     return true;
64 70
 }
1  mod/glossary/db/mysql.sql
@@ -39,6 +39,7 @@ CREATE TABLE prefix_glossary_entries (
39 39
      timecreated int(10) unsigned NOT NULL default '0',
40 40
      timemodified int(10) unsigned NOT NULL default '0',
41 41
      teacherentry tinyint(2) unsigned NOT NULL default '0',
  42
+     sourceglossaryid int(10) unsigned NOT NULL '0',
42 43
      PRIMARY KEY  (id)
43 44
 ) TYPE=MyISAM COMMENT='all glossary entries';
44 45
 
9  mod/glossary/db/oci8po.sql
@@ -61,7 +61,8 @@ CREATE TABLE prefix_glossary_entries (
61 61
   attachment varchar2(100) default '' not null,
62 62
   timecreated number(10) default '0' not null,
63 63
   timemodified number(10) default '0' not null,
64  
-  teacherentry number(2) default '0' not null
  64
+  teacherentry number(2) default '0' not null,
  65
+  sourceglossaryid number(10) default '0' not null
65 66
 );
66 67
 
67 68
 COMMENT on table prefix_glossary_entries is 'all glossary entries';
@@ -155,9 +156,15 @@ rem
155 156
 
156 157
 INSERT INTO prefix_log_display VALUES ('glossary', 'add', 'glossary', 'name');
157 158
 INSERT INTO prefix_log_display VALUES ('glossary', 'update', 'glossary', 'name');
  159
+INSERT INTO prefix_log_display VALUES ('glossary', 'delete', 'glossary', 'name');
158 160
 
159 161
 INSERT INTO prefix_log_display VALUES ('glossary', 'view', 'glossary', 'name');
160 162
 INSERT INTO prefix_log_display VALUES ('glossary', 'view all', 'glossary', 'name');
161 163
 
162 164
 INSERT INTO prefix_log_display VALUES ('glossary', 'add entry', 'glossary', 'name');
163 165
 INSERT INTO prefix_log_display VALUES ('glossary', 'update entry', 'glossary', 'name');
  166
+INSERT INTO prefix_log_display VALUES ('glossary', 'delete entry', 'glossary', 'name');
  167
+
  168
+INSERT INTO prefix_log_display VALUES ('glossary', 'add category', 'glossary', 'name');
  169
+INSERT INTO prefix_log_display VALUES ('glossary', 'update category', 'glossary', 'name');
  170
+INSERT INTO prefix_log_display VALUES ('glossary', 'delete category', 'glossary', 'name');
1  mod/glossary/db/postgres7.sql
@@ -39,6 +39,7 @@ CREATE TABLE prefix_glossary_entries (
39 39
      timecreated int4 NOT NULL default '0',
40 40
      timemodified int4 NOT NULL default '0',
41 41
      teacherentry int2 NOT NULL default '0',
  42
+     sourceglossaryid int4 NOT NULL default '0',
42 43
      PRIMARY KEY(id)
43 44
 );
44 45
 
96  mod/glossary/deleteentry.php
@@ -6,7 +6,7 @@
6 6
     require_variable($id);    // course module ID
7 7
     require_variable($mode);  // edit or delete
8 8
     optional_variable($go);  // commit the operation?
9  
-    optional_variable($entry);  // edit or delete
  9
+    optional_variable($entry);  // entry id
10 10
 
11 11
     $strglossary = get_string("modulename", "glossary");
12 12
     $strglossaries = get_string("modulenameplural", "glossary");
@@ -47,48 +47,58 @@
47 47
 /// If data submitted, then process and store.
48 48
     
49 49
     if ($mode == "edit" or $mode == "delete" ) {
50  
-	echo "<p>";
51  
-	if ( isteacher($cm->id) or $glossary->studentcanpost ) {
52  
-		if ($go) {	// the operation was confirmed.
53  
-			if ( $mode == "delete") {
54  
-				glossary_delete_old_attachments($entry);
55  
-				delete_records("glossary_entries","id", $entry);				
56  
-				print_simple_box_start("center","40%", "#FFBBBB");
57  
-				echo "<center>$entrydeleted"; //CAMBIAR
58  
-				echo "</center>";
59  
-				print_simple_box_end();
60  
-			}
61  
-    			print_footer($course);
62  
-                  add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id&currentview=$currentview&cat=$cat", $entry);
63  
-			redirect("view.php?id=$cm->id&currentview=$currentview&cat=$cat");
64  
-		} else {		// the operation has not been confirmed yet so ask the user to do so
65  
-			if ( $mode == "delete") {				
66  
-				print_simple_box_start("center","40%", "#FFBBBB");
67  
-				echo "<center><b>$entryfields->concept</b><br>$strareyousuredelete";
68  
-				
69  
-				?>
70  
-                    <form name="form" method="post" action="deleteentry.php">
71  
-
72  
-                    <input type="hidden" name=id 		   value="<?php p($cm->id) ?>">
73  
-                    <input type="hidden" name=mode         value="delete">
74  
-                    <input type="hidden" name=go       value="1">
75  
-                    <input type="hidden" name=entry         value="<?php p($entry) ?>">
76  
-                    <input type="hidden" name=currentview value=<? p($currentview) ?>>
77  
-                    <input type="hidden" name=cat=<? p($cat) ?>>
78  
-
79  
-                    <input type="submit" value=" <?php print_string("yes")?> ">
80  
-                    <input type=button value=" <?php print_string("no")?> " onclick="javascript:history.go(-1);">
81  
-
82  
-                    </form>
83  
-               	</center>
84  
-               	<?
85  
-				print_simple_box_end();
86  
-			}
87  
-		} 
88  
-	} else {
89  
-		error("You are not allowed to edit or delete entries");
90  
-	}
91  
-    } else {
  50
+    	echo "<p>";
  51
+    	if ( isteacher($cm->id) or $glossary->studentcanpost ) {
  52
+    		if ($go) {	// the operation was confirmed.
  53
+    			if ( $mode == "delete") {
  54
+    			    // if it is an imported entry, just delete the relation
  55
+    			    $entry = get_record("glossary_entries","id", $entry);
  56
+    			    if ( $entry->sourceglossaryid ) {
  57
+    			        $entry->glossaryid = $entry->sourceglossaryid;
  58
+    			        $entry->sourceglossaryid = 0;
  59
+                        if (! update_record("glossary_entries", $entry)) {
  60
+                   	        error("Could not update your glossary");
  61
+               	        }
  62
+    			    } else {
  63
+    				    glossary_delete_old_attachments($entry->id);
  64
+    				    delete_records("glossary_entries","id", $entry->id);				
  65
+    			    }
  66
+    			
  67
+                    print_simple_box_start("center","40%", "#FFBBBB");
  68
+    				echo "<center>$entrydeleted"; //CAMBIAR
  69
+    				echo "</center>";
  70
+    				print_simple_box_end();
  71
+    			}
  72
+        			print_footer($course);
  73
+                      add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id&currentview=$currentview&cat=$cat", $entry);
  74
+    			redirect("view.php?id=$cm->id&currentview=$currentview&cat=$cat");
  75
+    		} else {		// the operation has not been confirmed yet so ask the user to do so
  76
+    			if ( $mode == "delete") {				
  77
+    				print_simple_box_start("center","40%", "#FFBBBB");
  78
+    				echo "<center><b>$entryfields->concept</b><br>$strareyousuredelete";
  79
+    				
  80
+    				?>
  81
+                        <form name="form" method="post" action="deleteentry.php">
  82
+
  83
+                        <input type="hidden" name=id 		   value="<?php p($cm->id) ?>">
  84
+                        <input type="hidden" name=mode         value="delete">
  85
+                        <input type="hidden" name=go       value="1">
  86
+                        <input type="hidden" name=entry         value="<?php p($entry) ?>">
  87
+                        <input type="hidden" name=currentview value=<?php p($currentview) ?>>
  88
+                        <input type="hidden" name=cat=<?php p($cat) ?>>
  89
+
  90
+                        <input type="submit" value=" <?php print_string("yes")?> ">
  91
+                        <input type=button value=" <?php print_string("no")?> " onclick="javascript:history.go(-1);">
  92
+
  93
+                        </form>
  94
+                   	</center>
  95
+                   	<?php
  96
+    				print_simple_box_end();
  97
+    			}
  98
+    		}
  99
+    	} else {
  100
+    		error("You are not allowed to edit or delete entries");
  101
+    	}
92 102
     }
93 103
     print_footer($course);
94 104
 ?>
30  mod/glossary/edit.html
... ...
@@ -1,37 +1,39 @@
1  
-<?
  1
+<?php
2 2
 	global $CFG, $THEME;
3 3
     	require_once("../../config.php");
4 4
 ?>
5 5
 <FORM name="theform" method="post" <?=$onsubmit ?> action="edit.php" enctype="multipart/form-data">
6  
-<table  class=generalbox cellpadding=5 bgcolor="<? p($THEME->cellheading)?>">
  6
+<table  class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
7 7
 <tr valign=top>
8 8
     <td align=right><p><b><?php echo get_string("concept","glossary") ?>:</b></p></td>
9 9
     <td>
10  
-        <INPUT type="text" name="concept" size=30 value="<? p($form->concept) ?>">
  10
+        <INPUT type="text" name="concept" size=30 value="<?php p($form->concept) ?>">
11 11
     </td>
12 12
 </tr>
13 13
 <tr valign=top>
14 14
     <td align=right><p><b><?php echo get_string("categories","glossary") ?>:</b></p></td>
15 15
     <td>	
16  
-	<?
  16
+	<?php
17 17
 		$categories = get_records("glossary_categories","glossaryid",$glossary->id);
18 18
 		echo "<select size=\"6\" name=\"categories[]\" multiple=\"yes\">";
19 19
 		echo "<option value=0>" . get_string("nocategorized","glossary") . "</optioon>";
20 20
 
21  
-		foreach ( $categories as $category ) {
22  
-			echo "  <option ";
  21
+		if ( $categories ) {
  22
+            foreach ( $categories as $category ) {
  23
+			    echo "  <option ";
23 24
 
24  
-			if ( record_exists("glossary_entries_categories","entryid",$entry->id,"categoryid",$category->id) ) {
25  
-				echo "selected " ;
26  
-			}
27  
-			echo "value=\"$category->id\">$category->name</option>\n";
  25
+			    if ( record_exists("glossary_entries_categories","entryid",$entry->id,"categoryid",$category->id) ) {
  26
+				    echo "selected " ;
  27
+			    }
  28
+			    echo "value=\"$category->id\">$category->name</option>\n";
  29
+            }
28 30
 		}
29 31
 	?>
30 32
 	</select>
31 33
     </td>
32 34
 </tr>
33 35
 <tr valign=top>
34  
-    <td align=right><p><b><? echo get_string("definition","glossary") ?>:</b></p>
  36
+    <td align=right><p><b><?php echo get_string("definition","glossary") ?>:</b></p>
35 37
     <font size="1">
36 38
      <?php
37 39
         helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
@@ -75,7 +77,7 @@
75 77
 <tr>
76 78
 <td colspan=2>
77 79
 	<p align=center>
78  
-	<? if ($entry->id) {
  80
+	<?php if ($entry->id) {
79 81
 		echo "<input type=\"hidden\" name=entry value=\"$entry->id\">";
80 82
    	 }
81 83
 	?>
@@ -83,8 +85,8 @@
83 85
 	<input type="hidden" name=currentview value="<?=$currentview ?>">
84 86
 	<input type="hidden" name=cat value="<?=$cat ?>">
85 87
 
86  
-	<input type="submit" value="<? print_string("savechanges") ?>">
87  
-	<input type="reset" value="<? print_string("revert") ?>">
  88
+	<input type="submit" value="<?php print_string("savechanges") ?>">
  89
+	<input type="reset" value="<?php print_string("revert") ?>">
88 90
 	</P>
89 91
 </td>
90 92
 </tr>
3  mod/glossary/edit.php
@@ -95,10 +95,11 @@
95 95
                 $newentry->timecreated = time();
96 96
                 $newentry->timemodified = time();
97 97
                 $newentry->teacherentry = isteacher($course->id,$USER->id);
  98
+                $newentry->sourceglossaryid = 0;
98 99
 
99 100
                 $PermissionGranted = 1;
100 101
                 if ( !$glossary->allowduplicatedentries ) {
101  
-                       $dupentries = get_record("glossary_entries","UCASE(concept)", strtoupper($newentry->concept));
  102
+                       $dupentries = get_record("glossary_entries","UCASE(concept)", strtoupper($newentry->concept), "glossaryid", $glossary->id);
102 103
                        if ($dupentries) {
103 104
                               $PermissionGranted = 0;
104 105
                        }
10  mod/glossary/editcategories.html
... ...
@@ -1,11 +1,11 @@
1  
-<?
  1
+<?PHP
2 2
 	global $CFG, $THEME;
3 3
     	require_once("../../config.php");
4 4
 
5 5
 ?>
6 6
 
7 7
 <FORM name="form" method="post" <?=$onsubmit ?> action="editcategories.php">
8  
-<table  class=generalbox cellpadding=5 bgcolor="<? p($THEME->cellheading)?>">
  8
+<table  class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
9 9
 <tr valign=top>
10 10
     <td align=right><p><b><?php echo get_string("name") ?>:</b></p></td>
11 11
     <td>
@@ -17,9 +17,9 @@
17 17
 	<input type="hidden" name=id value="<?=$cm->id ?>">
18 18
 	<input type="hidden" name=action value="<?=$action?>">
19 19
 	<input type="hidden" name=confirm value=1>
20  
-	<input type="hidden" name=cat value=<? p($cat) ?>>
21  
-	<input type="submit" value="<? print_string("savechanges") ?>">
22  
-	<input type="reset" value="<? print_string("back","glossary") ?>"  onclick="javascript:history.go(-1);">
  20
+	<input type="hidden" name=cat value=<?php p($cat) ?>>
  21
+	<input type="submit" value="<?php print_string("savechanges") ?>">
  22
+	<input type="reset" value="<?php print_string("back","glossary") ?>"  onclick="javascript:history.go(-1);">
23 23
 	</P>
24 24
 </td>
25 25
 </tr>
77  mod/glossary/editcategories.php
@@ -56,11 +56,11 @@
56 56
                     $CategoryObject->name = $name;
57 57
 
58 58
                     if ( !update_record("glossary_categories", $CategoryObject) ) {
59  
-     				error("Weird error. The category was not updated.");
60  
-              			
61  
-          			redirect("editcategories.php?id=$cm->id");
  59
+     				    error("Weird error. The category was not updated.");
  60
+     				    redirect("editcategories.php?id=$cm->id");
  61
+                    } else {
  62
+                        add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $cat);
62 63
                     }
63  
-                    
64 64
                } else {
65 65
                     echo "<p align=\"center\">" . get_string("edit"). " " . get_string("category","glossary") . "<font size=\"3\">";
66 66
 
@@ -72,26 +72,26 @@
72 72
           } elseif ( $action == "delete" ) {
73 73
                if ( $confirm ) {
74 74
                
75  
-				delete_records("glossary_entries_categories","categoryid", $cat);
  75
+				    delete_records("glossary_entries_categories","categoryid", $cat);
76 76
                     delete_records("glossary_categories","id", $cat);
77 77
 				
78  
-				print_simple_box_start("center","40%", "#FFBBBB");
79  
-				echo "<center>" . get_string("categorydeleted","glossary") ."</center>";
80  
-				echo "</center>";
81  
-				print_simple_box_end();
  78
+				    print_simple_box_start("center","40%", "#FFBBBB");
  79
+				    echo "<center>" . get_string("categorydeleted","glossary") ."</center>";
  80
+				    echo "</center>";
  81
+				    print_simple_box_end();
82 82
 				
83 83
          			print_footer($course);
84 84
 
85 85
                     add_to_log($course->id, "glossary", "delete category", "editcategories.php?id=$cm->id", $cat);
86 86
                     
87  
-     			redirect("editcategories.php?id=$cm->id");
  87
+     			    redirect("editcategories.php?id=$cm->id");
88 88
                } else {
89 89
                     echo "<p align=\"center\">" . get_string("delete"). " " . get_string("category","glossary") . "<font size=\"3\">";
90 90
 
91  
-     			print_simple_box_start("center","40%", "#FFBBBB");
92  
-     			echo "<center><b>$category->name</b><br>";
  91
+     			    print_simple_box_start("center","40%", "#FFBBBB");
  92
+     			    echo "<center><b>$category->name</b><br>";
93 93
      			
94  
-     			$num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
  94
+     			    $num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
95 95
                     if ( $num_entries ) {
96 96
                          print_string("deletingnoneemptycategory","glossary");
97 97
                     }
@@ -109,29 +109,29 @@
109 109
                     <input type="submit" value=" <?php print_string("yes")?> ">
110 110
                     </form>
111 111
                     </td><td align=left width=50%>
112  
-                    <?
  112
+                    <?php
113 113
                     unset($options);
114 114
                     $options = array ("id" => $id);
115 115
                     print_single_button("editcategories.php", $options, get_string("no") );
116 116
                     echo "</td></tr></table>";
117  
-     			echo "</center>";
118  
-     			print_simple_box_end();
  117
+     			    echo "</center>";
  118
+     			    print_simple_box_end();
119 119
                }
120 120
           }
121 121
      } elseif ( $action == "add" ) {
122 122
           if ( $confirm ) {
123  
-               $dupcategory = get_record("glossary_categories","lcase(name)",strtolower($name));
  123
+               $dupcategory = get_record("glossary_categories","lcase(name)",strtolower($name),"glossaryid",$glossary->id);
124 124
                if ( $dupcategory ) {
125 125
                     echo "<p align=\"center\">" . get_string("add"). " " . get_string("category","glossary") . "<font size=\"3\">";
126 126
                     
127  
-				print_simple_box_start("center","40%", "#FFBBBB");
128  
-				echo "<center>" . get_string("duplicatedcategory","glossary") ."</center>";
129  
-				echo "</center>";
130  
-				print_simple_box_end();
  127
+ 				    print_simple_box_start("center","40%", "#FFBBBB");
  128
+				    echo "<center>" . get_string("duplicatedcategory","glossary") ."</center>";
  129
+				    echo "</center>";
  130
+				    print_simple_box_end();
131 131
 				
132 132
          			print_footer($course);
133 133
 
134  
-     			redirect("editcategories.php?id=$cm->id&action=add&&name=$name");
  134
+     			    redirect("editcategories.php?id=$cm->id&action=add&&name=$name");
135 135
 
136 136
                } else {
137 137
                     $action = "";
@@ -139,11 +139,11 @@
139 139
                     $CategoryObject->glossaryid = $glossary->id;
140 140
 
141 141
                     if ( ! $CategoryObject->id = insert_record("glossary_categories", $CategoryObject) ) {
142  
-     				error("Weird error. The category was not inserted.");
  142
+     				    error("Weird error. The category was not inserted.");
143 143
               			
144  
-          			redirect("editcategories.php?id=$cm->id");
  144
+          			    redirect("editcategories.php?id=$cm->id");
145 145
                     } else {
146  
-                         add_to_log($course->id, "glossary", "add category", "editcategories.php?id=$cm->id", $cat);
  146
+                        add_to_log($course->id, "glossary", "add category", "editcategories.php?id=$cm->id", $CategoryObject->id);
147 147
                     }
148 148
              }
149 149
           } else {
@@ -154,7 +154,6 @@
154 154
      }
155 155
      
156 156
      if ( $action ) {
157  
-
158 157
           print_footer();
159 158
           die;
160 159
      }
@@ -162,41 +161,41 @@
162 161
 ?>
163 162
 
164 163
 
165  
-<p align="center"><? p(get_string("edit")) ?> <? p(get_string("categories","glossary")) ?><font size="3">
  164
+<p align="center"><?php p(get_string("edit")) ?> <?php p(get_string("categories","glossary")) ?><font size="3">
166 165
 
167 166
 <FORM name="theform" method="post" <?=$onsubmit ?> action="editcategories.php">
168  
-<table width="40%" class=generalbox cellpadding=5 bgcolor="<? p($THEME->cellheading)?>">
  167
+<table width="40%" class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
169 168
         <tr>
170 169
           <td width="90%" align="center"><b>
171  
-          <? p(get_string("categories","glossary")) ?></b></td>
  170
+          <?php p(get_string("categories","glossary")) ?></b></td>
172 171
           <td width="10%" align="center"><b>
173  
-          <? p(get_string("action")) ?></b></td>
  172
+          <?php p(get_string("action")) ?></b></td>
174 173
         </tr>
175  
-        <tr><td width=100% colspan=2  bgcolor="<? p($THEME->cellheading2)?>">
  174
+        <tr><td width=100% colspan=2  bgcolor="<?php p($THEME->cellheading2)?>">
176 175
         
177 176
         <table width=100%>
178  
-<?
  177
+<?php
179 178
      $categories = get_records("glossary_categories","glossaryid",$glossary->id,"name ASC");
180 179
 
181 180
      if ( $categories ) {
182 181
           foreach ($categories as $category) {
183 182
                $num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
184 183
              ?>
185  
-             <tr bgcolor="<? p($THEME->cellheading2)?>">
  184
+             <tr bgcolor="<?php p($THEME->cellheading2)?>">
186 185
                <td width="90%" align="left">
187  
-               <?
  186
+               <?php
188 187
                     echo "<b>$category->name</b> <font size=-1>($num_entries " . get_string("entries","glossary") . ")</font>";
189 188
                ?>
190 189
                </td>
191 190
                <td width="10%" align="center"><b>
192  
-               <?
  191
+               <?php
193 192
           		echo "<a href=\"editcategories.php?id=$cm->id&action=delete&cat=$category->id\"><img  alt=\"" . get_string("delete") . "\"src=\"../../pix/t/delete.gif\" height=11 width=11 border=0></a> ";
194 193
           	  	echo "<a href=\"editcategories.php?id=$cm->id&action=edit&cat=$category->id\"><img  alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
195 194
                ?>
196 195
                </b></td>
197 196
              </tr>
198 197
              
199  
-             <?
  198
+             <?php
200 199
           }
201 200
      }
202 201
 ?>
@@ -204,8 +203,8 @@
204 203
         
205 204
         </td>
206 205
         <tr>
207  
-        <td width=100% colspan=2  align=center bgcolor="<? p($THEME->cellheading2)?>">
208  
-            <?
  206
+        <td width=100% colspan=2  align=center bgcolor="<?php p($THEME->cellheading2)?>">
  207
+            <?php
209 208
             
210 209
              $options['id'] = $cm->id;
211 210
              $options['action'] = "add";
@@ -230,4 +229,4 @@
230 229
 
231 230
 </form>
232 231
 
233  
-<? print_footer() ?>
  232
+<?php print_footer() ?>
51  mod/glossary/exportentry.php
... ...
@@ -1,4 +1,4 @@
1  
-<?
  1
+<?PHP
2 2
 	require_once("../../config.php");
3 3
 	require_once("lib.php");
4 4
 
@@ -66,45 +66,30 @@
66 66
 				}
67 67
 			}
68 68
 			if ( $PermissionGranted ) {
69  
-               	$newentry->userid = $entry->userid;
70  
-      	      	$newentry->glossaryid = $mainglossary->id;
71  
-	           	$newentry->concept = $entry->concept;
72  
-               	$newentry->definition = $entry->definition;
73  
-      	       	$newentry->format = $entry->format;
74  
-		  	   	$newentry->timecreated = $entry->timecreated;
75  
-	   		   	$newentry->timemodified = $entry->timemodified;
76  
-			   	$newentry->teacherentry = $entry->teacherentry;
77  
-			   	$newentry->attachment = $entry->attachment;
78  
-
79  
-		   		if (! $newentry->id = insert_record("glossary_entries", $newentry) ) {
  69
+			
  70
+                $entry->glossaryid       = $mainglossary->id;
  71
+                $entry->sourceglossaryid = $glossary->id;
  72
+                
  73
+                if (! update_record("glossary_entries", $entry)) {
80 74
 					error("Could not export the entry to the main glossary");
81 75
 				} else {
82  
-                         print_simple_box_start("center", "60%", "$THEME->cellheading");
83  
-                         echo "<p align=center><font size=3>$entryexported</font></p></font>";
84  
-                         if ($newentry->attachment) {
85  
-                              $entry->course = $cm->course;
86  
-               	          $newentry->course = $cm->course;
87  
-                              if ( !glossary_copy_attachments($entry, $newentry) ) {
88  
-                                   echo "<p align=\"center\">However, the attachment couldn't be exported.";
89  
-                              }
90  
-                         }
91  
-                         
92  
-                         add_to_log($course->id, "glossary", "add entry", "view.php?id=$cm->id&currentview=$currentview&cat=$cat&eid=".$entry->id, "$newentry->id");
93  
-
94  
-                         print_continue("view.php?id=$cm->id&currentview=$currentview&cat=$cat&eid=".$entry->id);
95  
-                         print_simple_box_end();
96  
-
97  
-     					print_footer();
98  
-
99  
-     	                redirect("view.php?id=$cm->id&currentview=$currentview&cat=$cat&eid=".$entry->id);
100  
-     	                die;
  76
+                    print_simple_box_start("center", "60%", "$THEME->cellheading");
  77
+                    echo "<p align=center><font size=3>$entryexported</font></p></font>";
  78
+
  79
+                    print_continue("view.php?id=$cm->id&eid=".$entry->id);
  80
+                    print_simple_box_end();
  81
+
  82
+     				print_footer();
  83
+
  84
+     	            redirect("view.php?id=$cm->id&eid=".$entry->id);
  85
+     	            die;
101 86
 				}
102 87
 			} else {
103 88
 			    print_simple_box_start("center", "60%", "#FFBBBB");
104 89
 			    echo "<p align=center><font size=3>$entryalreadyexist</font></p></font>";
105 90
 				echo "<p align=center>";
106 91
 
107  
-				print_continue("view.php?id=$cm->id&currentview=$currentview&cat=$cat&eid=".$entry->id);
  92
+				print_continue("view.php?id=$cm->id&eid=".$entry->id);
108 93
 
109 94
 			    print_simple_box_end();
110 95
 			}
@@ -113,7 +98,7 @@
113 98
 	    	print_simple_box_start("center", "60%", "#FFBBBB");
114 99
 	    	echo "<p align=center><font size=3>A weird error was found while trying to export this entry. Operation cancelled.</font></p></font>";
115 100
 
116  
-			print_continue("view.php?id=$cm->id&currentview=$currentview&cat=$cat&eid=".$entry->id);
  101
+			print_continue("view.php?id=$cm->id&eid=".$entry->id);
117 102
 
118 103
 	    	print_simple_box_end();
119 104
 	}
69  mod/glossary/lib.php
@@ -217,19 +217,39 @@ function glossary_print_entry_by_default($course, $cm, $glossary, $entry,$curren
217 217
 function glossary_print_entry_icons($course, $cm, $glossary, $entry,$currentview="",$cat="") {
218 218
     global $THEME, $USER;
219 219
 
220  
-	  if (isteacher($course->id) or $glossary->studentcanpost and $entry->userid == $USER->id) {
  220
+    $ImportedEntry = ($entry->sourceglossaryid == $glossary->id);
  221
+    $IsTeacher = isteacher($course->id);
  222
+    $IsMainGlossary = $glossary->mainglossary;
  223
+    
  224
+	if ($IsTeacher or $glossary->studentcanpost and $entry->userid == $USER->id) {
221 225
  	  	echo "<p align=right>";
222  
-		if (isteacher($course->id) and !$glossary->mainglossary) {
  226
+ 	  	// only teachers can export entries so check it out
  227
+		if ($IsTeacher and !$IsMainGlossary and !$ImportedEntry) {
223 228
 			$mainglossary = get_record("glossary","mainglossary",1,"course",$course->id);
224  
-			if ( $mainglossary ) {
225  
-
226  
-				echo "<a href=\"exportentry.php?id=$cm->id&entry=$entry->id&currentview=$currentview&cat=$cat\"><img  alt=\"" . get_string("exporttomainglossary","glossary") . "\"src=\"export.gif\" height=11 width=11 border=0></a> ";
  229
+			if ( $mainglossary ) {  // if there is a main glossary defined, allow to export the current entry
  230
+				
  231
+                echo "<a href=\"exportentry.php?id=$cm->id&entry=$entry->id&currentview=$currentview&cat=$cat\"><img  alt=\"" . get_string("exporttomainglossary","glossary") . "\"src=\"export.gif\" height=11 width=11 border=0></a> ";
227 232
 
228 233
 			}
229 234
 		}
230  
-		echo "<a href=\"deleteentry.php?id=$cm->id&mode=delete&entry=$entry->id&currentview=$currentview&cat=$cat\"><img  alt=\"" . get_string("delete") . "\"src=\"../../pix/t/delete.gif\" height=11 width=11 border=0></a> ";
231  
-	  	echo "<a href=\"edit.php?id=$cm->id&e=$entry->id&currentview=$currentview&cat=$cat\"><img  alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
232  
-	  }
  235
+		
  236
+        if ( $entry->sourceglossaryid ) {
  237
+            $icon = "minus.gif";   // graphical metaphor (minus) for deleting an imported entry
  238
+        } else {
  239
+            $icon = "../../pix/t/delete.gif";
  240
+        }
  241
+
  242
+		// Exported entries can be updated/deleted only by teachers in the main glossary
  243
+        if ( !$ImportedEntry and ($IsTeacher or !$IsMainGlossary) ) {
  244
+            echo "<a href=\"deleteentry.php?id=$cm->id&mode=delete&entry=$entry->id&currentview=$currentview&cat=$cat\"><img  alt=\"" . get_string("delete") . "\"src=\"";
  245
+            echo $icon;
  246
+            echo "\" height=11 width=11 border=0></a> ";
  247
+            
  248
+            echo "<a href=\"edit.php?id=$cm->id&e=$entry->id&currentview=$currentview&cat=$cat\"><img  alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
  249
+        } elseif ( $ImportedEntry ) {
  250
+            echo "<font size=-1>" . get_string("exportedentry","glossary") . "</font>";
  251
+        }
  252
+	}
233 253
 }
234 254
 
235 255
 function glossary_search_entries($searchterms, $glossary, $includedefinition) {
@@ -298,7 +318,7 @@ function glossary_search_entries($searchterms, $glossary, $includedefinition) {
298 318
     $selectsql = "{$CFG->prefix}glossary_entries e,
299 319
                   {$CFG->prefix}glossary g $onlyvisibletable
300 320
              WHERE ($conceptsearch OR $definitionsearch)
301  
-               AND e.glossaryid = g.id $onlyvisible
  321
+               AND (e.glossaryid = g.id or e.sourceglossaryid = g.id) $onlyvisible
302 322
 		   AND g.id = $glossary->id";
303 323
 
304 324
     $totalcount = count_records_sql("SELECT COUNT(*) FROM $selectsql");
@@ -499,7 +519,7 @@ function glossary_print_attachments($entry, $return=NULL) {
499 519
     return $imagereturn;
500 520
 }
501 521
 
502  
-function print_tabbed_table_start($data, $CurrentTab, $tTHEME = NULL) {
  522
+function glossary_print_tabbed_table_start($data, $CurrentTab, $tTHEME = NULL) {
503 523
 
504 524
 if ( !$tTHEME ) {
505 525
      global $THEME;
@@ -522,19 +542,22 @@ function print_tabbed_table_start($data, $CurrentTab, $tTHEME = NULL) {
522 542
 
523 543
 ?>
524 544
   <center>
525  
-  <table border="0" cellpadding="0" cellspacing="0" width="<? p($TableWidth) ?>">
  545
+  <table border="0" cellpadding="0" cellspacing="0" width="<?php p($TableWidth) ?>">
526 546
     <tr>
527 547
       <td width="100%">
528 548
 
529 549
       <table border="0" cellpadding="0" cellspacing="0" width="100%">
530 550
 
531  
-<?
  551
+<?php
532 552
 $TabProccessed = 0;
533 553
 for ($row = 0; $row < $NumRows; $row++) {
534 554
      echo "<tr>\n";
535 555
      if ( $row != $CurrentRow ) {
536 556
           for ($col = 0; $col < $TabsPerRow; $col++) {
537 557
                if ( $TabProccessed < $Tabs ) {
  558
+                    if ( $col == 0 ) {
  559
+                        echo "<td width=\"$TabSeparation\" align=\"center\">&nbsp;</td>";
  560
+                    }
538 561
                     if ($TabProccessed == $CurrentTab) {
539 562
                          $CurrentColor = $CurrentTabColor;
540 563
                     } else {
@@ -569,6 +592,9 @@ function print_tabbed_table_start($data, $CurrentTab, $tTHEME = NULL) {
569 592
           $TabProccessed = $FirstTabInCurrentRow;
570 593
           for ($col = 0; $col < $TabsPerRow; $col++) {
571 594
                if ( $TabProccessed < $Tabs ) {
  595
+                    if ( $col == 0 ) {
  596
+                        echo "<td width=\"$TabSeparation\" align=\"center\">&nbsp;</td>";
  597
+                    }
572 598
                     if ($TabProccessed == $CurrentTab) {
573 599
                          $CurrentColor = $CurrentTabColor;
574 600
                     } else {
@@ -607,15 +633,15 @@ function print_tabbed_table_start($data, $CurrentTab, $tTHEME = NULL) {
607 633
       </td>
608 634
     </tr>
609 635
     <tr>
610  
-      <td width="100%" bgcolor="<? p($TableColor) ?>"><hr></td>
  636
+      <td width="100%" bgcolor="<?php p($TableColor) ?>"><hr></td>
611 637
     </tr>
612 638
     <tr>
613  
-      <td width="100%" bgcolor="<? p($TableColor) ?>">
  639
+      <td width="100%" bgcolor="<?php p($TableColor) ?>">
614 640
           <center>
615  
-<?
  641
+<?php
616 642
 }
617 643
 
618  
-function print_tabbed_table_end() {
  644
+function glossary_print_tabbed_table_end() {
619 645
      echo "</center><p></td></tr></table></center>";
620 646
 }
621 647
 
@@ -722,4 +748,15 @@ function glossary_print_categories_menu($course, $cm, $glossary, $cat, $category
722 748
      echo "<tr><td colspan=3><hr></td></tr>";
723 749
      echo "</table>";
724 750
 }
  751
+
  752
+function glossary_sort_entries ( $entry0, $entry1 ) {
  753
+    if ( strtolower(ltrim($entry0->concept)) < strtolower(ltrim($entry1->concept)) ) {
  754
+        return -1;
  755
+    } elseif ( strtolower(ltrim($entry0->concept)) > strtolower(ltrim($entry1->concept)) ) {
  756
+        return 1;
  757
+    } else {
  758
+        return 0;
  759
+    }
  760
+}
  761
+
725 762
 ?>
BIN  mod/glossary/minus.gif
145  mod/glossary/mod.html
@@ -5,87 +5,92 @@
5 5
 <CENTER>
6 6
 <TABLE cellpadding=5>
7 7
 <TR valign=top>
8  
-    <TD align=right><P><B><? print_string("name") ?>:</B></P></TD>
  8
+    <TD align=right><P><B><?php print_string("name") ?>:</B></P></TD>
9 9
     <TD>
10  
-        <INPUT type="text" name="name" size=30 value="<? p($form->name) ?>">
  10
+        <INPUT type="text" name="name" size=30 value="<?php p($form->name) ?>">
11 11
     </TD>
12 12
 </TR>
13 13
 <!-- More rows go in here... -->
  14
+<?php
  15
+$mainglossary = get_record("glossary","mainglossary",1,"course",$form->course);
  16
+if (!$mainglossary or $mainglossary->id == $form->instance ) {
  17
+?>
14 18
 <TR valign=top>
15  
-    <TD align=right><P><B><? echo get_string("studentcanpost", "glossary") ?>:</B></P></TD>
  19
+    <TD align=right><P><B><?php echo get_string("glossarytype", "glossary") ?>:</B></P></TD>
16 20
     <TD>
17  
-  <select size="1" name="studentcanpost">
18  
-  <option value="1" <? 
19  
-   if ( $form->studentcanpost ) {
  21
+  <select size="1" name="mainglossary">
  22
+  <option value="1" <?php
  23
+   if ( $form->mainglossary ) {
20 24
       echo "selected";
21 25
    }
22  
-   ?>><? echo get_string("yes") ?></option>
23  
-  <option value="0" <? 
24  
-   if ( !$form->studentcanpost ) {
  26
+   ?>><?php echo get_string("mainglossary", "glossary") ?></option>
  27
+  <option value="0" <?php
  28
+   if ( !$form->mainglossary ) {
25 29
       echo "selected";
26 30
    }
27  
-   ?>><? echo get_string("no") ?>
  31
+   ?>><?php echo get_string("secondaryglossary", "glossary") ?>
28 32
   </option>
29  
-  </select> <? helpbutton("studentcanpost", get_string("studentcanpost", "glossary"), "glossary") ?>
  33
+  </select> <?php helpbutton("mainglossary", get_string("mainglossary", "glossary"), "glossary") ?>
30 34
     </TD>
31 35
 </TR>
  36
+<?php
  37
+} else {
  38
+	echo "<INPUT type=\"hidden\" name=mainglossary value=\"0\">";
  39
+}
  40
+?>
32 41
 <TR valign=top>
33  
-    <TD align=right><P><B><? echo get_string("allowduplicatedentries", "glossary") ?>:</B></P></TD>
  42
+    <TD align=right><P><B><?php p(get_string("studentcanpost", "glossary")) ?>:</B><br>
  43
+    <font size=1><?php p(get_string("warningstudentcapost","glossary")) ?></font></P></TD>
34 44
     <TD>
35  
-  <select size="1" name="allowduplicatedentries">
36  
-  <option value="1" <? 
37  
-   if ( $form->allowduplicatedentries ) {
  45
+  <select size="1" name="studentcanpost">
  46
+  <option value="1" <?php
  47
+   if ( $form->studentcanpost ) {
38 48
       echo "selected";
39 49
    }
40  
-   ?> 
41  
-   ><? echo get_string("yes") ?></option>
42  
-  <option value="0" <? 
43  
-   if ( !$form->allowduplicatedentries ) {
  50
+   ?>><?php echo get_string("yes") ?></option>
  51
+  <option value="0" <?php
  52
+   if ( !$form->studentcanpost ) {
44 53
       echo "selected";
45 54
    }
46  
-   ?>><? echo get_string("no") ?>
  55
+   ?>><?php echo get_string("no") ?>
47 56
   </option>
48  
-  </select> <? helpbutton("allowduplicatedentries", get_string("allowduplicatedentries", "glossary"), "glossary") ?>
  57
+  </select> <?php helpbutton("studentcanpost", get_string("studentcanpost", "glossary"), "glossary") ?>
49 58
     </TD>
50 59
 </TR>
51  
-<?
52  
-$mainglossary = get_record("glossary","mainglossary",1,"course",$form->course);
53  
-if (!$mainglossary or $mainglossary->id == $form->instance ) {
54  
-?>
55 60
 <TR valign=top>
56  
-    <TD align=right><P><B><? echo get_string("glossarytype", "glossary") ?>:</B></P></TD>
  61
+    <TD align=right><P><B><?php echo get_string("allowduplicatedentries", "glossary") ?>:</B></P></TD>
57 62
     <TD>
58  
-  <select size="1" name="mainglossary">
59  
-  <option value="1" <? 
60  
-   if ( $form->mainglossary ) {
  63
+  <select size="1" name="allowduplicatedentries">
  64
+  <option value="1" <?php
  65
+   if ( $form->allowduplicatedentries ) {
61 66
       echo "selected";
62 67
    }
63  
-   ?>><? echo get_string("mainglossary", "glossary") ?></option>
64  
-  <option value="0" <? 
65  
-   if ( !$form->mainglossary ) {
  68
+   ?> 
  69
+   ><?php echo get_string("yes") ?></option>
  70
+  <option value="0" <?php
  71
+   if ( !$form->allowduplicatedentries ) {
66 72
       echo "selected";
67 73
    }
68  
-   ?>><? echo get_string("secundaryglossary", "glossary") ?>
  74
+   ?>><?php echo get_string("no") ?>
69 75
   </option>
70  
-  </select> <? helpbutton("mainglossary", get_string("mainglossary", "glossary"), "glossary") ?>
  76
+  </select> <?php helpbutton("allowduplicatedentries", get_string("allowduplicatedentries", "glossary"), "glossary") ?>
71 77
     </TD>
72 78
 </TR>
73  
-<?
74  
-} else {
75  
-	echo "<INPUT type=\"hidden\" name=mainglossary value=\"0\">";
76  
-}
77  
-?>
78 79
 <TR valign=top>
79  
-    <TD align=right><P><B><? echo get_string("displayformat", "glossary") ?>:</B></P></TD>
  80
+<td colspan=2><hr>
  81
+</tr>
  82
+</tr>
  83
+<TR valign=top>
  84
+    <TD align=right><P><B><?php echo get_string("displayformat", "glossary") ?>:</B></P></TD>
80 85
     <TD>
81 86
   <select size="1" name="displayformat">
82  
-  <option value="0" <? 
  87
+  <option value="0" <?php
83 88
    if ( $form->displayformat == 0) {
84 89
       echo "selected";
85 90
    }
86  
-  ?>><? echo get_string("displayformatdefault", "glossary") ?></option>
  91
+  ?>><?php echo get_string("displayformatdefault", "glossary") ?></option>
87 92
 
88  
-<?
  93
+<?php
89 94
     global $CFG;
90 95
 
91 96
     $basedir = opendir("$CFG->dirroot/mod/glossary/formats");
@@ -112,75 +117,75 @@
112 117
 	
113 118
 ?>
114 119
 
115  
-    </select> <? helpbutton("displayformat", get_string("displayformat", "glossary"), "glossary") ?>
  120
+    </select> <?php helpbutton("displayformat", get_string("displayformat", "glossary"), "glossary") ?>
116 121
     </TD>
117 122
 </TR>
118 123
 <TR valign=top>
119  
-    <TD align=right><P><B><? echo get_string("showspecial", "glossary") ?>:</B></P></TD>
  124
+    <TD align=right><P><B><?php echo get_string("showspecial", "glossary") ?>:</B></P></TD>
120 125
     <TD>
121 126
   <select size="1" name="showspecial">
122  
-  <option value="1" <? 
  127
+  <option value="1" <?php
123 128
    if ( $form->showspecial ) {
124 129
       echo "selected";
125 130
    }
126 131
    ?> 
127  
-   ><? echo get_string("yes") ?></option>
128  
-  <option value="0" <? 
  132
+   ><?php echo get_string("yes") ?></option>
  133
+  <option value="0" <?php
129 134
    if ( !$form->showspecial ) {
130 135
       echo "selected";
131 136
    }
132  
-   ?>><? echo get_string("no") ?>
  137
+   ?>><?php echo get_string("no") ?>
133 138
   </option>
134  
-  </select> <? helpbutton("shows", get_string("showspecial", "glossary"), "glossary") ?>
  139
+  </select> <?php helpbutton("shows", get_string("showspecial", "glossary"), "glossary") ?>
135 140
     </TD>
136 141
 </TR>
137 142
 <TR valign=top>
138  
-    <TD align=right><P><B><? echo get_string("showalphabet", "glossary") ?>:</B></P></TD>
  143
+    <TD align=right><P><B><?php echo get_string("showalphabet", "glossary") ?>:</B></P></TD>
139 144
     <TD>
140 145
   <select size="1" name="showalphabet">
141  
-  <option value="1" <? 
  146
+  <option value="1" <?php
142 147
    if ( $form->showalphabet ) {
143 148
       echo "selected";
144 149
    }
145 150
    ?> 
146  
-   ><? echo get_string("yes") ?></option>
147  
-  <option value="0" <? 
  151
+   ><?php echo get_string("yes") ?></option>
  152
+  <option value="0" <?php
148 153
    if ( !$form->showalphabet ) {
149 154
       echo "selected";
150 155
    }
151  
-   ?>><? echo get_string("no") ?>
  156
+   ?>><?php echo get_string("no") ?>
152 157
   </option>
153  
-  </select> <? helpbutton("shows", get_string("showalphabet", "glossary"), "glossary") ?>
  158
+  </select> <?php helpbutton("shows", get_string("showalphabet", "glossary"), "glossary") ?>
154 159
     </TD>
155 160
 </TR>
156 161
 <TR valign=top>
157  
-    <TD align=right><P><B><? echo get_string("showall", "glossary") ?>:</B></P></TD>
  162
+    <TD align=right><P><B><?php echo get_string("showall", "glossary") ?>:</B></P></TD>
158 163
     <TD>
159 164
   <select size="1" name="showall">
160  
-  <option value="1" <? 
  165
+  <option value="1" <?php
161 166
    if ( $form->showall ) {
162 167
       echo "selected";
163 168
    }
164 169
    ?> 
165  
-   ><? echo get_string("yes") ?></option>
166  
-  <option value="0" <? 
  170
+   ><?php echo get_string("yes") ?></option>
  171
+  <option value="0" <?php
167 172
    if ( !$form->showall ) {
168 173
       echo "selected";
169 174
    }
170  
-   ?>><? echo get_string("no") ?>
  175
+   ?>><?php echo get_string("no") ?>
171 176
   </option>
172  
-  </select> <? helpbutton("shows", get_string("showall", "glossary"), "glossary") ?>
  177
+  </select> <?php helpbutton("shows", get_string("showall", "glossary"), "glossary") ?>
173 178
     </TD>
174 179
 </TR>
175 180
 </TABLE>
176 181
 <!-- These hidden variables are always the same -->
177  
-<INPUT type="hidden" name=course        value="<? p($form->course) ?>">
178  
-<INPUT type="hidden" name=coursemodule  value="<? p($form->coursemodule) ?>">
179  
-<INPUT type="hidden" name=section       value="<? p($form->section) ?>">
180  
-<INPUT type="hidden" name=module        value="<? p($form->module) ?>">
181  
-<INPUT type="hidden" name=modulename    value="<? p($form->modulename) ?>">
182  
-<INPUT type="hidden" name=instance      value="<? p($form->instance) ?>">
183  
-<INPUT type="hidden" name=mode          value="<? p($form->mode) ?>">
184  
-<INPUT type="submit" value="<? print_string("savechanges") ?>">
  182
+<INPUT type="hidden" name=course        value="<?php p($form->course) ?>">
  183
+<INPUT type="hidden" name=coursemodule  value="<?php p($form->coursemodule) ?>">
  184
+<INPUT type="hidden" name=section       value="<?php p($form->section) ?>">
  185
+<INPUT type="hidden" name=module        value="<?php p($form->module) ?>">
  186
+<INPUT type="hidden" name=modulename    value="<?php p($form->modulename) ?>">
  187
+<INPUT type="hidden" name=instance      value="<?php p($form->instance) ?>">
  188
+<INPUT type="hidden" name=mode          value="<?php p($form->mode) ?>">
  189
+<INPUT type="submit" value="<?php print_string("savechanges") ?>">
185 190
 </CENTER>