1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Mark read.
|
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 mark read'),
|
14
|
'icon' => 'icon_forum.png',
|
15
|
'description' => t('Link to mark all forums / individual forum read.'),
|
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_mark_read_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-mark-read';
|
41
|
$block->delta = $tid;
|
42
|
|
43
|
// By default this has no title.
|
44
|
$block->title = '';
|
45
|
_advanced_forum_add_files();
|
46
|
|
47
|
$mar_link = advanced_forum_get_mark_read_link($tid);
|
48
|
$block->content = (empty($mar_link)) ? '' : '<div class="forum-mark-read">' . advanced_forum_get_mark_read_link(
|
49
|
$tid
|
50
|
) . '</div>';
|
51
|
|
52
|
return $block;
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* Returns an edit form for the custom type.
|
57
|
*/
|
58
|
function advanced_forum_forum_mark_read_content_type_edit_form(
|
59
|
$form,
|
60
|
&$form_state
|
61
|
) {
|
62
|
return $form;
|
63
|
}
|
64
|
|
65
|
/**
|
66
|
* Submit callback.
|
67
|
*/
|
68
|
function advanced_forum_forum_mark_read_content_type_edit_form_submit(
|
69
|
$form,
|
70
|
&$form_state
|
71
|
) {
|
72
|
// Copy everything from our defaults.
|
73
|
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
74
|
$form_state['conf'][$key] = $form_state['values'][$key];
|
75
|
}
|
76
|
}
|
77
|
|
78
|
/**
|
79
|
* Callback for admin title.
|
80
|
*/
|
81
|
function advanced_forum_forum_mark_read_content_type_admin_title(
|
82
|
$subtype,
|
83
|
$conf,
|
84
|
$context
|
85
|
) {
|
86
|
return t('"@s" mark read', array('@s' => $context->identifier));
|
87
|
}
|