Menu::play()   B
last analyzed

Complexity

Conditions 4
Paths 5

Size

Total Lines 38
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 2
Metric Value
c 2
b 1
f 2
dl 0
loc 38
rs 8.5806
cc 4
eloc 23
nc 5
nop 0
1
<?php
2
/**
3
 * Menu
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 Menu 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
        if ($sess->isThere( 'Auth' )) {
44
            // 認証情報がある場合は取得する
45
            $detail = $sess->Load( 'Auth' );
46
        } else {
47
            // 認証情報がない場合はログイン画面へ遷移する
48
            $sess->store( 'AuthError', 'invalid_access' );
49
            \Risoluto\Url::redirectTo( 'Admin_Login' );
50
            exit;
51
        }
52
53
        // メニュータブ制御
54
        $params = $this->GetParam();
55
        if (!empty( $params )) {
56
            $active_tab = htmlentities( $params[ 0 ], ENT_QUOTES, 'UTF-8' );
57
        } else {
58
            $active_tab = 'user';
59
        }
60
        $allow_admintab = ( $detail[ 'groupno' ] == 1 ) ? true : false;
61
62
        // ヘッダ情報のセット
63
        $header = $this->getDefaultHeader();
64
        $header = $this->replaceHeader( $header, 'robots', 'NOINDEX,NOFOLLOW' );
65
66
        // テンプレートエンジン関連の処理
67
        $assign_value = [
68
            'header' => $header,
69
            'detail' => $detail,
70
            'active_tab' => $active_tab,
71
            'allow_admintab' => $allow_admintab
72
        ];
73
        $this->risolutoView( $assign_value );
74
    }
75
}