@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace LoginCidadao\APIBundle\Controller; |
4 | 4 | |
5 | 5 | use FOS\RestBundle\Controller\FOSRestController; |
6 | -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
|
7 | 6 | use FOS\RestBundle\Controller\Annotations as REST; |
8 | 7 | use Symfony\Component\HttpFoundation\Request; |
9 | 8 | use LoginCidadao\CoreBundle\Entity\Country; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | { |
25 | 25 | $query = $this->getDoctrine()->getRepository('LoginCidadaoCoreBundle:Country') |
26 | 26 | ->createQueryBuilder('cty') |
27 | - ->where('cty.reviewed = ' . Country::REVIEWED_OK) |
|
27 | + ->where('cty.reviewed = '.Country::REVIEWED_OK) |
|
28 | 28 | ->orderBy('cty.id', 'ASC'); |
29 | 29 | return $this->handleView($this->view($query->getQuery()->getResult(Query::HYDRATE_ARRAY))); |
30 | 30 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $query = $this->getDoctrine()->getRepository('LoginCidadaoCoreBundle:State') |
40 | 40 | ->createQueryBuilder('state') |
41 | - ->where('state.reviewed = ' . Country::REVIEWED_OK); |
|
41 | + ->where('state.reviewed = '.Country::REVIEWED_OK); |
|
42 | 42 | $country = $request->get('country_id'); |
43 | 43 | if ($country) { |
44 | 44 | $query->join('LoginCidadaoCoreBundle:Country', 'cty', 'WITH', 'state.country = cty'); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $query = $this->getDoctrine()->getRepository('LoginCidadaoCoreBundle:City') |
60 | 60 | ->createQueryBuilder('c') |
61 | - ->where('c.reviewed = ' . Country::REVIEWED_OK); |
|
61 | + ->where('c.reviewed = '.Country::REVIEWED_OK); |
|
62 | 62 | $country = $request->get('country_id'); |
63 | 63 | $state = $request->get('state_id'); |
64 | 64 | if ($country || $state) { |
@@ -6,14 +6,11 @@ |
||
6 | 6 | use Symfony\Component\Form\AbstractType; |
7 | 7 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | 8 | use Symfony\Component\Translation\TranslatorInterface; |
9 | -use LoginCidadao\CoreBundle\Form\DataTransformer\StateToStringTransformer; |
|
10 | 9 | use LoginCidadao\CoreBundle\Entity\Country; |
11 | 10 | use Doctrine\ORM\EntityManager; |
12 | -use Doctrine\ORM\EntityRepository; |
|
13 | 11 | use Symfony\Component\Form\FormEvent; |
14 | 12 | use Symfony\Component\Form\FormEvents; |
15 | 13 | use LoginCidadao\CoreBundle\Entity\State; |
16 | -use LoginCidadao\CoreBundle\Entity\City; |
|
17 | 14 | use LoginCidadao\CoreBundle\Entity\PersonAddress; |
18 | 15 | use LoginCidadao\CoreBundle\Model\SelectData; |
19 | 16 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function buildForm(FormBuilderInterface $builder, array $options) |
30 | 30 | { |
31 | 31 | $builder->addEventListener(FormEvents::PRE_SET_DATA, |
32 | - function (FormEvent $event) { |
|
32 | + function(FormEvent $event) { |
|
33 | 33 | $form = $event->getForm()->getParent(); |
34 | 34 | $person = $form->getData(); |
35 | 35 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $form->add('city', new CitySelectorComboType($person->getState())); |
40 | 40 | }); |
41 | 41 | $builder->addEventListener(FormEvents::PRE_SUBMIT, |
42 | - function (FormEvent $event) { |
|
42 | + function(FormEvent $event) { |
|
43 | 43 | $data = $event->getData(); |
44 | 44 | $form = $event->getForm()->getParent(); |
45 | 45 |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace LoginCidadao\CoreBundle\Form\Type; |
4 | 4 | |
5 | 5 | use Symfony\Component\Form\FormBuilderInterface; |
6 | -use Doctrine\ORM\EntityRepository; |
|
7 | 6 | use Symfony\Component\Form\FormEvent; |
8 | 7 | use Symfony\Component\Form\FormEvents; |
9 | 8 | use LoginCidadao\CoreBundle\Form\Type\CommonFormType; |
@@ -152,9 +152,9 @@ |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | public static function filterRoles(PersonInterface $person, |
155 | - PersonInterface $loggedUser, |
|
156 | - FormInterface $form, array $roles, |
|
157 | - $securityHelper, $security) |
|
155 | + PersonInterface $loggedUser, |
|
156 | + FormInterface $form, array $roles, |
|
157 | + $securityHelper, $security) |
|
158 | 158 | { |
159 | 159 | $loggedUserLevel = $securityHelper->getLoggedInUserLevel(); |
160 | 160 | $targetPersonLevel = $securityHelper->getTargetPersonLevel($person); |
@@ -76,7 +76,7 @@ |
||
76 | 76 | $securityHelper = $this->securityHelper; |
77 | 77 | $security = $this->security; |
78 | 78 | $builder->addEventListener(FormEvents::PRE_SET_DATA, |
79 | - function (FormEvent $event) use ($user, &$allRoles, &$securityHelper, &$security) { |
|
79 | + function(FormEvent $event) use ($user, &$allRoles, &$securityHelper, &$security) { |
|
80 | 80 | $person = $event->getData(); |
81 | 81 | $form = PersonResumeFormType::populateCountryStateCity($person, |
82 | 82 | $event->getForm()); |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Symfony\Component\Form\FormEvent; |
8 | 8 | use Symfony\Component\Form\FormEvents; |
9 | 9 | use Symfony\Component\OptionsResolver\OptionsResolver; |
10 | -use Doctrine\ORM\EntityManager; |
|
11 | 10 | use Doctrine\ORM\EntityRepository; |
12 | 11 | use LoginCidadao\CoreBundle\Entity\State; |
13 | 12 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function buildForm(FormBuilderInterface $builder, array $options) |
30 | 30 | { |
31 | 31 | $builder->addEventListener(FormEvents::PRE_SET_DATA, |
32 | - function (FormEvent $event) { |
|
32 | + function(FormEvent $event) { |
|
33 | 33 | $form = $event->getForm()->getParent(); |
34 | 34 | $person = $form->getData(); |
35 | 35 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $form->add('city', new CitySelectorComboType($person->getState())); |
40 | 40 | }); |
41 | 41 | $builder->addEventListener(FormEvents::PRE_SUBMIT, |
42 | - function (FormEvent $event) { |
|
42 | + function(FormEvent $event) { |
|
43 | 43 | $data = $event->getData(); |
44 | 44 | $form = $event->getForm()->getParent(); |
45 | 45 |
@@ -5,12 +5,10 @@ |
||
5 | 5 | use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; |
6 | 6 | use Symfony\Component\HttpFoundation\Request; |
7 | 7 | use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler; |
8 | -use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; |
|
9 | 8 | use Symfony\Component\HttpFoundation\RedirectResponse; |
10 | 9 | use Symfony\Component\HttpFoundation\Session\Session; |
11 | 10 | use Symfony\Component\Routing\RouterInterface; |
12 | 11 | use Doctrine\ORM\EntityManager; |
13 | -use LoginCidadao\CoreBundle\Entity\Person; |
|
14 | 12 | use LoginCidadao\CoreBundle\Entity\AccessSession; |
15 | 13 | use Symfony\Component\Security\Http\HttpUtils; |
16 | 14 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
@@ -14,7 +14,6 @@ |
||
14 | 14 | use LoginCidadao\NotificationBundle\Entity\Notification; |
15 | 15 | use LoginCidadao\CoreBundle\Helper\GridHelper; |
16 | 16 | use LoginCidadao\NotificationBundle\Entity\Broadcast; |
17 | -use LoginCidadao\NotificationBundle\Handler\NotificationHandler; |
|
18 | 17 | |
19 | 18 | /** |
20 | 19 | * @Route("/dev/broadcasts") |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $em->persist($broadcast); |
113 | 113 | $em->flush(); |
114 | 114 | $url = $this->generateUrl('lc_dev_broadcast_settings', |
115 | - array('broadcastId' => $broadcast->getId())); |
|
115 | + array('broadcastId' => $broadcast->getId())); |
|
116 | 116 | return $this->redirect($url); |
117 | 117 | } |
118 | 118 | |
@@ -138,23 +138,23 @@ discard block |
||
138 | 138 | |
139 | 139 | $form->handleRequest($request); |
140 | 140 | if ($form->isValid()) { |
141 | - $placeholders = $form->get('placeholders')->getData(); |
|
142 | - $broadcast->setHtmlTemplate($placeholders, $form->get('title')->getData(), $form->get('shortText')->getData()); |
|
141 | + $placeholders = $form->get('placeholders')->getData(); |
|
142 | + $broadcast->setHtmlTemplate($placeholders, $form->get('title')->getData(), $form->get('shortText')->getData()); |
|
143 | 143 | |
144 | - $translator = $this->get('translator'); |
|
145 | - if ($form->get('saveAndAdd')->isClicked()) { |
|
144 | + $translator = $this->get('translator'); |
|
145 | + if ($form->get('saveAndAdd')->isClicked()) { |
|
146 | 146 | $this->sendBroadcast($broadcast, $form->get('shortText')->getData(), $form->get('title')->getData()); |
147 | 147 | $broadcast->setSent(true); |
148 | 148 | $this->get('session')->getFlashBag()->add('success', $translator->trans("Broadcast sent")); |
149 | - } else { |
|
149 | + } else { |
|
150 | 150 | $this->get('session')->getFlashBag()->add('success', $translator->trans("Broadcast saved")); |
151 | - } |
|
151 | + } |
|
152 | 152 | |
153 | - $em = $this->getDoctrine()->getManager(); |
|
154 | - $em->persist($broadcast); |
|
155 | - $em->flush(); |
|
153 | + $em = $this->getDoctrine()->getManager(); |
|
154 | + $em->persist($broadcast); |
|
155 | + $em->flush(); |
|
156 | 156 | |
157 | - return $this->redirect($this->generateUrl('lc_dev_broadcasts')); |
|
157 | + return $this->redirect($this->generateUrl('lc_dev_broadcasts')); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return array('form' => $form->createView()); |
@@ -165,18 +165,18 @@ discard block |
||
165 | 165 | $html = $broadcast->getHtmlTemplate(); |
166 | 166 | |
167 | 167 | foreach ($broadcast->getReceivers() as $person) { |
168 | - $notification = new Notification(); |
|
169 | - $notification->setIcon($broadcast->getCategory()->getDefaultIcon()); |
|
170 | - //$notification->setCallbackUrl("url"); |
|
171 | - $notification->setShortText($shortText); |
|
172 | - $notification->setTitle($title); |
|
173 | - $notification->setHtmlTemplate($html); |
|
174 | - $notification->setPerson($person); |
|
175 | - $notification->setSender($broadcast->getCategory()->getClient()); |
|
176 | - $notification->setCategory($broadcast->getCategory()); |
|
177 | - $notification->setMailTemplate($broadcast->getMailTemplate()); |
|
178 | - |
|
179 | - $helper->send($notification); |
|
168 | + $notification = new Notification(); |
|
169 | + $notification->setIcon($broadcast->getCategory()->getDefaultIcon()); |
|
170 | + //$notification->setCallbackUrl("url"); |
|
171 | + $notification->setShortText($shortText); |
|
172 | + $notification->setTitle($title); |
|
173 | + $notification->setHtmlTemplate($html); |
|
174 | + $notification->setPerson($person); |
|
175 | + $notification->setSender($broadcast->getCategory()->getClient()); |
|
176 | + $notification->setCategory($broadcast->getCategory()); |
|
177 | + $notification->setMailTemplate($broadcast->getMailTemplate()); |
|
178 | + |
|
179 | + $helper->send($notification); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | return array('grid' => $grid->createView($request)); |
33 | 33 | } |
34 | 34 | |
35 | - private function getBroadcastGrid(){ |
|
35 | + private function getBroadcastGrid() { |
|
36 | 36 | $em = $this->getDoctrine()->getManager(); |
37 | 37 | $sql = $em->getRepository('LoginCidadaoNotificationBundle:Broadcast')->createQueryBuilder('c') |
38 | 38 | ->where('c.person = :person') |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $sql = $em->getRepository('LoginCidadaoCoreBundle:Person')->getFindAuthorizedByClientIdQuery($parms['client_id']); |
200 | 200 | $sql->andWhere('p.cpf like ?1 or p.username like ?1 or p.email like ?1 or p.firstName like ?1 or p.surname like ?1'); |
201 | 201 | $sql->setParameter('1', |
202 | - '%' . addcslashes($parms['username'], '\\%_') . '%'); |
|
202 | + '%'.addcslashes($parms['username'], '\\%_').'%'); |
|
203 | 203 | $sql->addOrderBy('p.id', 'desc'); |
204 | 204 | $grid->setQueryBuilder($sql); |
205 | 205 | } |
@@ -2,10 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace LoginCidadao\NotificationBundle\Controller\JsAPI; |
4 | 4 | |
5 | -use FOS\RestBundle\Util\Codes; |
|
6 | 5 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; |
7 | -use Symfony\Component\HttpFoundation\Request; |
|
8 | -use FOS\RestBundle\Request\ParamFetcherInterface; |
|
9 | 6 | use FOS\RestBundle\Controller\Annotations as REST; |
10 | 7 | use FOS\RestBundle\Controller\FOSRestController; |
11 | 8 | use LoginCidadao\NotificationBundle\Handler\NotificationHandlerInterface; |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Doctrine\ORM\EntityRepository; |
6 | 6 | use LoginCidadao\CoreBundle\Entity\Person; |
7 | -use Doctrine\ORM\Query; |
|
8 | 7 | use LoginCidadao\CoreBundle\Model\PersonInterface; |
9 | 8 | use LoginCidadao\OAuthBundle\Model\ClientInterface; |
10 | 9 |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | { |
13 | 13 | |
14 | 14 | public function findNextNotifications(Person $person, $items = 8, |
15 | - $lastId = 0, |
|
16 | - ClientInterface $client = null) |
|
15 | + $lastId = 0, |
|
16 | + ClientInterface $client = null) |
|
17 | 17 | { |
18 | 18 | $qb = $this->getEntityManager()->createQueryBuilder() |
19 | 19 | ->select('n') |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | return $this->getEntityManager()->createQueryBuilder('n') |
76 | 76 | ->select('COUNT(n.id) total') |
77 | 77 | ->from('LoginCidadaoNotificationBundle:Notification', |
78 | - 'n') |
|
78 | + 'n') |
|
79 | 79 | ->where('n.person = :person') |
80 | 80 | ->andWhere('n.readDate IS NULL') |
81 | 81 | ->setParameter('person', $person) |
@@ -2,17 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace LoginCidadao\NotificationBundle\Handler; |
4 | 4 | |
5 | -use Doctrine\Common\Persistence\ObjectManager; |
|
6 | -use Symfony\Component\Form\FormFactoryInterface; |
|
7 | 5 | use LoginCidadao\NotificationBundle\Handler\NotificationHandlerInterface; |
8 | -use LoginCidadao\NotificationBundle\Form\NotificationType; |
|
9 | -use LoginCidadao\NotificationBundle\Model\NotificationInterface; |
|
10 | -use LoginCidadao\NotificationBundle\Exception\InvalidFormException; |
|
11 | 6 | use LoginCidadao\CoreBundle\Model\PersonInterface; |
12 | 7 | use LoginCidadao\OAuthBundle\Model\ClientInterface; |
13 | 8 | use LoginCidadao\NotificationBundle\Model\CategoryInterface; |
14 | -use LoginCidadao\NotificationBundle\Entity\PersonNotificationOption; |
|
15 | -use LoginCidadao\NotificationBundle\Model\NotificationSettings; |
|
16 | 9 | use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; |
17 | 10 | |
18 | 11 | class AuthenticatedNotificationHandler implements AuthenticatedNotificationHandlerInterface |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | public function getAllFromClient(ClientInterface $client, $limit = 5, |
48 | - $offset = 0, $orderby = null) |
|
48 | + $offset = 0, $orderby = null) |
|
49 | 49 | { |
50 | 50 | return $this->handler->getAllFromPersonByClient($this->person, $client, |
51 | 51 | $limit, $offset, |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | public function getGroupedSettings(ClientInterface $client = null, |
81 | - CategoryInterface $category = null) |
|
81 | + CategoryInterface $category = null) |
|
82 | 82 | { |
83 | 83 | return $this->handler->getGroupedSettings($this->person, $client, |
84 | - $category); |
|
84 | + $category); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public function countUnread() |