Search in sources :

Example 1 with ForumRepository

use of net.jforum.repository.ForumRepository in project jforum2 by rafaelsteil.

the class CacheAction method list.

/**
	 * @see net.jforum.Command#list()
	 */
public void list() {
    this.setTemplateName(TemplateKeys.CACHE_LIST);
    this.context.put("bb", new BBCodeRepository());
    this.context.put("modules", new ModulesRepository());
    this.context.put("ranking", new RankingRepository());
    this.context.put("smilies", new SmiliesRepository());
    this.context.put("security", new SecurityRepository());
    this.context.put("forum", new ForumRepository());
    this.context.put("topic", new TopicRepository());
    this.context.put("session", new SessionFacade());
    this.context.put("posts", new PostRepository());
}
Also used : ForumRepository(net.jforum.repository.ForumRepository) SmiliesRepository(net.jforum.repository.SmiliesRepository) SessionFacade(net.jforum.SessionFacade) BBCodeRepository(net.jforum.repository.BBCodeRepository) RankingRepository(net.jforum.repository.RankingRepository) SecurityRepository(net.jforum.repository.SecurityRepository) ModulesRepository(net.jforum.repository.ModulesRepository) TopicRepository(net.jforum.repository.TopicRepository) PostRepository(net.jforum.repository.PostRepository)

Example 2 with ForumRepository

use of net.jforum.repository.ForumRepository in project jforum2 by rafaelsteil.

the class CategoryAction method list.

// Listing
public void list() {
    this.context.put("categories", DataAccessDriver.getInstance().newCategoryDAO().selectAll());
    this.context.put("repository", new ForumRepository());
    this.setTemplateName(TemplateKeys.CATEGORY_LIST);
}
Also used : ForumRepository(net.jforum.repository.ForumRepository)

Example 3 with ForumRepository

use of net.jforum.repository.ForumRepository in project jforum2 by rafaelsteil.

the class ForumAction method list.

// Listing
public void list() {
    this.context.put("categories", DataAccessDriver.getInstance().newCategoryDAO().selectAll());
    this.context.put("repository", new ForumRepository());
    this.setTemplateName(TemplateKeys.FORUM_ADMIN_LIST);
}
Also used : ForumRepository(net.jforum.repository.ForumRepository)

Example 4 with ForumRepository

use of net.jforum.repository.ForumRepository in project jforum2 by rafaelsteil.

the class SearchAction method search.

private void search(SearchOperation operation) {
    SearchArgs args = this.buildSearchArgs();
    int start = args.startFrom();
    int recordsPerPage = SystemGlobals.getIntValue(ConfigKeys.TOPICS_PER_PAGE);
    SearchResult searchResult = operation.performSearch(args);
    operation.prepareForDisplay();
    this.setTemplateName(operation.viewTemplate());
    this.context.put("results", operation.filterResults(operation.results()));
    this.context.put("categories", ForumRepository.getAllCategories());
    this.context.put("searchArgs", args);
    this.context.put("fr", new ForumRepository());
    this.context.put("pageTitle", I18n.getMessage("ForumBase.search"));
    this.context.put("openModeration", "1".equals(this.request.getParameter("openModeration")));
    this.context.put("postsPerPage", new Integer(SystemGlobals.getIntValue(ConfigKeys.POSTS_PER_PAGE)));
    ViewCommon.contextToPagination(start, searchResult.numberOfHits(), recordsPerPage);
    TopicsCommon.topicListingBase();
}
Also used : ForumRepository(net.jforum.repository.ForumRepository) SearchArgs(net.jforum.search.SearchArgs) SearchResult(net.jforum.search.SearchResult)

Example 5 with ForumRepository

use of net.jforum.repository.ForumRepository in project jforum2 by rafaelsteil.

the class ForumAction method list.

/**
	 * List all the forums (first page of forum index)?
	 */
