Skip to content

Commit

Permalink
MDL-33206 mod_book: Add a link to display the print dialog in the pri…
Browse files Browse the repository at this point in the history
…nt book tool
  • Loading branch information
gaudreaj committed Jan 18, 2013
1 parent a5ec499 commit 5595391
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
18 changes: 16 additions & 2 deletions mod/book/tool/print/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

// 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>
Expand All @@ -90,6 +90,13 @@
<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">
Expand Down Expand Up @@ -119,7 +126,7 @@

// 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>
Expand All @@ -128,6 +135,13 @@
<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>
Expand Down
18 changes: 18 additions & 0 deletions mod/book/tool/print/print.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 5595391

Please sign in to comment.