forked from creecros/MetaMagik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugin.php
115 lines (93 loc) · 3.91 KB
/
Plugin.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
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
114
115
<?php
namespace Kanboard\Plugin\MetaMagik;
use Kanboard\Core\Plugin\Base;
use Kanboard\Core\Translator;
use Kanboard\Plugin\MetaMagik\Helper\MetaHelper;
use Kanboard\Plugin\MetaMagik\Export\MetaTaskExport;
use Kanboard\Plugin\MetaMagik\Model\NewTaskModificationModel;
use Kanboard\Plugin\MetaMagik\Model\NewTaskCreationModel;
use Kanboard\Plugin\MetaMagik\Model\NewTaskDuplicationModel;
use Kanboard\Plugin\MetaMagik\Filter\MetaFieldFilter;
use Kanboard\Plugin\MetaMagik\Filter\MetaValueFilter;
class Plugin extends Base
{
public function initialize()
{
//Helpers
$this->helper->register('metaHelper', '\Kanboard\Plugin\MetaMagik\Helper\MetaHelper');
//Models
$this->container['taskModificationModel'] = $this->container->factory(function ($c) {
return new NewTaskModificationModel($c);
});
$this->container['taskCreationModel'] = $this->container->factory(function ($c) {
return new NewTaskCreationModel($c);
});
$this->container['taskDuplicationModel'] = $this->container->factory(function ($c) {
return new NewTaskDuplicationModel($c);
});
//Project
$this->template->hook->attach('template:project:sidebar', 'metaMagik:project/sidebar');
//Task
$this->template->hook->attach('template:task:sidebar:information', 'metaMagik:task/sidebar');
$this->template->hook->attach('template:board:task:icons', 'metaMagik:task/footer_icon');
$this->template->hook->attach('template:task:form:first-column', 'metaMagik:task/rendermeta1');
$this->template->hook->attach('template:task:form:second-column', 'metaMagik:task/rendermeta2');
$this->template->hook->attach('template:task:form:third-column', 'metaMagik:task/rendermeta3');
$this->template->hook->attach('template:task:details:bottom', 'metaMagik:task/metasummary');
$this->template->setTemplateOverride('project_header/dropdown', 'metaMagik:project_header/dropdown');
$this->template->setTemplateOverride('export/tasks', 'metaMagik:export/tasks');
//Routes
$this->route->addRoute('export/metatasks/:project_id', 'NewExportController', 'tasks');
//Filters
$this->container->extend('taskLexer', function($taskLexer, $c) {
$taskLexer->withFilter(MetaFieldFilter::getInstance()->setDatabase($c['db']));
return $taskLexer;
});
$this->container->extend('taskLexer', function($taskLexer, $c) {
$taskLexer->withFilter(MetaValueFilter::getInstance()->setDatabase($c['db']));
return $taskLexer;
});
//User
$this->template->hook->attach('template:user:sidebar:information', 'metaMagik:user/sidebar');
// Add link to new plugin settings
$this->template->hook->attach('template:config:sidebar', 'metaMagik:config/sidebar');
//java
$this->hook->on('template:layout:js', array('template' => 'plugins/MetaMagik/Assets/js/meta-drag-and-drop.js'));
}
public function onStartup()
{
// Translation
Translator::load($this->languageModel->getCurrentLanguage(), __DIR__.'/Locale');
}
public function getClasses()
{
return [
'Plugin\MetaMagik\Model' => [
'MetadataTypeModel',
],
'Plugin\MetaMagik\Export' => [
'MetaTaskExport',
],
];
}
public function getPluginName()
{
return 'metaMagik';
}
public function getPluginDescription()
{
return t('Custom Task Fields and Manage Metadata');
}
public function getPluginAuthor()
{
return 'Craig Crosby + BlueTeck';
}
public function getPluginVersion()
{
return '0.0.8';
}
public function getPluginHomepage()
{
return 'https://github.com/creecros/MetaMagik';
}
}