-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextension.driver.php
43 lines (33 loc) · 1.28 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
<?php
require_once(TOOLKIT . '/class.sectionmanager.php');
class Extension_Lock_Entry extends Extension {
public function getSubscribedDelegates() {
return array(
array(
'page' => '/backend/',
'delegate' => 'InitaliseAdminPageHead',
'callback' => 'initaliseAdminPageHead'
)
);
}
public function initaliseAdminPageHead($context) {
require_once(TOOLKIT . '/class.sectionmanager.php');
$page = Administration::instance()->Page;
$pageContext = $page->getContext();
$entryID = $pageContext['entry_id'];
if ($page instanceof ContentPublish and ($pageContext['page'] == 'edit')) {
$page->addScriptToHead(URL . '/extensions/lock_entry/assets/lock_entry.js', 300000);
$page->addScriptToHead(SYMPHONY_URL . '/extension/lock_entry/lock/?lock=checkLocked&entry_id='.$entryID, 300001);
}
}
public function uninstall(){
return Symphony::Database()->query("DROP TABLE `tbl_entry_lock`");
}
public function install(){
return Symphony::Database()->query("CREATE TABLE `tbl_entry_lock` (
`entry_id` int(11) NOT NULL,
`user_id` int(11) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
}
}