-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtbs_location_entity.install
137 lines (135 loc) · 5.61 KB
/
tbs_location_entity.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
<?php
/**
* Implements hook_install()
*/
function tbs_location_entity_install() {
//tbs_location_entity_type
if(!drupal_installation_attempted()){
$type = entity_create('tbs_location_entity_type', array(
'type' => 'accra',
'label' => t('Accra Locations'),
'weight' => 0,
'data' => array('is_office_location' => TRUE, 'is_local' => TRUE),
));
$type->save();
//DRUPAL_AUTHENTICATED_RID
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('administer tbs location entites','access site reports'));
drupal_set_message(t('A Location has been created and assigned to Administrators of Modules and access site reports. Go to the <a href="!url">Location Types</a> page to add somefields or to configure further location types. ',array('!url' => url('admin/structure/locations'))));
}
}
/**
* Implements hoo_schema()
*/
function tbs_location_entity_schema() {
$schema['tbs_location_entity_cities'] = array (
'description' => 'This table stores the list of cities in the country that was entered as entities',
'fields' => array(
'lid' => array(
'description' => 'This is the index key of the table and the primary identifier',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'type' => array(
'description' => 'This is the {tbs_location_type}. Type of this location.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'uid' => array(
'description' => 'This is the user id of the user who entered the data',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => NULL,
),
'label' => array(
'description' => 'This is the human-readable name of the location entity',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'created' => array(
'description' => 'This is the Unix timestamp of the location entity was created',
'type' => 'int',
'not null' => FALSE,
),
'changed' => array(
'description' => 'This is the Unix TimeStamp of the location entity that was changed.',
'type' => 'int',
'not null' => FALSE,
),
),
'indexes' => array(
'uid' => array('uid'),
),
'foreign keys' => array(
'uid' => array(
'table' => 'users',
'columns' => array('uid' => 'uid'),
),
'type' => array(
'table' => 'tbs_location_type',
'columns' => array('type' => 'type'),
),
),
'primary key' => array('lid'),
);
$schema['tbs_location_type'] = array(
'description' => 'This will store information of all the defined types of the location entity type.',
'fields' => array(
'id' => array(
'description' => 'This is the primary key of the location entity type',
'type' => 'serial',
'not null' => TRUE,
),
'type' => array(
'description' => 'This is the machine readable name of the location entity type',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'label' => array(
'description' => 'This is the human readable name of the location entity type',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'description' => 'This is the weight of the Location entity type in relation to others',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
),
'data' => array(
'description' => 'Aserialized array of additional data related to this location entity',
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
),
'status' => array(
'description' => 'The exportable status of the entity',
'type' => 'int',
'not null' => TRUE,
'default' => 0x01,
'size' => 'tiny',
),
'module' => array(
'description' => 'the name of the providing module if the entity has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'primary key' => array('id'),
'unique keys' => array(
'type' => array('type'),
),
);
return $schema;
}