本文整理匯總了PHP中Backend\Core\Engine\Model::createUrlForAction方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::createUrlForAction方法的具體用法?PHP Model::createUrlForAction怎麽用?PHP Model::createUrlForAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Backend\Core\Engine\Model
的用法示例。
在下文中一共展示了Model::createUrlForAction方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
BackendAuthentication::logout();
// redirect to login-screen
$this->redirect(BackendModel::createUrlForAction('Index', $this->getModule()));
}
示例2: redirectToAllowedModuleAndAction
private function redirectToAllowedModuleAndAction()
{
$allowedModule = $this->getAllowedModule();
$allowedAction = $this->getAllowedAction($allowedModule);
$allowedModuleActionUrl = $allowedModule ? BackendModel::createUrlForAction($allowedAction, $allowedModule) : BackendModel::createUrlForAction('Index', 'Authentication');
$userEmail = BackendAuthentication::getUser()->getEmail();
$this->getContainer()->get('logger')->info("Redirecting user '{$userEmail}' to {$allowedModuleActionUrl}.");
$this->redirect($this->getParameter('querystring', 'string', $allowedModuleActionUrl));
}
示例3: validateForm
/**
* Validate the form
*/
private function validateForm()
{
if ($this->frm->isSubmitted()) {
// shorten fields
$newPassword = $this->frm->getField('backend_new_password');
$newPasswordRepeated = $this->frm->getField('backend_new_password_repeated');
// required fields
$newPassword->isFilled(BL::err('PasswordIsRequired'));
$newPasswordRepeated->isFilled(BL::err('PasswordRepeatIsRequired'));
// all fields are ok?
if ($newPassword->isFilled() && $newPasswordRepeated->isFilled()) {
// the passwords entered match
if ($newPassword->getValue() !== $newPasswordRepeated->getValue()) {
// add error
$this->frm->addError(BL::err('PasswordsDontMatch'));
// show error
$this->tpl->assign('error', BL::err('PasswordsDontMatch'));
}
}
if ($this->frm->isCorrect()) {
// change the users password
BackendUsersModel::updatePassword($this->user, $newPassword->getValue());
// attempt to login the user
if (!BackendAuthentication::loginUser($this->user->getEmail(), $newPassword->getValue())) {
// redirect to the login form with an error
$this->redirect(BackendModel::createURLForAction('Index', null, null, array('login' => 'failed')));
}
// redirect to the login form
$this->redirect(BackendModel::createUrlForAction('Index', 'Dashboard', null, array('password_reset' => 'success')));
}
}
}