-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoer_analytics.install
182 lines (161 loc) · 4.75 KB
/
oer_analytics.install
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
/**
* @file
* Installation file for the Open.Michigan analytics (oer_analytics) module.
* Creation guidance from files at https://github.com/jasonhoekstra/learning_registry/blob/6.x-1.x
*
* This installation file sets up the database tables for the analytics module.
*/
/**
* Implements hook_install().
*/
function oer_analytics_install() {
//drupal_set_message((st('Installing oer_analytics')));
drupal_install_schema('oer_analytics');
}
/**
* Implements hook_uninstall().
*/
function oer_analytics_uninstall() {
drupal_uninstall_schema('oer_analytics');
}
/**
* Implements hook_enable().
*/
function oer_analytics_enable() {
// Nothing needed here at the moment
}
/**
* Implements hook_schema().
*
* @returns $schema
* An array providing the DB schema definition required by the schema API.
*/
function oer_analytics_schema() {
//drupal_set_message((st('Adding tables for oer_analytics')));
// $schema['oer_analytics_courses'] = array(
// 'fields' => array(
// 'nid' => array(
// 'description' => 'The primary identifier for a (course) node.',
// 'type' => 'int',
// 'unsigned' => TRUE,
// 'not null' => TRUE,
// ),
// 'totalviews' => array(
// 'description' => 'Number of total page views the course pg has had overall',
// 'type' => 'int',
// 'unsigned' => TRUE,
// 'not null' => TRUE,
// 'default' => 0,
// ),
// 'totalvisits' => array(
// 'description' => 'Number of total page visits the course pg has had overall',
// 'type' => 'int',
// 'unsigned' => TRUE,
// 'not null' => TRUE,
// 'default' =>0,
// ),
// 'total_materialviews' => array(
// 'description' => 'Number of overall views of the MATERIALS page belonging to a course or resource',
// 'type' => 'int',
// 'unsigned' => TRUE,
// 'not null' => TRUE,
// 'default' => 0,
// ),
// 'total_zipdownloads' => array(
// 'description' => 'Total zip downloads of the materials belonging to the course or resource',
// 'type' => 'int',
// 'unsigned' => TRUE,
// 'not null' => TRUE,
// 'default' => 0,
// ),
// ),
// 'primary key' => array('nid'),
// );
$schema['oer_analytics_youtube'] = array(
'fields' => array(
'course_nid' => array(
'description' => 'The primary identifier for the course node to which this YT material belongs.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'totalviews' => array(
'description' => 'Number of total youtube views the course youtube material has gotten',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
),
'totalcomments' => array(
'description' => 'Number of total youtube comments the course youtube material has gotten',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
),
// 'totallikes' => array(
// 'description' => 'Number of total Likes the course youtube material has gotten',
// 'type' => 'int',
// // not yet implemented
// ),
// 'totalfavs' => array(
// 'description' => 'Number of total Favorites the course youtube material has gotten',
// 'type' => 'int',
// // not yet implemented
// ),
// 'totalshares' => array(
// 'description' => 'Number of total times the course youtube material has been shared',
// 'type' => 'int',
// // not yet implemented
// ),
// 'commentdata' => array(
// 'description' => 'Complete text data of comments on any YouTube material from this course.',
// 'type' => 'longtext',
// // not yet implemented -- pending decision about how/whether we store this
// ),
),
'primary key' => array('course_nid'),
);
$schema['oer_analytics_vids'] = array(
'fields' => array(
'course_nid' => array(
'description' => 'The primary identifier for the course node to which this video belongs.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'videoid' => array(
'description' => 'The primary identifier for a YouTube video.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '', // may or may not need to check for this in future
),
'totalviews' => array(
'description' => 'Number of times this video has been viewed',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'totalcomments' => array(
'description' => 'Number of comments this video has gotten',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('videoid'),
);
//dpm($schema);
return $schema;
}
// /**
// * Implements hook_requirements().
// *
// * @returns $requirements
// * An array of requirements met or not met.
// */
// // TODO