Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jul 13th, 2018 67 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. public function addAction() {
  2.         if ($this->request->headers()->get('X-REQUESTED-WITH') !== false && $this->request->headers()->get('X-REQUESTED-WITH')->getFieldValue() == 'XMLHttpRequest') {
  3.             $this->layout()->setTemplate('layout/modal');
  4.         }
  5.        
  6.         $form = new User();
  7.         $view = new ViewModel();
  8.        
  9.         $user = $this->userService->getUserById($this->event->getRouteMatch()->getParam('id'));
  10.         if ($user != null) {
  11.             $form->populateWithUser($user);
  12.         }
  13.        
  14.         if ($this->request->isPost()) {
  15.             if ($form->isValid($this->request->post()->toArray())) {
  16.                 $user = $this->userService->saveUser($user, new Parameters($form->getValues()));
  17.                
  18.                 $this->flashMessenger()->addMessage('User "' . $user->getName() . '" added');
  19.                
  20.                 $this->redirect()->toRoute('default', array (
  21.                     'controller' => 'user',
  22.                     'action' => 'index',
  23.                 ));
  24.             }
  25.         }
  26.  
  27.         $view->form = $form;
  28.  
  29.         return $view;
  30.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top