-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathextension.driver.php
75 lines (66 loc) · 1.88 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
65
66
67
68
69
70
71
72
73
74
<?php
class extension_position_picker extends Extension {
/**
* About the author
*/
public function about() {
return array(
'name' => 'Field: Position Picker',
'version' => '1.2',
'release-date' => '2011-12-16',
'author' => array(
'name' => 'Giel Berkers',
'website' => 'http://www.gielberkers.com',
'email' => '[email protected]'
),
'description' => 'A pixel/percentage picker.'
);
}
/**
* Uninstallation script
* @return void
*/
public function uninstall() {
Symphony::Database()->query("DROP TABLE `tbl_fields_positionpicker`");
}
/**
* Installation script
* @return void
*/
public function install() {
Symphony::Database()->query("
CREATE TABLE IF NOT EXISTS `tbl_fields_positionpicker` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`field_id` INT(11) UNSIGNED NOT NULL,
`section_id` int(11) unsigned NULL ,
`image_url` TINYTEXT NULL ,
`unit` ENUM('pixels','percentage') NULL ,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
");
return true;
}
/**
* Get the subscribed delegates.
* @return array The delegates
*/
public function getSubscribedDelegates() {
return array(
array(
'page' => '/backend/',
'delegate' => 'InitaliseAdminPageHead',
'callback' => 'addScriptToHead'
)
);
}
/**
* Add some javascript and a stylesheet to the head of the page to provide the picker-functionality.
* @param $context The context, provided by Symphony
* @return void
*/
public function addScriptToHead($context) {
Administration::instance()->Page->addScriptToHead(URL.'/extensions/position_picker/assets/position_picker.js');
Administration::instance()->Page->addStylesheetToHead(URL.'/extensions/position_picker/assets/position_picker.css', 'screen');
}
}