Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getMessage()
 {
     if (!$this->deliverer) {
         throw new LogicException('You must set a deliverer before calling getMessage');
     }
     return $this->app->trans('%user% vous a delivre votre commande, consultez la en ligne a l\'adresse suivante', ['%user%' => $this->deliverer->getDisplayName()]);
 }
 /**
  * {@inheritdoc}
  */
 public function getMessage()
 {
     if (!$this->user) {
         throw new LogicException('You must set an user before calling getMessage');
     }
     return $this->app->trans('%user% has just sent its validation report, you can now see it', ['%user%' => $this->user->getDisplayName()]);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getMessage()
 {
     if (!$this->user instanceof User) {
         throw new LogicException('You must set a user before calling getMessage()');
     }
     return $this->app->trans('%user% has ordered documents', ['%user%' => $this->user->getDisplayName()]);
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function getMessage()
 {
     if (!$this->pusher) {
         throw new LogicException('You must set a basket before calling getMessage');
     }
     if (!$this->basket) {
         throw new LogicException('You must set a basket before calling getMessage');
     }
     return $this->app->trans('You just received a push containing %quantity% documents from %user%', ['%quantity%' => count($this->basket->getElements()), '%user%' => $this->pusher->getDisplayName()]) . "\n" . $this->message;
 }
 /**
  * {@inheritdoc}
  */
 public function getMessage()
 {
     if (!$this->deliverer instanceof User) {
         throw new LogicException('You must set a deliverer before calling getMessage()');
     }
     if (null === $this->quantity) {
         throw new LogicException('You must set a deliverer before calling getMessage()');
     }
     return $this->app->trans('%user% a refuse %quantity% elements de votre commande', ['%user%' => $this->deliverer->getDisplayName(), '%quantity%' => $this->quantity]);
 }
 /**
  * {@inheritdoc}
  */
 public function getSubject()
 {
     if (!$this->user) {
         throw new LogicException('You must set an user before calling getSubject');
     }
     if (!$this->title) {
         throw new LogicException('You must set a title before calling getSubject');
     }
     return $this->app->trans("Validation request from %user% for '%title%'", ['%user%' => $this->user->getDisplayName(), '%title%' => $this->title]);
 }
Ejemplo n.º 7
0
 public function testGetDisplayName()
 {
     $this->user->setLogin('login');
     $this->user->setFirstName('firstname');
     $this->user->setLastName('lastname');
     $this->user->setEmail('*****@*****.**');
     $this->assertEquals($this->user->getDisplayName(), 'firstname lastname');
     $this->user->setLastName('');
     $this->assertEquals($this->user->getDisplayName(), 'firstname');
     $this->user->setFirstName('');
     $this->assertEquals($this->user->getDisplayName(), '*****@*****.**');
     $this->user->setEmail(null);
     $this->assertEquals($this->user->getDisplayName(), 'login');
     $this->user->setLastName('lastname');
     $this->assertEquals($this->user->getDisplayName(), 'lastname');
     $this->user->setLastName(null);
     $this->user->setLogin(null);
     $this->assertEquals($this->user->getDisplayName(), 'Unnamed user');
 }
Ejemplo n.º 8
0
 protected function evaluateGoodUserItem($data, User $user)
 {
     foreach (['@entity@' => V1Controller::OBJECT_TYPE_USER, 'id' => $user->getId(), 'email' => $user->getEmail() ?: null, 'login' => $user->getLogin() ?: null, 'first_name' => $user->getFirstName() ?: null, 'last_name' => $user->getLastName() ?: null, 'display_name' => $user->getDisplayName() ?: null, 'address' => $user->getAddress() ?: null, 'zip_code' => $user->getZipCode() ?: null, 'city' => $user->getCity() ?: null, 'country' => $user->getCountry() ?: null, 'phone' => $user->getPhone() ?: null, 'fax' => $user->getFax() ?: null, 'job' => $user->getJob() ?: null, 'position' => $user->getActivity() ?: null, 'company' => $user->getCompany() ?: null, 'geoname_id' => $user->getGeonameId() ?: null, 'last_connection' => $user->getLastConnection() ? $user->getLastConnection()->format(DATE_ATOM) : null, 'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null, 'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null, 'locale' => $user->getLocale() ?: null] as $key => $value) {
         $this->assertArrayHasKey($key, $data, 'Assert key is present ' . $key);
         if ($value) {
             $this->assertEquals($value, $data[$key], 'Check key ' . $key);
         }
     }
 }
Ejemplo n.º 9
0
 /**
  * Creates an Emitter given a User
  *
  * @param User $user
  *
  * @return Emitter
  *
  * @throws InvalidArgumentException In case no valid email is found for user
  */
 public static function fromUser(User $user)
 {
     return new static($user->getDisplayName(), $user->getEmail());
 }
Ejemplo n.º 10
0
 protected function get_feed(Application $app, appbox $appbox, User $user, $pub_restrict, $homelink)
 {
     $user_key = 'user_' . $user->getId();
     if ($homelink == '1') {
         $feed_key = 'feed_homelink';
     } elseif ($pub_restrict == '1') {
         $feed_key = 'feed_restricted';
     } else {
         $feed_key = 'feed_public';
     }
     if (!array_key_exists($user_key, self::$feeds) || !isset(self::$feeds[$user_key][$feed_key])) {
         if ($homelink == '1') {
             $title = $user->getDisplayName() . ' - ' . 'homelink Feed';
         } elseif ($pub_restrict == '1') {
             $title = $user->getDisplayName() . ' - ' . 'private Feed';
         } else {
             $title = $user->getDisplayName() . ' - ' . 'public Feed';
         }
         $feed = new Feed();
         $publisher = new FeedPublisher();
         $feed->setTitle('title');
         $feed->setSubtitle('');
         $feed->addPublisher($publisher);
         $publisher->setFeed($feed);
         $publisher->setIsOwner(true);
         $publisher->setUser($user);
         if ($homelink) {
             $feed->setIsPublic(true);
             $app['orm.em']->persist($feed);
             $app['orm.em']->persist($user);
             $app['orm.em']->flush();
         } elseif ($pub_restrict == 1) {
             $collections = $app->getAclForUser($user)->get_granted_base();
             $collection = array_shift($collections);
             if (!$collection instanceof collection) {
                 foreach ($appbox->get_databoxes() as $databox) {
                     foreach ($databox->get_collections() as $coll) {
                         $collection = $coll;
                         break;
                     }
                     if ($collection instanceof collection) {
                         break;
                     }
                 }
             }
             if (!$collection instanceof collection) {
                 return false;
             }
             $feed->setCollection($collection);
         }
         self::$feeds[$user_key][$feed_key] = $feed;
     } else {
         $feed = self::$feeds[$user_key][$feed_key];
     }
     return $feed;
 }
Ejemplo n.º 11
0
 private function formatUser(User $user)
 {
     $subtitle = array_filter([$user->getJob(), $user->getCompany()]);
     return ['type' => 'USER', 'usr_id' => $user->getId(), 'firstname' => $user->getFirstName(), 'lastname' => $user->getLastName(), 'email' => $user->getEmail(), 'display_name' => $user->getDisplayName(), 'subtitle' => implode(', ', $subtitle)];
 }
Ejemplo n.º 12
0
 private function list_user(User $user)
 {
     switch ($user->getGender()) {
         case User::GENDER_MR:
             $gender = 'Mr';
             break;
         case User::GENDER_MRS:
             $gender = 'Mrs';
             break;
         case User::GENDER_MISS:
             $gender = 'Miss';
             break;
     }
     return ['@entity@' => self::OBJECT_TYPE_USER, 'id' => $user->getId(), 'email' => $user->getEmail() ?: null, 'login' => $user->getLogin() ?: null, 'first_name' => $user->getFirstName() ?: null, 'last_name' => $user->getLastName() ?: null, 'display_name' => $user->getDisplayName() ?: null, 'gender' => $gender, 'address' => $user->getAddress() ?: null, 'zip_code' => $user->getZipCode() ?: null, 'city' => $user->getCity() ?: null, 'country' => $user->getCountry() ?: null, 'phone' => $user->getPhone() ?: null, 'fax' => $user->getFax() ?: null, 'job' => $user->getJob() ?: null, 'position' => $user->getActivity() ?: null, 'company' => $user->getCompany() ?: null, 'geoname_id' => $user->getGeonameId() ?: null, 'last_connection' => $user->getLastConnection() ? $user->getLastConnection()->format(DATE_ATOM) : null, 'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null, 'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null, 'locale' => $user->getLocale() ?: null];
 }
 /**
  * {@inheritDoc}
  */
 public function getDisplayName()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getDisplayName', array());
     return parent::getDisplayName();
 }