-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_reports.sample.inc
87 lines (81 loc) · 2.3 KB
/
custom_reports.sample.inc
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
//--- SAMPLE DATA ------------------------------------------------------
function custom_reports_custom_reports_info(&$report) {
$items[] = array(
'title' => t('No id (should not appear)'),
);
$items[] = array(
'id' => 'sample0',
'title' => t('Active is FALSE (should not appear)'),
'active' => FALSE,
);
$items[] = array(
'id' => 'sample1',
'title' => t('Associative, with header'),
'callback' => 'custom_reports_sample_associative',
);
$items[] = array(
'id' => 'sample2',
'title' => t('Associative, without header'),
'callback' => 'custom_reports_sample_associative',
'header' => FALSE,
);
$items[] = array(
'id' => 'sample3',
'title' => t('Non-associative'),
'callback' => 'custom_reports_sample_non_associative',
'associative' => FALSE,
);
$items[] = array(
'id' => 'sample4',
'title' => t('No results'),
'callback' => 'custom_reports_sample_no_results',
'associative' => FALSE,
);
$items[] = array(
'id' => 'sample5',
'title' => t('Storable'),
'callback' => 'custom_reports_sample_associative',
'store' => TRUE,
);
$items[] = array(
'id' => 'sample6',
'title' => t('With form options'),
'callback' => 'custom_reports_sample_with_form_options',
'form' => array(
'start_date' => array(
'#type' => 'date',
'#title' => t('Start Date'),
'#default_value' => array('month' => 7, 'day' => 1, 'year' => 2010),
'#required' => TRUE,
),
'end_date' => array(
'#type' => 'date',
'#title' => 'End Date',
'#default_value' => array('month' => 6, 'day' => 30, 'year' => 2011),
),
),
);
return $items;
}
function custom_reports_sample_associative(&$report) {
$rows = array(
array('first' => 'John', 'last' => 'Doe'),
array('first' => 'Jane', 'last' => 'Doe'),
);
return $rows;
}
function custom_reports_sample_non_associative(&$report) {
$rows = array(
array('first', 'last', 'first initial', 'middle', 'last'),
array('John', 'Doe', 'J', 'V', 'Doe'),
array('Jane', 'Doe', 'J', 'W', 'Doe'),
);
return $rows;
}
function custom_reports_sample_no_results(&$report) {
return array();
}
function custom_reports_sample_with_form_options(&$report, $start_date, $end_date) {
dsm(func_get_args());
}