/** * generate new dataset in frm_threads * @param integer $topic * @param integer $author_id * @param integer $display_user_id * @param string $subject * @param string $message * @param integer $notify * @param integer $notify_posts * @param integer $anonymize * @param datetime $date * @return integer new post ID * @access public */ public function generateThread($forum_id, $author_id, $display_user_id, $subject, $message, $notify, $notify_posts, $alias = '', $date = '', $status = 1) { global $ilDB; $objNewThread = new ilForumTopic(); $objNewThread->setForumId($forum_id); $objNewThread->setDisplayUserId($display_user_id); $objNewThread->setSubject($subject); $objNewThread->setThrAuthorId($author_id); if ($date == "") { $objNewThread->setCreateDate(date("Y-m-d H:i:s")); } else { if (strpos($date, "-") > 0) { $objNewThread->setCreateDate($date); } else { $objNewThread->setCreateDate(date("Y-m-d H:i:s", $date)); } } $objNewThread->setImportName($this->getImportName()); $objNewThread->setUserAlias($alias); $objNewThread->insert(); if ($notify_posts == 1) { $objNewThread->enableNotification($author_id); } // update forum $statement = $ilDB->manipulateF(' UPDATE frm_data SET top_num_threads = top_num_threads + 1 WHERE top_pk = %s', array('integer'), array($forum_id)); return $this->generatePost($forum_id, $objNewThread->getId(), $author_id, $display_user_id, $message, 0, $notify, $subject, $alias, $objNewThread->getCreateDate(), $status, 0); }