MDL-33206 mod_book: Add a link to display the print dialog in the print book tool

This commit is contained in:
Jean-Philippe Gaudreau 2013-01-18 09:32:54 -05:00
parent a5ec499521
commit 5595391eae
2 changed files with 34 additions and 2 deletions

View file

@ -81,7 +81,7 @@ if ($chapter) {
// page header
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!DOCTYPE HTML>
<html>
<head>
<title><?php echo format_string($book->name, true, array('context'=>$context)) ?></title>
@ -90,6 +90,13 @@ if ($chapter) {
<link rel="stylesheet" type="text/css" href="print.css" />
</head>
<body>
<?php
// Print dialog link.
$printtext = get_string('printchapter', 'booktool_print');
$printicon = $OUTPUT->pix_icon('chapter', $printtext, 'booktool_print', array('class' => 'book_print_icon'));
$printlinkatt = array('onclick' => 'window.print();return false;', 'class' => 'book_no_print');
echo html_writer::link('#', $printicon.$printtext, $printlinkatt);
?>
<a name="top"></a>
<h1 class="book_title"><?php echo format_string($book->name, true, array('context'=>$context)) ?></h1>
<div class="chapter">
@ -119,7 +126,7 @@ if ($chapter) {
// page header
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!DOCTYPE HTML>
<html>
<head>
<title><?php echo format_string($book->name, true, array('context'=>$context)) ?></title>
@ -128,6 +135,13 @@ if ($chapter) {
<link rel="stylesheet" type="text/css" href="print.css" />
</head>
<body>
<?php
// Print dialog link.
$printtext = get_string('printbook', 'booktool_print');
$printicon = $OUTPUT->pix_icon('book', $printtext, 'booktool_print', array('class' => 'book_print_icon'));
$printlinkatt = array('onclick' => 'window.print();return false;', 'class' => 'book_no_print');
echo html_writer::link('#', $printicon.$printtext, $printlinkatt);
?>
<a name="top"></a>
<h1 class="book_title"><?php echo format_string($book->name, true, array('context'=>$context)) ?></h1>
<p class="book_summary"><?php echo format_text($book->intro, $book->introformat, array('noclean'=>true, 'context'=>$context)) ?></p>

View file

@ -155,3 +155,21 @@ font {
margin-top: 0px;
list-style: none;
}
/* Print dialog link icon */
.book_print_icon {
padding-left: 0;
padding-right: 3px;
height: 16px;
vertical-align: text-bottom;
width: 16px;
border-width: 0;
}
/* Exclude elements from printing */
@media print
{
.book_no_print {
display: none;
}
}