1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Forum statistics.
|
5
|
*/
|
6
|
|
7
|
/**
|
8
|
* Plugins are described by creating a $plugin array which will be used
|
9
|
* by the system that includes this file.
|
10
|
*/
|
11
|
$plugin = array(
|
12
|
'single' => TRUE,
|
13
|
'title' => t('Forum statistics'),
|
14
|
'icon' => 'icon_forum.png',
|
15
|
'description' => t('The forum statistics widget.'),
|
16
|
'required context' => new ctools_context_required(t('Forum'), 'forum'),
|
17
|
'category' => t('Forum'),
|
18
|
'defaults' => array(),
|
19
|
);
|
20
|
|
21
|
/**
|
22
|
* Render the content.
|
23
|
*/
|
24
|
function advanced_forum_forum_statistics_content_type_render(
|
25
|
$subtype,
|
26
|
$conf,
|
27
|
$panel_args,
|
28
|
$context
|
29
|
) {
|
30
|
if (!empty($context) && empty($context->data)) {
|
31
|
return;
|
32
|
}
|
33
|
|
34
|
$tid = 0;
|
35
|
if (!empty($context)) {
|
36
|
$tid = $context->data->tid;
|
37
|
}
|
38
|
|
39
|
$block = new stdClass();
|
40
|
$block->module = 'forum-secondary-links';
|
41
|
$block->delta = $tid;
|
42
|
|
43
|
// By default this has no title.
|
44
|
$block->title = '';
|
45
|
_advanced_forum_add_files();
|
46
|
|
47
|
$block->content = theme('advanced_forum_statistics');
|
48
|
|
49
|
return $block;
|
50
|
}
|
51
|
|
52
|
/**
|
53
|
* Returns an edit form for the custom type.
|
54
|
*/
|
55
|
function advanced_forum_forum_statistics_content_type_edit_form(
|
56
|
$form,
|
57
|
&$form_state
|
58
|
) {
|
59
|
return $form;
|
60
|
}
|
61
|
|
62
|
/**
|
63
|
* Submit callback.
|
64
|
*/
|
65
|
function advanced_forum_forum_statistics_content_type_edit_form_submit(
|
66
|
$form,
|
67
|
&$form_state
|
68
|
) {
|
69
|
// Copy everything from our defaults.
|
70
|
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
71
|
$form_state['conf'][$key] = $form_state['values'][$key];
|
72
|
}
|
73
|
}
|
74
|
|
75
|
/**
|
76
|
* Callback for admin title.
|
77
|
*/
|
78
|
function advanced_forum_forum_statistics_content_type_admin_title(
|
79
|
$subtype,
|
80
|
$conf,
|
81
|
$context
|
82
|
) {
|
83
|
return t('"@s" statistics', array('@s' => $context->identifier));
|
84
|
}
|