show

@author Tom Haskins-Vaughan <tom@harvestcloud.com>
@since  2013-09-27

@Route("/{slug}")
@ParamConverter("profile", class="HarvestCloudCoreBundle:Profile")

@param  Profile $profile
@param  Request $request
162967
public function showAction(Profile $profile, Request $request)
    {
        if ('jpg' == $request->getRequestFormat())
        {
            $image = new \Imagick($profile->getProfilePicture()->getUploadPath());
            $image->cropThumbnailImage(150, 150);

            $response = new Response($image, 200);
            $response->headers->set('Content-Type', $profile->getProfilePicture()->getMimeType());

            return $response;
        }

        $q  = $this->get('doctrine')
            ->getManager()
            ->createQuery('
                SELECT p
                FROM   HarvestCloudCoreBundle:Product p
                WHERE  p.seller = :seller
            ')
            ->setParameter('seller', $profile)
        ;

        $products = $q->getResult();

        return $this->render('HarvestCloudCoreBundle:Profile/Default:show.html.twig', array(
          'profile'  => $profile,
          'products' => $products,
        ));
    }
1245478
public function currentAction()
    {
        $user    = $this->getUser();
        $profile = $this->getRepo('Profile')->findCurrentWithLocation($user->getId());

        return $this->render('HarvestCloudMarketPlaceBuyerBundle:Profile:current.html.twig', array(
          'profile' => $profile,
        ));
    }
626947
public function indexAction(Profile $profile, $week)
    {
        $startDate = DateTime::getForStartOfWeek();
        $endDate   = DateTime::getForEndOfWeek();

        if ('next-week' == $week)
        {
            $startDate->add(new \DateInterval('P7D'));
            $endDate->add(new \DateInterval('P7D'));
        }

        $weekView = $this->getRepo('HubWindow')
            ->getWeekViewForHub($profile, $startDate, $endDate);

        return $this->render('HarvestCloudCoreBundle:Hub/Window:index.html.twig', array(
            'weekView'  => $weekView,
            'profile'   => $profile,
            'startDate' => $startDate,
            'endDate'   => $endDate,
        ));
    }
1151819
public function show(Request $request, $contentId)
    {
        $contentFolder = $this->content->findById($contentId);

        if (! $contentFolder) {
            return $this->handleError(trans('soda::errors.not-found', ['object' => trans('soda::terminology.content')]));
        } elseif (! $contentFolder->is_folder) {
            return redirect()->route('soda.content.edit', $contentFolder->getKey())->withInput();
        }

        $content = $this->content->listFolder($request, $contentFolder);

        if (! $request->has('search')) {
            $contentTypes = $this->content->getCreatableContentTypes($contentFolder->id);
            $shortcuts = $this->content->getShortcuts($contentFolder);
            $isMovable = $content->where('is_movable', true)->count() ? true : false;

            if ($contentFolder->real_depth > 0) {
                $this->buildBreadcrumbTree($contentFolder);
                app('soda.interface')->setHeading($contentFolder->name);
            }
        } else {
            $this->buildBreadcrumbTree($contentFolder, true);
            app('soda.interface')->setHeading('Search');
        }

        return soda_cms_view('data.content.index', compact('contentFolder', 'content', 'contentTypes', 'shortcuts', 'isMovable'));
    }
987930
public function listAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, ContentTypeInterface::ENTITY_TYPE);
        $mapping = array(
            'name' => 'names',
            'content_type_id' => 'contentTypeId',
            'linked_to_site' => 'linkedToSite'
        );
        $configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);
        $repository = $this->get('open_orchestra_model.repository.content_type');

        $collection = $repository->findAllNotDeletedInLastVersionForPaginate($configuration);
        $recordsTotal = $repository->countByContentTypeInLastVersion();
        $recordsFiltered = $repository->countNotDeletedInLastVersionWithSearchFilter($configuration);
        $facade = $this->get('open_orchestra_api.transformer_manager')->transform('content_type_collection', $collection);
        $facade->recordsTotal = $recordsTotal;
        $facade->recordsFiltered = $recordsFiltered;

        return $facade;
    }
