Ejemplo n.º 1
0
  public static BreadcrumbEntry getGuestGroupBreadcrumbEntry(ThemeDisplay themeDisplay)
      throws Exception {

    Group group = GroupLocalServiceUtil.getGroup(themeDisplay.getCompanyId(), GroupConstants.GUEST);

    if (group.getPublicLayoutsPageCount() == 0) {
      return null;
    }

    LayoutSet layoutSet = LayoutSetLocalServiceUtil.getLayoutSet(group.getGroupId(), false);

    BreadcrumbEntry breadcrumbEntry = new BreadcrumbEntry();

    Account account = themeDisplay.getAccount();

    breadcrumbEntry.setTitle(account.getName());

    String layoutSetFriendlyURL = PortalUtil.getLayoutSetFriendlyURL(layoutSet, themeDisplay);

    if (themeDisplay.isAddSessionIdToURL()) {
      layoutSetFriendlyURL =
          PortalUtil.getURLWithSessionId(layoutSetFriendlyURL, themeDisplay.getSessionId());
    }

    breadcrumbEntry.setURL(layoutSetFriendlyURL);

    return breadcrumbEntry;
  }
Ejemplo n.º 2
0
  private static void _addGroupsBreadcrumbEntries(
      List<BreadcrumbEntry> breadcrumbEntries,
      ThemeDisplay themeDisplay,
      LayoutSet layoutSet,
      boolean includeParentGroups)
      throws Exception {

    Group group = layoutSet.getGroup();

    if (group.isControlPanel()) {
      return;
    }

    if (includeParentGroups) {
      LayoutSet parentLayoutSet = _getParentLayoutSet(layoutSet);

      if (parentLayoutSet != null) {
        _addGroupsBreadcrumbEntries(breadcrumbEntries, themeDisplay, parentLayoutSet, true);
      }
    }

    int layoutsPageCount = 0;

    if (layoutSet.isPrivateLayout()) {
      layoutsPageCount = group.getPrivateLayoutsPageCount();
    } else {
      layoutsPageCount = group.getPublicLayoutsPageCount();
    }

    if ((layoutsPageCount > 0) && !group.isGuest()) {
      String layoutSetFriendlyURL = PortalUtil.getLayoutSetFriendlyURL(layoutSet, themeDisplay);

      if (themeDisplay.isAddSessionIdToURL()) {
        layoutSetFriendlyURL =
            PortalUtil.getURLWithSessionId(layoutSetFriendlyURL, themeDisplay.getSessionId());
      }

      BreadcrumbEntry breadcrumbEntry = new BreadcrumbEntry();

      breadcrumbEntry.setTitle(group.getDescriptiveName(themeDisplay.getLocale()));
      breadcrumbEntry.setURL(layoutSetFriendlyURL);

      breadcrumbEntries.add(breadcrumbEntry);
    }
  }