@@ -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 | |
@@ -8,10 +8,7 @@ |
||
| 8 | 8 | use LoginCidadao\CoreBundle\Entity\Country; |
| 9 | 9 | use LoginCidadao\CoreBundle\Entity\State; |
| 10 | 10 | use LoginCidadao\CoreBundle\Entity\City; |
| 11 | -use Symfony\Component\Form\FormEvent; |
|
| 12 | -use Symfony\Component\Form\FormEvents; |
|
| 13 | 11 | use Doctrine\ORM\EntityManager; |
| 14 | -use LoginCidadao\CoreBundle\Model\PersonInterface; |
|
| 15 | 12 | |
| 16 | 13 | class ProfileFormType extends BaseType |
| 17 | 14 | { |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | * is called by authentication listeners inheriting from AbstractAuthenticationListener. |
| 57 | 57 | * @param Request $request |
| 58 | 58 | * @param TokenInterface $token |
| 59 | - * @return Response The response to return |
|
| 59 | + * @return RedirectResponse The response to return |
|
| 60 | 60 | */ |
| 61 | 61 | function onAuthenticationSuccess(Request $request, TokenInterface $token) |
| 62 | 62 | { |
@@ -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; |
@@ -62,12 +62,18 @@ discard block |
||
| 62 | 62 | return $this; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | + /** |
|
| 66 | + * @param integer $var |
|
| 67 | + */ |
|
| 65 | 68 | public function setPerPage($var) |
| 66 | 69 | { |
| 67 | 70 | $this->perPage = $var; |
| 68 | 71 | return $this; |
| 69 | 72 | } |
| 70 | 73 | |
| 74 | + /** |
|
| 75 | + * @param integer $var |
|
| 76 | + */ |
|
| 71 | 77 | public function setMaxResult($var) |
| 72 | 78 | { |
| 73 | 79 | $this->maxResult = $var; |
@@ -76,7 +82,6 @@ discard block |
||
| 76 | 82 | |
| 77 | 83 | /** |
| 78 | 84 | * @deprecated since version 1.1.0 |
| 79 | - * @param QueryBuilder $var |
|
| 80 | 85 | * @return GridHelper |
| 81 | 86 | */ |
| 82 | 87 | public function setQueryBuilder(QueryBuilder &$queryBuilder) |
@@ -177,6 +182,9 @@ discard block |
||
| 177 | 182 | return $this->infiniteGrid; |
| 178 | 183 | } |
| 179 | 184 | |
| 185 | + /** |
|
| 186 | + * @param string $var |
|
| 187 | + */ |
|
| 180 | 188 | public function setId($var) |
| 181 | 189 | { |
| 182 | 190 | $this->id = $var; |
@@ -188,12 +196,18 @@ discard block |
||
| 188 | 196 | return $this->id; |
| 189 | 197 | } |
| 190 | 198 | |
| 199 | + /** |
|
| 200 | + * @param string $var |
|
| 201 | + */ |
|
| 191 | 202 | public function setRoute($var) |
| 192 | 203 | { |
| 193 | 204 | $this->route = $var; |
| 194 | 205 | return $this; |
| 195 | 206 | } |
| 196 | 207 | |
| 208 | + /** |
|
| 209 | + * @param string[] $var |
|
| 210 | + */ |
|
| 197 | 211 | public function setRouteParams($var) |
| 198 | 212 | { |
| 199 | 213 | $this->routeParams = $var; |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | * @param QueryBuilder $var |
| 80 | 80 | * @return GridHelper |
| 81 | 81 | */ |
| 82 | - public function setQueryBuilder(QueryBuilder &$queryBuilder) |
|
| 82 | + public function setQueryBuilder(QueryBuilder & $queryBuilder) |
|
| 83 | 83 | { |
| 84 | 84 | $this->queryBuilder = $queryBuilder; |
| 85 | 85 | // create QueryBuilderIterator for legacy code |
@@ -210,6 +210,9 @@ |
||
| 210 | 210 | return $this->loadUserByUsername($user->getFacebookId()); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | + /** |
|
| 214 | + * @param string $username |
|
| 215 | + */ |
|
| 213 | 216 | private function prepareFacebookUsername($username, $fbdata) |
| 214 | 217 | { |
| 215 | 218 | $defaultUsername = $username.'@facebook.com'; |
@@ -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; |
@@ -169,6 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | 171 | * Set defaultTitle |
| 172 | + * @param string $defaultTitle |
|
| 172 | 173 | */ |
| 173 | 174 | public function setDefaultTitle($defaultTitle) |
| 174 | 175 | { |
@@ -393,13 +394,16 @@ discard block |
||
| 393 | 394 | } |
| 394 | 395 | |
| 395 | 396 | /** |
| 396 | - * @return ClientInterface |
|
| 397 | + * @return string |
|
| 397 | 398 | */ |
| 398 | 399 | public function getClient() |
| 399 | 400 | { |
| 400 | 401 | return $this->client; |
| 401 | 402 | } |
| 402 | 403 | |
| 404 | + /** |
|
| 405 | + * @param Client $client |
|
| 406 | + */ |
|
| 403 | 407 | public function setClient($client) |
| 404 | 408 | { |
| 405 | 409 | $this->client = $client; |
@@ -436,8 +440,8 @@ discard block |
||
| 436 | 440 | |
| 437 | 441 | /** |
| 438 | 442 | * Sets the Unique Id of the Entity. |
| 439 | - * @param string $id the entity UID |
|
| 440 | - * @return AbstractUniqueEntity |
|
| 443 | + * @param string $uid the entity UID |
|
| 444 | + * @return Category |
|
| 441 | 445 | */ |
| 442 | 446 | public function setUid($uid = null) |
| 443 | 447 | { |
@@ -145,7 +145,7 @@ |
||
| 145 | 145 | /** |
| 146 | 146 | * Get responseCode |
| 147 | 147 | * |
| 148 | - * @return string |
|
| 148 | + * @return integer |
|
| 149 | 149 | */ |
| 150 | 150 | public function getResponseCode() |
| 151 | 151 | { |