forked from Humanized/yii2-location
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModule.php
53 lines (46 loc) · 1.44 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
<?php
namespace humanized\location;
/**
* Location Management Module for Yii2 - By Humanized
* This module wraps several mechisms employed in-house dealing with routine tasks related to location management.
* Additionally it is built to automate as much as possible, while remaining clean and modular.
*
*
* @name Yii2 Contact Management Module Class
* @version 0.1
* @author Jeffrey Geyssens <[email protected]>
* @package yii2-user
*/
class Module extends \yii\base\Module
{
const MASTER_MODE = 'master';
const SLAVE_MODE = 'slave';
public $mode = NULL;
public $tablePrefix = NULL;
public $enableRemote = FALSE;
public $remoteSettings = ['uri' => NULL, 'token' => NULL];
public $defaultLanguage = 'en';
public function init()
{
parent::init();
if (\Yii::$app instanceof \yii\console\Application) {
$this->controllerNamespace = 'humanized\location\commands';
}
$this->params['tablePrefix'] = $this->tablePrefix;
if ($this->enableRemote) {
$this->_initRemote();
}
}
private function _initRemote()
{
if (!isset($this->mode)) {
$this->mode = self::MASTER_MODE;
}
$this->params['mode'] = $this->mode;
$this->params['enableRemote'] = TRUE;
if (!empty($this->remoteSettings)) {
$this->params['remoteSettings'] = $this->remoteSettings;
return;
}
}
}