/** * Request-Handler * @return boolean */ public function request() { parent::request(); $filter = $this->getRequestVar('filter'); $sparams = array('searchtype' => (int) $filter['searchtype']); if (trim($filter['text'])) { $sparams['text'] = $filter['text']; } if ($filter['datefrom']) { $sparams['datefrom'] = strtotime($filter['datefrom']); } if ($filter['dateto']) { $sparams['dateto'] = strtotime($filter['dateto']); } if ($filter['spam'] > -1) { $sparams['spam'] = (int) $filter['spam']; } if ($filter['private'] > -1) { $sparams['private'] = (int) $filter['private']; } if ($filter['approved'] > -1) { $sparams['approved'] = (int) $filter['approved']; } $sparams['combination'] = $filter['combination'] ? 'OR' : 'AND'; $sparams = $this->events->runEvent('commentsPrepareSearch', $sparams); $list = count($sparams) > 1 ? $this->list->getCommentsBySearchCondition($sparams) : $this->list->getCommentsAll(); $this->view->assign('comments', $list); return true; }
/** * @see \fpcm\controller\abstracts\controller::process() * @return mixed */ public function process() { if (!parent::process()) { return false; } $this->initCommentPermissions(); $this->initSearchForm(); $this->view->assign('comments', $this->list->getCommentsAll()); $this->view->assign('commentsMode', 1); $this->view->render(); }
/** * Controller-Processing * @return boolean */ public function process() { if (!parent::process()) { return false; } $users = $this->userList->getUsersNameList(); $this->view->assign('timesMode', true); $this->view->assign('users', array_flip($users)); $this->view->assign('commentEnabledGlobal', $this->config->system_comments_enabled); $this->view->assign('showArchiveStatus', true); $this->view->assign('showDraftStatus', false); $this->view->assign('articleActions', $this->articleActions); $this->view->assign('showTrash', $this->config->articles_trash); $this->view->assign('deletePermissions', $this->deleteActions); $this->initSearchForm($users); if ($this->config->articles_trash) { $this->view->assign('trash', $this->articleList->getArticlesDeleted(true)); } $this->view->assign('drafts', $this->articleList->getArticlesDraft(true)); $commentCounts = $this->commentList->countComments($this->getArticleListIds()); $this->view->assign('commentCount', $commentCounts); $this->view->assign('commentPrivateUnapproved', $this->commentList->countUnapprovedPrivateComments($this->getArticleListIds())); $this->view->assign('commentSum', $commentCounts && $this->articleCount ? array_sum($commentCounts) : 0); $this->view->setViewJsFiles(array(\fpcm\classes\baseconfig::$jsPath . 'articlelist.js')); $this->translateCategories(); $this->view->assign('showDrafts', true); return true; }
/** * @see \fpcm\controller\abstracts\controller::process() * @return mixed */ public function process() { if (!parent::process()) { return false; } $this->view->assign('editorAction', 'articles/edit&articleid=' . $this->article->getId()); $this->view->assign('editorMode', 1); $this->view->assign('showRevisions', true); $this->view->assign('postponedTimer', $this->article->getCreatetime()); $this->view->assign('users', $this->userList->getUsersByIds(array($this->article->getCreateuser(), $this->article->getChangeuser()))); $this->view->assign('commentCount', array_sum($this->commentList->countComments(array($this->article->getId())))); $this->view->assign('comments', $this->commentList->getCommentsByCondition($this->article->getId(), -1, -1, -1)); $this->view->assign('commentsMode', 2); $revisions = $this->article->getRevisions(); $this->view->assign('revisions', $revisions); $this->view->assign('revisionCount', count($revisions)); $this->view->assign('revisionPermission', $this->permissions->check(array('article' => 'revisions'))); $this->view->addJsVars(array('fpcmEditorCommentLayerSave' => $this->lang->translate('GLOBAL_SAVE'), 'fpcmCanConnect' => \fpcm\classes\baseconfig::canConnect() ? 1 : 0, 'fpcmNavigationActiveItemId' => 'itemnav-id-editnews')); $this->view->addJsLangVars(array('editorCommentLayerHeader' => $this->lang->translate('COMMENTS_EDIT'))); if (!$this->permissions->check(array('article' => 'approve')) && $this->article->getApproval()) { $this->view->addMessage('Um den Artikel freizugeben, speichere ihn einfach erneut ab.'); } $this->initPermissions(); $this->view->assign('isRevision', false); if ($this->showRevision) { $this->view->assign('currentArticle', $this->currentArticle); $this->view->assign('editorFile', \fpcm\classes\baseconfig::$viewsDir . 'articles/editors/revisiondiff.php'); $this->view->assign('isRevision', true); $this->view->assign('showRevisions', false); $this->view->assign('showComments', false); $this->view->assign('editorAction', 'articles/edit&articleid=' . $this->article->getId() . '&rev=' . $this->getRequestVar('rev')); } $this->view->render(); }
/** * Controller ausführen * @return boolean */ public function process() { parent::process(); if ($this->cache->isExpired() || $this->session->exists()) { $this->users = array_flip($this->userList->getUsersNameList()); $this->usersEmails = array_flip($this->userList->getUsersEmailList()); $this->categories = $this->categoryList->getCategoriesAll(); $this->commentCounts = $this->config->system_comments_enabled ? $this->commentList->countComments(array(), 0, 1) : array(); } }
protected function processCommentActions(\fpcm\model\comments\commentList $commentList) { $action = $this->getRequestVar('commentAction', array(9)); $ids = $this->getRequestVar('ids', array(9)); if (!$action || !is_array($ids) || !count($ids)) { $this->view->addErrorMessage('SELECT_ITEMS_MSG'); return true; } switch ($action) { case $this->actions['COMMENTLIST_ACTION_DELETE']: if ($commentList->deleteComments($ids)) { $this->view->addNoticeMessage('DELETE_SUCCESS_COMMENTS'); } else { $this->view->addErrorMessage('DELETE_FAILED_COMMENTS'); } break; case $this->actions['COMMENTLIST_ACTION_APPROVE']: if ($commentList->toggleApprovement($ids)) { $this->view->addNoticeMessage('SAVE_SUCCESS_APPROVEMENT'); } else { $this->view->addErrorMessage('SAVE_FAILED_APPROVEMENT'); } break; case $this->actions['COMMENTLIST_ACTION_PRIVATE']: if ($commentList->togglePrivate($ids)) { $this->view->addNoticeMessage('SAVE_SUCCESS_PRIVATE'); } else { $this->view->addErrorMessage('SAVE_FAILED_PRIVATE'); } break; case $this->actions['COMMENTLIST_ACTION_SPAM']: if ($commentList->toggleSpammer($ids)) { $this->view->addNoticeMessage('SAVE_SUCCESS_SPAMMER'); } else { $this->view->addErrorMessage('SAVE_FAILED_SPAMMER'); } break; } return true; }
/** * Kommentare parsen * @return string */ protected function assignCommentsData() { if (!$this->config->system_comments_enabled || !$this->article->getComments()) { return ''; } $comments = $this->commentList->getCommentsByCondition($this->articleId); $parsed = array(); $i = 1; foreach ($comments as $comment) { $tpl = $this->commentTemplate; $replacements = array('{{author}}' => $comment->getName(), '{{email}}' => $comment->getEmail(), '{{website}}' => $comment->getWebsite(), '{{text}}' => $comment->getText(), '{{date}}' => date($this->config->system_dtmask, $comment->getCreatetime()), '{{number}}' => $i, '{{id}}' => $comment->getId(), '{{mentionid}}' => 'id="c' . $i . '"', '{{mention}}:{{/mention}}' => $i); $tpl->setReplacementTags($replacements); $parsed[] = $tpl->parse(); $i++; } return implode(PHP_EOL, $parsed); }
/** * Controller-Processing */ public function process() { if (!parent::process()) { return false; } $users = $this->userList->getUsersNameList(); $this->view->assign('timesMode', true); $this->view->assign('users', array_flip($users)); $this->view->assign('commentEnabledGlobal', $this->config->system_comments_enabled); $this->view->assign('showArchiveStatus', $this->mode == -1 ? true : false); $this->view->assign('showDraftStatus', false); $this->view->assign('isSearch', true); $this->view->assign('showPager', false); $this->initEditPermisions(); $commentCounts = $this->commentList->countComments($this->getArticleListIds()); $this->view->assign('commentCount', $commentCounts); $this->view->assign('commentSum', $commentCounts && count($this->articleItems) ? array_sum($commentCounts) : 0); $this->view->assign('list', $this->articleItems); $this->view->render(); }