|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* _ __ __ _____ _____ ___ ____ _____ |
|
5
|
|
|
* | | / // // ___//_ _// || __||_ _| |
|
6
|
|
|
* | |/ // /(__ ) / / / /| || | | | |
|
7
|
|
|
* |___//_//____/ /_/ /_/ |_||_| |_| |
|
8
|
|
|
* @link https://vistart.me/ |
|
9
|
|
|
* @copyright Copyright (c) 2016 - 2017 vistart |
|
10
|
|
|
* @license https://vistart.me/license/ |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace rhosocial\organization\widgets; |
|
14
|
|
|
|
|
15
|
|
|
use rhosocial\organization\MemberSearch; |
|
16
|
|
|
use rhosocial\organization\Organization; |
|
17
|
|
|
use yii\base\InvalidConfigException; |
|
18
|
|
|
use yii\base\Widget; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Class MemberSearchWidget |
|
22
|
|
|
* @package rhosocial\organization\widgets |
|
23
|
|
|
* @version 1.0 |
|
24
|
|
|
* @author vistart <[email protected]> |
|
25
|
|
|
*/ |
|
26
|
|
|
class MemberSearchWidget extends Widget |
|
27
|
|
|
{ |
|
28
|
|
|
public $formId = 'member-search-form'; |
|
29
|
|
|
/** |
|
30
|
|
|
* @var null|array |
|
31
|
|
|
*/ |
|
32
|
|
|
public $formConfig = null; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var Organization |
|
36
|
|
|
*/ |
|
37
|
|
|
public $organization; |
|
38
|
|
|
/** |
|
39
|
|
|
* @var MemberSearch |
|
40
|
|
|
*/ |
|
41
|
|
|
public $model; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @throws InvalidConfigException |
|
45
|
|
|
*/ |
|
46
|
|
|
public function init() |
|
47
|
|
|
{ |
|
48
|
|
|
if ($this->model == null) { |
|
49
|
|
|
throw new InvalidConfigException("The search model should not be empty."); |
|
50
|
|
|
} |
|
51
|
|
|
if ($this->formConfig == null) { |
|
52
|
|
|
$action = isset($this->organization) ? ['member', 'org' => $this->organization->getID()] : ['member']; |
|
53
|
|
|
$this->formConfig = [ |
|
54
|
|
|
'id' => !empty($this->formId) ? $this->formId : 'member-search-form', |
|
55
|
|
|
'action' => $action, |
|
56
|
|
|
'method' => 'get', |
|
57
|
|
|
]; |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function run() |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->render('member-search', [ |
|
64
|
|
|
'formId' => $this->formId, |
|
65
|
|
|
'formConfig' => $this->formConfig, |
|
66
|
|
|
'model' => $this->model, |
|
67
|
|
|
]); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|