BcAppController
extends AppController
in package
Uses
BcContainerTrait
Class BcAppController
Table of Contents
- $adminTheme : string
- 管理画面テーマ
- $Authentication : AuthenticationComponent
- $BcMessage : BcMessageComponent
- $content : array<string|int, mixed>
- コンテンツデータ
- $contentsTitle : string
- コンテンツタイトル
- $Paginator : PaginatorComponent
- $preview : bool
- プレビューフラグ
- $Security : SecurityComponent
- $site : array<string|int, mixed>
- サイトデータ
- $subDir : string
- サブディレクトリ
- $_View : View
- View
- __construct() : mixed
- BcAppController constructor.
- _blackHoleCallback() : void
- Securityコンポーネントのブラックホールからのコールバック
- ajaxError() : void
- Ajax用のエラーを出力する
- beforeFilter() : Response|void
- beforeFilter
- beforeRender() : void
- beforeRender
- dispatchLayerEvent() : bool|Event
- イベントを発火
- getService() : array<string|int, mixed>|mixed|object
- Get Service
- hasService() : bool
- Has Service
- initialize() : void
- Initialize
- isAuthorized() : bool
- 認証完了後処理
- notFound() : void
- NOT FOUNDページを出力する
- redirectIfIsRequireMaintenance() : Response|void|null
- メンテナンス画面へのリダイレクトが必要な場合にリダイレクトする
- requestAction() : mixed
- Calls a controller's method from any location.
- sendMail() : bool
- メールを送信する
- setAction() : mixed
- Internally redirects one action to another. Examples:
- setTitle() : void
- Set Title
- setupFrontView() : void
- フロント用のViewクラスをセットアップする
- _autoConvertEncodingByArray() : array<string|int, mixed>
- 配列の文字コードを変換する
- _checkSubmitToken() : mixed
- リクエストメソッドとトークンをチェックする
- convertBetweenCondition() : array<string|int, mixed>
- BETWEEN 条件を生成
- convertSelectTextCondition() : array<string|int, mixed>
- Select Text 用の条件を生成する
- generatePassword() : string
- ランダムなパスワード文字列を生成する
- getCakeVersion() : string
- CakePHPのバージョンを取得する
- getUserModel() : mixed
- リクエストされた画面に対しての認証用ユーザーモデルを取得する
- loadViewConditions() : void
- 画面の情報をセッションから読み込む
- saveDblog() : EntityInterface
- データベースログを記録する
- saveViewConditions() : void
- 画面の情報をセッションに保存する
- setViewConditions() : void
- 画面の情報をセットする
- __cleanupQueryParams() : void
- クエリーパラメーターの調整 環境によって?キーにamp;が付加されてしまうため
- __convertEncodingHttpInput() : void
- http経由で送信されたデータを変換する とりあえず、UTF-8で固定
- __loadDataToView() : void
- View用のデータを読み込む。 beforeRenderで呼び出される
- checkPermission() : bool
- アクセスルールの権限を確認する
Properties
$adminTheme
管理画面テーマ
public
string
$adminTheme
= null
$Authentication
public
AuthenticationComponent
$Authentication
$BcMessage
public
BcMessageComponent
$BcMessage
$content
コンテンツデータ
public
array<string|int, mixed>
$content
= []
$contentsTitle
コンテンツタイトル
public
string
$contentsTitle
= ''
$Paginator
public
PaginatorComponent
$Paginator
$preview
プレビューフラグ
public
bool
$preview
= false
$Security
public
SecurityComponent
$Security
$site
サイトデータ
public
array<string|int, mixed>
$site
= []
$subDir
サブディレクトリ
public
string
$subDir
= null
Tags
$_View
View
protected
View
$_View
Methods
__construct()
BcAppController constructor.
public
__construct([ServerRequest|null $request = null ][, Response|null $response = null ][, string|null $name = null ][, EventManagerInterface|null $eventManager = null ][, ComponentRegistry|null $components = null ]) : mixed
Parameters
- $request : ServerRequest|null = null
- $response : Response|null = null
- $name : string|null = null
- $eventManager : EventManagerInterface|null = null
- $components : ComponentRegistry|null = null
Tags
Return values
mixed —_blackHoleCallback()
Securityコンポーネントのブラックホールからのコールバック
public
_blackHoleCallback(string $err, mixed $exception) : void
フォーム改ざん対策・CSRF対策・SSL制限・HTTPメソッド制限などへの違反が原因で Securityコンポーネントに"ブラックホールされた"場合の動作を指定する
Parameters
- $err : string
-
エラーの種類
- $exception : mixed
Tags
Return values
void —ajaxError()
Ajax用のエラーを出力する
public
ajaxError([int $errorNo = 500 ][, mixed $message = '' ]) : void
Parameters
- $errorNo : int = 500
-
エラーのステータスコード
- $message : mixed = ''
-
エラーメッセージ
Return values
void —beforeFilter()
beforeFilter
public
beforeFilter(EventInterface $event) : Response|void
Parameters
- $event : EventInterface
Tags
Return values
Response|void —beforeRender()
beforeRender
public
beforeRender(EventInterface $event) : void
Parameters
- $event : EventInterface
Return values
void —dispatchLayerEvent()
イベントを発火
public
dispatchLayerEvent(string $name[, array<string|int, mixed> $data = [] ][, mixed $options = [] ]) : bool|Event
Parameters
- $name : string
- $data : array<string|int, mixed> = []
- $options : mixed = []
Tags
Return values
bool|Event —getService()
Get Service
public
getService( $service) : array<string|int, mixed>|mixed|object
Parameters
Tags
Return values
array<string|int, mixed>|mixed|object —hasService()
Has Service
public
hasService( $service) : bool
Parameters
Tags
Return values
bool —initialize()
Initialize
public
initialize() : void
Tags
Return values
void —isAuthorized()
認証完了後処理
public
isAuthorized(array<string|int, mixed> $user) : bool
Parameters
- $user : array<string|int, mixed>
-
認証されたユーザー情報
Return values
bool —notFound()
NOT FOUNDページを出力する
public
notFound() : void
Tags
Return values
void —redirectIfIsRequireMaintenance()
メンテナンス画面へのリダイレクトが必要な場合にリダイレクトする
public
redirectIfIsRequireMaintenance() : Response|void|null
Tags
Return values
Response|void|null —requestAction()
Calls a controller's method from any location.
public
requestAction(mixed $url[, array<string|int, mixed> $extra = [] ]) : mixed
Parameters
- $url : mixed
-
String or array-based url.
- $extra : array<string|int, mixed> = []
-
if array includes the key "return" it sets the AutoRender to true.
Return values
mixed —Boolean true or false on success/failure, or contents of rendered action if 'return' is set in $extra.
sendMail()
メールを送信する
public
sendMail(string $to[, string $title = '' ][, mixed $body = '' ][, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $to : string
-
送信先アドレス
- $title : string = ''
-
タイトル
- $body : mixed = ''
-
本文
- $options : array<string|int, mixed> = []
-
オプション
- bool agentTemplate : テンプレートの配置場所についてサイト名をサブフォルダとして利用するかどうか(初期値:true)
Return values
bool —送信結果
setAction()
Internally redirects one action to another. Examples:
public
setAction(string $action, mixed ...$args) : mixed
setAction('another_action'); setAction('action_with_parameters', $parameter1);
Parameters
- $action : string
-
The new action to be redirected to
- $args : mixed
Return values
mixed —Returns the return value of the called action
setTitle()
Set Title
public
setTitle(string $title) : void
Parameters
- $title : string
Tags
Return values
void —setupFrontView()
フロント用のViewクラスをセットアップする
public
setupFrontView() : void
Tags
Return values
void —_autoConvertEncodingByArray()
配列の文字コードを変換する
protected
_autoConvertEncodingByArray(array<string|int, mixed> $data[, string $outenc = 'UTF-8' ]) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
変換前データ
- $outenc : string = 'UTF-8'
-
変換後の文字コード
Tags
Return values
array<string|int, mixed> —変換後データ
_checkSubmitToken()
リクエストメソッドとトークンをチェックする
protected
_checkSubmitToken() : mixed
- GETでのアクセスの場合 not found
- トークンが送信されていない場合 not found
Return values
mixed —convertBetweenCondition()
BETWEEN 条件を生成
protected
convertBetweenCondition(string $fieldName, mixed $value) : array<string|int, mixed>
Parameters
- $fieldName : string
-
フィールド名
- $value : mixed
-
値
Return values
array<string|int, mixed> —convertSelectTextCondition()
Select Text 用の条件を生成する
protected
convertSelectTextCondition(string $fieldName, mixed $values[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
- $fieldName : string
-
フィールド名
- $values : mixed
-
値
- $options : array<string|int, mixed> = []
-
オプション
Return values
array<string|int, mixed> —generatePassword()
ランダムなパスワード文字列を生成する
protected
generatePassword([int $len = 8 ]) : string
Parameters
- $len : int = 8
-
文字列の長さ
Return values
string —パスワード
getCakeVersion()
CakePHPのバージョンを取得する
protected
getCakeVersion() : string
Return values
string —Baserバージョン
getUserModel()
リクエストされた画面に対しての認証用ユーザーモデルを取得する
protected
getUserModel() : mixed
Return values
mixed —string Or false
loadViewConditions()
画面の情報をセッションから読み込む
protected
loadViewConditions([array<string|int, mixed> $targetModel = [] ][, array<string|int, mixed>|string $options = [] ]) : void
初期値が設定されている場合は初期値を設定した上で、セッションで上書きし、 ServerRequestに設定する。
Parameters
- $targetModel : array<string|int, mixed> = []
- $options : array<string|int, mixed>|string = []
-
オプション
-
default
: 読み出す初期値(初期値:[]) -
group
: 保存するグループ名(初期値:'') -
post
: POSTデータを保存するかどうか(初期値:true) -
get
: GETデータを保存するかどうか(初期値:false)
-
Tags
Return values
void —saveDblog()
データベースログを記録する
protected
saveDblog(string $message) : EntityInterface
Parameters
- $message : string
Tags
Return values
EntityInterface —saveViewConditions()
画面の情報をセッションに保存する
protected
saveViewConditions([array<string|int, mixed> $targetModel = [] ][, array<string|int, mixed> $options = [] ]) : void
次のセッション名に保存。
- POSTデータ: BcApp.viewConditions.{$contentsName}.data.{$model}
- クエリパラメーター: BcApp.viewConditions.{$contentsName}.query
$contentsNameは次の形式となる。 {$controllerName}{$actionName}.{$group}
ただし、ページネーションにおいて、1ページ目はクエリパラメーターpage
を付けない仕様となっているため
page
は保存しない。
Parameters
- $targetModel : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
-
オプション
-
group
: 保存するグループ名(初期値:'') -
post
: POSTデータを保存するかどうか(初期値:true) -
get
: GETデータを保存するかどうか(初期値:false)
-
Tags
Return values
void —setViewConditions()
画面の情報をセットする
protected
setViewConditions([array<string|int, mixed> $targetModel = [] ][, array<string|int, mixed> $options = [] ]) : void
POSTデータとクエリパラメーターをセッションに保存した上で、 指定されたデフォルト値も含めて ServerRequest に設定する。
$this->setViewConditions(['Content'], [
'group' => 'index',
'default' => [
'query' => ['limit' => 10],
'data' => ['title' => 'default']
],
'get' => true
]);
Parameters
- $targetModel : array<string|int, mixed> = []
-
ターゲットとなるモデル
- $options : array<string|int, mixed> = []
-
オプション
-
default
: 読み出す初期値(初期値:[]) -
group
: 保存するグループ名(初期値:'') -
post
: POSTデータを保存するかどうか(初期値:true) -
get
: GETデータを保存するかどうか(初期値:false)
-
Tags
Return values
void —__cleanupQueryParams()
クエリーパラメーターの調整 環境によって?キーにamp;が付加されてしまうため
private
__cleanupQueryParams() : void
Tags
Return values
void —__convertEncodingHttpInput()
http経由で送信されたデータを変換する とりあえず、UTF-8で固定
private
__convertEncodingHttpInput() : void
Tags
Return values
void —__loadDataToView()
View用のデータを読み込む。 beforeRenderで呼び出される
private
__loadDataToView() : void
Return values
void —checkPermission()
アクセスルールの権限を確認する
private
checkPermission() : bool
現在アクセスしているURLについて権限があるかどうかを確認する。