-
Notifications
You must be signed in to change notification settings - Fork 0
/
reservations_operator_history.install
135 lines (128 loc) · 3.4 KB
/
reservations_operator_history.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
<?php
/**
* Implements hook_install().
*/
function reservations_operator_history_install() {
// Create the 'pbcore_pbcore_genres' field if it doesn't already exist.
if (!field_info_field('field_operator_history_view')) {
$field = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_operator_history_view',
'field_permissions' => array(
'type' => 2,
),
'foreign keys' => array(),
'indexes' => array(),
'locked' => 0,
'module' => 'viewfield',
'settings' => array(
'profile2_private' => FALSE,
),
'translatable' => 0,
'type' => 'viewfield',
);
field_create_field($field);
// Create the instance on the bundle.
$instance = array(
'bundle' => 'reservations_reservation',
'default_value' => array(
0 => array(
'vname' => 'reservation_operator_actions|block_1',
'vargs' => '[node:nid]',
),
),
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'viewfield',
'settings' => array(),
'type' => 'viewfield_default',
'weight' => 1,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_operator_history_view',
'label' => 'Operator History',
'required' => 0,
'settings' =>
array(
'allowed_views' =>
array(
'reservation_operator_actions' =>
'reservation_operator_actions',
),
'force_default' => 1,
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'viewfield',
'settings' => array(),
'type' => 'viewfield_select',
'weight' => 31,
),
);
field_create_instance($instance);
}
}
/**
* Implementation of hook_schema().
*/
function reservations_operator_history_schema() {
$schema['reservations_operator_history'] =
array(
'description' => t('Stores operator actions on reservations'),
'fields' =>
array(
'id' =>
array(
'description' => 'Primary Key.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE),
'uid' =>
array(
'description' =>
'Operator UID.',
'type' => 'int',
'not null' => TRUE),
'reservation_id' =>
array(
'description' => 'The Reservation ID.',
'type' => 'int',
),
'beginning_status' =>
array(
'description' => 'Beginning Status',
'type' => 'int',
'not null' => TRUE),
'end_status' =>
array(
'description' => 'Ending Status',
'type' => 'int',
'not null' => TRUE),
'timestamp' =>
array(
'description'=>'The Start Timestamp of The Series Slot.',
'type' => 'int',
'not null' => TRUE),
),
'indexes' => array(
'reservation_id' =>
array('reservation_id'),
'uid' => array('uid')),
'primary key' => array('id'),
);
return $schema;
}