-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathextension.driver.php
executable file
·75 lines (62 loc) · 2.22 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
75
<?php
class Extension_BiLinkField extends Extension {
/*-------------------------------------------------------------------------
Definition:
-------------------------------------------------------------------------*/
public function about() {
return array(
'name' => 'Field: Bi Link',
'version' => '1.1.1',
'release-date' => '2011-04-11',
'author' => array(
'name' => 'Rowan Lewis',
'website' => 'http://nbsp.io/',
'email' => '[email protected]'
),
'description' => 'A bi-directional linking system for Symphony.'
);
}
public function install() {
Symphony::Database()->query("
CREATE TABLE IF NOT EXISTS `tbl_fields_bilink` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`field_id` INT(11) UNSIGNED NOT NULL,
`linked_section_id` INT(11) UNSIGNED DEFAULT NULL,
`linked_field_id` INT(11) UNSIGNED DEFAULT NULL,
`allow_editing` ENUM('yes','no') DEFAULT 'no',
`allow_multiple` ENUM('yes','no') DEFAULT 'no',
`column_mode` ENUM('count','first-item','last-item','small-list','large-list') DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`),
KEY `linked_section_id` (`linked_section_id`),
KEY `linked_field_id` (`linked_field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
");
return true;
}
public function uninstall() {
$this->_Parent->Database->query("DROP TABLE `tbl_fields_bilink`");
return true;
}
public function update($previousVersion) {
if (version_compare($previousVersion, '1.1.0', '<')) {
Symphony::Database()->query("
ALTER TABLE `tbl_fields_bilink`
ADD COLUMN `allow_editing` ENUM('yes','no') DEFAULT 'no';
");
}
return true;
}
/*-------------------------------------------------------------------------
Utilites:
-------------------------------------------------------------------------*/
protected $addedHeaders = false;
public function addHeaders($page) {
if (!$this->addedHeaders) {
$page->addStylesheetToHead(URL . '/extensions/bilinkfield/assets/publish.css', 'screen', 123269781);
$page->addScriptToHead(URL . '/extensions/bilinkfield/assets/publish.js', 123269781);
$this->addedHeaders = true;
}
}
}
?>