1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* DelConfirm |
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\GroupMng; |
17
|
|
|
|
18
|
|
|
//------------------------------------------------------// |
19
|
|
|
// クラス定義 |
20
|
|
|
//------------------------------------------------------// |
21
|
|
|
class DelConfirm 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
|
|
|
$param = $this->getParam(); |
48
|
|
View Code Duplication |
if (is_numeric( $param[ 0 ] )) { |
|
|
|
|
49
|
|
|
// 引数値がセットされていれば、それを元に登録情報を呼び出す |
50
|
|
|
$target = \Risoluto\Auth::callProviderMethod( 'showGroupByNo', [ 'no' => $param[ 0 ] ] ); |
51
|
|
|
if (empty( $target )) { |
52
|
|
|
// 情報が取得できなかった場合も例外をThrow |
53
|
|
|
Throw new \Exception( 'Cannot load user data' ); |
54
|
|
|
} |
55
|
|
|
} else { |
56
|
|
|
// 指定されていなければ例外をThrowする |
57
|
|
|
Throw new \Exception( 'Require args not found' ); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
// 情報が取得できたら整形してセッションに保存する |
61
|
|
|
$getVals[ 'entered' ] = [ |
|
|
|
|
62
|
|
|
'no' => $target[ 0 ][ 'no' ], |
63
|
|
|
'groupid' => $target[ 0 ][ 'groupid' ], |
64
|
|
|
'groupname' => $target[ 0 ][ 'groupname' ], |
65
|
|
|
'status' => $target[ 0 ][ 'status' ] |
66
|
|
|
]; |
67
|
|
|
$sess->store( 'form', $getVals ); |
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
|
|
|
'entered' => $getVals, |
78
|
|
|
'csrf_token' => $sess->load( 'csrf_token' ) |
79
|
|
|
]; |
80
|
|
|
$this->risolutoView( $assign_value ); |
81
|
|
|
} |
82
|
|
|
} |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.