/**
  * @DI\Observe("badge-resource-icap_wiki-section_create-generate_validation_link")
  * @DI\Observe("badge-resource-icap_wiki-section_delete-generate_validation_link")
  * @DI\Observe("badge-resource-icap_wiki-section_move-generate_validation_link")
  * @DI\Observe("badge-resource-icap_wiki-section_remove-generate_validation_link")
  * @DI\Observe("badge-resource-icap_wiki-section_restore-generate_validation_link")
  * @DI\Observe("badge-resource-icap_wiki-section_update-generate_validation_link")
  * @DI\Observe("badge-resource-icap_wiki-contribution_create-generate_validation_link")
  */
 public function onBagdeCreateValidationLink($event)
 {
     $content = null;
     $log = $event->getLog();
     switch ($log->getAction()) {
         case LogSectionCreateEvent::ACTION:
         case LogSectionDeleteEvent::ACTION:
         case LogSectionMoveEvent::ACTION:
         case LogSectionRemoveEvent::ACTION:
         case LogSectionRestoreEvent::ACTION:
         case LogSectionUpdateEvent::ACTION:
             $logDetails = $event->getLog()->getDetails();
             $parameters = array('wikiId' => $logDetails['section']['wiki']);
             $sectionAnchor = sprintf('#section-%s', $logDetails['section']['id']);
             $url = $this->router->generate('icap_wiki_view', $parameters, UrlGeneratorInterface::ABSOLUTE_PATH);
             $title = $logDetails['section']['title'];
             $content = sprintf('<a href="%s%s" title="%s">%s</a>', $url, $sectionAnchor, $title, $title);
             break;
         case LogContributionCreateEvent::ACTION:
             $logDetails = $event->getLog()->getDetails();
             $parameters = array('wikiId' => $logDetails['contribution']['wiki']);
             $sectionAnchor = sprintf('#section-%s', $logDetails['contribution']['section']);
             $url = $this->router->generate('icap_wiki_view', $parameters, UrlGeneratorInterface::ABSOLUTE_PATH);
             $title = $logDetails['contribution']['title'];
             $content = sprintf('<a href="%s%s" title="%s">%s</a>', $url, $sectionAnchor, $title, $title);
             break;
     }
     $event->setContent($content);
     $event->stopPropagation();
 }
 /**
  * @return string
  */
 public function generateLinkChangePassword()
 {
     if (null === $this->webHomeAuthUrl) {
         return $this->router->generate('app_home_change_password');
     }
     return $this->webHomeAuthUrl . '/change-password';
 }
 /**
  * Constructor
  * Initialize some default items.
  *
  * @param Router $router
  */
 public function __construct(Router $router)
 {
     $this->items = array();
     $this->lastPosition = 0;
     $this->separatorCount = 0;
     $this->add('base.user.menu.admin')->setIcon('gear.png')->setUrl($router->generate('orga_admin'))->end()->add('base.user.menu.members')->setIcon('users.png')->setUrl($router->generate('orga_admin_members'))->end()->add('base.user.menu.logout')->setIcon('control-power.png')->setUrl($router->generate('user_disconnect'))->end()->addSeparator()->add('base.user.menu.help')->setIcon('question.png')->setUrl('')->end();
 }
 /**
  * @depends testPut
  */
 public function testDeleteMultiple()
 {
     $data = [2, 3];
     $uri = self::$router->generate('post_assets') . '.json';
     self::$client->request('DELETE', $uri, ['images' => json_encode($data)]);
     $this->assertTrue(self::$client->getResponse()->isRedirect());
 }
