forked from masihfathi/yii2-drag-drop-forms
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModule.php
102 lines (87 loc) · 2.62 KB
/
Module.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
<?php
namespace masihfathi\form;
use Yii;
class Module extends \yii\base\Module{
/**
* @ingeritdoc
*/
public $controllerNamespace = 'masihfathi\form\controllers';
/**
* @ingeritdoc
*/
public $defaultRoute = 'module';
/**
* @var string Default db connection
*/
public $db = 'db';
/**
* @var string The database table storing the forms
*/
public $formTable = 'forms';
/**
* @var string The database table storing the data from forms
*/
public $formDataTable = 'form_';
/**
* @var array the list of rights that are allowed to access this module.
* If you modify, you also need to enable authManager.
* http://www.yiiframework.com/doc-2.0/guide-security-authorization.html
* $rules = [
* [
* 'actions' => [ 'update', 'delete', 'clone','deletemultiple','preview','update-item' ],
* 'allow' => true,
* 'roles' => ['updateOwnForm'],
* ],
* [
* 'actions' => ['user', 'create'],
* 'allow' => true,
* 'roles' => ['user'],
* ]
* ];
*/
public $rules = [
[
'allow' => true,
'actions' => [],
'roles' => ['?'],
],[
'allow' => true,
'actions' => [],
'roles' => ['@'],
]
];
/**
* @var boolean If true after completing the form the message is sent
*/
public $sendEmail = false;
/**
* @var string The sender's address
*/
public $emailSender = null;
/**
* @var Boolean If true, you can see action buttons on index action
*/
public $buttonsEditOnIndex = false;
/**
* @var boolean if true, only necessary options
*/
public $easyMode = true;
/**
* @var boolean if true, example form
*/
public $testMode = false;
public function init()
{
parent::init();
$this->registerTranslations();
}
public function registerTranslations()
{
Yii::$app->i18n->translations['builder'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en-US',
'basePath' => '@masihfathi/form/messages',
'fileMap' => [ 'builder' => 'builder.php', ]
];
}
}