-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextension.driver.php
executable file
·64 lines (47 loc) · 1.99 KB
/
extension.driver.php
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
<?php
Class extension_maplocationfield extends Extension{
public function about(){
return array('name' => 'Field: Map Location',
'version' => '1.0',
'release-date' => '2008-02-01',
'author' => array('name' => 'Symphony Team',
'website' => 'http://www.symphony21.com',
'email' => 'team@symphony21.com')
);
}
public function uninstall(){
$this->_Parent->Database->query("DROP TABLE `tbl_fields_maplocation`");
$this->_Parent->Configuration->remove('google-api-key', 'map-location-field');
$this->_Parent->saveConfig();
}
public function getSubscribedDelegates(){
return array(
array(
'page' => '/system/preferences/',
'delegate' => 'AddCustomPreferenceFieldsets',
'callback' => 'appendPreferences'
),
);
}
public function appendPreferences($context){
$group = new XMLElement('fieldset');
$group->setAttribute('class', 'settings');
$group->appendChild(new XMLElement('legend', 'Map Location Field'));
$label = Widget::Label('Google Maps API Key');
$label->appendChild(Widget::Input('settings[map-location-field][google-api-key]', General::Sanitize($context['parent']->Configuration->get('google-api-key', 'map-location-field'))));
$group->appendChild($label);
$group->appendChild(new XMLElement('p', 'Get a Google Maps API key from the <a href="http://code.google.com/apis/maps/index.html">Google Maps site</a>.', array('class' => 'help')));
$context['wrapper']->appendChild($group);
}
public function install(){
return $this->_Parent->Database->query("CREATE TABLE `tbl_fields_maplocation` (
`id` int(11) unsigned NOT NULL auto_increment,
`field_id` int(11) unsigned NOT NULL,
`default_location` varchar(60) NOT NULL,
`default_location_coords` varchar(60) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `field_id` (`field_id`)
) TYPE=MyISAM");
}
}
?>