Beispiel #5
0
 /**
  * @throws \LogicException
  *
  * @param mixed $data
  *
  * @return string
  */
 public function getLinkForFill($data)
 {
     if (!$this->router instanceof Router) {
         throw new \LogicException('Link cannot be built without a Router');
     }
     return $this->router->generate('fill_filler', ['plugin' => $this->getName(), $this->getForm()->getName() => ['url' => $data]]);
 }
 /**
  * @param array $material
  * @return UserMaterial[]
  */
 public function create(array $material)
 {
     if (array_key_exists('filename', $material) && !empty($material['filename'])) {
         $absoluteFileUri = $this->router->generate('ilios_core_downloadlearningmaterial', ['token' => $material['token']], UrlGenerator::ABSOLUTE_URL);
     }
     /* @var UserMaterial $obj */
     $obj = new $this->decoratorClassName();
     $obj->id = $material['id'];
     $obj->session = isset($material['sessionId']) ? $material['sessionId'] : null;
     $obj->course = isset($material['courseId']) ? $material['courseId'] : null;
     $obj->sessionTitle = isset($material['sessionTitle']) ? $material['sessionTitle'] : null;
     $obj->courseTitle = isset($material['courseTitle']) ? $material['courseTitle'] : null;
     $obj->firstOfferingDate = isset($material['firstOfferingDate']) ? $material['firstOfferingDate'] : null;
     if ($material['publicNotes']) {
         $obj->publicNotes = $material['notes'];
     }
     $obj->required = $material['required'];
     $obj->title = $material['title'];
     $obj->description = $material['description'];
     $obj->originalAuthor = $material['originalAuthor'];
     $obj->absoluteFileUri = isset($absoluteFileUri) ? $absoluteFileUri : null;
     $obj->citation = $material['citation'];
     $obj->link = $material['link'];
     $obj->filename = $material['filename'];
     $obj->mimetype = $material['mimetype'];
     return $obj;
 }
 /**
  * @return string
  */
 public function getPortalLink()
 {
     $origContext = $this->updateRequestContext();
     $url = $this->router->generate('diamante_front', [], Router::ABSOLUTE_URL);
     $this->router->setContext($origContext);
     return $url;
 }
 /**
  * Constructor
  * Initialize some default items.
  *
  * @param Router $router
  */
 public function __construct(Router $router)
 {
     $this->items = array();
     $this->lastPosition = 0;
     $this->separatorCount = 0;
     $this->add('base.user.menu.flux')->setIcon('edit-list.png')->setUrl($router->generate('homepage'))->end()->add('base.user.menu.account')->setIcon('user.png')->setUrl($router->generate('user_profile'))->end()->add('base.user.menu.table')->setIcon('table.png')->setUrl($router->generate('user_schedule'))->end()->add('base.user.menu.orgas')->setIcon('bank.png')->setUrl($router->generate('memberships_index'))->end()->add('base.user.menu.logout')->setIcon('control-power.png')->setUrl($router->generate('user_disconnect'))->end();
 }
 /**
  * @DI\Observe("badge-resource-icap_dropzone-correction_delete-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-correction_end-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-correction_start-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-correction_update-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-correction_validation_change-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-criterion_create-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-criterion_delete-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-criterion_update-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-document_create-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-document_delete-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-document_open-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-drop_end-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-drop_evaluate-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-drop_start-generate_validation_link")
  * @DI\Observe("badge-resource-icap_dropzone-dropzone_configure-generate_validation_link")
  */
 public function onBagdeCreateValidationLink($event)
 {
     $content = null;
     $log = $event->getLog();
     switch ($log->getAction()) {
         case LogCorrectionDeleteEvent::ACTION:
         case LogCorrectionEndEvent::ACTION:
         case LogCorrectionStartEvent::ACTION:
         case LogCorrectionUpdateEvent::ACTION:
         case LogCorrectionValidationChangeEvent::ACTION:
         case LogCriterionCreateEvent::ACTION:
         case LogCriterionDeleteEvent::ACTION:
         case LogCriterionUpdateEvent::ACTION:
         case LogDocumentCreateEvent::ACTION:
         case LogDocumentDeleteEvent::ACTION:
         case LogDocumentOpenEvent::ACTION:
         case LogDropEndEvent::ACTION:
         case LogDropEvaluateEvent::ACTION:
         case LogDropStartEvent::ACTION:
         case LogDropzoneConfigureEvent::ACTION:
             $logDetails = $event->getLog()->getDetails();
             $parameters = array('resourceId' => $logDetails['dropzone']['id']);
             $url = $this->router->generate('icap_dropzone_open', $parameters, UrlGeneratorInterface::ABSOLUTE_PATH);
             /** @var Dropzone $dropzone */
             $dropzone = $this->entityManager->getRepository('IcapDropzoneBundle:Dropzone')->findOneById($logDetails['dropzone']['id']);
             $title = $dropzone->getResourceNode()->getName();
             $content = sprintf('<a href="%s" title="%s">%s</a>', $url, $title, $title);
             break;
     }
     $event->setContent($content);
     $event->stopPropagation();
 }
