From 14158fbc6b511965f0b2031d11c01b4bc0411c14 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 29 Dec 2002 12:03:08 +0000 Subject: - Added table rendering functions. As an example, I changed the node module to take advantage of it. --- modules/node.module | 11 +++++------ modules/node/node.module | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'modules') diff --git a/modules/node.module b/modules/node.module index c1a82d46e..9b234fc78 100644 --- a/modules/node.module +++ b/modules/node.module @@ -493,15 +493,14 @@ function node_admin_nodes() { $result = pager_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid ". $queries[$query ? $query : 0], 50); - $output .= "\n"; - $output .= " \n"; + $header = array(t("title"), t("type"), t("author"), t("status"), array("data" => t("operations"), "colspan" => 2)); + while ($node = db_fetch_object($result)) { - $output .= ""; + $rows[] = array(l(check_output($node->title), array("id" => $node->nid)), module_invoke($node->type, "node", "name"), format_name($node), ($node->status ? t("published") : t("not published")), la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid)), la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid))); } - $output .= "
". t("title") ."". t("type") ."". t("author") ."". t("status") ."". t("operations") ."
". l(check_output($node->title), array("id" => $node->nid)) ."". module_invoke($node->type, "node", "name") ."". format_name($node) ."". ($node->status ? t("published") : t("not published")) ."". la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid)) ."". la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid)) ."
". pager_display(NULL, 50, 0, "admin") ."
"; - +// $output .= "". pager_display(NULL, 50, 0, "admin") .""; - return $output; + return table($header, $rows); } /* diff --git a/modules/node/node.module b/modules/node/node.module index c1a82d46e..9b234fc78 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -493,15 +493,14 @@ function node_admin_nodes() { $result = pager_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid ". $queries[$query ? $query : 0], 50); - $output .= "\n"; - $output .= " \n"; + $header = array(t("title"), t("type"), t("author"), t("status"), array("data" => t("operations"), "colspan" => 2)); + while ($node = db_fetch_object($result)) { - $output .= ""; + $rows[] = array(l(check_output($node->title), array("id" => $node->nid)), module_invoke($node->type, "node", "name"), format_name($node), ($node->status ? t("published") : t("not published")), la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid)), la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid))); } - $output .= "
". t("title") ."". t("type") ."". t("author") ."". t("status") ."". t("operations") ."
". l(check_output($node->title), array("id" => $node->nid)) ."". module_invoke($node->type, "node", "name") ."". format_name($node) ."". ($node->status ? t("published") : t("not published")) ."". la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid)) ."". la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid)) ."
". pager_display(NULL, 50, 0, "admin") ."
"; - +// $output .= "". pager_display(NULL, 50, 0, "admin") .""; - return $output; + return table($header, $rows); } /* -- cgit v1.2.3