Admin_CommentCommenterController::toggleBanAction PHP Метод

toggleBanAction() публичный Метод

public toggleBanAction ( )
    public function toggleBanAction()
    {
        $params = $this->getRequest()->getParams();
        if (!isset($params['commenter']) && (!isset($params['article']) || !isset($params['forum']))) {
            throw new InvalidArgumentException();
        }
        if (isset($params['thread']) && isset($params['language'])) {
            $publication = $this->articleRepository->find(array('number' => $params['thread'], 'language' => $params['language']))->getPublication();
        }
        if (isset($params['forum'])) {
            $publication = $this->publicationRepository->find($params['forum']);
        }
        //$publication = null;
        $commenter = $this->commenterRepository->find($params['commenter']);
        if ($commenter->getUser() != null) {
            $commenter->setName($commenter->getUser()->getUsername());
        }
        $form = new Admin_Form_Ban();
        $this->handleBanForm($form, $commenter, $publication);
        $form->setValues($commenter, $this->acceptanceRepository->isBanned($commenter, $publication));
        $this->view->form = $form;
    }