public function __construct($file)
 {
     parent::__construct($file);
     $this->setMaxSize(1234567);
     $this->setMaxHeight(123456);
     $this->setMaxWidth(123456);
 }
 public function executeProfil(HTTPRequest $request)
 {
     //get Users manager
     $manager = $this->getManagerOf($this->module(), 'Users');
     //If datas posts
     if ($request->method() == 'POST') {
         //get the user from data base
         $user = $manager->getUnique($this->app->session()->getAttribute('UserId'));
         //Gestion de l'image
         $maxsize = 1234567;
         $maxwidth = 123456;
         $maxheight = 123456;
         $imageHandler = new ImageHandler($_FILES['avatar'], $maxsize, $maxwidth, $maxheight);
         if ($imageHandler->saveTo(__DIR__ . '/../../../../Web/images/avatars/', $user->id())) {
             $user->setAvatar($imageHandler->newFileName());
         }
         //Gestion du reste du formulaire
         $user->setNickName($request->postData('nickname'));
         $user->setMail($request->postData('mail'));
         $user->setName($request->postData('name'));
         $user->setFirstName($request->postData('firstName'));
         $user->setAddress($request->postData('address'));
         $user->setPostCode($request->postData('postCode'));
         $user->setCity($request->postData('city'));
         $user->setCellPhone(preg_replace('[\\s|\\.|\\-]', '', $request->postData('cellPhone')));
         $user->setPhone(preg_replace('[\\s|\\.|\\-]', '', $request->postData('phone')));
         $user->setGender($request->postData('gender'));
         $manager->save($user);
         $this->app->session()->setFlash('Le profil à été mis à jour');
     }
     //Si le formulaire n'est pas envoyé
     //On récupère le membre
     $user = $manager->getUnique($this->app->session()->getAttribute('UserId'));
     //On configure la page
     $this->sendView('users:usersFront:profil', array('user' => $user));
 }
Exemple #3
0
 public function __construct($file)
 {
     parent::__construct($file);
 }