示例#1
0
 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'));
     }
 }
示例#2
0
 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');
 }
示例#3
0
 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;
 }
示例#4
0
 /**
  * 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);
 }