public function renderTemplate() { // Получаем данные пользователя if (!($username = $this->modx->getOption('RouteUsername')) or !($user = $this->modx->getObject('modUser', array("username" => $username, "active" => 1)))) { return $this->modx->sendErrorPage(); } $this->setSearchable(true); $this->setCanonical($this->makeCanonical($user->username)); $this->meta['meta_title'] = $user->Profile->fullname ? $user->Profile->fullname : $user->username; return parent::renderTemplate(); }
public function renderTemplate() { // Получаем данные пользователя if (!($comment_id = (int) $this->modx->getOption('RouteCommentID'))) { return $this->modx->sendErrorPage(); } // Пытаемся получить данные комментария $response = $this->modx->runProcessor('web/society/topics/comments/getdata', array("where" => array("id" => $comment_id), "limit" => 1), array('processors_path' => MODX_CORE_PATH . 'components/modxsite/processors/')); if ($response->isError() || !($comments = $response->getObject())) { return $this->modx->sendErrorPage(); } // else $this->modx->smarty->assign('comments', $comments); $this->setSearchable(true); $this->setCanonical($this->makeCanonical($comment_id)); return parent::renderTemplate(); }
public function renderTemplate() { $tag = null; // Получаем данные пользователя if ($RouteTag = $this->modx->getOption('RouteTag')) { $q = $this->modx->newQuery('SocietyTopicTag', array("tag" => $RouteTag, "active" => 1)); $q->limit(1); $tag = $this->modx->getObject('SocietyTopicTag', $q); } if (!$tag) { return $this->modx->sendErrorPage(); } $this->setSearchable(true); $this->setCanonical($this->makeCanonical($tag->tag)); $this->modx->smarty->assign('tag', $tag->tag); $this->meta['meta_title'] = $tag->tag; return parent::renderTemplate(); }
public function renderTemplate() { /* Получаем все блоги топика, и если нет прав на чтение ни в одном блоге, то перекрываем доступ к топику */ $q = $this->modx->newQuery('SocietyBlog'); $q->innerJoin('SocietyBlogTopic', 'BlogTopics'); $q->where(array("BlogTopics.topicid" => $this->modx->resource->id)); $can_view = false; foreach ($this->modx->getCollection('SocietyBlog', $q) as $blog) { if ($blog->checkPolicy('view')) { $can_view = true; break; } } if (!$can_view) { return $this->modx->sendUnauthorizedPage(); } /* $this->setSearchable(true); $this->setCanonical($this->modx->makeUrl($this->modx->resource->id, '','', 'full') . $username . '/');*/ return parent::renderTemplate(); }