group = $this->app->trans('Validation'); } /** * * @return string */ public function icon_url() { return '/assets/common/images/icons/push16.png'; } /** * * @param string $datas * @param boolean $unread * @return Array */ public function datas(array $data, $unread) { $from = $data['from']; $ssel_id = $data['ssel_id']; $isVoteBasket = !empty($data['isVoteBasket']) ? $data['isVoteBasket'] : false; if (null === $user = $this->app['repo.users']->find($from)) { return []; } $sender = $user->getDisplayName(); try { $basket = $this->app['converter.basket']->convert($ssel_id); $basket_name = trim($basket->getName()) ? : $this->app->trans('Une selection'); } catch (\Exception $e) { $basket_name = $this->app->trans('Une selection'); } $bask_link = '' . htmlentities($basket_name) . ''; if ($isVoteBasket) { $text = $this->app->trans('%user% vous demande de valider %title%', [ '%user%' => htmlentities($sender), '%title%' => $bask_link, ]); } else { $text = $this->app->trans("notification:: Basket '%title%' shared from %user%", [ '%user%' => htmlentities($sender), '%title%' => $bask_link, ]); } $ret = [ 'text' => $this->app->trans($text, [ '%user%' => htmlentities($sender), '%title%' => $bask_link, ]) , 'class' => ($unread == 1 ? 'reload_baskets' : '') ]; return $ret; } /** * * @return string */ public function get_name() { return $this->app->trans('Validation'); } /** * * @return string */ public function get_description() { return $this->app->trans('Recevoir des notifications lorsqu\'on me demande une validation'); } /** * @param integer $usr_id The id of the user to check * * @return boolean */ public function is_available(User $user) { return true; } }