- Short tags are gone.
- Little changes in ES language.
$string['explainspecial'] = "<b>Special</b> will show all concepts that do not begin with a letter.<br>";
$string['explainalphabet'] = "Select the letter you want to look for.<p>";
$string['explainall'] = "<b>ALL</b> will show all entries in one page.";
+$string['exportedentry'] = "Exported entry";
$string['exporttomainglossary'] = "Export to main glossary";
$string['glossarytype'] = "Glossary Type";
$string['mainglossary'] = "Main glossary";
$string['noentry'] = "No entry found.";
$string['searchconcept'] = "Search:";
$string['searchindefinition'] = "Search in concept AND definitions?";
-$string['secundaryglossary'] = "Secondary glossary";
+$string['secondaryglossary'] = "Secondary glossary";
$string['showspecial'] = "Show 'Special' link";
$string['showalphabet'] = "Show alphabet";
$string['showall'] = "Show 'ALL' link";
$string['special'] = "Special";
$string['standardview'] = "Standard View";
$string['studentcanpost'] = "Students can add entries";
+$string['warningstudentcapost'] = "(This apply only if the glossary is not the main one)";
$string['writtenby'] = "By";
?>
<P>The system allows to export entries from any secondary glossary to the main one of the course.
<p>In order to do this, you should specify which glossary is the main one.
-<p>Note: You can have only one main glossary per course.
+<p>Note: You can have only one main glossary per course and its entries could be updated or deleted by teachers only.
<P ALIGN=CENTER><B>Students can post entries</B></P>
-<P>You can specify whether a user can or cannot add, edit or delete his/her own entries in this glossary.
-<p><b>Note:</b> A teacher can edit or delete any entry at any time.
\ No newline at end of file
+<P>You can specify whether a user can or cannot add, edit or delete his/her own entries.
+Entries exported to a main glossary can be updated or deleted by teachers only.
+<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.
<?PHP // $Id$
// glossary.php - created with Moodle 1.1 (2003082800)
-
-
$string['addentry'] = "Agregar entrada";
-$string['allcategories'] = "Todas las categorías";
$string['allentries'] = "TODAS";
+$string['allcategories'] = "Todas las categorías";
$string['allowduplicatedentries'] = "Permitir entradas duplicadas";
-$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";
-$string['areyousuredelete'] = "¿Está seguro que desea borrar esta entrada?";
+$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";
+$string['areyousuredelete'] = "¿Está seguro que desea borrarla?";
$string['attachment'] = "Adjunto";
-$string['back'] = "Atrás";
+$string['back'] = "Volver";
$string['categories'] = "Categorías";
+$string['categoryview'] = "Vista por Categoría";
$string['category'] = "Categoría";
-$string['categorydeleted'] = "Categoría borrada";
-$string['categoryview'] = "Por categoría";
+$string['categorydeleted'] = "Categoría eliminada";
$string['concept'] = "Concepto";
$string['concepts'] = "Conceptos";
$string['definition'] = "Definición";
$string['definitions'] = "Definiciones";
$string['deleteentry'] = "Borrar entrada";
-$string['deletingnoneemptycategory'] = "Borrar una categoría no borrará las entradas. Si desea borrar las entradas tendrá que hacerlo manualmente.";
-$string['displayformat'] = "¿Formato de muestra?";
-$string['displayformat1'] = "Completo con autor.";
-$string['displayformat2'] = "Completo sin autor.";
+$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.";
+$string['displayformat'] = "Formato de muestra de entradas";
$string['displayformatdefault'] = "Simple, estilo diccionario";
-$string['editcategories'] = "Editar categorías";
+$string['displayformat1'] = "Completo sin autor.";
+$string['displayformat2'] = "Completo con autor.";
$string['editentry'] = "Editar entrada";
+$string['editcategories'] = "Editar categorías";
$string['entries'] = "Entradas";
-$string['entrieswithoutcategory'] = "Entradas sin categorías";
+$string['entrieswithoutcategory'] = "Entradas sin categoría";
$string['entry'] = "Entrada";
$string['entryalreadyexist'] = "Esta entrada ya existe.";
$string['entrydeleted'] = "Entrada borrada.";
$string['entryexported'] = "Entrada exportada con éxito.";
-$string['explainall'] = "<b>Todas</b> mostrará todas las entradas en una página.";
-$string['explainalphabet'] = "Seleccione la letra inicial que usted desea buscar.<p> ";
-$string['explainspecial'] = "<b>Especial</b> mostrará todos los conceptos que no comienzan con una letra.<br>";
-$string['exporttomainglossary'] = "Exportar todo el glosario";
+$string['explainspecial'] = "<b>Especial</b> mostrará todos los conceptos que comiencen con símbolos.<br>";
+$string['explainalphabet'] = "Seleccione la letra que desea buscar.<p>";
+$string['explainall'] = "<b>TODAS</b> mostrará todas las entradas en una página.";
+$string['exporttomainglossary'] = "Exportar al glosario principal";
+$string['exportedentry'] = "Entrada exportada";
$string['glossarytype'] = "Tipo de glosario";
$string['mainglossary'] = "Glosario principal";
$string['modulename'] = "Glosario";
$string['modulenameplural'] = "Glosarios";
$string['newglossaryentries'] = "Nuevas entradas en el glosario:";
$string['nocategorized'] = "Sin categoría";
-$string['noentries'] = "No se encontraron entradas en esta sección";
+$string['noentries'] = "No se encontraro entradas en esta sección";
$string['noentry'] = "No se econtró ninguna entrada.";
$string['searchconcept'] = "Buscar:";
-$string['searchindefinition'] = "¿Buscar en conceptos Y definiciones?";
-$string['secundaryglossary'] = "Glosario secundario";
-$string['showall'] = "Mostrar el enlace 'Todas'";
-$string['showalphabet'] = "Mostrar el alfabeto";
-$string['showspecial'] = "Mostrar el enlace 'Especial'";
+$string['searchindefinition'] = "¿Buscar en conceptos y definiciones?";
+$string['secondaryglossary'] = "Glosario secundario";
+$string['showspecial'] = "Mostrar enlace 'Especial'";
+$string['showalphabet'] = "Mostrar alfabeto";
+$string['showall'] = "Mostrar enlace 'TODAS'";
$string['special'] = "Especial";
-$string['standardview'] = "Visualización estándar";
+$string['standardview'] = "Vista Normal";
$string['studentcanpost'] = "Los estudiantes pueden agregar entradas";
+$string['warningstudentcapost'] = "(Esto sólo aplica si el glosario no es principal)";
$string['writtenby'] = "Por";
?>
-<P ALIGN=CENTER><B>Es este el glosario principal del curso?</B></P>\r
-\r
-<P>El sistema permite exportar definiciones de los glosarios secundarios al glosario principal del sistema.\r
-<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.
\ No newline at end of file
+<P ALIGN=CENTER><B>Es este el glosario principal del curso?</B></P>
+
+<P>El sistema permite exportar definiciones de los glosarios secundarios al glosario principal del sistema.
+<p>Para hacer esto, usted debe especificar cual de los glosarios es el principal.
+<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.
-<P ALIGN=CENTER><B>Los estudiantes podrán agregar definiciones?</B></P>\r
-\r
-<P>Indique si desea que los estudiantes puedan o no agregar definiciones al glosario.\r
-\r
-<p>Si seleccionan que en efecto pueden hacerlo, el sistema le permitirá, además, modificar y eliminar sus propias definiciones.\r
+<P ALIGN=CENTER><B>Los estudiantes podrán agregar definiciones?</B></P>
+
+<P>Puede especificar si los estudiantes pueden o no agregar, modificar y eliminar sus propias definiciones al glosario.
+Las entradas exportadas a un glosario principal, sólo podrán ser editadas o borradas por un profesor.
+<p>Un profesor puede modificar o borrar cualquier entrada.
+<p>Esta variable no tiene efecto si el glosario es principal.
+
$status = true;
//Iterate over glossary table
- $glossaries = get_records ("glossary","course",$preferences->backup_course,"id");
+ $glossaries = get_records ("glossary","course",$preferences->backup_course,"mainglossary");
if ($glossaries) {
foreach ($glossaries as $glossary) {
//Start mod
fwrite ($bf,full_tag("GLOSSARYID",6,false,$glo_cat->glossaryid));
fwrite ($bf,full_tag("NAME",6,false,$glo_cat->name));
- $entries = get_records("glossary_entries_categories","categoryid",$glo_cat->id,"entryid");
+ $entries = get_records("glossary_entries_categories","categoryid",$glo_cat->id,"mainglossary");
if ($entries) {
$status =fwrite ($bf,start_tag("ENTRIES",6,true));
foreach ($entries as $entry) {
fwrite ($bf,full_tag("DEFINITION",6,false,$glo_ent->definition));
fwrite ($bf,full_tag("FORMAT",6,false,$glo_ent->format));
fwrite ($bf,full_tag("ATTACHMENT",6,false,$glo_ent->attachment));
+ fwrite ($bf,full_tag("SOURCEGLOSSARYID",6,false,$glo_ent->sourceglossaryid));
fwrite ($bf,full_tag("TIMECREATED",6,false,$glo_ent->timecreated));
fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$glo_ent->timemodified));
fwrite ($bf,full_tag("TEACHERENTRY",6,false,$glo_ent->teacherentry));
execute_sql("ALTER TABLE `{$CFG->prefix}glossary_entries_categories` DROP PRIMARY KEY ");
execute_sql("ALTER TABLE `{$CFG->prefix}glossary_entries_categories` ADD `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST");
}
+
+ if ( $oldversion < 2003092400 ) {
+ execute_sql( "ALTER TABLE `{$CFG->prefix}glossary_entries` " .
+ "ADD `sourceglossaryid` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `attachment` " );
+
+ }
return true;
}
timecreated int(10) unsigned NOT NULL default '0',
timemodified int(10) unsigned NOT NULL default '0',
teacherentry tinyint(2) unsigned NOT NULL default '0',
+ sourceglossaryid int(10) unsigned NOT NULL '0',
PRIMARY KEY (id)
) TYPE=MyISAM COMMENT='all glossary entries';
attachment varchar2(100) default '' not null,
timecreated number(10) default '0' not null,
timemodified number(10) default '0' not null,
- teacherentry number(2) default '0' not null
+ teacherentry number(2) default '0' not null,
+ sourceglossaryid number(10) default '0' not null
);
COMMENT on table prefix_glossary_entries is 'all glossary entries';
INSERT INTO prefix_log_display VALUES ('glossary', 'add', 'glossary', 'name');
INSERT INTO prefix_log_display VALUES ('glossary', 'update', 'glossary', 'name');
+INSERT INTO prefix_log_display VALUES ('glossary', 'delete', 'glossary', 'name');
INSERT INTO prefix_log_display VALUES ('glossary', 'view', 'glossary', 'name');
INSERT INTO prefix_log_display VALUES ('glossary', 'view all', 'glossary', 'name');
INSERT INTO prefix_log_display VALUES ('glossary', 'add entry', 'glossary', 'name');
INSERT INTO prefix_log_display VALUES ('glossary', 'update entry', 'glossary', 'name');
+INSERT INTO prefix_log_display VALUES ('glossary', 'delete entry', 'glossary', 'name');
+
+INSERT INTO prefix_log_display VALUES ('glossary', 'add category', 'glossary', 'name');
+INSERT INTO prefix_log_display VALUES ('glossary', 'update category', 'glossary', 'name');
+INSERT INTO prefix_log_display VALUES ('glossary', 'delete category', 'glossary', 'name');
timecreated int4 NOT NULL default '0',
timemodified int4 NOT NULL default '0',
teacherentry int2 NOT NULL default '0',
+ sourceglossaryid int4 NOT NULL default '0',
PRIMARY KEY(id)
);
require_variable($id); // course module ID
require_variable($mode); // edit or delete
optional_variable($go); // commit the operation?
- optional_variable($entry); // edit or delete
+ optional_variable($entry); // entry id
$strglossary = get_string("modulename", "glossary");
$strglossaries = get_string("modulenameplural", "glossary");
/// If data submitted, then process and store.
if ($mode == "edit" or $mode == "delete" ) {
- echo "<p>";
- if ( isteacher($cm->id) or $glossary->studentcanpost ) {
- if ($go) { // the operation was confirmed.
- if ( $mode == "delete") {
- glossary_delete_old_attachments($entry);
- delete_records("glossary_entries","id", $entry);
- print_simple_box_start("center","40%", "#FFBBBB");
- echo "<center>$entrydeleted"; //CAMBIAR
- echo "</center>";
- print_simple_box_end();
- }
- print_footer($course);
- add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id¤tview=$currentview&cat=$cat", $entry);
- redirect("view.php?id=$cm->id¤tview=$currentview&cat=$cat");
- } else { // the operation has not been confirmed yet so ask the user to do so
- if ( $mode == "delete") {
- print_simple_box_start("center","40%", "#FFBBBB");
- echo "<center><b>$entryfields->concept</b><br>$strareyousuredelete";
-
- ?>
- <form name="form" method="post" action="deleteentry.php">
-
- <input type="hidden" name=id value="<?php p($cm->id) ?>">
- <input type="hidden" name=mode value="delete">
- <input type="hidden" name=go value="1">
- <input type="hidden" name=entry value="<?php p($entry) ?>">
- <input type="hidden" name=currentview value=<? p($currentview) ?>>
- <input type="hidden" name=cat=<? p($cat) ?>>
-
- <input type="submit" value=" <?php print_string("yes")?> ">
- <input type=button value=" <?php print_string("no")?> " onclick="javascript:history.go(-1);">
-
- </form>
- </center>
- <?
- print_simple_box_end();
- }
- }
- } else {
- error("You are not allowed to edit or delete entries");
- }
- } else {
+ echo "<p>";
+ if ( isteacher($cm->id) or $glossary->studentcanpost ) {
+ if ($go) { // the operation was confirmed.
+ if ( $mode == "delete") {
+ // if it is an imported entry, just delete the relation
+ $entry = get_record("glossary_entries","id", $entry);
+ if ( $entry->sourceglossaryid ) {
+ $entry->glossaryid = $entry->sourceglossaryid;
+ $entry->sourceglossaryid = 0;
+ if (! update_record("glossary_entries", $entry)) {
+ error("Could not update your glossary");
+ }
+ } else {
+ glossary_delete_old_attachments($entry->id);
+ delete_records("glossary_entries","id", $entry->id);
+ }
+
+ print_simple_box_start("center","40%", "#FFBBBB");
+ echo "<center>$entrydeleted"; //CAMBIAR
+ echo "</center>";
+ print_simple_box_end();
+ }
+ print_footer($course);
+ add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id¤tview=$currentview&cat=$cat", $entry);
+ redirect("view.php?id=$cm->id¤tview=$currentview&cat=$cat");
+ } else { // the operation has not been confirmed yet so ask the user to do so
+ if ( $mode == "delete") {
+ print_simple_box_start("center","40%", "#FFBBBB");
+ echo "<center><b>$entryfields->concept</b><br>$strareyousuredelete";
+
+ ?>
+ <form name="form" method="post" action="deleteentry.php">
+
+ <input type="hidden" name=id value="<?php p($cm->id) ?>">
+ <input type="hidden" name=mode value="delete">
+ <input type="hidden" name=go value="1">
+ <input type="hidden" name=entry value="<?php p($entry) ?>">
+ <input type="hidden" name=currentview value=<?php p($currentview) ?>>
+ <input type="hidden" name=cat=<?php p($cat) ?>>
+
+ <input type="submit" value=" <?php print_string("yes")?> ">
+ <input type=button value=" <?php print_string("no")?> " onclick="javascript:history.go(-1);">
+
+ </form>
+ </center>
+ <?php
+ print_simple_box_end();
+ }
+ }
+ } else {
+ error("You are not allowed to edit or delete entries");
+ }
}
print_footer($course);
?>
-<?
+<?php
global $CFG, $THEME;
require_once("../../config.php");
?>
<FORM name="theform" method="post" <?=$onsubmit ?> action="edit.php" enctype="multipart/form-data">
-<table class=generalbox cellpadding=5 bgcolor="<? p($THEME->cellheading)?>">
+<table class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
<tr valign=top>
<td align=right><p><b><?php echo get_string("concept","glossary") ?>:</b></p></td>
<td>
- <INPUT type="text" name="concept" size=30 value="<? p($form->concept) ?>">
+ <INPUT type="text" name="concept" size=30 value="<?php p($form->concept) ?>">
</td>
</tr>
<tr valign=top>
<td align=right><p><b><?php echo get_string("categories","glossary") ?>:</b></p></td>
<td>
- <?
+ <?php
$categories = get_records("glossary_categories","glossaryid",$glossary->id);
echo "<select size=\"6\" name=\"categories[]\" multiple=\"yes\">";
echo "<option value=0>" . get_string("nocategorized","glossary") . "</optioon>";
- foreach ( $categories as $category ) {
- echo " <option ";
+ if ( $categories ) {
+ foreach ( $categories as $category ) {
+ echo " <option ";
- if ( record_exists("glossary_entries_categories","entryid",$entry->id,"categoryid",$category->id) ) {
- echo "selected " ;
- }
- echo "value=\"$category->id\">$category->name</option>\n";
+ if ( record_exists("glossary_entries_categories","entryid",$entry->id,"categoryid",$category->id) ) {
+ echo "selected " ;
+ }
+ echo "value=\"$category->id\">$category->name</option>\n";
+ }
}
?>
</select>
</td>
</tr>
<tr valign=top>
- <td align=right><p><b><? echo get_string("definition","glossary") ?>:</b></p>
+ <td align=right><p><b><?php echo get_string("definition","glossary") ?>:</b></p>
<font size="1">
<?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
<tr>
<td colspan=2>
<p align=center>
- <? if ($entry->id) {
+ <?php if ($entry->id) {
echo "<input type=\"hidden\" name=entry value=\"$entry->id\">";
}
?>
<input type="hidden" name=currentview value="<?=$currentview ?>">
<input type="hidden" name=cat value="<?=$cat ?>">
- <input type="submit" value="<? print_string("savechanges") ?>">
- <input type="reset" value="<? print_string("revert") ?>">
+ <input type="submit" value="<?php print_string("savechanges") ?>">
+ <input type="reset" value="<?php print_string("revert") ?>">
</P>
</td>
</tr>
$newentry->timecreated = time();
$newentry->timemodified = time();
$newentry->teacherentry = isteacher($course->id,$USER->id);
+ $newentry->sourceglossaryid = 0;
$PermissionGranted = 1;
if ( !$glossary->allowduplicatedentries ) {
- $dupentries = get_record("glossary_entries","UCASE(concept)", strtoupper($newentry->concept));
+ $dupentries = get_record("glossary_entries","UCASE(concept)", strtoupper($newentry->concept), "glossaryid", $glossary->id);
if ($dupentries) {
$PermissionGranted = 0;
}
-<?
+<?PHP
global $CFG, $THEME;
require_once("../../config.php");
?>
<FORM name="form" method="post" <?=$onsubmit ?> action="editcategories.php">
-<table class=generalbox cellpadding=5 bgcolor="<? p($THEME->cellheading)?>">
+<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>
<td>
<input type="hidden" name=id value="<?=$cm->id ?>">
<input type="hidden" name=action value="<?=$action?>">
<input type="hidden" name=confirm value=1>
- <input type="hidden" name=cat value=<? p($cat) ?>>
- <input type="submit" value="<? print_string("savechanges") ?>">
- <input type="reset" value="<? print_string("back","glossary") ?>" onclick="javascript:history.go(-1);">
+ <input type="hidden" name=cat value=<?php p($cat) ?>>
+ <input type="submit" value="<?php print_string("savechanges") ?>">
+ <input type="reset" value="<?php print_string("back","glossary") ?>" onclick="javascript:history.go(-1);">
</P>
</td>
</tr>
$CategoryObject->name = $name;
if ( !update_record("glossary_categories", $CategoryObject) ) {
- error("Weird error. The category was not updated.");
-
- redirect("editcategories.php?id=$cm->id");
+ error("Weird error. The category was not updated.");
+ redirect("editcategories.php?id=$cm->id");
+ } else {
+ add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $cat);
}
-
} else {
echo "<p align=\"center\">" . get_string("edit"). " " . get_string("category","glossary") . "<font size=\"3\">";
} elseif ( $action == "delete" ) {
if ( $confirm ) {
- delete_records("glossary_entries_categories","categoryid", $cat);
+ delete_records("glossary_entries_categories","categoryid", $cat);
delete_records("glossary_categories","id", $cat);
- print_simple_box_start("center","40%", "#FFBBBB");
- echo "<center>" . get_string("categorydeleted","glossary") ."</center>";
- echo "</center>";
- print_simple_box_end();
+ print_simple_box_start("center","40%", "#FFBBBB");
+ echo "<center>" . get_string("categorydeleted","glossary") ."</center>";
+ echo "</center>";
+ print_simple_box_end();
print_footer($course);
add_to_log($course->id, "glossary", "delete category", "editcategories.php?id=$cm->id", $cat);
- redirect("editcategories.php?id=$cm->id");
+ redirect("editcategories.php?id=$cm->id");
} else {
echo "<p align=\"center\">" . get_string("delete"). " " . get_string("category","glossary") . "<font size=\"3\">";
- print_simple_box_start("center","40%", "#FFBBBB");
- echo "<center><b>$category->name</b><br>";
+ print_simple_box_start("center","40%", "#FFBBBB");
+ echo "<center><b>$category->name</b><br>";
- $num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
+ $num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
if ( $num_entries ) {
print_string("deletingnoneemptycategory","glossary");
}
<input type="submit" value=" <?php print_string("yes")?> ">
</form>
</td><td align=left width=50%>
- <?
+ <?php
unset($options);
$options = array ("id" => $id);
print_single_button("editcategories.php", $options, get_string("no") );
echo "</td></tr></table>";
- echo "</center>";
- print_simple_box_end();
+ echo "</center>";
+ print_simple_box_end();
}
}
} elseif ( $action == "add" ) {
if ( $confirm ) {
- $dupcategory = get_record("glossary_categories","lcase(name)",strtolower($name));
+ $dupcategory = get_record("glossary_categories","lcase(name)",strtolower($name),"glossaryid",$glossary->id);
if ( $dupcategory ) {
echo "<p align=\"center\">" . get_string("add"). " " . get_string("category","glossary") . "<font size=\"3\">";
- print_simple_box_start("center","40%", "#FFBBBB");
- echo "<center>" . get_string("duplicatedcategory","glossary") ."</center>";
- echo "</center>";
- print_simple_box_end();
+ print_simple_box_start("center","40%", "#FFBBBB");
+ echo "<center>" . get_string("duplicatedcategory","glossary") ."</center>";
+ echo "</center>";
+ print_simple_box_end();
print_footer($course);
- redirect("editcategories.php?id=$cm->id&action=add&&name=$name");
+ redirect("editcategories.php?id=$cm->id&action=add&&name=$name");
} else {
$action = "";
$CategoryObject->glossaryid = $glossary->id;
if ( ! $CategoryObject->id = insert_record("glossary_categories", $CategoryObject) ) {
- error("Weird error. The category was not inserted.");
+ error("Weird error. The category was not inserted.");
- redirect("editcategories.php?id=$cm->id");
+ redirect("editcategories.php?id=$cm->id");
} else {
- add_to_log($course->id, "glossary", "add category", "editcategories.php?id=$cm->id", $cat);
+ add_to_log($course->id, "glossary", "add category", "editcategories.php?id=$cm->id", $CategoryObject->id);
}
}
} else {
}
if ( $action ) {
-
print_footer();
die;
}
?>
-<p align="center"><? p(get_string("edit")) ?> <? p(get_string("categories","glossary")) ?><font size="3">
+<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">
-<table width="40%" class=generalbox cellpadding=5 bgcolor="<? p($THEME->cellheading)?>">
+<table width="40%" class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
<tr>
<td width="90%" align="center"><b>
- <? p(get_string("categories","glossary")) ?></b></td>
+ <?php p(get_string("categories","glossary")) ?></b></td>
<td width="10%" align="center"><b>
- <? p(get_string("action")) ?></b></td>
+ <?php p(get_string("action")) ?></b></td>
</tr>
- <tr><td width=100% colspan=2 bgcolor="<? p($THEME->cellheading2)?>">
+ <tr><td width=100% colspan=2 bgcolor="<?php p($THEME->cellheading2)?>">
<table width=100%>
-<?
+<?php
$categories = get_records("glossary_categories","glossaryid",$glossary->id,"name ASC");
if ( $categories ) {
foreach ($categories as $category) {
$num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
?>
- <tr bgcolor="<? p($THEME->cellheading2)?>">
+ <tr bgcolor="<?php p($THEME->cellheading2)?>">
<td width="90%" align="left">
- <?
+ <?php
echo "<b>$category->name</b> <font size=-1>($num_entries " . get_string("entries","glossary") . ")</font>";
?>
</td>
<td width="10%" align="center"><b>
- <?
+ <?php
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> ";
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>";
?>
</b></td>
</tr>
- <?
+ <?php
}
}
?>
</td>
<tr>
- <td width=100% colspan=2 align=center bgcolor="<? p($THEME->cellheading2)?>">
- <?
+ <td width=100% colspan=2 align=center bgcolor="<?php p($THEME->cellheading2)?>">
+ <?php
$options['id'] = $cm->id;
$options['action'] = "add";
</form>
-<? print_footer() ?>
+<?php print_footer() ?>
-<?
+<?PHP
require_once("../../config.php");
require_once("lib.php");
}
}
if ( $PermissionGranted ) {
- $newentry->userid = $entry->userid;
- $newentry->glossaryid = $mainglossary->id;
- $newentry->concept = $entry->concept;
- $newentry->definition = $entry->definition;
- $newentry->format = $entry->format;
- $newentry->timecreated = $entry->timecreated;
- $newentry->timemodified = $entry->timemodified;
- $newentry->teacherentry = $entry->teacherentry;
- $newentry->attachment = $entry->attachment;
-
- if (! $newentry->id = insert_record("glossary_entries", $newentry) ) {
+
+ $entry->glossaryid = $mainglossary->id;
+ $entry->sourceglossaryid = $glossary->id;
+
+ if (! update_record("glossary_entries", $entry)) {
error("Could not export the entry to the main glossary");
} else {
- print_simple_box_start("center", "60%", "$THEME->cellheading");
- echo "<p align=center><font size=3>$entryexported</font></p></font>";
- if ($newentry->attachment) {
- $entry->course = $cm->course;
- $newentry->course = $cm->course;
- if ( !glossary_copy_attachments($entry, $newentry) ) {
- echo "<p align=\"center\">However, the attachment couldn't be exported.";
- }
- }
-
- add_to_log($course->id, "glossary", "add entry", "view.php?id=$cm->id¤tview=$currentview&cat=$cat&eid=".$entry->id, "$newentry->id");
-
- print_continue("view.php?id=$cm->id¤tview=$currentview&cat=$cat&eid=".$entry->id);
- print_simple_box_end();
-
- print_footer();
-
- redirect("view.php?id=$cm->id¤tview=$currentview&cat=$cat&eid=".$entry->id);
- die;
+ print_simple_box_start("center", "60%", "$THEME->cellheading");
+ echo "<p align=center><font size=3>$entryexported</font></p></font>";
+
+ print_continue("view.php?id=$cm->id&eid=".$entry->id);
+ print_simple_box_end();
+
+ print_footer();
+
+ redirect("view.php?id=$cm->id&eid=".$entry->id);
+ die;
}
} else {
print_simple_box_start("center", "60%", "#FFBBBB");
echo "<p align=center><font size=3>$entryalreadyexist</font></p></font>";
echo "<p align=center>";
- print_continue("view.php?id=$cm->id¤tview=$currentview&cat=$cat&eid=".$entry->id);
+ print_continue("view.php?id=$cm->id&eid=".$entry->id);
print_simple_box_end();
}
print_simple_box_start("center", "60%", "#FFBBBB");
echo "<p align=center><font size=3>A weird error was found while trying to export this entry. Operation cancelled.</font></p></font>";
- print_continue("view.php?id=$cm->id¤tview=$currentview&cat=$cat&eid=".$entry->id);
+ print_continue("view.php?id=$cm->id&eid=".$entry->id);
print_simple_box_end();
}
function glossary_print_entry_icons($course, $cm, $glossary, $entry,$currentview="",$cat="") {
global $THEME, $USER;
- if (isteacher($course->id) or $glossary->studentcanpost and $entry->userid == $USER->id) {
+ $ImportedEntry = ($entry->sourceglossaryid == $glossary->id);
+ $IsTeacher = isteacher($course->id);
+ $IsMainGlossary = $glossary->mainglossary;
+
+ if ($IsTeacher or $glossary->studentcanpost and $entry->userid == $USER->id) {
echo "<p align=right>";
- if (isteacher($course->id) and !$glossary->mainglossary) {
+ // only teachers can export entries so check it out
+ if ($IsTeacher and !$IsMainGlossary and !$ImportedEntry) {
$mainglossary = get_record("glossary","mainglossary",1,"course",$course->id);
- if ( $mainglossary ) {
-
- echo "<a href=\"exportentry.php?id=$cm->id&entry=$entry->id¤tview=$currentview&cat=$cat\"><img alt=\"" . get_string("exporttomainglossary","glossary") . "\"src=\"export.gif\" height=11 width=11 border=0></a> ";
+ if ( $mainglossary ) { // if there is a main glossary defined, allow to export the current entry
+
+ echo "<a href=\"exportentry.php?id=$cm->id&entry=$entry->id¤tview=$currentview&cat=$cat\"><img alt=\"" . get_string("exporttomainglossary","glossary") . "\"src=\"export.gif\" height=11 width=11 border=0></a> ";
}
}
- echo "<a href=\"deleteentry.php?id=$cm->id&mode=delete&entry=$entry->id¤tview=$currentview&cat=$cat\"><img alt=\"" . get_string("delete") . "\"src=\"../../pix/t/delete.gif\" height=11 width=11 border=0></a> ";
- echo "<a href=\"edit.php?id=$cm->id&e=$entry->id¤tview=$currentview&cat=$cat\"><img alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
- }
+
+ if ( $entry->sourceglossaryid ) {
+ $icon = "minus.gif"; // graphical metaphor (minus) for deleting an imported entry
+ } else {
+ $icon = "../../pix/t/delete.gif";
+ }
+
+ // Exported entries can be updated/deleted only by teachers in the main glossary
+ if ( !$ImportedEntry and ($IsTeacher or !$IsMainGlossary) ) {
+ echo "<a href=\"deleteentry.php?id=$cm->id&mode=delete&entry=$entry->id¤tview=$currentview&cat=$cat\"><img alt=\"" . get_string("delete") . "\"src=\"";
+ echo $icon;
+ echo "\" height=11 width=11 border=0></a> ";
+
+ echo "<a href=\"edit.php?id=$cm->id&e=$entry->id¤tview=$currentview&cat=$cat\"><img alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
+ } elseif ( $ImportedEntry ) {
+ echo "<font size=-1>" . get_string("exportedentry","glossary") . "</font>";
+ }
+ }
}
function glossary_search_entries($searchterms, $glossary, $includedefinition) {
$selectsql = "{$CFG->prefix}glossary_entries e,
{$CFG->prefix}glossary g $onlyvisibletable
WHERE ($conceptsearch OR $definitionsearch)
- AND e.glossaryid = g.id $onlyvisible
+ AND (e.glossaryid = g.id or e.sourceglossaryid = g.id) $onlyvisible
AND g.id = $glossary->id";
$totalcount = count_records_sql("SELECT COUNT(*) FROM $selectsql");
return $imagereturn;
}
-function print_tabbed_table_start($data, $CurrentTab, $tTHEME = NULL) {
+function glossary_print_tabbed_table_start($data, $CurrentTab, $tTHEME = NULL) {
if ( !$tTHEME ) {
global $THEME;
?>
<center>
- <table border="0" cellpadding="0" cellspacing="0" width="<? p($TableWidth) ?>">
+ <table border="0" cellpadding="0" cellspacing="0" width="<?php p($TableWidth) ?>">
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
-<?
+<?php
$TabProccessed = 0;
for ($row = 0; $row < $NumRows; $row++) {
echo "<tr>\n";
if ( $row != $CurrentRow ) {
for ($col = 0; $col < $TabsPerRow; $col++) {
if ( $TabProccessed < $Tabs ) {
+ if ( $col == 0 ) {
+ echo "<td width=\"$TabSeparation\" align=\"center\"> </td>";
+ }
if ($TabProccessed == $CurrentTab) {
$CurrentColor = $CurrentTabColor;
} else {
$TabProccessed = $FirstTabInCurrentRow;
for ($col = 0; $col < $TabsPerRow; $col++) {
if ( $TabProccessed < $Tabs ) {
+ if ( $col == 0 ) {
+ echo "<td width=\"$TabSeparation\" align=\"center\"> </td>";
+ }
if ($TabProccessed == $CurrentTab) {
$CurrentColor = $CurrentTabColor;
} else {
</td>
</tr>
<tr>
- <td width="100%" bgcolor="<? p($TableColor) ?>"><hr></td>
+ <td width="100%" bgcolor="<?php p($TableColor) ?>"><hr></td>
</tr>
<tr>
- <td width="100%" bgcolor="<? p($TableColor) ?>">
+ <td width="100%" bgcolor="<?php p($TableColor) ?>">
<center>
-<?
+<?php
}
-function print_tabbed_table_end() {
+function glossary_print_tabbed_table_end() {
echo "</center><p></td></tr></table></center>";
}
echo "<tr><td colspan=3><hr></td></tr>";
echo "</table>";
}
+
+function glossary_sort_entries ( $entry0, $entry1 ) {
+ if ( strtolower(ltrim($entry0->concept)) < strtolower(ltrim($entry1->concept)) ) {
+ return -1;
+ } elseif ( strtolower(ltrim($entry0->concept)) > strtolower(ltrim($entry1->concept)) ) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
?>
<CENTER>
<TABLE cellpadding=5>
<TR valign=top>
- <TD align=right><P><B><? print_string("name") ?>:</B></P></TD>
+ <TD align=right><P><B><?php print_string("name") ?>:</B></P></TD>
<TD>
- <INPUT type="text" name="name" size=30 value="<? p($form->name) ?>">
+ <INPUT type="text" name="name" size=30 value="<?php p($form->name) ?>">
</TD>
</TR>
<!-- More rows go in here... -->
+<?php
+$mainglossary = get_record("glossary","mainglossary",1,"course",$form->course);
+if (!$mainglossary or $mainglossary->id == $form->instance ) {
+?>
<TR valign=top>
- <TD align=right><P><B><? echo get_string("studentcanpost", "glossary") ?>:</B></P></TD>
+ <TD align=right><P><B><?php echo get_string("glossarytype", "glossary") ?>:</B></P></TD>
<TD>
- <select size="1" name="studentcanpost">
- <option value="1" <?
- if ( $form->studentcanpost ) {
+ <select size="1" name="mainglossary">
+ <option value="1" <?php
+ if ( $form->mainglossary ) {
echo "selected";
}
- ?>><? echo get_string("yes") ?></option>
- <option value="0" <?
- if ( !$form->studentcanpost ) {
+ ?>><?php echo get_string("mainglossary", "glossary") ?></option>
+ <option value="0" <?php
+ if ( !$form->mainglossary ) {
echo "selected";
}
- ?>><? echo get_string("no") ?>
+ ?>><?php echo get_string("secondaryglossary", "glossary") ?>
</option>
- </select> <? helpbutton("studentcanpost", get_string("studentcanpost", "glossary"), "glossary") ?>
+ </select> <?php helpbutton("mainglossary", get_string("mainglossary", "glossary"), "glossary") ?>
</TD>
</TR>
+<?php
+} else {
+ echo "<INPUT type=\"hidden\" name=mainglossary value=\"0\">";
+}
+?>
<TR valign=top>
- <TD align=right><P><B><? echo get_string("allowduplicatedentries", "glossary") ?>:</B></P></TD>
+ <TD align=right><P><B><?php p(get_string("studentcanpost", "glossary")) ?>:</B><br>
+ <font size=1><?php p(get_string("warningstudentcapost","glossary")) ?></font></P></TD>
<TD>
- <select size="1" name="allowduplicatedentries">
- <option value="1" <?
- if ( $form->allowduplicatedentries ) {
+ <select size="1" name="studentcanpost">
+ <option value="1" <?php
+ if ( $form->studentcanpost ) {
echo "selected";
}
- ?>
- ><? echo get_string("yes") ?></option>
- <option value="0" <?
- if ( !$form->allowduplicatedentries ) {
+ ?>><?php echo get_string("yes") ?></option>
+ <option value="0" <?php
+ if ( !$form->studentcanpost ) {
echo "selected";
}
- ?>><? echo get_string("no") ?>
+ ?>><?php echo get_string("no") ?>
</option>
- </select> <? helpbutton("allowduplicatedentries", get_string("allowduplicatedentries", "glossary"), "glossary") ?>
+ </select> <?php helpbutton("studentcanpost", get_string("studentcanpost", "glossary"), "glossary") ?>
</TD>
</TR>
-<?
-$mainglossary = get_record("glossary","mainglossary",1,"course",$form->course);
-if (!$mainglossary or $mainglossary->id == $form->instance ) {
-?>
<TR valign=top>
- <TD align=right><P><B><? echo get_string("glossarytype", "glossary") ?>:</B></P></TD>
+ <TD align=right><P><B><?php echo get_string("allowduplicatedentries", "glossary") ?>:</B></P></TD>
<TD>
- <select size="1" name="mainglossary">
- <option value="1" <?
- if ( $form->mainglossary ) {
+ <select size="1" name="allowduplicatedentries">
+ <option value="1" <?php
+ if ( $form->allowduplicatedentries ) {
echo "selected";
}
- ?>><? echo get_string("mainglossary", "glossary") ?></option>
- <option value="0" <?
- if ( !$form->mainglossary ) {
+ ?>
+ ><?php echo get_string("yes") ?></option>
+ <option value="0" <?php
+ if ( !$form->allowduplicatedentries ) {
echo "selected";
}
- ?>><? echo get_string("secundaryglossary", "glossary") ?>
+ ?>><?php echo get_string("no") ?>
</option>
- </select> <? helpbutton("mainglossary", get_string("mainglossary", "glossary"), "glossary") ?>
+ </select> <?php helpbutton("allowduplicatedentries", get_string("allowduplicatedentries", "glossary"), "glossary") ?>
</TD>
</TR>
-<?
-} else {
- echo "<INPUT type=\"hidden\" name=mainglossary value=\"0\">";
-}
-?>
<TR valign=top>
- <TD align=right><P><B><? echo get_string("displayformat", "glossary") ?>:</B></P></TD>
+<td colspan=2><hr>
+</tr>
+</tr>
+<TR valign=top>
+ <TD align=right><P><B><?php echo get_string("displayformat", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="displayformat">
- <option value="0" <?
+ <option value="0" <?php
if ( $form->displayformat == 0) {
echo "selected";
}
- ?>><? echo get_string("displayformatdefault", "glossary") ?></option>
+ ?>><?php echo get_string("displayformatdefault", "glossary") ?></option>
-<?
+<?php
global $CFG;
$basedir = opendir("$CFG->dirroot/mod/glossary/formats");
?>
- </select> <? helpbutton("displayformat", get_string("displayformat", "glossary"), "glossary") ?>
+ </select> <?php helpbutton("displayformat", get_string("displayformat", "glossary"), "glossary") ?>
</TD>
</TR>
<TR valign=top>
- <TD align=right><P><B><? echo get_string("showspecial", "glossary") ?>:</B></P></TD>
+ <TD align=right><P><B><?php echo get_string("showspecial", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="showspecial">
- <option value="1" <?
+ <option value="1" <?php
if ( $form->showspecial ) {
echo "selected";
}
?>
- ><? echo get_string("yes") ?></option>
- <option value="0" <?
+ ><?php echo get_string("yes") ?></option>
+ <option value="0" <?php
if ( !$form->showspecial ) {
echo "selected";
}
- ?>><? echo get_string("no") ?>
+ ?>><?php echo get_string("no") ?>
</option>
- </select> <? helpbutton("shows", get_string("showspecial", "glossary"), "glossary") ?>
+ </select> <?php helpbutton("shows", get_string("showspecial", "glossary"), "glossary") ?>
</TD>
</TR>
<TR valign=top>
- <TD align=right><P><B><? echo get_string("showalphabet", "glossary") ?>:</B></P></TD>
+ <TD align=right><P><B><?php echo get_string("showalphabet", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="showalphabet">
- <option value="1" <?
+ <option value="1" <?php
if ( $form->showalphabet ) {
echo "selected";
}
?>
- ><? echo get_string("yes") ?></option>
- <option value="0" <?
+ ><?php echo get_string("yes") ?></option>
+ <option value="0" <?php
if ( !$form->showalphabet ) {
echo "selected";
}
- ?>><? echo get_string("no") ?>
+ ?>><?php echo get_string("no") ?>
</option>
- </select> <? helpbutton("shows", get_string("showalphabet", "glossary"), "glossary") ?>
+ </select> <?php helpbutton("shows", get_string("showalphabet", "glossary"), "glossary") ?>
</TD>
</TR>
<TR valign=top>
- <TD align=right><P><B><? echo get_string("showall", "glossary") ?>:</B></P></TD>
+ <TD align=right><P><B><?php echo get_string("showall", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="showall">
- <option value="1" <?
+ <option value="1" <?php
if ( $form->showall ) {
echo "selected";
}
?>
- ><? echo get_string("yes") ?></option>
- <option value="0" <?
+ ><?php echo get_string("yes") ?></option>
+ <option value="0" <?php
if ( !$form->showall ) {
echo "selected";
}
- ?>><? echo get_string("no") ?>
+ ?>><?php echo get_string("no") ?>
</option>
- </select> <? helpbutton("shows", get_string("showall", "glossary"), "glossary") ?>
+ </select> <?php helpbutton("shows", get_string("showall", "glossary"), "glossary") ?>
</TD>
</TR>
</TABLE>
<!-- These hidden variables are always the same -->
-<INPUT type="hidden" name=course value="<? p($form->course) ?>">
-<INPUT type="hidden" name=coursemodule value="<? p($form->coursemodule) ?>">
-<INPUT type="hidden" name=section value="<? p($form->section) ?>">
-<INPUT type="hidden" name=module value="<? p($form->module) ?>">
-<INPUT type="hidden" name=modulename value="<? p($form->modulename) ?>">
-<INPUT type="hidden" name=instance value="<? p($form->instance) ?>">
-<INPUT type="hidden" name=mode value="<? p($form->mode) ?>">
-<INPUT type="submit" value="<? print_string("savechanges") ?>">
+<INPUT type="hidden" name=course value="<?php p($form->course) ?>">
+<INPUT type="hidden" name=coursemodule value="<?php p($form->coursemodule) ?>">
+<INPUT type="hidden" name=section value="<?php p($form->section) ?>">
+<INPUT type="hidden" name=module value="<?php p($form->module) ?>">
+<INPUT type="hidden" name=modulename value="<?php p($form->modulename) ?>">
+<INPUT type="hidden" name=instance value="<?php p($form->instance) ?>">
+<INPUT type="hidden" name=mode value="<?php p($form->mode) ?>">
+<INPUT type="submit" value="<?php print_string("savechanges") ?>">
</CENTER>
</FORM>
$entry->definition = backup_todb($ent_info['#']['DEFINITION']['0']['#']);
$entry->format = backup_todb($ent_info['#']['FORMAT']['0']['#']);
$entry->attachment = backup_todb($ent_info['#']['ATTACHMENT']['0']['#']);
+ $entry->sourceglossaryid = backup_todb($ent_info['#']['SOURCEGLOSSARYID']['0']['#']);
$entry->timecreated = backup_todb($ent_info['#']['TIMECREATED']['0']['#']);
$entry->timemodified = backup_todb($ent_info['#']['TIMEMODIFIED']['0']['#']);
$entry->teacherentry = backup_todb($ent_info['#']['TEACHERENTRY']['0']['#']);
+
//We have to recode the userid field
$user = backup_getid($restore->backup_unique_code,"user",$entry->userid);
if ($user) {
$entry->userid = $user->new_id;
- }
+ }
+ //We have to recode the sourceglossaryid field
+ $source = backup_getid($restore->backup_unique_code,"glossary",$entry->sourceglossaryid);
+ if ($source) {
+ $entry->sourceglossaryid = $source->new_id;
+ }
//If it's a teacher entry or userinfo was selected, restore the entry
if ($entry->teacherentry or $restore->mods['glossary']->userinfo) {
//The structure is equal to the db, so insert the glossary_entries
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2003092102; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2003092400; // The current module version (Date: YYYYMMDDXX)
$module->cron = 0; // Period for cron to check this module (secs)
-$release = "0.3.2 development"; // User-friendly version number
+$release = "0.4 development"; // User-friendly version number
?>
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
- $strglossaries = get_string("modulenameplural", "glossary");
- $strglossary = get_string("modulename", "glossary");
- $strallcategories= get_string("allcategories", "glossary");
- $straddentry = get_string("addentry", "glossary");
- $strnoentries = get_string("noentries", "glossary");
-
- print_header("$course->shortname: $glossary->name", "$course->fullname",
+ $strglossaries = get_string("modulenameplural", "glossary");
+ $strglossary = get_string("modulename", "glossary");
+ $strallcategories= get_string("allcategories", "glossary");
+ $straddentry = get_string("addentry", "glossary");
+ $strnoentries = get_string("noentries", "glossary");
+ print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
echo "<table width=100% border=0><tr><td width=50% align=right>";
?>
<form method="POST" action="view.php">
- <? p(get_string("searchconcept","glossary")) ?> <input type="text" name="search" size="20" value=""> <br><? p(get_string("searchindefinition","glossary")) ?> <input type="checkbox" name="includedefinition" value="1">
- <input type="submit" value="Search" name="searchbutton">
- <input type="hidden" name="id" value="<? p($cm->id) ?>">
+ <?php p(get_string("searchconcept","glossary")) ?> <input type="text" name="search" size="20" value=""> <br><?php p(get_string("searchindefinition","glossary")) ?> <input type="checkbox" name="includedefinition" value="1">
+ <input type="submit" value="<?php p(get_string("search")) ?>" name="searchbutton">
+ <input type="hidden" name="id" value="<?php p($cm->id) ?>">
</form>
- <?
+ <?php
echo "</td><td valign=top align=right width=50%>";
if (isteacher($course->id) or ($glossary->studentcanpost) and !isguest($course->id)) {
$options = array ("id" => "$cm->id");
} else {
$CurrentTab = 0;
}
- print_tabbed_table_start($data, $CurrentTab, $tCFG);
+ glossary_print_tabbed_table_start($data, $CurrentTab, $tCFG);
echo "<center>";
if ( $currentview ) {
glossary_print_categories_menu($course, $cm, $glossary, $cat, $category);
$allentries = get_records("glossary_entries", "id", $eid);
} elseif ( $currentview and $cat == 0 ) { // Browsing all categories
$sql = "SELECT gec.id gecid, gc.name, gc.id CID, ge.*
- FROM {$CFG->prefix}glossary_entries ge,
- {$CFG->prefix}glossary_entries_categories gec,
- {$CFG->prefix}glossary_categories gc
- WHERE ge.glossaryid = '$glossary->id' AND
- gec.entryid = ge.id AND
- gc.id = gec.categoryid
- ORDER BY gc.name, ge.concept";
+ FROM {$CFG->prefix}glossary_entries ge,
+ {$CFG->prefix}glossary_entries_categories gec,
+ {$CFG->prefix}glossary_categories gc
+ WHERE (ge.glossaryid = '$glossary->id' or ge.sourceglossaryid = '$glossary->id') AND
+ gec.entryid = ge.id AND
+ gc.id = gec.categoryid
+ ORDER BY gc.name, ge.concept";
$allentries = get_records_sql( $sql );
} else { // looking for terms that begin with a specify letter or entries with no category associated
- $allentries = get_records("glossary_entries", "glossaryid", $glossary->id,"concept ASC");
+ $ownentries = get_records("glossary_entries", "glossaryid", $glossary->id,"concept ASC");
+ $importedentries = get_records("glossary_entries", "sourceglossaryid", $glossary->id,"concept ASC");
+
+ if ( $ownentries and $importedentries ) {
+ $allentries = array_merge($ownentries, $importedentries);
+ usort($allentries, glossary_sort_entries);
+ } elseif ( $importedentries ) {
+ $allentries = $importedentries;
+ } elseif ( $ownentries ) {
+ $allentries = $ownentries;
+ }
}
if ( $allentries ) {
}
echo "</center>";
- print_tabbed_table_end();
+ glossary_print_tabbed_table_end();
/// Finish the page
print_footer($course);