Beispiel #10
0
 private function generateTabsView($fieldTranslations, $field, $isKeywords = false)
 {
     $template = '<ul id="tabs" class="nav nav-tabs" data-tabs="tabs">';
     $i = 0;
     foreach ($fieldTranslations as $langCode => $translationValue) {
         if ($i == 0) {
             $template .= '<li class="active"><a href="#' . $field . '-' . $langCode . '" data-toggle="tab">' . $langCode . '</a></li>';
         } else {
             $template .= '<li><a href="#' . $field . '-' . $langCode . '" data-toggle="tab">' . $langCode . '</a></li>';
         }
         $i++;
     }
     $template .= '</ul><div id="my-tab-content" class="tab-content">';
     $t = 0;
     foreach ($fieldTranslations as $langCode => $translationValue) {
         $activeString = $t == 0 ? 'active' : '';
         $template .= '<div class="tab-pane ' . $activeString . '" id="' . $field . '-' . $langCode . '">';
         if ($isKeywords) {
             $explodeValue = explode(',', $translationValue);
             $i = 0;
             foreach ($explodeValue as $explodeItem) {
                 $commaSign = $i != 0 ? ',' : '';
                 $template .= $commaSign . '<a href="' . $this->router->generate('ojs_search_index', ['q' => $explodeItem]) . '" target="_blank">' . $explodeItem . '</a>';
                 $i++;
             }
         } else {
             $template .= $translationValue;
         }
         $template .= '</div>';
         $t++;
     }
     $template .= '</div>';
     return $template;
 }
 /**
  * add a rel=self Link header to the response
  *
  * @param FilterResponseEvent $event response listener event
  *
  * @return void
  */
 public function onKernelResponse(FilterResponseEvent $event)
 {
     if (!$event->isMasterRequest()) {
         // don't do anything if it's not the master request
         return;
     }
     $response = $event->getResponse();
     $request = $event->getRequest();
     $linkHeader = LinkHeader::fromResponse($response);
     // extract various info from route
     $routeName = $request->get('_route');
     $routeParts = explode('.', $routeName);
     $routeType = end($routeParts);
     if ($routeType == 'post') {
         $routeName = substr($routeName, 0, -4) . 'get';
     }
     /** if the request failed in the RestController, $request will not have an record id in
         case of a POST and $router->generate() will fail. that's why we catch it and fail silently
         by not including our header in the response. i hope that's a good compromise. **/
     /** Nope, it's not a good compromise...catch and handle it where it happens.
      *  I will refactory this in another branch*/
     $addHeader = true;
     $url = '';
     try {
         $url = $this->router->generate($routeName, $this->generateParameters($routeType, $request), true);
     } catch (\Exception $e) {
         $addHeader = false;
     }
     if ($addHeader) {
         // append rel=self link to link headers
         $linkHeader->add(new LinkHeaderItem($url, array('rel' => 'self')));
         // overwrite link headers with new headers
         $response->headers->set('Link', (string) $linkHeader);
     }
 }
