예제 #1
0
 /**
  * Get and load the thread
  * @return bool|quipThread
  */
 public function getThread()
 {
     $threadName = $this->getProperty('thread', '');
     if (empty($threadName)) {
         return false;
     }
     /** @var quipThread $thread */
     $this->thread = $this->modx->getObject('quipThread', array('name' => $threadName));
     if (!$this->thread) {
         $this->thread = $this->modx->newObject('quipThread');
         $this->thread->fromArray(array('name' => $threadName, 'createdon' => strftime('%Y-%m-%d %H:%M:%S', time()), 'moderated' => $this->getProperty('moderate', 0, 'isset'), 'resource' => $this->modx->resource->get('id'), 'idprefix' => $this->getProperty('idprefix', 'qcom')), '', true, true);
         $this->thread->save();
         $this->thread->sync($this->getProperties());
     }
     if ($this->thread) {
         $closeAfter = (int) $this->getProperty('closeAfter', 14, 'isset');
         $open = $this->thread->checkIfStillOpen($closeAfter) && !$this->getProperty('closed', false, 'isset');
         $this->setProperty('stillOpen', $open);
     }
     return $this->thread;
 }
예제 #2
0
 public function isOpen()
 {
     return $this->thread->checkIfStillOpen($this->getProperty('closeAfter', 14, 'isset')) && !$this->getProperty('closed', false, 'isset');
 }