本文整理汇总了PHP中yii\web\Controller::actions方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::actions方法的具体用法?PHP Controller::actions怎么用?PHP Controller::actions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\web\Controller
的用法示例。
在下文中一共展示了Controller::actions方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actions
/**
* @inheritdoc
*/
public function actions()
{
$actions = parent::actions();
$actions['login'] = ['class' => LoginAction::className(), 'modelClass' => $this->modelClass];
$actions['logout'] = ['class' => LogoutAction::className()];
return $actions;
}
示例2: getActions
/**
* Returns all available actions of the specified controller.
* @param Controller $controller the controller instance
* @return array all available action IDs.
*/
public function getActions($controller)
{
$actions = array_keys($controller->actions());
$class = new \ReflectionClass($controller);
foreach ($class->getMethods() as $method) {
$name = $method->getName();
if ($name !== 'actions' && $method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0) {
$actions[] = Inflector::camel2id(substr($name, 6), '-', true);
}
}
sort($actions);
return array_unique($actions);
}
示例3: actions
public function actions()
{
$actions = parent::actions();
if (Yii::$app->user->isGuest) {
return $this->redirect(Url::toroute('site/login'));
}
return $actions;
}
示例4: actions
public function actions()
{
parent::actions();
/*
* http://www.yiiframework.ru/forum/viewtopic.php?f=9&t=22866#p141025
* логика такова: загрузил изображение по пути указанному в path, а в редакторе, в src изображения прописал url
* behaviour - download image by path defined in path variable and in redactor define src for image from url variable
*/
return ['image-upload' => ['class' => 'vova07\\imperavi\\actions\\UploadAction', 'url' => Yii::getAlias(Yii::$app->controller->module->itemImageURL), 'path' => Yii::getAlias(Yii::$app->controller->module->itemImagePath)], 'images-get' => ['class' => 'vova07\\imperavi\\actions\\GetAction', 'url' => Yii::getAlias(Yii::$app->controller->module->itemImageURL), 'path' => Yii::getAlias(Yii::$app->controller->module->itemImagePath), 'type' => \vova07\imperavi\actions\GetAction::TYPE_IMAGES]];
}
示例5: actions
public function actions()
{
if (is_array($this->actions)) {
return $this->actions;
}
if (is_callable($this->actions)) {
return call_user_func($this->actions, $this);
}
return parent::actions();
}
示例6: actions
public function actions()
{
return ArrayHelper::merge(parent::actions(), ['toggle' => ['class' => ToggleAction::className(), 'modelClass' => OptionsList::className(), 'setFlash' => true, 'attribute' => 'active', 'primaryKey' => 'id'], 'editsort' => ['class' => EditableColumnAction::className(), 'modelClass' => OptionsList::className(), 'outputValue' => function ($model, $attribute, $key, $index) {
return (int) $model->{$attribute};
// return any custom output value if desired
}, 'outputMessage' => function ($model, $attribute, $key, $index) {
return '';
// any custom error to return after model save
}, 'showModelErrors' => true, 'errorOptions' => ['header' => ''], 'postOnly' => true, 'ajaxOnly' => true]]);
}
示例7: actions
public function actions()
{
$actions = ['list' => ['class' => 'sibds\\controllers\\actions\\ListAction'], 'trash' => ['class' => 'sibds\\controllers\\actions\\TrashAction'], 'copy' => ['class' => 'sibds\\controllers\\actions\\CopyAction'], 'update' => ['class' => 'sibds\\controllers\\actions\\UpdateAction'], 'unlock' => ['class' => 'sibds\\controllers\\actions\\UnlockAction'], 'lock' => ['class' => 'sibds\\controllers\\actions\\LockAction'], 'delete' => ['class' => 'sibds\\controllers\\actions\\DeleteAction'], 'restore' => ['class' => 'sibds\\controllers\\actions\\RestoreAction']];
if ($this->testBehavior(new NestedSetsBehavior())) {
$actions['nodeMove'] = ['class' => 'sibds\\controllers\\actions\\NodeMoveAction'];
}
if ($this->testBehavior(new GalleryBehavior())) {
$actions['galleryApi'] = ['class' => 'zxbodya\\yii2\\galleryManager\\GalleryManagerAction'];
}
return ArrayHelper::merge($actions, parent::actions());
// TODO: Change the autogenerated stub
}
示例8: actions
public function actions()
{
parent::actions();
/*
* http://www.yiiframework.ru/forum/viewtopic.php?t=22866#p141006
* "url" - this is the link to web-accessible folder where file will be stored. At this time file will be uploaded
* in temporary folder, that`s why URL is temporary to.
* "path" - this is the path to temporary folder where file will be uploaded. At the beginning widget load file to
* the temporary folder which defined by variable "path". And when you save record file will be moved to constant
* folder. You should define same folders.
* "url" - это ссылка к директории с веб доступом в которой будет загружен сам файл. Подразумевается что
* в конкретно данной ситуации загрузка происходит во временную папку, по этому и УРЛ будет временным.
* "path" - это путь к временной папке куда будет загружен файл. Данный виджет имеет такую логику что он
* предварительно загружает файл в временную папку, именно в той что указано в "path". И только при сохранении
* он перемещает файл в постоянную папку. надо указывать одну и туже папку
*/
return ['image-upload' => ['class' => 'vova07\\imperavi\\actions\\UploadAction', 'url' => $this->module->imagesUrl, 'path' => $this->module->imagesPath], 'images-get' => ['class' => 'vova07\\imperavi\\actions\\GetAction', 'url' => $this->module->imagesUrl, 'path' => $this->module->imagesPath, 'type' => \vova07\imperavi\actions\GetAction::TYPE_IMAGES]];
}
示例9: actions
public function actions()
{
return parent::actions();
// TODO: Change the autogenerated stub
}
示例10: actions
/**
* Declares class-based actions.
* For change functional use AuthUserBehavior, This is component
* declaret in to config.php, you can change him.
* Auth event:
*
* - beforeLogin(ActionEvent)
* - afterLogin(ActionEvent)
* - errorLogin(ActionEvent)
*
* - beforeSignup(ActionEvent)
* - afterSignup(ActionEvent)
* - errorSignup(ActionEvent)
*
* - beforeCheckRecoveryKey(ActionEvent)
* - afterCheckRecoveryKey(ActionEvent)
* - errorCheckRecoveryKey(ActionEvent)
*
* - beforeForgot(ActionEvent)
* - afterForgot(ActionEvent)
* - errorForgot(ActionEvent)
*
* - beforeLogout(ActionEvent)
* - afterLogout(ActionEvent)
*
* Also if you use extensions evenement, use this events,
* Insert into listeners.php:
*
* ...
* yiicod.auth.controllers.WebUserBase.[All event name before]
* ...
*/
public function actions()
{
return ArrayHelper::merge(parent::actions(), ['login' => ['class' => \yiicod\auth\actions\webUser\LoginAction::className()], 'requestPasswordReset' => ['class' => \yiicod\auth\actions\webUser\RequestPasswordResetAction::className()], 'logout' => ['class' => \yiicod\auth\actions\webUser\LogoutAction::className()], 'signup' => ['class' => \yiicod\auth\actions\webUser\SignupAction::className()], 'resetPassword' => ['class' => \yiicod\auth\actions\webUser\ResetPasswordAction::className()]]);
}
示例11: actions
/**
* @inheritDoc
*/
public function actions()
{
return ArrayHelper::merge(parent::actions(), ['upload' => ['class' => UEditorAction::className()]]);
}
示例12: actions
public function actions()
{
parent::actions();
return ['index' => ['class' => 'yii\\web\\ErrorAction']];
}
示例13: actions
/**
* @inheritdoc
*/
public function actions()
{
return array_merge(parent::actions(), ['error' => ['class' => 'yii\\web\\ErrorAction']]);
}
示例14: actions
public function actions()
{
return ArrayHelper::merge(parent::actions(), ['create-client' => ['class' => actions\CreateUser::className(), 'view' => '@app/modules/manager/views/default/createClient.php', 'redirectAction' => 'update-client-profile', 'role' => 'client'], 'update-client-profile' => ['class' => actions\UpdateProfile::className(), 'view' => '@app/modules/client/views/default/profile.php', 'redirectAction' => '/', 'modelClass' => 'app\\modules\\user\\models\\User'], 'profile' => ['class' => actions\UpdateProfile::className(), 'view' => '@app/modules/manager/views/default/profile.php', 'redirectAction' => '/manager/default/profile', 'modelClass' => 'app\\modules\\user\\models\\User', 'isManagerProfile' => true]]);
}