Example #1
0
 /**
  * Adds new user.
  * @param  string
  * @param  string
  * @param  string
  * @param  DateTime
  * @return void
  */
 public function add($username, $password, $email, $date)
 {
     try {
         $data = array('username' => $username, 'password' => Passwords::hash($password), 'email' => $email, 'date' => $date, 'role' => 'user');
         $this->usersFacade->update($data);
     } catch (Nette\Database\UniqueConstraintViolationException $e) {
         throw new DuplicateNameException();
     }
 }
Example #2
0
 public function renderAddress()
 {
     $this->template->username = $this->usersFacade->find($this->id)->getUsername();
     $this->template->id = $this->id;
     $this->template->addresses = $this->addressFacade->addressList($this->id);
     $this->template->head = $this->addressFacade->addressInfo($this->addressId);
     $this->template->tariff = $this->tariffs;
     $this->template->history = $this->calculationFacade->historyList($this->addressId);
 }
Example #3
0
 public function formAddSucceeded($form)
 {
     $this->addressFacade->update(array('country' => $form['country']->getValue(), 'city' => $form['city']->getValue(), 'street' => $form['street']->getValue(), 'house' => $form['house']->getValue(), 'room' => $form['room']->getValue(), 'user' => $this->usersFacade->find($this->user->id)));
 }