SelfComplete   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 2
Bugs 1 Features 2
Metric Value
wmc 3
c 2
b 1
f 2
lcom 1
cbo 6
dl 0
loc 61
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B play() 0 44 3
1
<?php
2
/**
3
 * SelfComplete
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;
17
18
//------------------------------------------------------//
19
// クラス定義
20
//------------------------------------------------------//
21
class SelfComplete 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, false );
46
        $entered = $common->checkEnteredSelfData( $_POST, $sess->load( 'csrf_token' ), $detail[ 'no' ] );
47
48
        // エラー情報があった場合は入力画面に戻る
49
        if (!empty( $entered[ 'error' ][ 'msg' ] ) or !empty( $entered[ 'error' ][ 'form_crit' ] )) {
50
            // 入力情報はセッションに保存
51
            $sess->store( 'form', $entered );
52
53
            \Risoluto\Url::redirectTo( 'Admin_SelfEntry' );
54
            exit;
55
        }
56
57
        // DBへの登録を行う
58
        $options = [
59
            'by_who' => $detail[ 'no' ] . ':' . $detail[ 'userid' ],
60
            'no' => $detail[ 'no' ],
61
            'userid' => $detail[ 'userid' ],
62
            'username' => $detail[ 'username' ],
63
            'password' => $entered[ 'entered' ][ 'password' ],
64
            'groupno' => $detail[ 'groupno' ],
65
            'status' => $detail[ 'status' ]
66
        ];
67
        $result = \Risoluto\Auth::callProviderMethod( 'modUserByNo', $options );
68
69
        // ヘッダ情報のセット
70
        $header = $this->getDefaultHeader();
71
        $header = $this->replaceHeader( $header, 'robots', 'NOINDEX,NOFOLLOW' );
72
73
        // テンプレートエンジン関連の処理
74
        $assign_value = [
75
            'header' => $header,
76
            'detail' => $detail,
77
            'result' => $result
78
        ];
79
        $this->risolutoView( $assign_value );
80
    }
81
}