AddComplete::play()   B
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 40
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 2
Metric Value
c 2
b 1
f 2
dl 0
loc 40
rs 8.8571
cc 2
eloc 24
nc 2
nop 0
1
<?php
2
/**
3
 * AddComplete
4
 *
5
 * ユーザ追加画面(完了)を実現するためのクラス
6
 *
7
 * @package           risoluto
8
 * @author            Risoluto Developers
9
 * @license           http://opensource.org/licenses/bsd-license.php new BSD license
10
 * @copyright     (C) 2008-2015 Risoluto Developers / All Rights Reserved.
11
 */
12
13
//------------------------------------------------------//
14
// 名前空間の定義
15
//------------------------------------------------------//
16
namespace RisolutoApps\Admin\UserMng;
17
18
//------------------------------------------------------//
19
// クラス定義
20
//------------------------------------------------------//
21
class AddComplete extends \Risoluto\RisolutoControllerBase implements \Risoluto\RisolutoControllerInterface
22
{
23
    // View関連の処理を使用する
24
    use \Risoluto\RisolutoViewTrait;
25
26
    /**
27
     * play()
28
     *
29
     * 主処理を行う
30
     *
31
     * @access    public
32
     *
33
     * @param     void
34
     *
35
     * @return    void    なし
36
     */
37
    public function play()
38
    {
39
        // セッションをスタート
40
        $sess = new \Risoluto\Session();
41
        $sess->start();
42
43
        // 共通処理クラスを呼び出し
44
        $common = new \RisolutoApps\Admin\AdminCommon;
45
        $detail = $common->loginCheck( $sess, true );
46
47
        // セッションにフォーム入力情報が存在した場合は取得
48
        $entered = [ ];
49
        if ($sess->isThere( 'form' )) {
50
            $entered = $sess->load( 'form' );
51
            $sess->revoke( 'form' );
52
        }
53
54
        // DBへの登録を行う
55
        $options = [
56
            'by_who' => $detail[ 'no' ] . ':' . $detail[ 'userid' ],
57
            'userid' => $entered[ 'entered' ][ 'userid' ],
58
            'username' => $entered[ 'entered' ][ 'username' ],
59
            'password' => $entered[ 'entered' ][ 'password' ],
60
            'groupno' => $entered[ 'entered' ][ 'groupno' ],
61
            'status' => $entered[ 'entered' ][ 'status' ]
62
        ];
63
        $result = \Risoluto\Auth::callProviderMethod( 'addUser', $options );
64
65
        // ヘッダ情報のセット
66
        $header = $this->getDefaultHeader();
67
        $header = $this->replaceHeader( $header, 'robots', 'NOINDEX,NOFOLLOW' );
68
69
        // テンプレートエンジン関連の処理
70
        $assign_value = [
71
            'header' => $header,
72
            'detail' => $detail,
73
            'result' => $result
74
        ];
75
        $this->risolutoView( $assign_value );
76
    }
77
}