public void list() {
    this.setTemplateName(TemplateKeys.FORUMS_LIST);
    this.context.put("allCategories", ForumCommon.getAllCategoriesAndForums(true));
    this.context.put("topicsPerPage", new Integer(SystemGlobals.getIntValue(ConfigKeys.TOPICS_PER_PAGE)));
    this.context.put("rssEnabled", SystemGlobals.getBoolValue(ConfigKeys.RSS_ENABLED));
    this.context.put("totalMessages", new Integer(ForumRepository.getTotalMessages()));
    this.context.put("totalRegisteredUsers", ForumRepository.totalUsers());
    this.context.put("lastUser", ForumRepository.lastRegisteredUser());
    SimpleDateFormat df = new SimpleDateFormat(SystemGlobals.getValue(ConfigKeys.DATE_TIME_FORMAT));
    GregorianCalendar gc = new GregorianCalendar();
    this.context.put("now", df.format(gc.getTime()));
    this.context.put("lastVisit", df.format(SessionFacade.getUserSession().getLastVisit()));
    this.context.put("forumRepository", new ForumRepository());
    // Online Users
    this.context.put("totalOnlineUsers", new Integer(SessionFacade.size()));
    int aid = SystemGlobals.getIntValue(ConfigKeys.ANONYMOUS_USER_ID);
    List onlineUsersList = SessionFacade.getLoggedSessions();
    // Check for an optional language parameter
    UserSession currentUser = SessionFacade.getUserSession();
    if (currentUser.getUserId() == aid) {
        String lang = this.request.getParameter("lang");
        if (lang != null && I18n.languageExists(lang)) {
            currentUser.setLang(lang);
        }
    }
    // show the "guest" username
    if (onlineUsersList.size() == 0) {
        UserSession us = new UserSession();
        us.setUserId(aid);
        us.setUsername(I18n.getMessage("Guest"));
        onlineUsersList.add(us);
    }
    int registeredSize = SessionFacade.registeredSize();
    int anonymousSize = SessionFacade.anonymousSize();
    int totalOnlineUsers = registeredSize + anonymousSize;
    this.context.put("userSessions", onlineUsersList);
    this.context.put("totalOnlineUsers", new Integer(totalOnlineUsers));
    this.context.put("totalRegisteredOnlineUsers", new Integer(registeredSize));
    this.context.put("totalAnonymousUsers", new Integer(anonymousSize));
    // Most users ever online
    MostUsersEverOnline mostUsersEverOnline = ForumRepository.getMostUsersEverOnline();
    if (totalOnlineUsers > mostUsersEverOnline.getTotal()) {
        mostUsersEverOnline.setTotal(totalOnlineUsers);
        mostUsersEverOnline.setTimeInMillis(System.currentTimeMillis());
        ForumRepository.updateMostUsersEverOnline(mostUsersEverOnline);
    }
    this.context.put("mostUsersEverOnline", mostUsersEverOnline);
}
Also used : ForumRepository(net.jforum.repository.ForumRepository) MostUsersEverOnline(net.jforum.entities.MostUsersEverOnline) UserSession(net.jforum.entities.UserSession) GregorianCalendar(java.util.GregorianCalendar) List(java.util.List) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

ForumRepository (net.jforum.repository.ForumRepository)5 SimpleDateFormat (java.text.SimpleDateFormat)1 GregorianCalendar (java.util.GregorianCalendar)1 List (java.util.List)1 SessionFacade (net.jforum.SessionFacade)1 MostUsersEverOnline (net.jforum.entities.MostUsersEverOnline)1 UserSession (net.jforum.entities.UserSession)1 BBCodeRepository (net.jforum.repository.BBCodeRepository)1 ModulesRepository (net.jforum.repository.ModulesRepository)1 PostRepository (net.jforum.repository.PostRepository)1 RankingRepository (net.jforum.repository.RankingRepository)1 SecurityRepository (net.jforum.repository.SecurityRepository)1 SmiliesRepository (net.jforum.repository.SmiliesRepository)1 TopicRepository (net.jforum.repository.TopicRepository)1 SearchArgs (net.jforum.search.SearchArgs)1 SearchResult (net.jforum.search.SearchResult)1