Commit dab784a3 authored by Petr Skoda's avatar Petr Skoda
Browse files

book should be now compatible with 1.8

parent c5444041
$Id: README.txt,v 1.2 2006/04/24 19:41:14 skodak Exp $
$Id: README.txt,v 1.3 2007/05/20 06:00:29 skodak Exp $
///////////////////////////////////////////////////////////////////////////
// //
......@@ -110,5 +110,9 @@ CHANGELOG:
* all languages converted to utf-8
* moved to contrib/book_16 directory
* added proper content encoding conversion during import
== 1.4alpha - 2007/05/20 ====================================================
* compatible with 1.8
* export link enabled - thanks Eloy!
* no new features
skodak
/* $Id: book_theme.css,v 1.1 2006/03/12 18:39:59 skodak Exp $*/
/* $Id: book_theme.css,v 1.2 2007/05/20 06:00:30 skodak Exp $*/
/* later should be defined in themes*/
......@@ -16,6 +16,15 @@
text-align: left;
}
img.bigicon {
vertical-align:middle;
margin-right:4px;
margin-left:4px;
width:24px;
height:24px;
border:0px;
}
/* == TOC styles == */
/* toc style NONE */
......
This diff is collapsed.
<?PHP // $Id: edit.php,v 1.1 2006/03/12 18:39:59 skodak Exp $
<?PHP // $Id: edit.php,v 1.2 2007/05/20 06:00:26 skodak Exp $
require_once('../../config.php');
require_once('lib.php');
......@@ -13,7 +13,7 @@ $subchapter = optional_param('subchapter', 0, PARAM_BOOL);
// =========================================================================
require_login();
if (!$cm = get_record('course_modules', 'id', $id)) {
if (!$cm = get_coursemodule_from_id('book', $id)) {
error('Course Module ID was incorrect');
}
......@@ -21,9 +21,8 @@ if (!$course = get_record('course', 'id', $cm->course)) {
error('Course is misconfigured');
}
if (!isteacheredit($course->id)) {
error('Only editing teachers can edit books!', $_SERVER['HTTP_REFERER']);
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $context);
if (!$book = get_record('book', 'id', $cm->instance)) {
error('Course module is incorrect');
......
<?PHP // $Id: generateimscp.php,v 1.1 2007/02/11 12:18:23 stronk7 Exp $
<?PHP // $Id: generateimscp.php,v 1.2 2007/05/20 06:00:26 skodak Exp $
///////////////////////////////////////////////////////////////////////////
// //
......@@ -29,13 +29,11 @@ require_once('lib.php');
require_once($CFG->dirroot . '/backup/lib.php');
require_once($CFG->dirroot . '/lib/filelib.php');
$id = required_param('id', PARAM_INT); // Course Module ID
$id = required_param('id', PARAM_INT); // Course Module ID
if ($CFG->forcelogin) {
require_login();
}
require_login();
if (!$cm = get_record('course_modules', 'id', $id)) {
if (!$cm = get_coursemodule_from_id('book', $id)) {
error('Course Module ID was incorrect');
}
......@@ -43,22 +41,13 @@ if (!$course = get_record('course', 'id', $cm->course)) {
error('Course is misconfigured');
}
if ($course->category) {
require_login($course->id);
}
if (!$cm->visible and !isteacher($course->id)) {
notice(get_string('activityiscurrentlyhidden'));
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $context);
if (!$book = get_record('book', 'id', $cm->instance)) {
error('Course module is incorrect');
}
if (!isteacher($course->id)) {
error('Only teachers are allowed to generate IMS CP packages');
}
$strbooks = get_string('modulenameplural', 'book');
$strbook = get_string('modulename', 'book');
$strtop = get_string('top', 'book');
......@@ -220,6 +209,7 @@ function chapter2html($chapter, $courseid, $bookid) {
$content .= '</head>' . "\n";
$content .= '<body>' . "\n";
$content .= '<h1 id="header">' . $chapter->title . '</h1>' ."\n";
$options = new object();
$options->noclean = true;
$content .= format_text($chapter->content, '', $options, $courseid) . "\n";
$content .= '</body>' . "\n";
......@@ -255,7 +245,7 @@ function chapter2html($chapter, $courseid, $bookid) {
}
/// Build the final object needed to have all the info in order to create the manifest
$object = new stdClass;
$object = new object();
$object->content = $content;
$object->localfiles = $basefiles;
......
<?PHP // $Id: import.php,v 1.2 2006/11/21 19:26:36 skodak Exp $
<?PHP // $Id: import.php,v 1.3 2007/05/20 06:00:29 skodak Exp $
require_once('../../config.php');
require_once('lib.php');
......@@ -12,7 +12,7 @@ $cancel = optional_param('cancel', 0, PARAM_BOOL);
// =========================================================================
require_login();
if (!$cm = get_record('course_modules', 'id', $id)) {
if (!$cm = get_coursemodule_from_id('book', $id)) {
error('Course Module ID was incorrect');
}
......@@ -20,9 +20,8 @@ if (!$course = get_record('course', 'id', $cm->course)) {
error('Course is misconfigured');
}
if (!isteacheredit($course->id)) {
error('Only editing teachers can edit books!');
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $context);
if (!$book = get_record('book', 'id', $cm->instance)) {
error('Course module is incorrect');
......@@ -150,8 +149,8 @@ if (($form = data_submitted()) && (confirm_sesskey())) {
</td>
<td>
<?php
echo '<input name="reference" size="40" value="" />&nbsp;';
button_to_popup_window ('/mod/book/coursefiles.php?choose=theform.reference&id='.$course->id,
echo '<input id="id_reference" name="reference" size="40" value="" />&nbsp;';
button_to_popup_window ('/mod/book/coursefiles.php?choose=id_reference&id='.$course->id,
'coursefiles', $strchoose, 500, 750, $strchoose);
?>
</td>
......
<?PHP // $Id: index.php,v 1.1 2006/03/12 18:39:59 skodak Exp $
<?PHP // $Id: index.php,v 1.2 2007/05/20 06:00:29 skodak Exp $
/// This page lists all the instances of book in a particular course
......@@ -10,17 +10,12 @@ $id = required_param('id', PARAM_INT); // Course Module ID
// =========================================================================
// security checks START - teachers and students view
// =========================================================================
if ($CFG->forcelogin) {
require_login();
}
if (!$course = get_record('course', 'id', $id)) {
error('Course ID is incorrect');
}
if ($course->category) {
require_login($course->id);
}
require_course_login($course, true);
//check all variables
unset($id);
......
<?PHP // $Id: book.php,v 1.1 2006/03/12 18:40:04 skodak Exp $
<?PHP // $Id: book.php,v 1.2 2007/05/20 06:00:30 skodak Exp $
$string['modulename'] = 'Book';
$string['modulenameplural'] = 'Books';
......@@ -40,6 +40,7 @@ $string['navexit'] = 'Exit Book';
$string['importingchapters'] = 'Importing chapters into book';
$string['import'] = 'Import';
$string['doimport'] = 'Import';
$string['doexport'] = 'Export';
$string['importing'] = 'Importing';
$string['relinking'] = 'Relinking';
$string['importinfo'] = 'Import selected HTML file or directory.<br />Chapters are sorted alphabetically using file names.<br />Files named \'sub_*.*\' are always imported as subchapters.';
......
<?PHP // $Id: lib.php,v 1.1 2006/03/12 18:39:59 skodak Exp $
<?PHP // $Id: lib.php,v 1.2 2007/05/20 06:00:30 skodak Exp $
define('NUM_NONE', '0');
define('NUM_NUMBERS', '1');
define('NUM_BULLETS', '2');
define('NUM_INDENTED', '3');
$NUMBERING_TYPE = array (NUM_NONE => get_string('numbering0', 'book'),
NUM_NUMBERS => get_string('numbering1', 'book'),
NUM_BULLETS => get_string('numbering2', 'book'),
NUM_INDENTED => get_string('numbering3', 'book') );
if (!isset($CFG->book_tocwidth)) {
set_config("book_tocwidth", 180); // default toc width
}
function book_get_numbering_types() {
return array (NUM_NONE => get_string('numbering0', 'book'),
NUM_NUMBERS => get_string('numbering1', 'book'),
NUM_BULLETS => get_string('numbering2', 'book'),
NUM_INDENTED => get_string('numbering3', 'book') );
}
/// Library of functions and constants for module 'book'
......@@ -25,6 +27,12 @@ function book_add_instance($book) {
$book->timecreated = time();
$book->timemodified = $book->timecreated;
if (!isset($book->customtitles)) {
$book->customtitles = 0;
}
if (!isset($book->disableprinting)) {
$book->disableprinting = 0;
}
return insert_record('book', $book);
}
......@@ -37,6 +45,12 @@ function book_update_instance($book) {
$book->timemodified = time();
$book->id = $book->instance;
if (!isset($book->customtitles)) {
$book->customtitles = 0;
}
if (!isset($book->disableprinting)) {
$book->disableprinting = 0;
}
# May have to add extra stuff in here #
......@@ -64,6 +78,20 @@ function book_delete_instance($id) {
return $result;
}
function book_get_types() {
global $CFG;
$types = array();
$type = new object();
$type->modclass = MOD_CLASS_RESOURCE;
$type->type = 'book';
$type->typestr = get_string('modulename', 'book');
$types[] = $type;
return $types;
}
function book_user_outline($course, $user, $mod, $book) {
/// Return a small object with summary information about what a
/// user has done with a given particular instance of this module
......@@ -178,11 +206,11 @@ function book_edit_button($id, $courseid, $chapterid) {
$string = get_string("turneditingon");
$edit = '1';
}
return '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/mod/book/view.php">'.
return '<form method="get" action="'.$CFG->wwwroot.'/mod/book/view.php"><div>'.
'<input type="hidden" name="id" value="'.$id.'" />'.
'<input type="hidden" name="chapterid" value="'.$chapterid.'" />'.
'<input type="hidden" name="edit" value="'.$edit.'" />'.
'<input type="submit" value="'.$string.'" /></form>';
'<input type="submit" value="'.$string.'" /></div></form>';
} else {
return '';
}
......
<?php // $Id: mod.html,v 1.1 2006/03/12 18:39:59 skodak Exp $
require($CFG->dirroot.'/mod/book/lib.php');
if (empty($form->name)) {
$form->name = '';
}
if (empty($form->summary)) {
$form->summary = '';
}
if (empty($form->numbering)) {
$form->numbering = NUM_NONE;
}
if (empty($form->disableprinting)) {
$form->disableprinting = 0;
}
if (empty($form->customtitles)) {
$form->customtitles = 0;
}
?>
<form name="form" method="post" action="mod.php">
<table cellpadding="5" align="center">
<tr valign="top">
<td align="right"><p><b><?php print_string('name') ?>:</b></p></td>
<td>
<input type="text" name="name" size="30" value="<?php p($form->name) ?>">
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string('summary') ?>:</b></p>
<font size="1">
<?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
echo "<br />";
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
} else {
emoticonhelpbutton("form", "description");
}
?>
<br />
</font>
</td>
<td>
<?php print_textarea($usehtmleditor, 20, 60, 680, 400, 'summary', $form->summary); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string('numbering', 'book') ?>:</b></p></td>
<td>
<?php
choose_from_menu($NUMBERING_TYPE, 'numbering', $form->numbering, '');
helpbutton('numberingtype', get_string('numbering', 'book'), 'book');
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string('disableprinting', 'book') ?>:</b></p></td>
<td>
<select size="1" name="disableprinting">
<option value="1" <?php
if ( $form->disableprinting ) {
echo 'selected="selected"';
}
?>><?php echo get_string('yes') ?>
</option>
<option value="0" <?php
if ( !$form->disableprinting ) {
echo 'selected="selected"';
}
?>><?php echo get_string('no') ?>
</option>
</select> <?php helpbutton('disableprinting', get_string('disableprinting', 'book'), 'book') ?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string('customtitles', 'book') ?>:</b></p></td>
<td>
<select size="1" name="customtitles">
<option value="1" <?php
if ( $form->customtitles ) {
echo 'selected="selected"';
}
?>><?php echo get_string('yes') ?>
</option>
<option value="0" <?php
if ( !$form->customtitles ) {
echo 'selected="selected"';
}
?>><?php echo get_string('no') ?>
</option>
</select> <?php helpbutton('customtitles', get_string('customtitles', 'book'), 'book') ?>
</td>
</tr>
</table>
<center>
<input type="submit" value="<?php print_string('savechanges') ?>" />
</center>
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" />
<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) ?>" />
</form>
<?php
require_once($CFG->dirroot.'/mod/book/lib.php');
require_once('moodleform_mod.php');
class mod_book_mod_form extends moodleform_mod {
function definition() {
global $CFG;
$mform =& $this->_form;
//-------------------------------------------------------------------------------
$mform->addElement('header', 'general', get_string('general', 'form'));
$mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
$mform->setType('name', PARAM_TEXT);
$mform->addRule('name', null, 'required', null, 'client');
$mform->addElement('htmleditor', 'summary', get_string('summary'));
$mform->setType('summary', PARAM_RAW);
$mform->addRule('summary', null, 'required', null, 'client');
$mform->setHelpButton('summary', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$mform->addElement('select', 'numbering', get_string('numbering', 'book'), book_get_numbering_types());
$mform->setHelpButton('numbering', array('numberingtype', get_string('numbering', 'book'), 'book'));
$mform->addElement('checkbox', 'disableprinting', get_string('disableprinting', 'book'));
$mform->setHelpButton('disableprinting', array('disableprinting', get_string('disableprinting', 'book'), 'book'));
$mform->setDefault('disableprinting', 0);
$mform->addElement('checkbox', 'customtitles', get_string('customtitles', 'book'));
$mform->setHelpButton('customtitles', array('customtitles', get_string('customtitles', 'book'), 'book'));
$mform->setDefault('customtitles', 0);
$this->standard_coursemodule_elements();
//-------------------------------------------------------------------------------
// buttons
$this->add_action_buttons();
}
}
?>
\ No newline at end of file
<?PHP // $Id: print.php,v 1.1 2006/03/12 18:39:59 skodak Exp $
<?PHP // $Id: print.php,v 1.2 2007/05/20 06:00:26 skodak Exp $
require_once('../../config.php');
require_once('lib.php');
......@@ -9,11 +9,7 @@ $chapterid = optional_param('chapterid', 0, PARAM_INT); // Chapter ID
// =========================================================================
// security checks START - teachers and students view
// =========================================================================
if ($CFG->forcelogin) {
require_login();
}
if (!$cm = get_record('course_modules', 'id', $id)) {
if (!$cm = get_coursemodule_from_id('book', $id)) {
error('Course Module ID was incorrect');
}
......@@ -21,13 +17,7 @@ if (!$course = get_record('course', 'id', $cm->course)) {
error('Course is misconfigured');
}
if ($course->category) {
require_login($course->id);
}
if (!$cm->visible and !isteacher($course->id)) {
notice(get_string('activityiscurrentlyhidden'));
}
require_course_login($course, true, $cm);
if (!$book = get_record('book', 'id', $cm->instance)) {
error('Course module is incorrect');
......@@ -61,23 +51,15 @@ unset($chapterid);
$strbooks = get_string('modulenameplural', 'book');
$strbook = get_string('modulename', 'book');
$strtop = get_string('top', 'book');
if (!empty($CFG->unicode)) {
$encoding = 'utf-8';
} else {
$encoding = get_string('thischarset');
}
moodle_setlocale(); //workaround for buggy forced course language
$strtop = get_string('top', 'book');
@header('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
@header('Pragma: no-cache');
@header('Expires: ');
@header('Accept-Ranges: none');
@header('Content-type: text/html; charset='.$encoding);
@header('Content-type: text/html; charset=utf-8');
$formatoptions = new stdClass;
$formatoptions = new object();
$formatoptions->noclean = true;
if ($chapter) {
......@@ -94,9 +76,9 @@ if ($chapter) {
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><?PHP echo str_replace('"', '&quot;', $book->name) ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?PHP echo $encoding ?>" />
<meta name="description" content="<?PHP echo str_replace('"', '&quot;', $book->name) ?>" />
<title><?PHP echo format_string($book->name) ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="<?PHP echo s(format_string($book->name)) ?>" />
<link rel="stylesheet" type="text/css" href="book_print.css" />
</head>
<body>
......@@ -125,28 +107,28 @@ if ($chapter) {
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><?PHP echo str_replace('"', '&quot;', $book->name) ?></title>
<title><?PHP echo format_string(name) ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?PHP echo $encoding ?>" />
<meta name="description" content="<?PHP echo str_replace('"', '&quot;', $book->name) ?>" />
<meta name="description" content="<?PHP echo s(format_string($book->name)) ?>" />
<link rel="stylesheet" type="text/css" href="book_print.css" />
</head>
<body>
<a name="top"></a>
<p class="book_title"><?PHP echo strip_tags($book->name) ?></p>
<p class="book_summary"><?PHP echo strip_tags($book->summary) ?></p>
<p class="book_title"><?PHP echo format_string($book->name) ?></p>
<p class="book_summary"><?PHP echo format_string($book->summary) ?></p>
<div class="book_info"><table>
<tr>
<td><?PHP echo get_string('site') ?>:</td>
<td><a href="<?PHP echo $CFG->wwwroot ?>"><?PHP echo strip_tags($site->fullname) ?></a></td>
<td><a href="<?PHP echo $CFG->wwwroot ?>"><?PHP echo format_string($site->fullname) ?></a></td>
</tr><tr>
<td><?PHP echo get_string('course') ?>:</td>
<td><?PHP echo strip_tags($course->fullname) ?></td>
<td><?PHP echo format_string($course->fullname) ?></td>
</tr><tr>
<td><?PHP echo get_string('modulename', 'book') ?>:</td>
<td><?PHP echo strip_tags($book->name) ?></td>
<td><?PHP echo format_string($book->name) ?></td>
</tr><tr>
<td><?PHP echo get_string('printedby', 'book') ?>:</td>
<td><?PHP echo strip_tags(fullname($USER, true)) ?></td>
<td><?PHP echo format_string(fullname($USER, true)) ?></td>
</tr><tr>
<td><?PHP echo get_string('printdate','book') ?>:</td>
<td><?PHP echo userdate(time()) ?></td>
......
<?PHP // $Id: teacheraccess.php,v 1.1 2006/03/12 18:39:59 skodak Exp $
<?PHP // $Id: teacheraccess.php,v 1.2 2007/05/20 06:00:27 skodak Exp $
///standard routine to allow only teachers in
///check of $id and $chapterid parameters
......@@ -14,8 +14,7 @@ require_login();
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
if (!$cm = get_record('course_modules', 'id', $id)) {
if (!$cm = get_coursemodule_from_id('book', $id)) {
error('Course Module ID was incorrect');
}
......@@ -23,9 +22,8 @@ if (!$course = get_record('course', 'id', $cm->course)) {
error('Course is misconfigured');
}
if (!isteacheredit($course->id)) {
error('Only editing teachers can edit books!');
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $context);
if (!$book = get_record('book', 'id', $cm->instance)) {
error('Course module is incorrect');
......
<?PHP // $Id: toc.php,v 1.2 2006/11/07 18:32:05 skodak Exp $
<?PHP // $Id: toc.php,v 1.3 2007/05/20 06:00:30 skodak Exp $
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
......@@ -125,23 +125,23 @@ if ($print) { ///TOC for printing
$currsubtitle = '&nbsp;';
}
} else {
$toc .= '<a title="'.htmlspecialchars($title).'" href="view.php?id='.$cm->id.'&chapterid='.$ch->id.'">'.$title.'</a>';
$toc .= '<a title="'.htmlspecialchars($title).'" href="view.php?id='.$cm->id.'&amp;chapterid='.$ch->id.'">'.$title.'</a>';
}
$toc .= '&nbsp;&nbsp;';
if ($i != 1) {
$toc .= ' <a title="'.get_string('up').'" href="move.php?id='.$cm->id.'&chapterid='.$ch->id.'&up=1&sesskey='.$USER->sesskey.'"><img src="'.$CFG->pixpath.'/t/up.gif" height="11" width="11" border="0" /></a>';
$toc .= ' <a title="'.get_string('up').'" href="move.php?id='.$cm->id.'&amp;chapterid='.$ch->id.'&amp;up=1&amp;sesskey='.$USER->sesskey.'"><img src="'.$CFG->pixpath.'/t/up.gif" height="11" class="iconsmall" alt="'.get_string('up').'" /></a>';
}
if ($i != count($chapters)) {
$toc .= ' <a title="'.get_string('down').'" href="move.php?id='.$cm->id.'&chapterid='.$ch->id.'&up=0&sesskey='.$USER->sesskey.'"><img src="'.$CFG->pixpath.'/t/down.gif" height="11" width="11" border="0" /></a>';
$toc .= ' <a title="'.get_string('down').'" href="move.php?id='.$cm->id.'&amp;chapterid='.$ch->id.'&amp;up=0&amp;sesskey='.$USER->sesskey.'"><img src="'.$CFG->pixpath.'/t/down.gif" height="11" class="iconsmall" alt="'.get_string('down').'" /></a>';
}
$toc .= ' <a title="'.get_string('edit').'" href="edit.php?id='.$cm->id.'&chapterid='.$ch->id.'"><img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" /></a>';
$toc .= ' <a title="'.get_string('delete').'" href="delete.php?id='.$cm->id.'&chapterid='.$ch->id.'&sesskey='.$USER->sesskey.'"><img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" /></a>';
$toc .= ' <a title="'.get_string('edit').'" href="edit.php?id='.$cm->id.'&amp;chapterid='.$ch->id.'"><img src="'.$CFG->pixpath.'/t/edit.gif" height="11" class="iconsmall" alt="'.get_string('edit').'" /></a>';
$toc .= ' <a title="'.get_string('delete').'" href="delete.php?id='.$cm->id.'&amp;chapterid='.$ch->id.'&amp;sesskey='.$USER->sesskey.'"><img src="'.$CFG->pixpath.'/t/delete.gif" height="11" class="iconsmall" alt="'.get_string('delete').'" /></a>';
if ($ch->hidden) {
$toc .= ' <a title="'.get_string('show').'" href="show.php?id='.$cm->id.'&chapterid='.$ch->id.'&sesskey='.$USER->sesskey.'"><img src="'.$CFG->pixpath.'/t/show.gif" height="11" width="11" border="0" /></a>';
$toc .= ' <a title="'.get_string('show').'" href="show.php?id='.$cm->id.'&amp;chapterid='.$ch->id.'&amp;sesskey='.$USER->sesskey.'"><img src="'.$CFG->pixpath.'/t/show.gif" height="11" class="iconsmall" alt="'.get_string('show').'" /></a>';
} else {
$toc .= ' <a title="'.get_string('hide').'" href="show.php?id='.$cm->id.'&chapterid='.$ch->id.'&sesskey='.$USER->sesskey.'"><img src="'.$CFG->pixpath.'/t/hide.gif" height="11" width="11" border="0" /></a>';
$toc .= ' <a title="'.get_string('hide').'" href="show.php?id='.$cm->id.'&amp;chapterid='.$ch->id.'&amp;sesskey='.$USER->sesskey.'"><img src="'.$CFG->pixpath.'/t/hide.gif" height="11" class="iconsmall" alt="'.get_string('hide').'" /></a>';