public function initialize() { $thread = $this->getProperty('thread', false); if (empty($thread)) { $post = $this->getProperty('post', false); if (empty($post)) { $this->modx->sendErrorPage(); } $this->post = $this->modx->getObject('disPost', $post); if (empty($this->post)) { $this->discuss->sendErrorPage(); } /* get thread root */ $this->thread = $this->post->getOne('Thread'); if (empty($this->thread)) { $this->discuss->sendErrorPage(); } } else { $this->thread = $this->modx->getObject('disThread', $thread); if (empty($this->thread)) { $this->discuss->sendErrorPage(); } $this->post = $this->thread->getOne('FirstPost'); if (empty($this->post)) { $this->discuss->sendErrorPage(); } } $this->author = $this->post->getOne('Author'); $this->board = $this->thread->getOne('Board'); $this->modx->lexicon->load('discuss:post'); if ($this->board) { $this->discuss->user->isModerator($this->board->get('id')); } }
public function initialize() { if (empty($this->scriptProperties['thread']) && empty($this->scriptProperties['post'])) { $this->modx->sendErrorPage(); } if (!empty($this->scriptProperties['post']) && empty($this->scriptProperties['thread'])) { $this->post = $this->modx->getObject('disPost', $this->scriptProperties['post']); if (empty($this->post)) { $this->discuss->sendErrorPage(); } $this->scriptProperties['thread'] = $this->post->get('thread'); } if (!class_exists('disThread')) { $this->modx->loadClass('disThread'); } $this->thread = $this->modx->call('disThread', 'fetch', array(&$this->modx, $this->scriptProperties['thread'], disThread::TYPE_MESSAGE)); if (empty($this->thread)) { $this->modx->sendErrorPage(); } if (empty($this->post)) { $this->post = $this->thread->getOne('FirstPost'); if (empty($this->post)) { $this->discuss->sendErrorPage(); } } $this->author = $this->post->getOne('Author'); $this->modx->lexicon->load('discuss:post'); }
public function getBreadcrumbs() { /* build breadcrumbs */ $trail = ''; if (empty($this->board)) { $this->board = $this->thread->getOne('Board'); } if ($this->board) { $default = array(); if (!empty($this->options['showTitleInBreadcrumbs'])) { $default[] = array('text' => $this->modx->lexicon('discuss.modify_post_header', array('post' => $this->post->get('title'))), 'active' => true); } $this->board->buildBreadcrumbs($default, true); $trail = $this->board->get('trail'); } return $trail; }
/** * Get the last post of the thread and set it as a placeholder * @return void */ public function getLastPost() { $this->lastPost = $this->thread->getOne('LastPost'); $lastPostArray = $this->lastPost->toArray('lastPost.'); $this->setPlaceholders($lastPostArray); }