forked from IceCreamYou/Drupal-Activity-Log
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPI.php
More file actions
58 lines (55 loc) · 2.06 KB
/
API.php
File metadata and controls
58 lines (55 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* @file
* Hook documentation for the Activity Log module.
*/
/**
* Implementation of hook_activity_log_collapse_methods().
*
* Specifies available options for combining an array of strings into a single
* string. These options are exposed on the "Log activity" Rules action form
* and are used to collapse an array of evaluated items into the [collection]
* token in the group template.
*
* @return
* An associative array of options where the key is the name of the
* function for collapsing an array and the value is the human-friendly name
* of the option. The available functions should take a $collection array and
* an integral $count of the number of items in that collection as parameters
* and return a string summarizing the items in the $collection. The
* $collection will always have at least 2 items.
*/
function hook_activity_log_collapse_methods() {
return array(
'activity_log_collapse_inline' => t('Inline (A, B, and 3 others)'),
'activity_log_collapse_list_horizontal' => t('Horizontal list (A B C D)'),
'activity_log_collapse_list_vertical' => t('Vertical list (each item on its own line)'),
);
}
/**
* Implementation of hook_activity_log_event().
*
* Invoked when an activity is logged; allows taking action when this happens.
*
* @param $event
* The activity event object (properties correspond with the columns in the
* {activity_log_events} table).
* @param $group
* The activity message object (properties correspond with the columns in the
* {activity_log_messages} table).
* @param $settings
* An array containing the evaluated settings for the executed Activity Log
* Rules action.
*/
function hook_activity_log_event($event, $group, $settings) {
if (module_exists('radioactivity')) {
module_load_include('inc', 'radioactivity');
$aids = explode(',', $group->aids);
if (count($aids) > 1) {
radioactivity_add_energy($group->mid, 'act_log', 'group:'. $record->tid);
}
else {
radioactivity_add_energy($group->mid, 'act_log', 'event:'. $record->tid);
}
}
}