public function indexAction(\Difra\Param\AnyString $link = null) { if (!is_null($link)) { // страница анонса события $this->eventRoot = $this->root->appendChild($this->xml->createElement('announcements-event-view')); $this->eventRoot->setAttribute('view', true); $this->_showEvent(rawurldecode($link->val())); } else { if (\Difra\Plugger::isEnabled('Blogs')) { $Group = \Difra\Plugins\Blogs\Group::current(); if ($Group) { // страница анонсов группы $this->eventRoot = $this->root->appendChild($this->xml->createElement('groupEvents')); $groupId = $Group->getId(); $this->_showGroupEvents($groupId); } else { throw new \Difra\View\HttpError(404); return; } } else { // общая страница анонсов $this->eventRoot = $this->root->appendChild($this->xml->createElement('allEvents')); $this->_showByPriority(); } } }
public function dispatch() { if ($Group = Blogs\Group::current()) { $Group->getXML($this->root); $this->root->setAttribute('currentGroup', $Group->getDomain()); } // группы юзера \Difra\Plugins\Blogs::getInstance()->getUserGroupsXML($this->root); }
public function addAjaxActionAuth(Param\AjaxString $title, Param\AjaxSafeHTML $text, Param\AjaxString $tags = null) { $userId = Difra\Auth::getInstance()->getEmail(); if ($group = Blogs\Group::current()) { if (!$group->hasUser($userId)) { \Difra\Libs\Cookies::getInstance()->notify(\Difra\Locales::getInstance()->getXPath('blogs/notifies/add_post_denied'), true); $this->view->redirect('/'); } $blog = Blogs\Blog::touchByGroup($group->getId()); } else { $blog = Blogs\Blog::touchByUser($userId); } if ($post = $blog->addPost($userId, $title->val(), $text->val())) { $post = $blog->getPost($post->getId()); if (class_exists('Difra\\Plugins\\Tags')) { $tagsArray = Difra\Plugins\Tags::getInstance()->tagsFromString($tags); Difra\Plugins\Tags::getInstance()->update('posts', $post->getId(), $tagsArray); } $this->ajax->redirect($post->getUrl()); } else { $this->ajax->error(\Difra\Locales::getInstance()->getXPath('blogs/notifies/add_post_failed')); } }