1339457
public function showSearchResultsAction(Request $request)
    {
        $response = new Response();
        $searchText = '';
        $searchCount = 0;

        // Creating a form using Symfony's form component
        $simpleSearch = new SimpleSearch();
        $form = $this->createForm($this->get('ezdemo.form.type.simple_search'), $simpleSearch);
        $form->handleRequest($request);

        $pager = null;

        if ($form->isValid()) {
            /** @var SearchHelper $searchHelper */
            $searchHelper = $this->get('ezdemo.search_helper');

            if (!empty($simpleSearch->searchText)) {
                $searchText = $simpleSearch->searchText;

                $pager = $searchHelper->searchForPaginatedContent(
                    $searchText,
                    $request->get('page', 1),
                    $this->getConfigResolver()->getParameter('languages')
                );

                $searchCount = $pager->getNbResults();
            }
        }

        return $this->render(
            'eZDemoBundle:search:search.html.twig',
            array(
                'searchText' => $searchText,
                'searchCount' => $searchCount,
                'pagerSearch' => $pager,
                'form' => $form->createView(),
            ),
            $response
        );
    }
1025884
public function showAction(Request $request, $id)
    {
        $this->checkIfUserHasPermission(Permission::VIEW);

        list($parentEntity) = $this->getParentEntityDefinition($request);

        $entity = $this->getEntity($id);

        $this->getEventDispatcher()->dispatch(
            Events::PRE_CRUD_CONTROLLER_ACTION,
            new CrudControllerActionEvent($this->meta, __FUNCTION__)
        );

        try {
            $this->getCustomObjectLoader()->loadCustomObjects($entity);
        } catch (CustomObjectException $ex) {
        }

        $view = $this->getEntityToShowViewTransformer()->transform($this->meta, $entity);

        return $this->renderResponse('show', [
            'entity'        => $entity,
            'meta'          => $this->meta,
            'parent_entity' => $parentEntity,
            'view'          => $view,
        ], $request->isXmlHttpRequest());
    }
1159572
public function profileAction(Request $request)
    {
        $user = $this->getUser();

        $form = $this->createForm(ProfileType::class, $user);
        $form->handleRequest($request);

        if ($form->isValid()) {

            if ($user->isTwoFactorEnabled() == false) {
                $user->setGoogleAuthenticatorSecret(null);
            }

            $this->get('fos_user.user_manager')->updateUser($user, true);

            if ($user->isTwoFactorEnabled() == true && empty($user->getGoogleAuthenticatorSecret())) {
                return $this->redirectToRoute('opifer_cms_user_activate_2fa');                    
            }

            $this->addFlash('success', 'Your profile was updated successfully!');

            return $this->redirectToRoute('opifer_cms_user_profile');
        }

        return $this->render('OpiferCmsBundle:Backend/User:profile.html.twig', [
            'form' => $form->createView(),
            'user' => $user,
        ]);
    }
1168564
public function show(string $name, Request $request)
    {
        $availableMenus = config('press.menu');
        $currentLocale = $request->get('lang', app()->getLocale());

        $menu = Dashboard::modelClass(Menu::class)
            ->where('lang', $currentLocale)
            ->where('parent', 0)
            ->where('type', $name)
            ->orderBy('sort', 'asc')
            ->with('children')
            ->get();

        return view('platform::container.systems.menu', [
            'name'           => $name,
            'locales'        => config('press.locales'),
            'currentLocale'  => $currentLocale,
            'menu'           => $menu,
            'availableMenus' => $availableMenus,
        ]);
    }
1037619
public function overviewAction(Request $request)
    {
        $this->denyAccessUnlessGranted('ez:infocollector:read');

        $adapter = new InformationCollectionContentsAdapter($this->service, Query::count());
        $pager = $this->getPager($adapter, (int) $request->query->get('page'));

        return $this->render("NetgenInformationCollectionBundle:admin:overview.html.twig", ['objects' => $pager]);
    }
100289
public function profileOverview(Request $request, SalesChannelContext $context): Response
    {
        $this->denyAccessUnlessLoggedIn();

        $page = $this->profilePageLoader->load($request, $context);

        return $this->renderStorefront('@Storefront/page/account/profile/index.html.twig', ['page' => $page]);
    }
431439
public function handle(Request $request)
	{
		if (!$this->app->runningInConsole())
		{
			$this->app['dispatcher']->trigger('system.onBeforeRoute');

			foreach ($this->app['router']->parse($request->getUri()) as $key => $val)
			{
				$request->setVar($key, $val, 'get');
			}

			$this->app['dispatcher']->trigger('system.onAfterRoute');

			if ($this->app->has('profiler'))
			{
				$this->app['profiler'] ? $this->app['profiler']->mark('afterRoute') : null;
			}
		}

		return $this->next($request);
	}
