-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathextension.driver.php
83 lines (66 loc) · 2.5 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
76
77
78
79
80
81
82
83
<?php
/* * * @package dynamictextgroup * * */
/* * * Dynamic Text Group * * */
Class extension_dynamictextgroup extends Extension {
/* * * @see http://symphony-cms.com/learn/api/2.2/toolkit/extension/#__construct * * */
public function __construct(Array $args){
parent::__construct($args);
// Include Stage
if(!class_exists('Stage')) {
try {
if((include_once(EXTENSIONS . '/dynamictextgroup/lib/stage/class.stage.php')) === FALSE) {
throw new Exception();
}
}
catch(Exception $e) {
throw new SymphonyErrorPage(__('Please make sure that the Stage submodule is initialised and available at %s.', array('<code>' . EXTENSIONS . '/dynamictextgroup/lib/stage/</code>')) . '<br/><br/>' . __('It\'s available at %s.', array('<a href="https://github.com/nilshoerrmann/stage">github.com/nilshoerrmann/stage</a>')), __('Stage not found'));
}
}
}
/* * * @see http://symphony-cms.com/learn/api/2.2/toolkit/extension/#about * * */
public function about() {
return array(
'name' => 'Dynamic Text Group',
'version' => '2.0',
'release-date' => '10-28-2012',
'author' => array(
'name' => 'Brock Petrie',
'website' => 'http://www.brockpetrie.com',
'email' => '[email protected]'
),
'description' => 'A field for dynamically adding text fields to a section.'
);
}
/* * * @see http://symphony-cms.com/learn/api/2.2/toolkit/extension/#install * * */
public function install() {
$status = array();
// Create database field table
$status[] = Symphony::Database()->query(
"CREATE TABLE `tbl_fields_dynamictextgroup` (
`id` int(11) unsigned NOT NULL auto_increment,
`field_id` int(11) unsigned NOT NULL,
`fieldcount` tinyint(1),
`schema` text,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
)"
);
// Create stage
$status[] = Stage::install();
// Report status
if(in_array(false, $status, true)) {
return false;
}
else {
return true;
}
}
/* * * @see http://symphony-cms.com/learn/api/2.2/toolkit/extension/#uninstall * * */
public function uninstall() {
// Drop related entries from stage tables
Symphony::Database()->query("DELETE FROM `tbl_fields_stage` WHERE `context` = 'dynamictextgroup'");
Symphony::Database()->query("DELETE FROM `tbl_fields_stage_sorting` WHERE `context` = 'dynamictextgroup'");
// Drop date and time table
Symphony::Database()->query("DROP TABLE `tbl_fields_dynamictextgroup`");
}
}