1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
13c3c9b4
|
Assos Assos
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* Forum topic list.
|
5 |
|
|
*/
|
6 |
85ad3d82
|
Assos Assos
|
|
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 topic list'),
|
14 |
|
|
'icon' => 'icon_forum.png',
|
15 |
|
|
'description' => t('The list of all topics for a forum.'),
|
16 |
|
|
'required context' => new ctools_context_required(t('Forum'), 'forum'),
|
17 |
|
|
'category' => t('Forum'),
|
18 |
|
|
'defaults' => array('show_sort' => TRUE),
|
19 |
|
|
);
|
20 |
|
|
|
21 |
|
|
/**
|
22 |
|
|
* Render the content.
|
23 |
|
|
*/
|
24 |
13c3c9b4
|
Assos Assos
|
function advanced_forum_forum_topic_list_content_type_render(
|
25 |
|
|
$subtype,
|
26 |
|
|
$conf,
|
27 |
|
|
$panel_args,
|
28 |
|
|
$context
|
29 |
|
|
) {
|
30 |
85ad3d82
|
Assos Assos
|
if (!empty($context) && empty($context->data)) {
|
31 |
|
|
return;
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
if (!empty($context->data->container)) {
|
35 |
|
|
return;
|
36 |
|
|
}
|
37 |
|
|
|
38 |
13c3c9b4
|
Assos Assos
|
$tid = 0;
|
39 |
|
|
if (!empty($context)) {
|
40 |
85ad3d82
|
Assos Assos
|
$tid = $context->data->tid;
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
$block = new stdClass();
|
44 |
|
|
$block->module = 'forum-secondary-links';
|
45 |
|
|
$block->delta = $tid;
|
46 |
|
|
|
47 |
13c3c9b4
|
Assos Assos
|
// By default this has no title.
|
48 |
|
|
$block->title = '';
|
49 |
85ad3d82
|
Assos Assos
|
_advanced_forum_add_files();
|
50 |
|
|
|
51 |
|
|
// TODO: We could make these settings, but they're ignored if it isusing
|
52 |
|
|
// the view, so we have to be careful about that.
|
53 |
|
|
$forum_per_page = variable_get('forum_per_page', 25);
|
54 |
|
|
$sortby = variable_get('forum_order', 1);
|
55 |
|
|
|
56 |
13c3c9b4
|
Assos Assos
|
$block->content = advanced_forum_get_topics(
|
57 |
|
|
$tid,
|
58 |
|
|
$sortby,
|
59 |
|
|
$forum_per_page,
|
60 |
|
|
!empty($conf['show_sort'])
|
61 |
|
|
);
|
62 |
85ad3d82
|
Assos Assos
|
|
63 |
|
|
return $block;
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
/**
|
67 |
|
|
* Returns an edit form for the custom type.
|
68 |
|
|
*/
|
69 |
13c3c9b4
|
Assos Assos
|
function advanced_forum_forum_topic_list_content_type_edit_form(
|
70 |
|
|
$form,
|
71 |
|
|
&$form_state
|
72 |
|
|
) {
|
73 |
85ad3d82
|
Assos Assos
|
$conf = $form_state['conf'];
|
74 |
|
|
$form['show_sort'] = array(
|
75 |
|
|
'#type' => 'checkbox',
|
76 |
|
|
'#title' => t('Show sort form'),
|
77 |
13c3c9b4
|
Assos Assos
|
'#description' => t(
|
78 |
|
|
'If checked the sort form will appear at the top of the table. Uncheck this if you wish it to appear in a separate pane.'
|
79 |
|
|
),
|
80 |
85ad3d82
|
Assos Assos
|
'#default_value' => !empty($conf['show_sort']),
|
81 |
|
|
);
|
82 |
|
|
|
83 |
|
|
return $form;
|
84 |
|
|
}
|
85 |
|
|
|
86 |
13c3c9b4
|
Assos Assos
|
/**
|
87 |
|
|
* Submit callback.
|
88 |
|
|
*/
|
89 |
|
|
function advanced_forum_forum_topic_list_content_type_edit_form_submit(
|
90 |
|
|
$form,
|
91 |
|
|
&$form_state
|
92 |
|
|
) {
|
93 |
85ad3d82
|
Assos Assos
|
// Copy everything from our defaults.
|
94 |
|
|
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
95 |
|
|
$form_state['conf'][$key] = $form_state['values'][$key];
|
96 |
|
|
}
|
97 |
|
|
}
|
98 |
|
|
|
99 |
13c3c9b4
|
Assos Assos
|
/**
|
100 |
|
|
* Callback for admin title.
|
101 |
|
|
*/
|
102 |
|
|
function advanced_forum_forum_topic_list_content_type_admin_title(
|
103 |
|
|
$subtype,
|
104 |
|
|
$conf,
|
105 |
|
|
$context
|
106 |
|
|
) {
|
107 |
85ad3d82
|
Assos Assos
|
return t('"@s" topic list', array('@s' => $context->identifier));
|
108 |
|
|
} |