本文整理汇总了PHP中Phalcon\Tag::resetInput方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::resetInput方法的具体用法?PHP Tag::resetInput怎么用?PHP Tag::resetInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Tag
的用法示例。
在下文中一共展示了Tag::resetInput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changePasswordAction
/**
* Signed in users can change their password
*/
public function changePasswordAction()
{
$user = $this->auth->getUser();
if ($user === false) {
$this->flash->success($this->translate->gettext('You must be signed in to change the password'));
return $this->dispatcher->forward(['controller' => 'index', 'action' => 'notification']);
}
$form = new ChangePasswordForm();
$form->setDI($this->getDI());
if ($this->request->isPost()) {
if ($form->isValid($this->request->getPost()) !== false) {
$user->password = $this->request->getPost('password');
$user->mustChangePassword = 'N';
$passwordChange = new PasswordChanges();
$passwordChange->user = $user;
$passwordChange->ipAddress = $this->request->getClientAddress();
$passwordChange->userAgent = $this->request->getUserAgent();
if ($passwordChange->save()) {
$this->auth->clearNeedToChangePassword();
$this->flash->success($this->translate->gettext('Your password was successfully changed'));
Tag::resetInput();
} else {
$this->flash->error($passwordChange->getMessages());
}
}
}
$this->view->form = $form;
}
示例2: editAction
public function editAction($id)
{
$fileStore = FileStore::findFirst($id);
if ($fileStore == false) {
$this->flash->error(_("Document was not found"));
return $this->dispatcher->forward(array('action' => 'index'));
}
$request = $this->request;
$userId = $this->auth->getIdentity();
$form = new FileStoreForm($fileStore, array('edit' => true));
if ($request->isPost()) {
if ($form->isValid($request->getPost()) == true && $request->hasFiles() == true) {
$fileStore = new FileStore();
foreach ($request->getUploadedFiles() as $file) {
$fileStore->assign(array('id' => $id, 'fileName' => $file->getName(), 'fileCaption' => $request->getPost('fileCaption'), 'description' => $request->getPost('description'), 'categoriesId' => $request->getPost('categoriesId'), 'userId' => $userId['id'], 'mimeType' => $file->getType(), 'fileData' => file_get_contents($file->getTempName())));
if ($fileStore->update() == true) {
$this->flash->success(_("Update Document success"));
Tag::resetInput();
return $this->dispatcher->forward(array('action' => 'index'));
}
$this->flash->error($fileStore->getMessages());
}
}
}
$this->view->form = $form;
}
示例3: createAction
/**
* Creates a User
*/
public function createAction()
{
if ($this->request->isPost()) {
$user = new Users();
$user->assign(array('name' => $this->request->getPost('name', 'striptags'), 'email' => $this->request->getPost('email', 'email')));
if (!$user->save()) {
$this->flash->error($user->getMessages());
} else {
$this->flash->success("User was created successfully");
Tag::resetInput();
}
}
$this->view->form = new UsersForm(null);
}
示例4: createAction
/**
* Creates a new Profile
*
*/
public function createAction()
{
Tag::displayTo("active", "Y");
if ($this->request->isPost()) {
$model = new Roles();
$model->assign(array('name' => $this->request->getPost('name', 'striptags'), 'active' => $this->request->getPost('active')));
if (!$model->save()) {
$this->flash->error($model->getMessages());
} else {
$this->flashSession->success("Новая роль добавлена");
Tag::resetInput();
return $this->response->redirect("backend/roles");
}
}
}
示例5: createAction
/**
* Creates a User
*
*/
public function createAction()
{
Tag::displayTo("role_id", 3);
if ($this->request->isPost()) {
$model = new Users();
$model->assign(array('name' => $this->request->getPost('name', 'striptags'), 'role_id' => $this->request->getPost('role_id', 'int'), 'email' => $this->request->getPost('email', 'email')));
if (!$model->save()) {
$this->flash->error($model->getMessages());
} else {
$this->flashSession->success("Новый пользователь добавлен");
Tag::resetInput();
return $this->response->redirect("backend/users");
}
}
}
示例6: editAction
public function editAction($id)
{
$categories = Categories::findFirst($id);
if ($categories == false) {
$this->flash->error("categories was not found");
return $this->dispatcher->forward(array('action' => 'index'));
}
$request = $this->request;
$form = new CategoriesForm($categories, array('edit' => true));
if ($request->isPost()) {
if ($form->isValid($request->getPost()) == true) {
$categories->assign(array('id' => $id, 'name' => $request->getPost('name'), 'slug' => $request->getPost('slug')));
if ($categories->update() == true) {
$this->flash->success(_("Update sucess post"));
Tag::resetInput();
return $this->dispatcher->forward(array('action' => 'index'));
}
$this->flash->error($categories->getMessages());
}
}
$this->view->form = $form;
}
示例7: testFieldParameter
/**
* Runs the test for a Tag::$function with $options
*
* @param string $function
* @param mixed $options
* @param string $expected
* @param boolean $xhtml
* @param string $set
*/
public function testFieldParameter($function, $options, $expected, $xhtml, $set = '')
{
Tag::resetInput();
if ($xhtml) {
Tag::setDocType(Tag::XHTML10_STRICT);
$expected .= ' />';
} else {
Tag::setDocType(Tag::HTML5);
$expected .= '>';
}
if ($set) {
Tag::displayTo('x_name', 'x_value');
}
$actual = Tag::$function($options);
if ($set) {
Tag::$set('x_name', '');
}
$this->assertEquals($expected, $actual);
}
示例8: editAction
/**
* Saves the user from the 'edit' action
*/
public function editAction($id)
{
$user = Users::findFirstById($id);
if (!$user) {
$this->flash->error($this->translate->gettext('User was not found'));
return $this->dispatcher->forward(['action' => 'index']);
}
$this->view->user = $user;
$form = new UsersForm($user, ['edit' => true]);
$form->setDI($this->getDI());
$this->view->form = $form;
if ($this->request->isPost()) {
if ($form->isValid($this->request->getPost()) !== false) {
$user->assign(['name' => $this->request->getPost('name', 'striptags'), 'rolesId' => $this->request->getPost('rolesId', 'int'), 'email' => $this->request->getPost('email', 'email'), 'banned' => $this->request->getPost('banned'), 'active' => $this->request->getPost('active')]);
if (!$user->save()) {
$this->flash->error($user->getMessages());
} else {
$this->flash->success($this->translate->gettext('User was updated successfully'));
Tag::resetInput();
}
}
}
}
示例9: resetInput
public static function resetInput()
{
parent::resetInput();
}
示例10: testResetInputDisplayToXHTMLT53
/**
* Tests resetInput (after a displayTo)
*
* @issue 53
* @author Nikos Dimopoulos <nikos@phalconphp.com>
* @since 2012-10-26
*/
public function testResetInputDisplayToXHTMLT53()
{
\Phalcon\Tag::setDoctype(\Phalcon\Tag::XHTML10_STRICT);
$options = 'some_field_name';
$expected = '<input type="text" id="some_field_name" name="some_field_name" value="Wall-E" />';
\Phalcon\Tag::displayTo('some_field_name', 'Wall-E');
$actual = \Phalcon\Tag::textField($options);
$this->assertEquals($expected, $actual, sprintf($this->message, 'XHTML resetInput before contains a value'));
\Phalcon\Tag::resetInput();
$expected = '<input type="text" id="some_field_name" name="some_field_name" value="" />';
$actual = \Phalcon\Tag::textField($options);
\Phalcon\Tag::setDoctype('');
$this->assertEquals($expected, $actual, sprintf($this->message, 'XHTML resetInput after contains a value'));
}
示例11: testResetInput
/**
* @issue 11319
*/
public function testResetInput()
{
Tag::resetInput();
}
示例12: editAction
/**
* Edits an existing Role
*
* @param int $id
*/
public function editAction($id)
{
$role = Roles::findFirstById($id);
if (!$role) {
$this->flash->error($this->translate->gettext('Role was not found'));
return $this->dispatcher->forward(['action' => 'index']);
}
$this->view->role = $role;
$form = new RolesForm($role, ['edit' => true]);
$form->setDI($this->getDI());
$this->view->form = $form;
if ($this->request->isPost()) {
if ($form->isValid($this->request->getPost()) !== false) {
$role->assign(['name' => $this->request->getPost('name', 'striptags'), 'active' => $this->request->getPost('active')]);
if (!$role->save()) {
$this->flash->error($role->getMessages());
} else {
$this->flash->success($this->translate->gettext('Role was updated successfully'));
}
Tag::resetInput();
}
}
}
示例13: changePasswordAction
public function changePasswordAction()
{
// get the user resetting password and then log them out so they can't navigate
// to other protected parts of the site
// rewrite comment,idea has changed
/** @var \Talon\Models\Users\Users $user */
$user = $this->auth->getUser();
if (!$user) {
$this->flashSession->error(Users::USER_DOES_NOT_EXIST);
$this->redirect('session', 'login');
}
$form = new ChangePasswordForm();
$code = $this->dispatcher->getParam('code');
if ($code) {
$resetPasswords = ResetPasswords::findFirstByCode($code);
if ($resetPasswords->reset === 1) {
$this->auth->unregisterIdentity();
}
}
if ($this->request->isPost()) {
if ($form->isValid($this->request->getPost()) !== false) {
$passwordChange = new PasswordChanges();
$passwordChange->usersId = $user->id;
$passwordChange->ipAddress = $this->request->getClientAddress();
$passwordChange->userAgent = $this->request->getUserAgent();
if (!$passwordChange->save()) {
$this->flashSession->error($passwordChange->getMessages());
} else {
$user->setPassword($this->request->getPost('password'));
if ($user->save() === false) {
// log user back in so they can get to the form
// in case they were resetting password and were logged out
$this->auth->authUserById($user->id);
foreach ($user->getMessages() as $message) {
$this->flashSession->error($message);
}
} else {
$this->flashSession->success('Password changed successfully.');
return $this->redirect('session', 'login');
}
}
}
}
Tag::resetInput();
$this->view->setVar('form', $form);
}
示例14: editAction
public function editAction($id)
{
$post = Posts::findFirst($id);
if ($post == false) {
$this->flash->error(_("Post was not found"));
return $this->dispatcher->forward(array('action' => 'index'));
}
$request = $this->request;
$form = new PostsForm($post, array('edit' => true));
if ($request->isPost()) {
if ($form->isValid($request->getPost()) == true) {
$userId = $this->auth->getIdentity();
$content = Markdown::defaultTransform($request->getPost('content'));
$title = $request->getPost('title');
$post->assign(array('id' => $id, 'title' => $title, 'categoriesId' => $request->getPost('categoriesId'), 'tags' => $request->getPost('tags'), 'slug' => $this->tag->friendlyTitle($this->normalizeChars($title)), 'content' => $content, 'userPost' => $userId['username'], 'numberViews' => $post->numberViews));
if ($post->update() == true) {
$this->flash->success(_("Update success"));
Tag::resetInput();
return $this->dispatcher->forward(array('action' => 'index'));
}
$this->flash->error($post->getMessages());
}
}
$this->view->form = $form;
}
示例15: editAction
/**
* Edits an existing Profile
*
* @param int $id
*/
public function editAction($id)
{
$profile = Profiles::findFirstById($id);
if (!$profile) {
$this->flash->error("Profile was not found");
return $this->dispatcher->forward(array('action' => 'index'));
}
if ($this->request->isPost()) {
$profile->assign(array('name' => $this->request->getPost('name', 'striptags'), 'active' => $this->request->getPost('active')));
if (!$profile->save()) {
$this->flash->error($profile->getMessages());
} else {
$this->flash->success("Profile was updated successfully");
}
Tag::resetInput();
}
$this->view->form = new ProfilesForm($profile, array('edit' => true));
$this->view->profile = $profile;
}