README.md 3.33 KB
Newer Older
Marcello Pivanti's avatar
Marcello Pivanti committed
1
2
3
4
5
6
7
8
9
10
11
12
13
#Amos Report


Extension for report sending on contents like news, discussions, etc...

Installation
------------

1. The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```bash
waltermazza's avatar
waltermazza committed
14
composer require arter/amos-report
Marcello Pivanti's avatar
Marcello Pivanti committed
15
16
17
18
19
```

or add this row

```
waltermazza's avatar
waltermazza committed
20
"arter/amos-report": "dev-master"
Marcello Pivanti's avatar
Marcello Pivanti committed
21
22
23
24
25
26
27
28
29
30
```

to the require section of your `composer.json` file.

2. Add module to your main config in backend:
	
    ```php
    
    'modules' => [
        'comments' => [
waltermazza's avatar
waltermazza committed
31
            'class' => 'arter\amos\report\AmosReport',
Marcello Pivanti's avatar
Marcello Pivanti committed
32
33
34
            'modelsEnabled' => [
                /**
                 * Add here the classnames of the models for whose you want to enable reports
waltermazza's avatar
waltermazza committed
35
                 * (i.e. 'arter\amos\news\models\News')
Marcello Pivanti's avatar
Marcello Pivanti committed
36
37
38
39
40
41
42
43
44
45
46
                 */
            ]
        ],
    ],
    ```

3. To send report notification not only to the content creator but also to the content validator, installation of amos-workflow is needed too
 
    a. Add workflow to composer
    
    ```
waltermazza's avatar
waltermazza committed
47
    "arter/amos-workflow": "dev-master"
Marcello Pivanti's avatar
Marcello Pivanti committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    ```
    
    b. check in config/main for 'workflow' in modules array, if present
    ```php
    'workflow' => [
        'class' => 'cornernote\workflow\manager\Module',
    ],
    ```
    change the entry in:
    ```php
    'workflow-manager' => [
        'class' => 'cornernote\workflow\manager\Module',
    ],
    ```
    
    c. add workflow entry (config/main in modules array):
   ```php
   'workflow' => [
waltermazza's avatar
waltermazza committed
66
       'class' => 'arter\amos\workflow\AmosWorkflow',
Marcello Pivanti's avatar
Marcello Pivanti committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
   ],
   ```

   d. add 'workflow' entry to your bootstrap:
	
    ```php
    'bootstrap' => [
        .
        .
        .
        'workflow',
        .
        .
        .
    ],
    ```

4. Apply migrations

    a. amos-report migrations
    ```bash
waltermazza's avatar
waltermazza committed
88
    php yii migrate/up --migrationPath=@vendor/arter/amos-report/src/migrations
Marcello Pivanti's avatar
Marcello Pivanti committed
89
90
91
92
93
94
95
96
97
    ```
    
    or add this row to your migrations config in console:
    
    ```php
    return [
        .
        .
        .
waltermazza's avatar
waltermazza committed
98
        '@vendor/arter/amos-report/src/migrations',
Marcello Pivanti's avatar
Marcello Pivanti committed
99
100
101
102
103
104
105
106
        .
        .
        .
    ];
    ```

    b. if workflow module is installed (see step 3), also add amos-workflow migrations:
    ```bash
waltermazza's avatar
waltermazza committed
107
    php yii migrate/up --migrationPath=@vendor/arter/amos-workflow/src/migrations
Marcello Pivanti's avatar
Marcello Pivanti committed
108
109
110
111
112
113
114
115
    ```
    or add this row to your migrations config in console:
    
    ```php
    return [
        .
        .
        .
waltermazza's avatar
waltermazza committed
116
        '@vendor/arter/amos-workflow/src/migrations',
Marcello Pivanti's avatar
Marcello Pivanti committed
117
118
119
120
121
122
123
124
125
126
        .
        .
        .
    ];
    ```

Widgets
-----------

Amos Report provides two Widgets:
waltermazza's avatar
waltermazza committed
127
* **ReportWidget** *arter\amos\report\widgets\ReportWidget*  
Marcello Pivanti's avatar
Marcello Pivanti committed
128
129
Draw a flag icon related to a model. On flag click, the system opens form to insert a new report on a modal popup. 

waltermazza's avatar
waltermazza committed
130
* **TabReportsWidget** *arter\amos\report\widgets\TabReportsWidget*  
Marcello Pivanti's avatar
Marcello Pivanti committed
131
132
133
134
135
136
137
138
139
140
141
142
143
Draw the Report tab in a model view/form, containing the list of reports a specif content.  
If a model has been enabled for reports, the tab is automatically injected in update phase (form) by AmosCore widget 'Tabs'.


Email Sending
-----------

After the creation of a new report on a content a mail is sent to:
 * Content creator
 * Content validator (if exixts)
 * Users having the REPORT_MONITOR role for that content type (if role exists)  
 The role name must follow the general permission naming convention <MODELNAME>_REPORT_MONITOR as for eg. create and update permissions (MODELNAME_CREATE, MODELNAME_UPDATE).