summaryrefslogtreecommitdiff
path: root/plugins/KanboardSearchPlugin/Plugin.php
blob: 4b041d1af4175aa2cf5e3dfa39ea69626f40b0f9 (plain)
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
<?php

namespace Kanboard\Plugin\KanboardSearchPlugin;

use Kanboard\Core\Filter\LexerBuilder;
use Kanboard\Core\Plugin\Base;
use Kanboard\Core\Translator;
use Kanboard\Plugin\KanboardSearchPlugin\Filter\AdvancedSearchFilter;

class Plugin extends Base
{
    public function initialize()
    {
        $this->template->hook->attach("template:config:sidebar",
            "KanboardSearchPlugin:config/sidebar");

        $this->route->addRoute('settings/advancedsearch', 'AdvancedSearchController', 'index',
            'KanboardSearchPlugin');

        $this->container->extend('taskLexer', function ($taskLexer, $c) {
            /**
             * @var LexerBuilder $taskLexer
             */
            $taskLexer->withFilter(AdvancedSearchFilter::getInstance()
                ->setDatabase($c['db'])
                ->setConfigModel($this->configModel)
                ->setFileModel($this->taskFileModel), true);

            return $taskLexer;
        });
    }

    public function onStartup()
    {
        Translator::load($this->languageModel->getCurrentLanguage(), __DIR__.'/Locale');
    }

    public function getPluginName()
    {
        return 'KanboardSearchPlugin';
    }

    public function getPluginDescription()
    {
        return t('This plugin is used for advanced fulltext search within all Projects');
    }

    public function getPluginAuthor()
    {
        return 'ipunkt Business Solutions';
    }

    public function getPluginVersion()
    {
        return '1.0.0';
    }

    public function getPluginHomepage()
    {
        return 'https://www.ipunkt.biz/unternehmen/opensource';
    }
}