759411
public function enter(Profile $profile)
    {
        $name = 'Twig Template: ' . substr($profile->getName(), strlen(ROOT) + 1);
        DebugTimer::start($name, __d('twig_view', $name));

        parent::enter($profile);
    }
98581
public function editAction(Location $location, Request $request)
    {
        if ($location->getProfile()->getId() != $this->getCurrentProfile()->getId())
        {
            throw new \Exception('No access to this Location');
        }

        $form = $this->createForm(new LocationType(), $location);

        if ($response = $this->processForm($request, $form, 'Profile_location_show'))
        {
            return $response;
        }

        return $this->render('HarvestCloudCoreBundle:Profile/Location:edit.html.twig', array(
          'form'     => $form->createView(),
          'location' => $location,
        ));
    }
1100919
public function showAction(Profile $seller, $product_slug)
    {
        $q  = $this->get('doctrine')
            ->getManager()
            ->createQuery('
                SELECT p
                FROM HarvestCloudCoreBundle:Product p
                WHERE p.seller = :seller
                AND p.slug = :product_slug
            ')
            ->setParameter('product_slug', $product_slug)
            ->setParameter('seller', $seller)
        ;

        $product = $q->getSingleResult();

        $form = $this->createForm(new AddToCartType(
            $product,
            $this->getCurrentCart()->getQuantity($product)
        ));

        return $this->render('HarvestCloudCoreBundle:Buyer/Product:show.html.twig', array(
          'product'          => $product,
          'quantity_in_cart' => $this->getCurrentCart()->getQuantity($product),
          'lineItem'         => $this->getCurrentCart()->getLineItemForProduct($product),
          'form'             => $form->createView(),
        ));
    }
1054851
public function newAction(Request $request)
    {
        $windowMaker = new HubWindowMaker();
        $windowMaker->setHub($this->getCurrentProfile());
        $form = $this->createForm(new HubWindowMakerType($this->getCurrentProfile()), $windowMaker);

        if ($response = $this->processForm($request, $form, 'Hub_window_maker_show'))
        {
            return $response;
        }

        return $this->render('HarvestCloudCoreBundle:Hub/WindowMaker:new.html.twig', array(
            'form' => $form->createView(),
        ));
    }
1017955
public function listAction(Request $request)
	{
		$rootNodes = array();

		$repo = $this->container->getDoctrine()
			->getManager()->getRepository('Supra\Package\Cms\Entity\Abstraction\File');

		$output = array();

		// if parent dir is set then we set folder as rootNode
		if ($request->query->get('id')) {
			$node = $this->getFolder('id');
			$rootNodes = $node->getChildren();
		} else {
			$rootNodes = $repo->getRootNodes();
		}

		foreach ($rootNodes as $rootNode) {
			/* @var $rootNode FileAbstraction */

			if ($request->query->get('type')) {

				$itemType = $this->getEntityType($rootNode);
				$requestedType = $request->query->get('type');

				if ( ! (
					($itemType == $requestedType) ||
					($itemType == Folder::TYPE_ID)
				)) {
					continue;
				}
			}

			$item = $this->entityToArray($rootNode);

			if ($rootNode instanceof File) {

				$extension = mb_strtolower($rootNode->getExtension());

				$knownExtensions = $this->container->getParameter('cms.media_library_known_file_extensions');
				if (in_array($extension, $knownExtensions)) {
					$item['known_extension'] = $extension;
				}

				$checkExistance = $this->container->getParameter('cms.media_library_check_file_existence');
				if ($checkExistance == self::CHECK_FULL) {
					$item['broken'] = ( ! $this->isAvailable($rootNode));
				}
			}

			// Get thumbnail
			if ($rootNode instanceof Image) {
				// create preview
				// TODO: hardcoded 30x30
				try {
					if ($this->getFileStorage()->fileExists($rootNode)) {
						$sizeName = $this->getFileStorage()->createResizedImage($rootNode, 30, 30, true);
						if ($rootNode->isPublic()) {
							$item['thumbnail'] = $this->getFileStorage()->getWebPath($rootNode, $sizeName);
						} else {
							$item['thumbnail'] = $this->getPrivateImageWebPath($rootNode, $sizeName);
						}
					}
				} catch (\Exception $e) {
					$item['broken'] = true;
				}
			}

			$output[] = $item;
		}

		return new SupraJsonResponse(array(
			'totalRecords' => count($output),
			'records' => $output,
		));
	}