summaryrefslogtreecommitdiff
path: root/modules/book.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/book.module')
-rw-r--r--modules/book.module35
1 files changed, 24 insertions, 11 deletions
diff --git a/modules/book.module b/modules/book.module
index daf314d1c..80a8da754 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -3,7 +3,8 @@
$module = array("find" => "book_find",
"page" => "book_page",
"user" => "book_user",
- "admin" => "book_admin");
+ "admin" => "book_admin",
+ "export" => "book_export");
class Book {
function Book($nid, $userid, $title, $body, $parent, $weight, $timestamp) {
@@ -188,18 +189,10 @@ function book_list($query = array()) {
function book_query($type = "") {
global $status;
- $queries = array(0 => array("active book pages", "WHERE n.type = 'book' ORDER BY n.timestamp DESC"), 1 => array("posted book pages", "WHERE n.type = 'book' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), 2 => array("queued book pages", "WHERE n.type = 'book' AND n.status = '$status[queued]' ORDER BY n.timestamp DESC"), 3 => array("dumped book pages", "WHERE n.type = 'book' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC"));
+ $queries = array(array("recent book pages", "WHERE n.type = 'book' ORDER BY n.timestamp DESC"), array("posted book pages", "WHERE n.type = 'book' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), array("queued book pages", "WHERE n.type = 'book' AND n.status = '$status[queued]' ORDER BY n.timestamp DESC"), array("dumped book pages", "WHERE n.type = 'book' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC"));
return ($queries[$type] ? $queries[$type] : $queries);
}
-function book_listing() {
- foreach (book_query() as $key=>$array) {
- $output .= "<LI><A HREF=\"admin.php?mod=book&type=$key\">$array[0]</A></LI>\n";
- }
- return "<OL>$output</OL>\n";
-}
-
-
function book_admin() {
global $op, $id, $edit, $mod, $keys, $type, $user;
@@ -215,7 +208,7 @@ function book_admin() {
print book_form(node_get_array(nid, $id));
break;
case "listing":
- print book_listing();
+ print node_listing(book_query());
break;
case "search":
print search_form($keys);
@@ -288,4 +281,24 @@ function book_user() {
}
}
+function book_export_html($parent = "", $depth = 0) {
+ global $status;
+
+ $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight");
+
+ while ($node = db_fetch_object($result)) {
+ $output .= "<H$depth>". check_output($node->title) ."</H$depth>";
+ if ($node->body) $output .= check_output($node->body, 1);
+ if ($node->pid) $output .= book_export_html($node->pid, $depth + 1);
+ $output .= book_export_html($node->nid, $depth + 1);
+ }
+ return $output;
+}
+
+function book_export($uri) {
+ if ($uri[2] == "book") {
+ print book_export_html($uri[3], $depth = 1);
+ }
+}
+
?>