public function deleteAccountType($params) { if (!empty($params['accountType']) && mb_strlen($params['accountType']) > 0) { /* @var $defaultAccountType = */ $defaultAccountType = $this->questionService->getDefaultAccountType(); $questionsCount = $this->questionService->findCountExlusiveQuestionForAccount($params['accountType']); if ($defaultAccountType == $params['accountType']) { OW::getFeedback()->error(OW::getLanguage()->text('admin', 'questions_cant_delete_default_account_type')); } else { if ($questionsCount > 0) { OW::getFeedback()->error(OW::getLanguage()->text('admin', 'questions_account_type_has_exclusive_questions')); } else { if ($this->questionService->deleteAccountType(htmlspecialchars($params['accountType']))) { OW::getFeedback()->info(OW::getLanguage()->text('admin', 'questions_account_type_was_deleted')); } } } } else { throw new Redirect404Exception(); } $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'editAccountType')); }