AmosWorkflow.php 1.68 KB
Newer Older
Marcello Pivanti's avatar
Marcello Pivanti committed
1
2
3
4
5
6
7
<?php

/**
 * Art-ER Attrattività, ricerca e territorio dell’Emilia-Romagna
 * OPEN 2.0
 *
 *
waltermazza's avatar
waltermazza committed
8
 * @package    arter\amos\workflow
Marcello Pivanti's avatar
Marcello Pivanti committed
9
10
11
12
 * @category   CategoryName
 * @author     Elite Division S.r.l.
 */

waltermazza's avatar
waltermazza committed
13
namespace arter\amos\workflow;
Marcello Pivanti's avatar
Marcello Pivanti committed
14

waltermazza's avatar
waltermazza committed
15
16
17
18
use arter\amos\core\module\Module;
use arter\amos\core\module\ModuleInterface;
use arter\amos\core\record\Record;
use arter\amos\workflow\components\events\SimpleWorkFlowEventsListener;
Marcello Pivanti's avatar
Marcello Pivanti committed
19
20
21
22
23
24
use raoul2000\workflow\base\SimpleWorkflowBehavior;
use Yii;
use yii\base\Event;

/**
 * Class AmosWorkflow
waltermazza's avatar
waltermazza committed
25
 * @package arter\amos\workflow
Marcello Pivanti's avatar
Marcello Pivanti committed
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
 */
class AmosWorkflow extends Module implements ModuleInterface
{
    public static $CONFIG_FOLDER = 'config';

    /**
     * @var string|boolean the layout that should be applied for views within this module. This refers to a view name
     * relative to [[layoutPath]]. If this is not set, it means the layout value of the [[module|parent module]]
     * will be taken. If this is false, layout will be disabled within this module.
     */
    public $layout = 'main';

    public $name = 'Workflow';

    public static function getModuleName()
    {
        return "workflow";
    }

    public function init()
    {
        parent::init();
        // initialize the module with the configuration loaded from config.php
        Yii::configure($this, require(__DIR__ . DIRECTORY_SEPARATOR . self::$CONFIG_FOLDER . DIRECTORY_SEPARATOR . 'config.php'));

        Event::on(Record::className(), SimpleWorkflowBehavior::EVENT_AFTER_CHANGE_STATUS, [SimpleWorkFlowEventsListener::className(), 'afterChangeStatus']);
    }

    public function getWidgetIcons()
    {
        return [];
    }

    public function getWidgetGraphics()
    {
        return [];
    }
}