Exemplo n.º 1
0
 /**
  * @param \Secretary\Entity\User $user
  * @param string                 $action
  */
 public function __construct(\Secretary\Entity\User $user, $action = '#')
 {
     parent::__construct('userForm');
     $this->setAttribute('method', 'post')->setAttribute('action', $action)->setAttribute('class', 'form-horizontal');
     $displayName = new \Zend\Form\Element\Text('display_name');
     $displayName->setAttribute('required', 'required')->setAttribute('label', 'Display Name')->setValue($user->getDisplayName());
     $this->add($displayName);
     $select = new \Zend\Form\Element\Select('language');
     $select->setAttribute('required', 'required')->setAttribute('label', 'Select Language')->setValueOptions(array('de_DE' => 'german', 'en_US' => 'english'))->setValue($user->getLanguage());
     $this->add($select);
     $notifications = new \Zend\Form\Element\Select('notifications');
     $notifications->setAttribute('required', 'required')->setAttribute('label', 'Enable notifications')->setValueOptions(array('0' => 'no', '1' => 'yes'))->setValue($user->getNotifications());
     $this->add($notifications);
     $submit = new \Zend\Form\Element\Submit('submit');
     $submit->setAttribute('class', 'btn btn-primary')->setAttribute('value', 'save');
     $this->add($submit);
 }
 /**
  * {@inheritDoc}
  */
 public function getLanguage()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getLanguage', array());
     return parent::getLanguage();
 }
Exemplo n.º 3
0
 /**
  * @param  Entity\Note $note
  * @param  array $users
  * @param  Entity\User $owner
  * @param  string $subject
  * @param  string $title
  * @return void
  */
 protected function sendNoteGroupMail(Entity\Note $note, array $users, Entity\User $owner, $subject, $title)
 {
     /** @var Entity\User $user */
     foreach ($users as $user) {
         if ($user->getId() != $owner->getId() && true === $user->getNotifications()) {
             $this->translator->setLocale($user->getLanguage());
             $subject = $this->translator->translate($subject);
             $content = new ViewModel();
             $content->setTemplate('mail/note.phtml')->setVariable('title', $title)->setVariable('note', $note)->setVariable('host', $this->host);
             $message = $this->SxMail->compose($content);
             $message->addTo($user->getEmail());
             $message->addFrom($this->defaultFrom);
             $message->setSubject($subject);
             $this->SxMail->send($message);
         }
     }
     // @todo this will only work, as long owner is the only one with edit permissions
     $this->translator->setLocale($owner->getLanguage());
     return;
 }