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());
}
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);
}
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);
}
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();
}
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);
}
Aggregations