protected function processImpl(PostArrayAdapter $adapter, $button) { $FEEDBACK = FeedbackManager::inst(); /* * Тема */ $theme = $adapter->str(FORM_PARAM_THEME); $error = UserInputValidator::validateShortText($theme); if ($error) { return array(FORM_PARAM_THEME => $error); } $theme = UserInputTools::safeShortText($theme); /* * Комментарий */ $text = $adapter->str(FORM_PARAM_COMMENT); $error = UserInputValidator::validateLongText($text); if ($error) { return array(FORM_PARAM_COMMENT => $error); } $text = UserInputTools::safeLongText($text); /* * АВТОРИЗОВАН - пользуемся стандартным механизмом добавления сообщения в тред. * Кодом треда, при этом, является сам пользователь. */ if (AuthManager::isAuthorized()) { $msg = $FEEDBACK->saveMessage(PsUser::inst()->getId(), null, $text, $theme, PsUser::inst()); return new AjaxSuccess($FEEDBACK->buildLeaf($msg)); } /* * НЕ АВТОРИЗОВАН - сохраняем сообщение в таблицу анонимных пользователей. */ if (!AuthManager::isAuthorized()) { /* * Имя пользователя */ $name = $adapter->str(FORM_PARAM_NAME); $error = UserInputValidator::validateShortText($name); if ($error) { return array(FORM_PARAM_NAME => $error); } $name = UserInputTools::safeShortText($name); /* * Контакты */ $contacts = $adapter->str(FORM_PARAM_REG_CONTACTS); if ($contacts) { $error = UserInputValidator::validateShortText($contacts, false); if ($error) { return array(FORM_PARAM_REG_CONTACTS => $error); } $contacts = UserInputTools::safeShortText($contacts); } $FEEDBACK->saveAnonimousFeedback($name, $contacts, $theme, $text); return new AjaxSuccess(); } }
function smarty_block_feed($params, $content, Smarty_Internal_Template &$smarty) { if (!$content) { return; } $text = trim($content); $text = $text == '.' ? null : $text; $blank = !isEmptyInArray('blank', $params); $http = !isEmptyInArray('http', $params); return FeedbackManager::inst()->writeToUsHref($text, $blank, $http); }
protected function executeImpl(ArrayAdapter $params) { $id = $params->int('id'); //feedId or userId - в зависимости от action $action = $params->str('action'); $res = 'OK'; switch ($action) { case 'delete': AdminFeedbackBean::inst()->deleteAnonimMsg($id); break; case 'load': //id = userId $res = FeedbackManager::inst()->buildDiscussion(false, $id, false); break; default: raise_error("Unknown action: {$action}"); } return new AjaxSuccess($res); }
/** * Структура сайта (навигация и т.д.) * * @return NavigationItem */ private function getStructureImpl() { $MAP = NavigationItem::byPageCode(BASE_PAGE_MAP); $INDEX = NavigationItem::byPageCode(BASE_PAGE_INDEX, 'О проекте'); $INDEX->addChild(NavigationItem::byPageCode(PAGE_OFFICE)); $INDEX->addChild(NavigationItem::byPageCode(PAGE_REGISTRATION)); $INDEX->addChild(NavigationItem::byPageCode(PAGE_PASS_REMIND)); $MAGAZINE = NavigationItem::byPostsProcessor(MagManager::inst(), 'Все выпуски'); $BLOG = NavigationItem::byRubricProcessor(BlogManager::inst(), 'Все заметки', 'Все заметки раздела'); $TRAININGS = NavigationItem::byRubricProcessor(TrainManager::inst(), 'Все занятия', 'Все занятия в разделе'); $TRAININGS->addChild(NavigationItem::byPageCode(PAGE_LESSON_HOW_TO)); $FEEDBACK = NavigationItem::byPageCode(BASE_PAGE_FEEDBACK, 'Об авторе'); $FEEDBACK->addChild(NavigationItem::byHref(FeedbackManager::inst()->writeToUsHref())->setNoBg()); $FEEDBACK->addChild(NavigationItem::byPageCode(PAGE_HELPUS)); //Окончательная структура $MAP->addChild($INDEX); $MAP->addChild($MAGAZINE); $MAP->addChild($BLOG); $MAP->addChild($TRAININGS); $MAP->addChild($FEEDBACK); return $MAP; }
protected function processRequest(ArrayAdapter $params) { $smarty['discussion'] = FeedbackManager::inst()->buildDiscussion(false, AuthManager::getUserId(), true); return new IdentPageFilling($smarty); }
public function title() { $cnt = AdminUserBean::inst()->getClientsCount(); $unreaded = FeedbackManager::inst()->getNotConfirmemMsgsCnt(); return "Пользователи ({$cnt}" . ($unreaded > 0 ? "/{$unreaded}" : '') . ')'; }
private function __construct() { PsProfiler::inst(__CLASS__)->start(__FUNCTION__); $managers = array(MagManager::inst(), BlogManager::inst(), TrainManager::inst()); foreach ($managers as $manager) { //Соберём типы постов $this->postTypes[] = $manager->getPostType(); if ($manager instanceof RubricsProcessor) { $this->rubricsProcessors[$manager->getPostType()] = $manager; $this->foldings[] = $manager->getRubricsFolding(); } if ($manager instanceof PostsProcessor) { $this->postsProcessors[$manager->getPostType()] = $manager; $this->foldings[] = $manager->getFolding(); } if ($manager instanceof CommentsProcessor) { $this->commentProcessors[$manager->getPostType()] = $manager; $this->discussionControllers[$manager->getDiscussionController()->getDiscussionUnique()] = $manager->getDiscussionController(); } if ($manager instanceof PagePreloadListener) { $this->pagePreloadListeners[] = $manager; } if ($manager instanceof NewsProvider) { $this->newsProviders[$manager->getNewsEventType()] = $manager; } } //Контроллеры дискуссий $this->discussionControllers[FeedbackManager::inst()->getDiscussionUnique()] = FeedbackManager::inst(); //Фолдинги $this->foldings[] = PopupPagesManager::inst(); $this->foldings[] = PluginsManager::inst(); $this->foldings[] = IdentPagesManager::inst(); $this->foldings[] = TimeLineManager::inst(); $this->foldings[] = TemplateMessages::inst(); $this->foldings[] = UserPointsManager::inst(); $this->foldings[] = StockManager::inst(); $this->foldings[] = HelpManager::inst(); $this->foldings[] = EmailManager::inst(); $this->foldings[] = PSForm::inst(); $this->foldings[] = DialogManager::inst(); //Библиотеки $this->foldings[] = PoetsManager::inst(); $this->foldings[] = ScientistsManager::inst(); //Админские страницы $this->foldings[] = APagesResources::inst(); //Базовые страницы $this->foldings[] = BasicPagesManager::inst(); //Построитель страниц $this->foldings[] = PageBuilder::inst(); //Управление списком предпросмотра постов $this->foldings[] = ShowcasesCtrlManager::inst(); //Элементы в правой панели навигации $this->foldings[] = ClientBoxManager::inst(); /* * Выделим различные подклассы фолдингов */ foreach ($this->foldings as $folding) { //Фолдинги библиотек if ($folding instanceof LibResources) { $this->libs[] = $folding; } //Фолдинги обработчиков постов if ($folding instanceof PostFoldedResources) { $this->postProcessorFoldings[] = $folding; } //Фолдинги для баблов if ($folding instanceof BubbledFolding) { $this->bubbles[] = $folding; } //Фолдинги, предоставляющие панели if ($folding instanceof PanelFolding) { $this->panels[] = $folding; } //Фолдинги, финализирующие контент страницы if ($folding instanceof PageFinalizerFolding) { $this->pageFinaliseFoldings[] = $folding; } //Индексированный список фолдингов $this->folding2unique[$folding->getUnique()] = $folding; //Префиксы smarty к фолдингам $this->folding2smartyPrefix[$folding->getSmartyPrefix()] = $folding; //Префиксы классов к фолдингам if ($folding->getClassPrefix()) { $this->folding2classPrefix[$folding->getClassPrefix()] = $folding; } } PsProfiler::inst(__CLASS__)->stop(); }
public function send($templateData = null) { FeedbackManager::inst()->saveTemplatedMessage($this->receiver->getId(), null, $this->templateId, $templateData, $this->author); }