/[drupal]/contributions/modules/hidden/hidden.display-pages.inc
ViewVC logotype

Contents of /contributions/modules/hidden/hidden.display-pages.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Thu Dec 18 15:29:07 2008 UTC (11 months, 1 week ago) by ekes
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--1
Changes since 1.3: +3 -15 lines
File MIME type: text/x-php
#276732 Continuing D6 migration
  admin pages forms upgraded to D6
  tests written for admin pages
  filters section reworked and using drupal_write_record
1 <?php
2 // $Id: hidden.display-pages.inc,v 1.3 2008/12/13 18:42:43 ekes Exp $
3
4 /**
5 * @file
6 * Hidden user pages to display hidden content.
7 */
8
9 /**
10 * Menu callback; a page with the hidden nodes list.
11 *
12 * @see theme_hidden_list_nodes()
13 */
14 function hidden_list_nodes() {
15 $query = 'SELECT n.nid AS nid, n.title AS title,'.
16 ' r.title AS reason,'.
17 ' u.uid AS uid, u.name AS name'.
18 ' FROM {hidden_node} AS h'.
19 ' LEFT JOIN {hidden_reasons} AS r ON h.rid=r.rid'.
20 ' INNER JOIN ({users} AS u, {node} AS n) ON (n.uid=u.uid AND n.nid=h.nid)'.
21 ' ORDER BY h.created DESC';
22 $table = _hidden_list_get($query, 'node');
23 $output = theme('hidden_list_nodes', $table);
24 drupal_set_html_head('<meta name="robots" content="noindex, nofollow" />');
25 $output .= theme('pager', NULL, HIDDEN_PAGER_LIMIT);
26 return $output;
27 }
28
29 /**
30 * Menu callback; a page with the hidden comments list.
31 *
32 * @see theme_hidden_list_comments()
33 */
34 function hidden_list_comments() {
35 $query = 'SELECT c.cid AS cid, c.subject AS title,'.
36 ' r.title AS reason,'.
37 ' u.uid AS uid, u.name AS name'.
38 ' FROM {hidden_comment} AS h'.
39 ' LEFT JOIN {hidden_reasons} AS r ON h.rid=r.rid'.
40 ' INNER JOIN ({users} AS u, {comments} AS c) ON (c.uid=u.uid AND c.cid=h.cid)'.
41 ' ORDER BY h.created DESC';
42 $table = _hidden_list_get($query, 'comment');
43 $output = theme('hidden_list_comments', $table);
44 drupal_set_html_head('<meta name="robots" content="noindex, nofollow" />');
45 $output .= theme('pager', NULL, HIDDEN_PAGER_LIMIT);
46
47 return $output;
48 }
49
50 /**
51 * Formats table of hidden nodes.
52 *
53 * @param $table
54 * results from _hidden_list_get().
55 * @return
56 * text html themed table.
57 * @ingroup themeable.
58 */
59 function theme_hidden_list_nodes($table) {
60 return theme(
61 'table',
62 array(t('Title'), t('Author'), t('Reason')),
63 $table
64 );
65 }
66
67 /**
68 * Format table of hidden comments.
69 *
70 * @param $table
71 * results from _hidden_list_get().
72 * @return
73 * text html themed table.
74 * @ingroup themable.
75 */
76 function theme_hidden_list_comments($table) {
77 return theme(
78 'table',
79 array(t('Title'), t('Author'), t('Reason')),
80 $table
81 );
82 }
83
84 /**
85 * Menu callback; display a single hidden node or comment.
86 *
87 * @param $hidden
88 * object node or comment.
89 * @return
90 * page content if is hidden.
91 */
92 function hidden_view($type, $id) {
93 if (! $hidden = _hidden_hidden_get($type, $id)) {
94 drupal_not_found();
95 return;
96 }
97 if ($type == 'comment') {
98 $comment = _comment_load($id);
99 $node = node_load($comment->nid);
100 drupal_set_title(t('Hidden comment: @title', array('@title' => $comment->subject)));
101 $links = hidden_link('comment', $comment);
102 $output = theme_comment_view($comment, $node, $links);
103 }
104 elseif ($type == 'node') {
105 $node = node_load($id);
106 drupal_set_title(t('Hidden node: @title', array('@title' => $node->title)));
107 $output = node_show($node, 0);
108 }
109 else {
110 _hidden_log(HIDDEN_LOG_DEBUG, 'hidden_view() called with invalid $hidden->type.');
111 drupal_not_found();
112 return;
113 }
114 return $output;
115 }

  ViewVC Help
Powered by ViewVC 1.1.2