Search in sources :

Example 1 with EPNotification

use of org.olat.portfolio.model.notification.EPNotification in project OpenOLAT by OpenOLAT.

the class EPNotificationManager method getPageSubscriptionListItem.

public List<SubscriptionListItem> getPageSubscriptionListItem(Long mapKey, String rootBusinessPath, Date compareDate, Translator translator) {
    List<EPStructureElementNotification> notifications = getPageNotifications(mapKey, compareDate);
    List<SubscriptionListItem> items = new ArrayList<SubscriptionListItem>();
    for (EPNotification notification : notifications) {
        SubscriptionListItem item = null;
        String[] title = new String[] { StringHelper.escapeHtml(notification.getTitle()) };
        if ("page".equals(notification.getType())) {
            String bPath = rootBusinessPath + "[EPPage:" + notification.getPageKey() + "]";
            String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
            item = new SubscriptionListItem(translator.translate("li.newpage", title), linkUrl, bPath, notification.getCreationDate(), "o_ep_icon_page");
            item.setUserObject(notification.getPageKey());
        } else {
            String bPath = rootBusinessPath;
            if (notification.getPageKey() != null) {
                bPath = rootBusinessPath + "[EPPage:" + notification.getPageKey() + "]";
            }
            String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
            item = new SubscriptionListItem(translator.translate("li.newstruct", title), linkUrl, bPath, notification.getCreationDate(), "o_ep_icon_struct");
            item.setUserObject(notification.getPageKey());
        }
        if (item != null) {
            items.add(item);
        }
    }
    return items;
}
Also used : EPStructureElementNotification(org.olat.portfolio.model.notification.EPStructureElementNotification) SubscriptionListItem(org.olat.core.commons.services.notifications.model.SubscriptionListItem) ArrayList(java.util.ArrayList) EPNotification(org.olat.portfolio.model.notification.EPNotification)

Example 2 with EPNotification

use of org.olat.portfolio.model.notification.EPNotification in project openolat by klemens.

the class EPNotificationManager method getPageSubscriptionListItem.

public List<SubscriptionListItem> getPageSubscriptionListItem(Long mapKey, String rootBusinessPath, Date compareDate, Translator translator) {
    List<EPStructureElementNotification> notifications = getPageNotifications(mapKey, compareDate);
    List<SubscriptionListItem> items = new ArrayList<SubscriptionListItem>();
    for (EPNotification notification : notifications) {
        SubscriptionListItem item = null;
        String[] title = new String[] { StringHelper.escapeHtml(notification.getTitle()) };
        if ("page".equals(notification.getType())) {
            String bPath = rootBusinessPath + "[EPPage:" + notification.getPageKey() + "]";
            String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
            item = new SubscriptionListItem(translator.translate("li.newpage", title), linkUrl, bPath, notification.getCreationDate(), "o_ep_icon_page");
            item.setUserObject(notification.getPageKey());
        } else {
            String bPath = rootBusinessPath;
            if (notification.getPageKey() != null) {
                bPath = rootBusinessPath + "[EPPage:" + notification.getPageKey() + "]";
            }
            String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
            item = new SubscriptionListItem(translator.translate("li.newstruct", title), linkUrl, bPath, notification.getCreationDate(), "o_ep_icon_struct");
            item.setUserObject(notification.getPageKey());
        }
        if (item != null) {
            items.add(item);
        }
    }
    return items;
}
Also used : EPStructureElementNotification(org.olat.portfolio.model.notification.EPStructureElementNotification) SubscriptionListItem(org.olat.core.commons.services.notifications.model.SubscriptionListItem) ArrayList(java.util.ArrayList) EPNotification(org.olat.portfolio.model.notification.EPNotification)

Aggregations

ArrayList (java.util.ArrayList)2 SubscriptionListItem (org.olat.core.commons.services.notifications.model.SubscriptionListItem)2 EPNotification (org.olat.portfolio.model.notification.EPNotification)2 EPStructureElementNotification (org.olat.portfolio.model.notification.EPStructureElementNotification)2