1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Holds theme functions and template preprocesses.
|
6
|
* Other style related functions are in style.inc
|
7
|
*/
|
8
|
|
9
|
/**
|
10
|
* Theme function to display a link, optionally buttonized.
|
11
|
*/
|
12
|
function theme_advanced_forum_l(&$variables) {
|
13
|
$text = $variables['text'];
|
14
|
$path = empty($variables['path']) ? NULL : $variables['path'];
|
15
|
$options = empty($variables['options']) ? array() : $variables['options'];
|
16
|
$button_class = empty($variables['button_class']) ? NULL : $variables['button_class'];
|
17
|
|
18
|
$l = '';
|
19
|
if (!isset($options['attributes'])) {
|
20
|
$options['attributes'] = array();
|
21
|
}
|
22
|
if (!is_null($button_class)) {
|
23
|
// Buttonized link: add our button class and the span.
|
24
|
if (!isset($options['attributes']['class'])) {
|
25
|
$options['attributes']['class'] = array("af-button-$button_class");
|
26
|
}
|
27
|
else {
|
28
|
$options['attributes']['class'][] = "af-button-$button_class";
|
29
|
}
|
30
|
$options['html'] = TRUE;
|
31
|
// @codingStandardsIgnoreStart
|
32
|
$l = l('<span>' . $text . '</span>', $path, $options);
|
33
|
// @codingStandardsIgnoreEnd
|
34
|
}
|
35
|
else {
|
36
|
// Standard link: just send it through l().
|
37
|
$l = l($text, $path, $options);
|
38
|
}
|
39
|
|
40
|
return $l;
|
41
|
}
|
42
|
|
43
|
/**
|
44
|
* Theme function to show list of types that can be posted in forum.
|
45
|
*/
|
46
|
function theme_advanced_forum_node_type_create_list(&$variables) {
|
47
|
$forum_id = $variables['forum_id'];
|
48
|
|
49
|
// Get the list of node types to display links for.
|
50
|
$type_list = advanced_forum_node_type_create_list($forum_id);
|
51
|
|
52
|
$output = '';
|
53
|
if (is_array($type_list)) {
|
54
|
foreach ($type_list as $type => $item) {
|
55
|
$output .= '<div class="forum-add-node forum-add-' . $type . '">';
|
56
|
$output .= theme('advanced_forum_l', array(
|
57
|
'text' => t('New @node_type', array('@node_type' => $item['name'])),
|
58
|
'path' => $item['href'],
|
59
|
'options' => NULL,
|
60
|
'button_class' => 'large',
|
61
|
));
|
62
|
$output .= '</div>';
|
63
|
}
|
64
|
}
|
65
|
else {
|
66
|
// User did not have access to create any node types in this fourm so
|
67
|
// we just return the denial text / login prompt.
|
68
|
$output = $type_list;
|
69
|
}
|
70
|
|
71
|
return $output;
|
72
|
}
|
73
|
|
74
|
/**
|
75
|
* Theme function to show simple author pane when not using Author Pane.
|
76
|
*/
|
77
|
function theme_advanced_forum_simple_author_pane(&$variables) {
|
78
|
$context = $variables['context'];
|
79
|
// Sending the context rather than the account makes it work for anon comments.
|
80
|
$name = theme('username', array('account' => $context));
|
81
|
|
82
|
$account = user_load($context->uid);
|
83
|
$picture = theme('user_picture', array('account' => $account));
|
84
|
|
85
|
return '<div class="author-pane">' . $name . $picture . '</div>';
|
86
|
}
|
87
|
|
88
|
/**
|
89
|
* Theme function to format the reply link at the top/bottom of topic.
|
90
|
*/
|
91
|
function theme_advanced_forum_reply_link(&$variables) {
|
92
|
$node = $variables['node'];
|
93
|
|
94
|
// Get the information about whether the user can reply and the link to do
|
95
|
// so if the user is allowed to.
|
96
|
$reply_link = advanced_forum_get_reply_link($node);
|
97
|
|
98
|
if (is_array($reply_link)) {
|
99
|
// Reply is allowed. Variable contains the link information.
|
100
|
$output = '<div class="topic-reply-allowed">';
|
101
|
$output .= theme('advanced_forum_l', array(
|
102
|
'text' => $reply_link['title'],
|
103
|
'path' => $reply_link['href'],
|
104
|
'options' => $reply_link['options'],
|
105
|
'button_class' => 'large',
|
106
|
));
|
107
|
$output .= '</div>';
|
108
|
return $output;
|
109
|
}
|
110
|
elseif ($reply_link == 'reply-locked') {
|
111
|
// @TODO: The double span here is icky but I don't know how else to get
|
112
|
// around the fact that there's no "a" to put the button class on.
|
113
|
return '<div class="topic-reply-locked"><span class="af-button-large"><span>' . t('Topic locked') . '</span></span></div>';
|
114
|
}
|
115
|
elseif ($reply_link == 'reply-forbidden') {
|
116
|
// User is not allowed to reply to this topic.
|
117
|
return theme('comment_post_forbidden', array('node' => $node));
|
118
|
}
|
119
|
}
|
120
|
|
121
|
/**
|
122
|
* Theme function to a formatted list of subforums.
|
123
|
*
|
124
|
* @param array $variables
|
125
|
* Array of subforums.
|
126
|
*
|
127
|
* @return string
|
128
|
* Formatted list of subforums.
|
129
|
*/
|
130
|
function theme_advanced_forum_subforum_list(&$variables) {
|
131
|
$subforums = array();
|
132
|
foreach ($variables['subforum_list'] as $tid => $subforum) {
|
133
|
// Note: $subforum->name has not been run through check_plain because
|
134
|
// it ends up going through there when l() is called without the HTML
|
135
|
// option. If you change this to set HTML to TRUE, you must sanitize it.
|
136
|
$text = l($subforum->name, "forum/$tid");
|
137
|
$text .= ' (' . $subforum->total_posts;
|
138
|
|
139
|
if (empty($subforum->new_posts)) {
|
140
|
$text .= ')';
|
141
|
}
|
142
|
else {
|
143
|
$text .= ' - ' . l($subforum->new_posts_text, $subforum->new_posts_path, array('fragment' => 'new')) . ')';
|
144
|
}
|
145
|
|
146
|
$subforums[] = $text;
|
147
|
}
|
148
|
return implode(', ', $subforums);
|
149
|
}
|
150
|
|
151
|
/**
|
152
|
* Theme function to a formatted list of subcontainers.
|
153
|
*
|
154
|
* @param array $variables
|
155
|
* Array of subcontainers.
|
156
|
*
|
157
|
* @return string
|
158
|
* Formatted list of subcontainers.
|
159
|
*/
|
160
|
function theme_advanced_forum_subcontainer_list(&$variables) {
|
161
|
$subcontainers = array();
|
162
|
foreach ($variables['subcontainer_list'] as $tid => $subcontainer) {
|
163
|
// Note: $subcontainer->name has not been run through check_plain because
|
164
|
// it ends up going through there when l() is called without the HTML
|
165
|
// option. If you change this to set HTML to TRUE, you must sanitize it.
|
166
|
$text = l($subcontainer->name, "forum/$tid");
|
167
|
$text .= ' (' . $subcontainer->total_posts;
|
168
|
|
169
|
if (empty($subcontainer->new_posts)) {
|
170
|
$text .= ')';
|
171
|
}
|
172
|
else {
|
173
|
$text .= ' - ' . l($subforum->new_posts_text, $subforum->new_posts_path, array('fragment' => 'new')) . ')';
|
174
|
}
|
175
|
|
176
|
$subcontainers[] = $text;
|
177
|
}
|
178
|
|
179
|
return implode(', ', $subcontainers);
|
180
|
}
|
181
|
|
182
|
// TEMPLATE PREPROCESS ******************************************************/
|
183
|
|
184
|
/* * * FORUM OVERVIEW & TOPIC LIST PAGES ************************************* */
|
185
|
|
186
|
/**
|
187
|
* Preprocesses template variables for the forum template.
|
188
|
*/
|
189
|
function advanced_forum_preprocess_forums(&$variables) {
|
190
|
include_once drupal_get_path('module', 'advanced_forum') . '/includes/advanced_forum_preprocess_forums.inc';
|
191
|
_advanced_forum_preprocess_forums($variables);
|
192
|
}
|
193
|
|
194
|
/**
|
195
|
* Preprocesses template variables for the forum search form template.
|
196
|
*/
|
197
|
function advanced_forum_preprocess_advanced_forum_search_forum(&$variables) {
|
198
|
advanced_forum_add_template_suggestions("search_forum", $variables);
|
199
|
|
200
|
$variables['forum'] = !empty($variables['tid']) ? $variables['tid'] : 'All';
|
201
|
$variables['path'] = url('forum/search');
|
202
|
}
|
203
|
|
204
|
/**
|
205
|
* Preprocesses template variables for the search results template.
|
206
|
*/
|
207
|
function advanced_forum_preprocess_views_view_fields__advanced_forum_search(&$variables) {
|
208
|
_advanced_forum_add_files();
|
209
|
advanced_forum_add_template_suggestions("search_result", $variables);
|
210
|
}
|
211
|
|
212
|
/**
|
213
|
* Preprocesses template variables for the submitted by/in template.
|
214
|
*/
|
215
|
function advanced_forum_preprocess_forum_submitted(&$variables) {
|
216
|
advanced_forum_add_template_suggestions("submitted", $variables);
|
217
|
// Avoid E_ALL warning.
|
218
|
$variables['topic_link'] = '';
|
219
|
|
220
|
if (isset($variables['topic']->node_title)) {
|
221
|
$nid = $variables['topic']->nid;
|
222
|
|
223
|
// Make a fake node object to avoid the node load.
|
224
|
$node = new stdClass();
|
225
|
$node->nid = $nid;
|
226
|
$node->type = $variables['topic']->type;
|
227
|
|
228
|
// Find the page of the first unread comment, if any.
|
229
|
$comment_count = db_query('SELECT COUNT(cid) FROM {comment} WHERE nid = :nid', array(':nid' => $nid))->fetchField();
|
230
|
$new_replies = advanced_forum_reply_num_new($nid);
|
231
|
$query = advanced_forum_page_first_new($comment_count, $new_replies, $node);
|
232
|
|
233
|
// Format the node title with a link.
|
234
|
$title_length = variable_get('advanced_forum_topic_title_length', 15);
|
235
|
if ($title_length == 0) {
|
236
|
$short_topic_title = $variables['topic']->node_title;
|
237
|
}
|
238
|
else {
|
239
|
$short_topic_title = truncate_utf8($variables['topic']->node_title, $title_length, TRUE, TRUE);
|
240
|
}
|
241
|
|
242
|
$variables['short_topic_title'] = $short_topic_title;
|
243
|
|
244
|
$fragment = ($new_replies) ? 'new' : NULL;
|
245
|
|
246
|
$variables['topic_link_fragment'] = $fragment;
|
247
|
$variables['topic_link_query'] = $query;
|
248
|
$variables['topic_link'] = l($short_topic_title, "node/$nid", array('query' => $query, 'fragment' => $fragment));
|
249
|
}
|
250
|
|
251
|
if (isset($variables['topic']->created)) {
|
252
|
$timestamp = $variables['topic']->created;
|
253
|
$interval = REQUEST_TIME - $timestamp;
|
254
|
$variables['time'] = format_interval($interval);
|
255
|
|
256
|
// For items posted more than $cutoff hours ago, offer an actual date.
|
257
|
$cutoff = variable_get('advanced_forum_time_ago_cutoff', 48) * 60 * 60;
|
258
|
if ($interval > $cutoff) {
|
259
|
$variables['date_posted'] = format_date($timestamp, 'short');
|
260
|
}
|
261
|
else {
|
262
|
unset($variables['date_posted']);
|
263
|
}
|
264
|
}
|
265
|
}
|
266
|
|
267
|
/**
|
268
|
* Preprocess forum topic pager.
|
269
|
*/
|
270
|
function advanced_forum_preprocess_advanced_forum_topic_pager(&$variables) {
|
271
|
$pagecount = $variables['pagecount'];
|
272
|
$topic = $variables['topic'];
|
273
|
|
274
|
// Get the information to assemble the pager. This returns an object with
|
275
|
// the following properties:
|
276
|
// - initial_pages: Array of linked numbers for first set of pages
|
277
|
// - last_page_text: Linked text "Last page" (translatable)
|
278
|
// - last_page_number: Linked number pointing to the last page.
|
279
|
$topic_pager = advanced_forum_create_topic_pager($pagecount, $topic);
|
280
|
|
281
|
$variables['last_page_text'] = '';
|
282
|
|
283
|
if (!empty($topic_pager->initial_pages)) {
|
284
|
$variables['pages'] = $topic_pager->initial_pages;
|
285
|
if (!empty($topic_pager->last_page_text)) {
|
286
|
$variables['last_page'] = $topic_pager->last_page;
|
287
|
$variables['last_page_text'] = $topic_pager->last_page_text;
|
288
|
$variables['last_page_number'] = $topic_pager->last_page_number;
|
289
|
|
290
|
// If you prefer to end with the number, replace
|
291
|
// $topic_pager->last_page_text with $topic_pager->last_page_number
|
292
|
$variables['last_page_text'] = ' … ' . $topic_pager->last_page_text;
|
293
|
}
|
294
|
}
|
295
|
}
|
296
|
|
297
|
/**
|
298
|
* Preprocess variables for advanced-forum.naked.post-edited.tpl.php.
|
299
|
*/
|
300
|
function advanced_forum_preprocess_advanced_forum_post_edited(&$variables) {
|
301
|
$editor = user_load($variables['who']);
|
302
|
|
303
|
$variables['edited_name'] = theme('username', array('account' => $editor));
|
304
|
$variables['edited_datetime'] = format_date($variables['when'], 'custom', variable_get('date_format_short', 'm/d/Y - H:i'));
|
305
|
$variables['edited_reason'] = empty($variables['why']) ? '' : $variables['why'];
|
306
|
}
|
307
|
|
308
|
/**
|
309
|
* Preprocess forum shadow topic.
|
310
|
*/
|
311
|
function advanced_forum_preprocess_advanced_forum_shadow_topic(&$variables) {
|
312
|
$nid = $variables['nid'];
|
313
|
|
314
|
$variables['new_forum_url'] = url("node/$nid");
|
315
|
// Compatibility variable.
|
316
|
$variables['new_forum_link'] = l(t('View topic'), "node/$nid");
|
317
|
}
|
318
|
|
319
|
/* * * JUST FORUM OVERVIEW PAGE ********************************************** */
|
320
|
|
321
|
/**
|
322
|
* Preprocesses template variables for the forum legend template.
|
323
|
*/
|
324
|
function advanced_forum_preprocess_advanced_forum_forum_legend(&$variables) {
|
325
|
advanced_forum_add_template_suggestions("forum_legend", $variables);
|
326
|
}
|
327
|
|
328
|
/**
|
329
|
* Preprocesses template variables for the forum statistics template.
|
330
|
*/
|
331
|
function advanced_forum_preprocess_advanced_forum_statistics(&$variables) {
|
332
|
advanced_forum_add_template_suggestions("statistics", $variables);
|
333
|
|
334
|
$variables['topics'] = advanced_forum_statistics_topics();
|
335
|
$variables['posts'] = advanced_forum_statistics_replies() + $variables['topics'];
|
336
|
$variables['users'] = advanced_forum_statistics_users();
|
337
|
|
338
|
$authenticated_users = advanced_forum_statistics_online_users();
|
339
|
$variables['online_users'] = implode(', ', $authenticated_users);
|
340
|
$variables['current_users'] = advanced_forum_session_count(FALSE);
|
341
|
// For backwards compatibility.
|
342
|
$variables['current_guests'] = 0;
|
343
|
$variables['current_total'] = $variables['current_users'] + $variables['current_guests'];
|
344
|
|
345
|
$latest_users = advanced_forum_statistics_latest_users();
|
346
|
$variables['latest_users'] = implode(', ', $latest_users);
|
347
|
}
|
348
|
|
349
|
/**
|
350
|
* Preprocesses template variables for the forum list template.
|
351
|
*/
|
352
|
function advanced_forum_preprocess_forum_list(&$variables) {
|
353
|
include_once drupal_get_path('module', 'advanced_forum') . '/includes/advanced_forum_preprocess_forum_list.inc';
|
354
|
_advanced_forum_preprocess_forum_list($variables);
|
355
|
}
|
356
|
|
357
|
/* * * JUST TOPIC LIST PAGES ************************************************* */
|
358
|
|
359
|
/**
|
360
|
* Preprocess views forum topic list.
|
361
|
*/
|
362
|
function advanced_forum_preprocess_views_view_forum_topic_list__advanced_forum_topic_list(&$variables) {
|
363
|
_advanced_forum_add_files();
|
364
|
die("advanced_forum_preprocess_views_view_forum_topic_list__advanced_forum_topic_list");
|
365
|
advanced_forum_add_template_suggestions("topic_list_view", $variables);
|
366
|
// Set a variable for displaying the topic legend.
|
367
|
$variables['topic_legend'] = theme('advanced_forum_topic_legend');
|
368
|
}
|
369
|
|
370
|
/**
|
371
|
* Preprocess views forum topic list.
|
372
|
*/
|
373
|
function advanced_forum_preprocess_views_view__advanced_forum_topic_list(&$variables) {
|
374
|
_advanced_forum_add_files();
|
375
|
advanced_forum_add_template_suggestions("topic_list_outer_view", $variables);
|
376
|
|
377
|
$variables['node_create_list'] = '';
|
378
|
$variables['forum_tools'] = '';
|
379
|
$variables['forum_jump'] = '';
|
380
|
|
381
|
$menu_item = menu_get_item();
|
382
|
|
383
|
if (!empty($menu_item) && $menu_item['access']) {
|
384
|
if (($menu_item['map'][0] == 'forum') && (!empty($menu_item['map'][1]))) {
|
385
|
$forum = $menu_item['map'][1];
|
386
|
if ($forum->vid == variable_get('forum_nav_vocabulary') && $forum->tid > 0) {
|
387
|
$variables['node_create_list'] = theme('advanced_forum_node_type_create_list', array('forum_id' => $forum->tid));
|
388
|
$variables['forum_description'] = $forum->description;
|
389
|
$variables['forum_tools'] = advanced_forum_forum_tools($forum->tid);
|
390
|
$variables['forum_jump'] = advanced_forum_forum_jump($forum->tid);
|
391
|
}
|
392
|
}
|
393
|
}
|
394
|
}
|
395
|
|
396
|
/**
|
397
|
* Display a view as a forum topic list style.
|
398
|
*/
|
399
|
function template_preprocess_advanced_forum_topic_list_view(&$variables) {
|
400
|
include_once drupal_get_path('module', 'advanced_forum') . '/includes/template_preprocess_advanced_forum_topic_list_view.inc';
|
401
|
_template_preprocess_advanced_forum_topic_list_view($variables);
|
402
|
}
|
403
|
|
404
|
/**
|
405
|
* Preprocesses template variables for the topic list template.
|
406
|
*/
|
407
|
function advanced_forum_preprocess_forum_topic_list(&$variables) {
|
408
|
advanced_forum_add_template_suggestions("topic_list", $variables);
|
409
|
}
|
410
|
|
411
|
/**
|
412
|
* Preprocesses template variables for the forum icon template.
|
413
|
*/
|
414
|
function advanced_forum_preprocess_forum_icon(&$variables) {
|
415
|
advanced_forum_add_template_suggestions("topic_icon", $variables);
|
416
|
}
|
417
|
|
418
|
/**
|
419
|
* Preprocesses template variables for the topic legend template.
|
420
|
*/
|
421
|
function advanced_forum_preprocess_advanced_forum_topic_legend(&$variables) {
|
422
|
advanced_forum_add_template_suggestions("topic_legend", $variables);
|
423
|
}
|
424
|
|
425
|
/* * * TOPIC PAGES *********************************************************** */
|
426
|
/**
|
427
|
* Preprocess forum search topic.
|
428
|
*/
|
429
|
function advanced_forum_preprocess_advanced_forum_search_topic(&$variables) {
|
430
|
advanced_forum_add_template_suggestions("search_topic", $variables);
|
431
|
|
432
|
$variables['path'] = url('node/' . $variables['node']->nid . '/search');
|
433
|
}
|
434
|
|
435
|
/**
|
436
|
* Preprocess views forum search topic.
|
437
|
*/
|
438
|
function advanced_forum_preprocess_views_view_fields__advanced_forum_search_topic(&$variables) {
|
439
|
_advanced_forum_add_files();
|
440
|
advanced_forum_add_template_suggestions("search_result", $variables);
|
441
|
}
|
442
|
|
443
|
/**
|
444
|
* Preprocesses template variables for the topic header template.
|
445
|
*/
|
446
|
function advanced_forum_preprocess_advanced_forum_topic_header(&$variables) {
|
447
|
advanced_forum_add_template_suggestions("topic_header", $variables);
|
448
|
|
449
|
$node = $variables['node'];
|
450
|
|
451
|
// Reply link/button.
|
452
|
$variables['reply_link'] = theme('advanced_forum_reply_link', array('node' => $node));
|
453
|
|
454
|
// Total posts, including first post.
|
455
|
$posts = (empty($variables['comment_count'])) ? 1 : $variables['comment_count'] + 1;
|
456
|
$variables['total_posts_count'] = format_plural($posts, '1 post', '@count posts');
|
457
|
|
458
|
// Number of new posts on topic.
|
459
|
$variables['new_posts_count'] = advanced_forum_reply_num_new($node->nid);
|
460
|
|
461
|
// Link to first new post.
|
462
|
$variables['first_new_post_link'] = '';
|
463
|
if ($posts > 1) {
|
464
|
$variables['first_new_post_link'] = advanced_forum_first_new_post_link($variables['node'], $variables['comment_count']);
|
465
|
}
|
466
|
|
467
|
// Link to last post in topic.
|
468
|
$variables['last_post_link'] = advanced_forum_last_post_link($node);
|
469
|
|
470
|
// Pager.
|
471
|
if (isset($variables['node']->comment_count)) {
|
472
|
pager_default_initialize($variables['node']->comment_count, variable_get('comment_default_per_page_' . $variables['node']->type, 50));
|
473
|
}
|
474
|
|
475
|
$variables['pager'] = theme('pager');
|
476
|
}
|
477
|
|
478
|
/**
|
479
|
* Preprocesses template variables for the active poster template.
|
480
|
*/
|
481
|
function advanced_forum_preprocess_advanced_forum_active_poster(&$variables) {
|
482
|
advanced_forum_add_template_suggestions("active_poster", $variables);
|
483
|
|
484
|
$variables['account_name'] = theme('username', array('account' => $variables['account']));
|
485
|
$variables['picture'] = theme('advanced_forum_user_picture', array('account' => $variables['account']));
|
486
|
|
487
|
$node = $variables['last_post'];
|
488
|
$variables['last_post_title'] = l($node->title, "node/$node->nid");
|
489
|
$variables['last_post_date'] = format_date($node->created);
|
490
|
}
|
491
|
|
492
|
/**
|
493
|
* Preprocesses template variables for the author pane.
|
494
|
*/
|
495
|
function advanced_forum_preprocess_author_pane(&$variables) {
|
496
|
// Author pane is used in various places. Check the caller to make sure
|
497
|
// we are the one that called it.
|
498
|
if (!empty($variables['caller']) && $variables['caller'] == 'advanced_forum') {
|
499
|
advanced_forum_add_template_suggestions("author_pane", $variables);
|
500
|
}
|
501
|
}
|
502
|
|
503
|
/**
|
504
|
* Preprocesses template variables for the page template.
|
505
|
*/
|
506
|
function advanced_forum_preprocess_page(&$variables) {
|
507
|
if (arg(0) == 'forum') {
|
508
|
$variables['forum_page'] = TRUE;
|
509
|
}
|
510
|
elseif (arg(0) == 'node' && !empty($variables['node']) && advanced_forum_type_is_in_forum($variables['node']->type)) {
|
511
|
$variables['forum_page'] = TRUE;
|
512
|
}
|
513
|
}
|
514
|
|
515
|
/**
|
516
|
* Preprocesses template variables for the node template.
|
517
|
*/
|
518
|
function advanced_forum_preprocess_node(&$variables) {
|
519
|
if (advanced_forum_is_styled($variables['node'], $variables['teaser'], 'node')) {
|
520
|
include_once drupal_get_path('module', 'advanced_forum') . '/includes/advanced_forum_preprocess_node.inc';
|
521
|
_advanced_forum_preprocess_node($variables);
|
522
|
}
|
523
|
}
|
524
|
|
525
|
/**
|
526
|
* Preprocess comment wrapper.
|
527
|
*/
|
528
|
function advanced_forum_preprocess_comment_wrapper(&$variables) {
|
529
|
$variables['reply_link'] = '';
|
530
|
if (advanced_forum_is_styled($variables['node'], FALSE, 'comment-wrapper')) {
|
531
|
advanced_forum_add_template_suggestions("advanced_forum_comment_wrapper", $variables);
|
532
|
|
533
|
$form_on_seperate_page = variable_get('comment_form_location_' . $variables['node']->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE;
|
534
|
|
535
|
$comments_locked = $variables['node']->comment != COMMENT_NODE_OPEN;
|
536
|
|
537
|
if ($form_on_seperate_page || $comments_locked) {
|
538
|
// If the post is locked or the comment form is on a seperate page,
|
539
|
// build the reply/locked link / button.
|
540
|
$variables['reply_link'] = theme('advanced_forum_reply_link', array('node' => $variables['node']));
|
541
|
}
|
542
|
}
|
543
|
}
|
544
|
|
545
|
/**
|
546
|
* Preprocesses template variables for the comment template.
|
547
|
*/
|
548
|
function advanced_forum_preprocess_comment(&$variables) {
|
549
|
if (advanced_forum_is_styled($variables['comment'], FALSE, 'comment')) {
|
550
|
include_once drupal_get_path('module', 'advanced_forum') . '/includes/advanced_forum_preprocess_comment.inc';
|
551
|
_advanced_forum_preprocess_comment($variables);
|
552
|
}
|
553
|
}
|
554
|
|
555
|
/* * * ORGANIC GROUPS ******************************************************** */
|
556
|
/**
|
557
|
* Preprocess view forum group list.
|
558
|
*/
|
559
|
function advanced_forum_preprocess_views_view__advanced_forum_group_topic_list(&$variables) {
|
560
|
_advanced_forum_add_files();
|
561
|
advanced_forum_add_template_suggestions("group_topic_list_outer_view", $variables);
|
562
|
|
563
|
// Set a variable for displaying the topic legend.
|
564
|
$variables['topic_legend'] = theme('advanced_forum_topic_legend');
|
565
|
}
|