/** * 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); }
/** * @inheritdoc */ public function actions() { $actions = parent::actions(); $actions['login'] = ['class' => LoginAction::className(), 'modelClass' => $this->modelClass]; $actions['logout'] = ['class' => LogoutAction::className()]; return $actions; }
public function actions() { $actions = parent::actions(); if (Yii::$app->user->isGuest) { return $this->redirect(Url::toroute('site/login')); } return $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]]; }
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(); }
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]]); }
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 }
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]]; }
public function actions() { return parent::actions(); // TODO: Change the autogenerated stub }
/** * 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()]]); }
/** * @inheritDoc */ public function actions() { return ArrayHelper::merge(parent::actions(), ['upload' => ['class' => UEditorAction::className()]]); }
public function actions() { parent::actions(); return ['index' => ['class' => 'yii\\web\\ErrorAction']]; }
/** * @inheritdoc */ public function actions() { return array_merge(parent::actions(), ['error' => ['class' => 'yii\\web\\ErrorAction']]); }
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]]); }