use of net.jforum.dao.ModerationLogDAO in project jforum2 by rafaelsteil.
the class ModerationAction method showActivityLog.
public void showActivityLog() {
if (!SecurityRepository.canAccess(SecurityConstants.PERM_MODERATION_LOG)) {
this.denied();
return;
}
ModerationLogDAO dao = DataAccessDriver.getInstance().newModerationLogDAO();
int start = ViewCommon.getStartPage();
int recordsPerPage = SystemGlobals.getIntValue(ConfigKeys.TOPICS_PER_PAGE);
List list = dao.selectAll(start, recordsPerPage);
boolean canAccessFullModerationLog = SecurityRepository.canAccess(SecurityConstants.PERM_FULL_MODERATION_LOG);
PostDAO postDao = DataAccessDriver.getInstance().newPostDAO();
TopicDAO topicDao = DataAccessDriver.getInstance().newTopicDAO();
for (Iterator iter = list.iterator(); iter.hasNext(); ) {
ModerationLog log = (ModerationLog) iter.next();
if (log.getPostId() > 0) {
Post post = postDao.selectById(log.getPostId());
if (post.getId() > 0 && ForumRepository.getForum(post.getForumId()) == null) {
iter.remove();
continue;
}
} else if (log.getTopicId() > 0) {
Topic topic = topicDao.selectRaw(log.getTopicId());
if (topic.getId() > 0 && ForumRepository.getForum(topic.getForumId()) == null) {
iter.remove();
continue;
}
}
if (log.getOriginalMessage() != null && canAccessFullModerationLog) {
Post post = new Post();
post.setText(log.getOriginalMessage());
log.setOriginalMessage(PostCommon.preparePostForDisplay(post).getText());
}
}
this.setTemplateName(TemplateKeys.MODERATION_SHOW_ACTIVITY_LOG);
this.context.put("activityLog", list);
this.context.put("canAccessFullModerationLog", canAccessFullModerationLog);
int totalRecords = dao.totalRecords();
ViewCommon.contextToPagination(start, totalRecords, recordsPerPage);
}
use of net.jforum.dao.ModerationLogDAO in project jforum2 by rafaelsteil.
the class ModerationHelper method saveModerationLog.
public void saveModerationLog(ModerationLog log) {
ModerationLogDAO dao = DataAccessDriver.getInstance().newModerationLogDAO();
dao.add(log);
}
Aggregations