Beispiel #12
0
 /**
  * get php value when field is used as identifier
  *
  * @param \MongoDBRef $value ref from mongodb
  *
  * @return string
  */
 public function convertToPHPValue($value)
 {
     if (!array_key_exists('$ref', $value) && !array_key_exists($value['$ref'], $this->mapping) && !array_key_exists('$id', $value)) {
         return '';
     }
     return $this->router->generate($this->mapping[$value['$ref']], ['id' => $value['$id']]);
 }
 /**
  * @DI\Observe("badge-resource-icap_blog-post_create-generate_validation_link")
  * @DI\Observe("badge-resource-icap_blog-post_delete-generate_validation_link")
  * @DI\Observe("badge-resource-icap_blog-post_read-generate_validation_link")
  * @DI\Observe("badge-resource-icap_blog-post_update-generate_validation_link")
  * @DI\Observe("badge-resource-icap_blog-comment_create-generate_validation_link")
  * @DI\Observe("badge-resource-icap_blog-comment_delete-generate_validation_link")
  */
 public function onBagdeCreateValidationLink($event)
 {
     $content = null;
     $log = $event->getLog();
     switch ($log->getAction()) {
         case LogPostCreateEvent::ACTION:
         case LogPostDeleteEvent::ACTION:
         case LogPostReadEvent::ACTION:
         case LogPostUpdateEvent::ACTION:
             $logDetails = $event->getLog()->getDetails();
             $parameters = array('blogId' => $logDetails['post']['blog'], 'postSlug' => $logDetails['post']['slug']);
             $url = $this->router->generate('icap_blog_post_view', $parameters, UrlGeneratorInterface::ABSOLUTE_PATH);
             $title = $logDetails['post']['title'];
             $content = sprintf('<a href="%s" title="%s">%s</a>', $url, $title, $title);
             break;
         case LogCommentCreateEvent::ACTION:
         case LogCommentDeleteEvent::ACTION:
             $logDetails = $event->getLog()->getDetails();
             $parameters = array('blogId' => $logDetails['post']['blog'], 'postSlug' => $logDetails['post']['slug']);
             $url = $this->router->generate('icap_blog_post_view', $parameters, UrlGeneratorInterface::ABSOLUTE_PATH);
             $title = $logDetails['post']['title'];
             $anchor = isset($logDetails['comment']['id']) ? '#comment-' . $logDetails['comment']['id'] : '';
             $content = sprintf('<a href="%s%s" title="%s">%s</a>', $url, $anchor, $title, $title);
             break;
     }
     $event->setContent($content);
     $event->stopPropagation();
 }
 /**
  * @return array
  * @throw InvalidConfigurationException
  */
 public function getRoleConfig()
 {
     $prefix = "vss_oauth_extension.auth.role";
     if (!$this->container->getParameter("{$prefix}.client_id")) {
         throw new InvalidConfigurationException("No {$prefix} node configured.");
     }
     return ['client_id' => $this->container->getParameter("{$prefix}.client_id"), 'client_secret' => $this->container->getParameter("{$prefix}.client_secret"), 'endpoint' => $this->container->getParameter("{$prefix}.endpoint"), 'logout_path' => $this->router->generate($this->container->getParameter("{$prefix}.logout_path"))];
 }
 /**
  * @param Request $request
  * @param TokenInterface $token
  * @return RedirectResponse
  */
 public function onAuthenticationSuccess(Request $request, TokenInterface $token)
 {
     if ($this->security->isGranted('ROLE_ADMIN')) {
         return new RedirectResponse($this->router->generate('admin_index'));
     } else {
         return new RedirectResponse($this->router->generate('blog_index'));
     }
 }
 public function testIndexThereIsRequiredStepsAction()
 {
     $this->authenticateUser('ria', array('ROLE_RIA', 'ROLE_RIA_BASE', 'ROLE_ADMIN'));
     $crawler = $this->client->request('GET', $this->router->generate('rx_ria_dashboard'));
     $this->assertEquals(200, $this->client->getResponse()->getStatusCode(), 'Dashboard is available to see');
     $this->assertEquals(1, $crawler->filter('html:contains("You must complete the following steps before wealthbot.io will be ready to use")')->count(), 'Dashboard have notification area');
     $this->assertEquals(1, $crawler->filter('html:contains("Create billing specs")')->count(), 'There is a billing information in notication area');
 }
