Permalink
Browse files

CONTRIB-350 - Update book module to use new navigation structure & admin

settings in 1.9
  • Loading branch information...
1 parent ee7758e commit 50c53e20493166bee6dbc720452f4315199b979f @danpoltawski danpoltawski committed Mar 25, 2008
Showing with 34 additions and 100 deletions.
  1. +0 −30 config.html
  2. +3 −15 delete.php
  3. +3 −16 edit.php
  4. +6 −15 import.php
  5. +6 −16 index.php
  6. +2 −1 lang/en_utf8/book.php
  7. +11 −0 settings.php
  8. +3 −7 view.php
View
@@ -1,30 +0,0 @@
-<!-- $Id: config.html,v 1.1 2006/03/12 18:39:59 skodak Exp $ //-->
-
-<form method="post" action="module.php" name="form">
-<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
-
-<table cellpadding="9" cellspacing="0">
-<tr valign="top">
- <td align="right">
- <p>book_tocwidth:</p>
- </td>
- <td>
- <?php
- $choices = array('140'=>'140', '160'=>'160', '180'=>'180', '200'=>'200',
- '220'=>'220', '240'=>'240', '260'=>'260', '280'=>'280', '300'=>'300');
- choose_from_menu ($choices, 'book_tocwidth', $CFG->book_tocwidth, '');
- ?>
- </td>
- <td>
- <?php print_string('tocwidth', 'book') ?>
- </td>
-</tr>
-
-<tr>
- <td colspan="3" align="center">
- <input type="submit" value="<?php print_string('savechanges') ?>" />
- </td>
-</tr>
-</table>
-
-</form>
View
@@ -1,4 +1,4 @@
-<?PHP // $Id: delete.php,v 1.2 2006/11/21 19:26:36 skodak Exp $
+<?PHP // $Id: delete.php,v 1.3 2008/03/25 20:19:49 poltawski Exp $
require('teacheraccess.php'); //page only for teachers
$confirm = optional_param('confirm', 0, PARAM_BOOL);
@@ -8,21 +8,9 @@
$strbooks = get_string('modulenameplural', 'book');
$strbook = get_string('modulename', 'book');
-if ($course->category) {
- $navigation = '<a href="../../course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->';
-} else {
- $navigation = '';
-}
+$navigation = build_navigation('', $cm);
-print_header( "$course->shortname: $book->name",
- $course->fullname,
- "$navigation <a href=index.php?id=$course->id>$strbooks</a> -> $book->name",
- '',
- '',
- true,
- '',
- ''
- );
+print_header("$course->shortname: $book->name", $course->fullname, $navigation);
///form processing
if ($confirm) { // the operation was confirmed.
View
@@ -1,4 +1,4 @@
-<?PHP // $Id: edit.php,v 1.2 2007/05/20 06:00:26 skodak Exp $
+<?PHP // $Id: edit.php,v 1.3 2008/03/25 20:19:49 poltawski Exp $
require_once('../../config.php');
require_once('lib.php');
@@ -123,22 +123,9 @@
}
///prepare the page header
-if ($course->category) {
- $navigation = '<a href="../../course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->';
-} else {
- $navigation = '';
-}
-
-print_header( "$course->shortname: $book->name",
- $course->fullname,
- "$navigation <a href=\"index.php?id=$course->id\">$strbooks</A> -> <a href=\"view.php?id=$cm->id\">$book->name</A> -> $stredit",
- '',
- '',
- true,
- '',
- ''
- );
+$navigation = build_navigation('', $cm);
+print_header("$course->shortname: $book->name", $course->fullname, $navigation);
$icon = '<img align="absmiddle" height="16" width="16" src="icon_chapter.gif" />&nbsp;';
print_heading_with_help($pageheading, 'edit', 'book', $icon);
View
@@ -1,4 +1,4 @@
-<?PHP // $Id: import.php,v 1.3 2007/05/20 06:00:29 skodak Exp $
+<?PHP // $Id: import.php,v 1.4 2008/03/25 20:19:49 poltawski Exp $
require_once('../../config.php');
require_once('lib.php');
@@ -45,21 +45,12 @@
$strbooks = get_string('modulenameplural', 'book');
$strimport = get_string('import', 'book');
-if ($course->category) {
- $navigation = '<a href="../../course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->';
-} else {
- $navigation = '';
-}
+$navlinks = array();
+$navlinks[] = array('name' => $strimport, 'link' => '', 'type' => 'title');
+
+$navigation = build_navigation($navlinks, $cm);
-print_header( "$course->shortname: $book->name",
- $course->fullname,
- "$navigation <a href=\"index.php?id=$course->id\">$strbooks</a> -> <a href=\"view.php?id=$cm->id\">$book->name</a> -> $strimport",
- '',
- '',
- true,
- '',
- ''
- );
+print_header("$course->shortname: $book->name", $course->fullname, $navigation);
/// If data submitted, then process, store and relink.
if (($form = data_submitted()) && (confirm_sesskey())) {
View
@@ -1,4 +1,4 @@
-<?PHP // $Id: index.php,v 1.2 2007/05/20 06:00:29 skodak Exp $
+<?PHP // $Id: index.php,v 1.3 2008/03/25 20:19:49 poltawski Exp $
/// This page lists all the instances of book in a particular course
@@ -28,22 +28,12 @@
$strbooks = get_string('modulenameplural', 'book');
$strbook = get_string('modulename', 'book');
-/// Print the header
-if ($course->category) {
- $navigation = '<a href="../../course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->';
-} else {
- $navigation = '';
-}
-print_header( "$course->shortname: $strbooks",
- $course->fullname,
- "$navigation $strbooks",
- '',
- '',
- true,
- '',
- navmenu($course)
- );
+$navlinks = array();
+$navlinks[] = array('name' => $strbooks, 'link' => '', 'type' => 'activity');
+$navigation = build_navigation($navlinks);
+
+print_header_simple($strbooks, '', $navigation, '', '', true, '', navmenu($course));
add_to_log($course->id, 'book', 'view all', 'index.php?id='.$course->id, '');
View
@@ -1,10 +1,11 @@
-<?PHP // $Id: book.php,v 1.2 2007/05/20 06:00:30 skodak Exp $
+<?PHP // $Id: book.php,v 1.3 2008/03/25 20:19:49 poltawski Exp $
$string['modulename'] = 'Book';
$string['modulenameplural'] = 'Books';
$string['toc'] = 'Table of Contents';
$string['tocwidth'] = 'Select width of the Table of Contents for all books.';
+$string['book_tocwidth'] = 'Table of Contents width';
$string['faq'] = 'Book FAQ';
$string['disableprinting'] = 'Disable Printing';
View
@@ -0,0 +1,11 @@
+<?php //$Id: settings.php,v 1.2 2008/03/25 20:19:49 poltawski Exp $
+
+$choices = array('140'=>'140', '160'=>'160', '180'=>'180', '200'=>'200',
+ '220'=>'220', '240'=>'240', '260'=>'260', '280'=>'280', '300'=>'300');
+
+
+$settings->add(new admin_setting_configselect('book_tocwidth', get_string('book_tocwidth', 'book'),
+ get_string('tocwidth', 'book'), '180', $choices));
+
+
+?>
View
@@ -1,4 +1,4 @@
-<?PHP // $Id: view.php,v 1.4 2007/06/17 10:41:25 stronk7 Exp $
+<?PHP // $Id: view.php,v 1.5 2008/03/25 20:19:49 poltawski Exp $
require_once('../../config.php');
require_once('lib.php');
@@ -98,19 +98,15 @@
$strTOC = get_string('TOC', 'book');
/// prepare header
-if ($course->category) {
- $navigation = '<a href="../../course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->';
-} else {
- $navigation = '';
-}
+$navigation = build_navigation('', $cm);
$buttons = $allowedit ? '<table cellspacing="0" cellpadding="0"><tr><td>'.update_module_button($cm->id, $course->id, $strbook).'</td>'.
'<td>&nbsp;</td><td>'.book_edit_button($cm->id, $course->id, $chapter->id).'</td></tr></table>'
: '&nbsp;';
print_header( "$course->shortname: $book->name ($chapter->title)",
$course->fullname,
- "$navigation <a href=\"index.php?id=$course->id\">$strbooks</a> -> $book->name",
+ $navigation,
'',
'<style type="text/css">@import url('.$CFG->wwwroot.'/mod/book/book_theme.css);</style>',
true,

0 comments on commit 50c53e2

Please sign in to comment.