$string['allentries'] = 'ALL';
$string['allowcomments'] = 'Allow comments on entries';
$string['allowduplicatedentries'] = 'Duplicated entries allowed';
+$string['allowprintview'] = 'Allow print view';
$string['allowratings'] = 'Allow entries to be rated?';
$string['answer'] = 'Answer';
$string['approve'] = 'Approve';
$string['numberofentries'] = 'Number of entries';
$string['onebyline'] = '(one per line)';
$string['printerfriendly'] = 'Printer-friendly version';
+$string['printviewnotallowed'] = 'Print view isn\'t allowed';
$string['question'] = 'Question';
$string['rate'] = 'Rate';
$string['rating'] = 'Rating';
--- /dev/null
+<p align="center"><b>Allow print view</b></p>
+
+<p>Students can be allowed to use the print view of the glossary.</p>
+
+<p>You can choose whether this feature is enabled or disabled.</p>
+
+<p>Teachers always can use the print view.</p>
fwrite ($bf,full_tag("SHOWALPHABET",4,false,$glossary->showalphabet));
fwrite ($bf,full_tag("SHOWALL",4,false,$glossary->showall));
fwrite ($bf,full_tag("ALLOWCOMMENTS",4,false,$glossary->allowcomments));
+ fwrite ($bf,full_tag("ALLOWPRINTVIEW",4,false,$glossary->allowprintview));
fwrite ($bf,full_tag("USEDYNALINK",4,false,$glossary->usedynalink));
fwrite ($bf,full_tag("DEFAULTAPPROVAL",4,false,$glossary->defaultapproval));
fwrite ($bf,full_tag("GLOBALGLOSSARY",4,false,$glossary->globalglossary));
}
}
}
+
+ //Allowprintview flag
+ if ($oldversion < 2005011200) {
+ table_column('glossary','','allowprintview','tinyint','2', 'unsigned', '1', '', 'allowcomments');
+ $glossaries = get_records('glossary', '', '', '', 'id, name');
+ if ($glossaries) {
+ foreach ($glossaries as $glossary) {
+ set_field('glossary', 'allowprintview', '1', 'id', "$glossary->id");
+ }
+ }
+ }
return true;
}
showalphabet tinyint(2) unsigned NOT NULL default '1',
showall tinyint(2) unsigned NOT NULL default '1',
allowcomments tinyint(2) unsigned NOT NULL default '0',
+ allowprintview tinyint(2) unsigned NOT NULL default '1',
usedynalink tinyint(2) unsigned NOT NULL default '1',
defaultapproval tinyint(2) unsigned NOT NULL default '1',
globalglossary tinyint(2) unsigned NOT NULL default '0',
}
}
+ //Allowprintview flag
+ if ($oldversion < 2005011200) {
+ table_column('glossary','','allowprintview','integer','2', 'unsigned', '1', '', 'allowcomments');
+ $glossaries = get_records('glossary', '', '', '', 'id, name');
+ if ($glossaries) {
+ foreach ($glossaries as $glossary) {
+ set_field('glossary', 'allowprintview', '1', 'id', "$glossary->id");
+ }
+ }
+ }
+
return true;
}
showalphabet int2 NOT NULL default '1',
showall int2 NOT NULL default '1',
allowcomments int2 NOT NULL default '0',
+ allowprintview int2 NOT NULL default '1',
usedynalink int2 NOT NULL default '1',
defaultapproval int2 NOT NULL default '1',
globalglossary int2 NOT NULL default '0',
if ( $lastcategory != $concept->id ) {
$category = get_record("glossary_categories","id",$concept->id);
$lastcategory = $concept->id;
- if ( $cm->instance != $category->glossaryid ) {
+ if ( empty($cm->instance) || $cm->instance != $category->glossaryid ) {
$gcat = get_record("glossary","id",$category->glossaryid);
if ( !$cm = get_coursemodule_from_instance("glossary", $category->glossaryid, $gcat->course) ) {
$cm->id = 1;
if (!isset($form->allowcomments)) {
$form->allowcomments = $CFG->glossary_allowcomments;
}
+if (!isset($form->allowprintview)) {
+ $form->allowprintview = 1;
+}
if (!isset($form->usedynalink)) {
$form->usedynalink = $CFG->glossary_linkbydefault;
}
</select> <?php helpbutton("allowcomments", get_string("allowcomments", "glossary"), "glossary") ?>
</td>
</tr>
+<tr valign="top">
+ <td align="right"><b><?php echo get_string("allowprintview", "glossary") ?>:</b></td>
+ <td align="left">
+ <select size="1" name="allowprintview">
+ <option value="1" <?php
+ if ( $form->allowprintview ) {
+ echo "selected=\"selected\"";
+ }
+ ?>
+ ><?php echo get_string("yes") ?></option>
+ <option value="0" <?php
+ if ( !$form->allowprintview ) {
+ echo "selected=\"selected\"";
+ }
+ ?>><?php echo get_string("no") ?>
+ </option>
+ </select> <?php helpbutton("allowprintview", get_string("allowprintview", "glossary"), "glossary") ?>
+ </td>
+</tr>
<tr valign="top">
<td align="right"><b><?php echo get_string("usedynalink", "glossary") ?>:</b></td>
<td align="left">
notice(get_string("activityiscurrentlyhidden"));
}
+ if (!isteacher($course->id) and !$glossary->allowprintview) {
+ notice(get_string('printviewnotallowed', 'glossary'));
+ }
+
/// setting the default values for the display mode of the current glossary
/// only if the glossary is viewed by the first time
if ( $dp = get_record('glossary_formats','name', addslashes($glossary->displayformat)) ) {
$glossary->showalphabet = backup_todb($info['MOD']['#']['SHOWALPHABET']['0']['#']);
$glossary->showall = backup_todb($info['MOD']['#']['SHOWALL']['0']['#']);
$glossary->allowcomments = backup_todb($info['MOD']['#']['ALLOWCOMMENTS']['0']['#']);
+ $glossary->allowprintview = backup_todb($info['MOD']['#']['ALLOWPRINTVIEW']['0']['#']);
$glossary->usedynalink = backup_todb($info['MOD']['#']['USEDYNALINK']['0']['#']);
$glossary->defaultapproval = backup_todb($info['MOD']['#']['DEFAULTAPPROVAL']['0']['#']);
$glossary->globalglossary = backup_todb($info['MOD']['#']['GLOBALGLOSSARY']['0']['#']);
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2005011100;
+$module->version = 2005011200;
$module->requires = 2004112300; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
echo '<p align="center"><font size="3"><b>' . stripslashes_safe($glossary->name);
if ( $isuserframe and $mode != 'search') {
/// the "Print" icon
- echo " <a title =\"". get_string("printerfriendly","glossary") . "\" target=\"printview\" href=\"print.php?id=$cm->id&mode=$mode&hook=$hook&sortkey=$sortkey&sortorder=$sortorder&offset=$offset\">\n";
- echo '<img border="0" src="print.gif" alt="" /></a>';
+ if (isteacher($course->id) or $glossary->allowprintview) {
+ echo " <a title =\"". get_string("printerfriendly","glossary") . "\" target=\"printview\" href=\"print.php?id=$cm->id&mode=$mode&hook=$hook&sortkey=$sortkey&sortorder=$sortorder&offset=$offset\">\n";
+ echo '<img border="0" src="print.gif" alt="" /></a>';
+ }
}
echo '</b></font></p>';