" ADD `showall` TINYINT(2) UNSIGNED DEFAULT '1' NOT NULL AFTER `showalphabet` ");
}
- return true;
-}
+ if ( $oldversion < 2003091800 ) {
+
+ execute_sql("CREATE TABLE `{$CFG->prefix}glossary_categories` (
+ `id` INT(10) unsigned NOT NULL auto_increment,
+ `glossaryid` INT(10) UNSIGNED NOT NULL default '0',
+ `name` VARCHAR(255) NOT NULL default '',
+ PRIMARY KEY (`id`)
+ ) TYPE=MyISAM COMMENT='all categories for glossary entries'");
+
+ execute_sql("CREATE TABLE `{$CFG->prefix}glossary_entries_categories` (
+ `categoryid` INT(10) UNSIGNED NOT NULL default '1',
+ `entryid` INT(10) UNSIGNED NOT NULL default '0',
+ PRIMARY KEY (`categoryid`, `entryid`)
+ ) TYPE=MyISAM COMMENT='categories of each glossary entry'");
+
+ // creating a default category for every glossary
+ execute_sql("INSERT INTO `{$CFG->prefix}glossary_categories` (`glossaryid`, `name`)
+ SELECT `id`, '" . get_string("main","glossary") . "' FROM `{$CFG->prefix}glossary`");
+
+ // setting the default category for every entry.
+ execute_sql("INSERT INTO `{$CFG->prefix}glossary_entries_categories` (`categoryid`, `entryid`)
+ SELECT c.id, e.id
+ FROM `{$CFG->prefix}glossary_entries` e, `{$CFG->prefix}glossary_categories` c
+ WHERE e.glossaryid = c.glossaryid");
+ }
+
+ return true;
+}
?>
PRIMARY KEY (id)
) TYPE=MyISAM COMMENT='all glossary entries';
+#
+# Table structure for table `glossary_cageories`
+#
+
+CREATE TABLE prefix_glossary_categories (
+ id int(10) unsigned NOT NULL auto_increment,
+ glossaryid int(10) unsigned NOT NULL default '0',
+ name varchar(255) NOT NULL default '',
+ PRIMARY KEY (id)
+) TYPE=MyISAM COMMENT='all categories for glossary entries';
+
+#
+# Table structure for table `glossary_entries_category`
+#
+
+CREATE TABLE prefix_glossary_entries_categories (
+ categoryid int(10) unsigned NOT NULL default '1',
+ entryid int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (categoryid, entryid)
+) TYPE=MyISAM COMMENT='categories of each glossary entry';
+
#
# Dumping data for table `log_display`
#
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', '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');
+<?
+ global $CFG, $THEME;
+ require_once("../../config.php");
+?>
<FORM name="theform" method="post" <?=$onsubmit ?> action="edit.php" enctype="multipart/form-data">
-<table>
-<tr>
- <td align=right>
+<table class=generalbox cellpadding=5 bgcolor="<? 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) ?>">
+ </td>
+</tr>
+<tr valign=top>
+ <td align=right><p><b><? echo get_string("definition","glossary") ?>:</b></p>
<font size="1">
- <?PHP
+ <?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
} else {
- emoticonhelpbutton("theform", "text");
+ emoticonhelpbutton("form", "description");
}
?>
- <br />
+ <br />
</font>
</td>
-</tr>
-
-<tr>
- <td align=center>
- <? echo get_string("concept","glossary") ?>: <INPUT type="text" name="concept" size=30 value="<? p($form->concept) ?>">
- </td>
-</tr>
-<tr>
- <td align=center><p>
- <? echo get_string("definition","glossary").":" ?>
+ <td>
+ <?php
+ print_textarea($usehtmleditor, 20, 60, 680, 400, "text", $entry->text);
+
+ echo "<p align=right>";
+ helpbutton("textformat", get_string("helpformatting"));
+ print_string("formattexttype");
+ echo ": ";
+ if (!$form->format) {
+ $form->format = $defaultformat;
+ }
+ choose_from_menu(format_text_menu(), "format", $entry->format, "");
+ if ($entry->id) {
+ echo "<input type=\"hidden\" name=entry value=\"$entry->id\">";
+ }
+ echo "</p>";
+ ?>
</td>
</tr>
-
-</table>
-
-<? print_textarea($usehtmleditor, 20, 60, 630, 400, "text", $entry->text); ?>
-
-<p align=center>
-<?PHP
- print_string("formattexttype");
- echo ": ";
- choose_from_menu(format_text_menu(), "format", $entry->format, "");
- echo "<font size=\"1\">";
- helpbutton("textformat", get_string("helpformatting"));
- echo "</font>";
- if ($entry->id) {
- echo "<input type=\"hidden\" name=entry value=\"$entry->id\">";
- }
-?>
-</p>
-
-<table border=0>
<tr valign=top>
<td align=right><p><b><?php print_string("attachment", "glossary") ?>:<br \>(<?php print_string("optional") ?>) </b></p></td>
<td>
print_string("maxsize", "", display_size(get_max_upload_file_size()));
?>
</td>
-
+</tr>
+<tr>
+<td colspan=2>
+ <p align=center>
+ <input type="hidden" name=id value="<?=$cm->id ?>">
+ <input type="submit" value="<? print_string("savechanges") ?>">
+ <input type="reset" value="<? print_string("revert") ?>">
+ </P>
+</td>
</tr>
</table>
+</p>
+
-<p align=center>
-<input type="hidden" name=id value="<?=$cm->id ?>">
-<input type="submit" value="<? print_string("savechanges") ?>">
-<input type="reset" value="<? print_string("revert") ?>">
-</P>
</form>
<?PHP
// } else {
// $colour = $THEME->cellheading;
// }
- echo "<table width=70% border=0><tr><td>";
+ echo "<table width=95% border=0><tr><td>";
echo "\n<TABLE BORDER=1 CELLSPACING=0 width=100% valign=top cellpadding=10>";
$user = get_record("user", "id", $entry->userid);
$strby = get_string("writtenby","glossary");
- echo "<table width=70% border=0><tr><td>";
+ echo "<table width=95% border=0><tr><td>";
echo "\n<TABLE BORDER=1 CELLSPACING=0 valign=top cellpadding=10>";
} else {
$PermissionGranted = 1;
}
+
if ( $glossary->displayformat > 0 and $PermissionGranted ) {
glossary_print_entry_by_format($course, $cm, $glossary, $entry);
} else {
return $imagereturn;
}
+function print_tabbed_table_start($data, $CurrentTab, $tTHEME = NULL) {
+
+if ( !$tTHEME ) {
+ global $THEME;
+ $tTHEME = $THEME;
+}
+
+$TableColor = $tTHEME->TabTableBGColor;
+$TableWidth = $tTHEME->TabTableWidth;
+$CurrentTabColor = $tTHEME->ActiveTabColor;
+$TabColor = $tTHEME->InactiveTabColor;
+$TabsPerRow = $tTHEME->TabsPerRow;
+$TabSeparation = $tTHEME->TabSeparation;
+
+$Tabs = count($data);
+$TabWidth = (int) (100 / $TabsPerRow);
+
+$CurrentRow = ( $CurrentTab - ( $CurrentTab % $TabsPerRow) ) / $TabsPerRow;
+
+$NumRows = (int) ( $Tabs / $TabsPerRow ) + 1;
+
+?>
+ <center>
+ <table border="0" cellpadding="0" cellspacing="0" width="<? p($TableWidth) ?>">
+ <tr>
+ <td width="100%">
+
+ <table border="0" cellpadding="0" cellspacing="0" width="100%">
+
+<?
+$TabProccessed = 0;
+for ($row = 0; $row < $NumRows; $row++) {
+ echo "<tr>\n";
+ if ( $row != $CurrentRow ) {
+ for ($col = 0; $col < $TabsPerRow; $col++) {
+ if ( $TabProccessed < $Tabs ) {
+ if ($TabProccessed == $CurrentTab) {
+ $CurrentColor = $CurrentTabColor;
+ } else {
+ $CurrentColor = $TabColor;
+ }
+ ?>
+ <td width="<? p($TabWidth) ?>%" bgcolor="<? p($CurrentColor) ?>" align="center">
+ <b><a href="<? p($data[$TabProccessed]->link) ?>"><? p($data[$TabProccessed]->caption) ?></a></b></td>
+ <? if ($col < $TabsPerRow) { ?>
+ <td width="<? p($TabSeparation) ?>" align="center"> </td>
+ <? }
+ } else {
+ $CurrentColor = "";
+ }
+ $TabProccessed++;
+ }
+ } else {
+ $FirstTabInCurrentRow = $TabProccessed;
+ $TabProccessed += $TabsPerRow;
+ }
+ echo "</tr><tr><td colspan=" . (2* $TabsPerRow) . " ></td></tr>\n";
+}
+ echo "<tr>\n";
+ $TabProccessed = $FirstTabInCurrentRow;
+ for ($col = 0; $col < $TabsPerRow; $col++) {
+ if ( $TabProccessed < $Tabs ) {
+ if ($TabProccessed == $CurrentTab) {
+ $CurrentColor = $CurrentTabColor;
+ } else {
+ $CurrentColor = $TabColor;
+ }
+ ?>
+ <td width="<? p($TabWidth) ?>%" bgcolor="<? p($CurrentColor) ?>" align="center">
+ <b><a href="<? p($data[$TabProccessed]->link) ?>"><? p($data[$TabProccessed]->caption) ?></a></b></td>
+ <? if ($col < $TabsPerRow) { ?>
+ <td width="<? p($TabSeparation) ?>" align="center"> </td>
+ <? }
+ } else {
+ if ($NumRows > 1) {
+ $CurrentColor = $TabColor;
+ } else {
+ $CurrentColor = "";
+ }
+ echo "<td colspan = " . (2 * ($TabsPerRow - $col)) . " bgcolor=\"$CurrentColor\" align=\"center\">";
+ echo "</td>";
+
+ $col = $TabsPerRow;
+ }
+ $TabProccessed++;
+ }
+ echo "</tr>\n";
+ ?>
+
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td width="100%" bgcolor="<? p($TableColor) ?>"><hr></td>
+ </tr>
+ <tr>
+ <td width="100%" bgcolor="<? p($TableColor) ?>">
+ <center>
+<?
+}
+
+function print_tabbed_table_end() {
+ echo "</center><p></td></tr></table></center>";
+}
+
?>
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2003091600; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2003091800; // The current module version (Date: YYYYMMDDXX)
$module->cron = 0; // Period for cron to check this module (secs)
-$release = "0.3 development"; // User-friendly version number
+$release = "0.3.1 development"; // User-friendly version number
?>