Beispiel #17
0
 /**
  * @param BadgeUnlockEvent $event
  */
 public function onUnlockBadge(BadgeUnlockEvent $event)
 {
     $unlockedBadge = $event->getUnlockedBadge();
     $user = $unlockedBadge->getUser();
     $badge = $unlockedBadge->getBadge();
     $data = ['text' => sprintf('<%s|%s> just unlocked the badge <%s|%s>!', $this->router->generate('userprofile', ['username' => $user->getUsername()], UrlGeneratorInterface::ABSOLUTE_URL), $user->getUsername(), $this->router->generate('viewbadge', ['id' => $badge->getId()], UrlGeneratorInterface::ABSOLUTE_URL), $badge->getTitle()), 'attachments' => [['color' => 'good', 'title' => $badge->getTitle(), 'text' => $badge->getDescription(), 'thumb_url' => $this->router->generate('homepage', [], UrlGeneratorInterface::ABSOLUTE_URL) . $badge->getImageWebPath()]]];
     $this->notifier->notify($data);
 }
Beispiel #18
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber());
     $builder->addEventSubscriber(new FormExitSubscriber('api.client', $options));
     if (!$options['data']->getId()) {
         $builder->add('api_mode', 'choice', array('mapped' => false, 'label' => 'mautic.api.client.form.auth_protocol', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'onchange' => 'Mautic.refreshApiClientForm(\'' . $this->router->generate('mautic_client_action', array('objectAction' => 'new')) . '\', this)'), 'choices' => array('oauth1a' => 'OAuth 1.0a', 'oauth2' => 'OAuth 2'), 'required' => false, 'empty_value' => false, 'data' => $this->apiMode));
     }
     $builder->add('name', 'text', array('label' => 'mautic.core.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     if ($this->apiMode == 'oauth2') {
         $arrayStringTransformer = new Transformers\ArrayStringTransformer();
         $builder->add($builder->create('redirectUris', 'text', array('label' => 'mautic.api.client.redirecturis', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.api.client.form.help.requesturis')))->addViewTransformer($arrayStringTransformer));
         $builder->add('publicId', 'text', array('label' => 'mautic.api.client.form.clientid', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'disabled' => true, 'required' => false, 'mapped' => false, 'data' => $options['data']->getPublicId()));
         $builder->add('secret', 'text', array('label' => 'mautic.api.client.form.clientsecret', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'disabled' => true, 'required' => false));
         $translator = $this->translator;
         $validator = $this->validator;
         $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use($translator, $validator) {
             $form = $event->getForm();
             $data = $event->getData();
             if ($form->has('redirectUris')) {
                 foreach ($data->getRedirectUris() as $uri) {
                     $urlConstraint = new OAuthCallback();
                     $urlConstraint->message = $translator->trans('mautic.api.client.redirecturl.invalid', array('%url%' => $uri), 'validators');
                     $errors = $validator->validateValue($uri, $urlConstraint);
                     if (!empty($errors)) {
                         foreach ($errors as $error) {
                             $form['redirectUris']->addError(new FormError($error->getMessage()));
                         }
                     }
                 }
             }
         });
     } else {
         $builder->add($builder->create('callback', 'text', array('label' => 'mautic.api.client.form.callback', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.api.client.form.help.callback'), 'required' => false))->addModelTransformer(new Transformers\NullToEmptyTransformer()));
         $builder->add('consumerKey', 'text', array('label' => 'mautic.api.client.form.consumerkey', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'onclick' => 'this.setSelectionRange(0, this.value.length);'), 'read_only' => true, 'required' => false, 'mapped' => false, 'data' => $options['data']->getConsumerKey()));
         $builder->add('consumerSecret', 'text', array('label' => 'mautic.api.client.form.consumersecret', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'onclick' => 'this.setSelectionRange(0, this.value.length);'), 'read_only' => true, 'required' => false));
         $translator = $this->translator;
         $validator = $this->validator;
         $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use($translator, $validator) {
             $form = $event->getForm();
             $data = $event->getData();
             if ($form->has('callback')) {
                 $uri = $data->getCallback();
                 $urlConstraint = new OAuthCallback();
                 $urlConstraint->message = $translator->trans('mautic.api.client.redirecturl.invalid', array('%url%' => $uri), 'validators');
                 $errors = $validator->validateValue($uri, $urlConstraint);
                 if (!empty($errors)) {
                     foreach ($errors as $error) {
                         $form['callback']->addError(new FormError($error->getMessage()));
                     }
                 }
             }
         });
     }
     $builder->add('buttons', 'form_buttons');
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
 private function handleForm(Request $request, Form $form, $id, $command)
 {
     $form->submit($request);
     if ($form->isValid()) {
         $this->handleCommand($command);
         return $this->redirectView($this->router->generate('get_game', array('id' => $id)), Codes::HTTP_CREATED);
     }
     return $form;
 }
 public function renderMenuLanguages()
 {
     $languages = $this->getDoctrine()->getRepository('BaconLanguageBundle:Language')->findAll();
     $htmlReturn = '';
     foreach ($languages as $lang) {
         $htmlReturn .= '<li><a href="' . $this->router->generate('locale_change', ['current' => $this->request->getCurrentRequest()->getLocale(), 'locale' => $lang->getAcron()]) . '"><span class="flag-icon flag-icon-' . $this->getAcronByLocale($lang->getLocale()) . '"></span>&nbsp;&nbsp;&nbsp;' . $lang->getName() . '</a></li>';
     }
     return $htmlReturn;
 }
 /**
  * @param string $key
  * @param bool   $isOroUser
  *
  * @return string
  */
 public function renderUrl($key, $isOroUser)
 {
     $route = 'diamante_ticket_view';
     $url = $this->router->generate($route, ['key' => $key], Router::ABSOLUTE_URL);
     if (!$isOroUser) {
         $url = str_replace('desk/tickets/view', 'diamantefront/#tickets', $url);
     }
     return $url;
 }
 /**
  * Initialise the PaymentOrder Model to be posted to IRIS
  */
 protected function generatePaymentOrder()
 {
     // Set the necessary data to POST to the endpoint
     // TODO: the payment types are currently hardcoded, but aren't likely to change in the near future. This will eventually need refactoring.
     $this->paymentOrder->setPaymentTypes(array(1));
     // Success: redirect to the view page of the new case
     $this->paymentOrder->setRedirectOnSuccessUrl($this->router->generate('barbon_hostedapi_landlord_reference_newreference_success_index', array(), true));
     // Failure: redirect to generic failed payment page
     $this->paymentOrder->setRedirectOnFailureUrl($this->router->generate('barbon_hostedapi_landlord_reference_newreference_failure_index', array(), true));
 }
Beispiel #23
0
 public function testGenerateWithServiceParam()
 {
     $routes = new RouteCollection();
     $routes->add('foo', new Route(' /{_locale}', array('_locale' => '%locale%'), array('_locale' => 'en|es')));
     $sc = $this->getServiceContainer($routes);
     $sc->setParameter('locale', 'es');
     $router = new Router($sc, 'foo');
     $this->assertSame('/en', $router->generate('foo', array('_locale' => 'en')));
     $this->assertSame('/', $router->generate('foo', array('_locale' => 'es')));
 }
 /**
  * @param Email $email
  *
  * @return bool|string
  */
 protected function getFromNameLink(Email $email)
 {
     $path = false;
     if ($email->getFromEmailAddress() && $email->getFromEmailAddress()->getOwner()) {
         $className = $email->getFromEmailAddress()->getOwner()->getClass();
         $routeName = $this->configManager->getEntityMetadata($className)->getRoute('view', false);
         $path = $this->router->generate($routeName, ['id' => $email->getFromEmailAddress()->getOwner()->getId()]);
     }
     return $path;
 }
 /**
  * @Route()
  * @Method("GET")
  *
  * @param Todo $todo
  * @return RedirectResponse
  */
 public function indexAction(Todo $todo)
 {
     try {
         $this->completeTodo->run($todo);
         $this->notification->info('タスクを完了にしました');
     } catch (\InvalidArgumentException $e) {
         $this->notification->danger('完了処理に失敗しました');
     }
     return new RedirectResponse($this->router->generate('app_todo_default_index'));
 }
Beispiel #26
0
 protected function generateDistantUrl($routeName, $parameters = [])
 {
     $url = $this->router->generate($routeName, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH);
     //if (strpos($url, '/app_dev.php') === 0) {
     //    $url = '/app.php' . substr($url, 12);
     //}
     $url = 'http://' . $this->router->getRouteCollection()->get($routeName)->getDefault('_http_host') . $url;
     // TODO: manage SSL mode (HTTP/HTTPS), host by host
     return $url;
 }
Beispiel #27
0
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $view->vars['remote_path'] = $this->router->generate($options['remote_route'], $options['remote_params']);
     $varNames = array('minimum_input_length', 'placeholder');
     foreach ($varNames as $varName) {
         $view->vars[$varName] = $options[$varName];
     }
     $view->vars['full_name'] .= '[]';
 }
 public function testUpdateAction()
 {
     $billingSpec = $this->getLastBilling();
     $this->assertNotEquals('Test name', $billingSpec->getName());
     $this->authenticateUser('ria', array('ROLE_RIA', 'ROLE_RIA_BASE', 'ROLE_ADMIN'));
     $crawler = $this->client->request('POST', $this->router->generate('rx_ria_api_billing_specs_rest'), array('billing_spec' => array('minimalFee' => '100', 'name' => 'Test name', 'type' => BillingSpec::TYPE_TIER, 'fees' => array(0 => array('fee_without_retirement' => 23)))));
     $billingSpec = $this->getLastBilling();
     $this->assertEquals('Test name', $billingSpec->getName());
     $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
 }
 protected function url(MenuItem $item, $type)
 {
     $route = $item->getRoute()->getRoute();
     $parameters = [];
     /** @var MenuItemParameter $parameter */
     foreach ($item->getParameters() as $parameter) {
         $key = $parameter->getParameter()->getParameter();
         $parameters[$key] = $this->getValue($parameter);
     }
     return $this->router->generate($route, $parameters, $type);
 }
Beispiel #30
0
 /**
  *
  * {@inheritdoc}
  *
  */
 public function getParameters(View $view, FormFactoryInterface $formFactoty, Request $request)
 {
     $criteriaUpdateConfig = new CriteriaUpdateConfig($view, $request->getSession());
     $form = $formFactoty->create(CriteriaFilterType::class, $criteriaUpdateConfig, ['view' => $view, 'method' => 'GET', 'action' => $this->router->generate('views.criteria.table', ['view' => $view->getId()])]);
     $form->handleRequest($request);
     $categoryField = false;
     if ($view->getContentType()->getCategoryField()) {
         $categoryField = $view->getContentType()->getFieldType()->__get('ems_' . $view->getContentType()->getCategoryField());
     }
     return ['criteriaField' => $view->getOptions()['criteriaField'], 'categoryField' => $categoryField, 'view' => $view, 'contentType' => $view->getContentType(), 'environment' => $view->getContentType()->getEnvironment(), 'criterionList' => $view->getContentType()->getFieldType()->__get('ems_' . $view->getOptions()['criteriaField']), 'form' => $form->createView()];
 }