This repository was archived by the owner on Oct 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNeatlinePluginPlugin.php
More file actions
113 lines (83 loc) · 2.81 KB
/
NeatlinePluginPlugin.php
File metadata and controls
113 lines (83 loc) · 2.81 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 cc=80; */
/**
* @package omeka
* @subpackage neatline-Plugin
* @copyright 2012 Rector and Board of Visitors, University of Virginia
* @license http://www.apache.org/licenses/LICENSE-2.0.html
*/
class NeatlinePluginPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks = array(
'install',
'uninstall'
);
protected $_filters = array(
'neatline_exhibit_expansions',
'neatline_record_expansions'
);
/**
* Create exhibit and record expansions.
*/
public function hookInstall()
{
// Exhibit:
$this->_db->query("CREATE TABLE IF NOT EXISTS
`{$this->_db->prefix}neatline_exhibit_expansions` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`parent_id` INT(10) UNSIGNED NULL,
`field1` INT(10) UNSIGNED NULL,
`field2` INT(10) UNSIGNED NULL,
`field3` INT(10) UNSIGNED NULL,
PRIMARY KEY (`id`),
UNIQUE KEY (`parent_id`),
INDEX (`parent_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
// Record:
$this->_db->query("CREATE TABLE IF NOT EXISTS
`{$this->_db->prefix}neatline_record_expansions` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`parent_id` INT(10) UNSIGNED NULL,
`field4` INT(10) UNSIGNED NULL,
`field5` INT(10) UNSIGNED NULL,
`field6` INT(10) UNSIGNED NULL,
PRIMARY KEY (`id`),
UNIQUE KEY (`parent_id`),
INDEX (`parent_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
}
/**
* Drop exhibit expansion table.
*/
public function hookUninstall()
{
// Exhibit:
$this->_db->query("DROP TABLE IF EXISTS
`{$this->_db->prefix}neatline_exhibit_expansions`");
// Record:
$this->_db->query("DROP TABLE IF EXISTS
`{$this->_db->prefix}neatline_record_expansions`");
}
/**
* Register the exhibit expansion.
*
* @param array $tables Exhbit expansions.
* @return array The modified array.
*/
public function filterNeatlineExhibitExpansions($tables)
{
$tables[] = $this->_db->getTable('NeatlineExhibitExpansion');
return $tables;
}
/**
* Register the exhibit expansion.
*
* @param array $tables Exhbit expansions.
* @return array The modified array.
*/
public function filterNeatlineRecordExpansions($tables)
{
$tables[] = $this->_db->getTable('NeatlineRecordExpansion');
return $tables;
}
}