-
Notifications
You must be signed in to change notification settings - Fork 2
/
extension.driver.php
63 lines (51 loc) · 1.56 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
<?php
Class extension_Slider extends Extension {
/**
* Subscribe to Delegates
*/
public function getSubscribedDelegates() {
return array(
array(
'page' => '/backend/',
'delegate' => 'InitaliseAdminPageHead',
'callback' => 'appendAssets'
)
);
}
/**
* Append Assets
*/
public function appendAssets(Array $context) {
$callback = Administration::instance()->getPageCallback();
if(in_array($callback['context']['page'], array('new', 'edit'))) {
Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/slider/assets/nouislider.css');
Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/slider/assets/slider.css');
Administration::instance()->Page->addScriptToHead(URL . '/extensions/slider/assets/nouislider.min.js');
Administration::instance()->Page->addScriptToHead(URL . '/extensions/slider/assets/slider.js');
}
}
/**
* Installation
*/
public function install() {
Symphony::Database()->query("CREATE TABLE IF NOT EXISTS `tbl_fields_slider` (
`id` int(11) unsigned NOT NULL auto_increment,
`field_id` int(11) unsigned NOT NULL,
`min_range` INT NOT NULL,
`max_range` INT NOT NULL,
`start_value` INT NOT NULL,
`increment_value` VARCHAR(255) NOT NULL,
`range` BOOL NOT NULL,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
)");
return true;
}
/**
* Uninstall
*/
public function uninstall() {
Symphony::Database()->query("DROP TABLE `tbl_fields_slider`;");
return true;
}
}