19 declare(strict_types=1);
90 $this->db = $DIC->database();
92 if ($history_id > 0) {
99 $res = $this->db->queryF(
100 'SELECT * FROM frm_drafts_history WHERE history_id = %s',
105 while ($row = $this->db->fetchAssoc(
$res)) {
121 $ilDB = $DIC->database();
124 'SELECT * FROM frm_drafts_history WHERE draft_id = %s ORDER BY draft_date DESC',
130 $draftHistory =
new self();
131 $draftHistory = self::populateWithDatabaseRecord($draftHistory, $row);
133 $instances[] = $draftHistory;
144 $history_draft->
setDraftId((
int) $row[
'draft_id']);
149 return $history_draft;
152 public function delete():
void 154 $this->db->manipulateF(
155 'DELETE FROM frm_drafts_history WHERE history_id = %s',
163 $res = $this->db->queryF(
164 'SELECT * FROM frm_drafts_history WHERE draft_id = %s ORDER BY history_id ASC',
169 if ($row = $this->db->fetchAssoc(
$res)) {
179 $res = $this->db->queryF(
180 'SELECT * FROM frm_drafts_history WHERE draft_id = %s ORDER BY history_id DESC',
185 while ($row = $this->db->fetchAssoc(
$res)) {
195 $next_id = $this->db->nextId(
'frm_drafts_history');
197 'frm_drafts_history',
199 'history_id' => [
'integer', $next_id],
200 'draft_id' => [
'integer', $this->
getDraftId()],
203 'draft_date' => [
'timestamp', date(
"Y-m-d H:i:s")]
212 foreach ($oldMediaObjects as $oldMob) {
229 self::MEDIAOBJECT_TYPE,
235 $draft->updateDraft();
248 if ($post_ids !== []) {
249 $res = $this->db->query(
' 250 SELECT frm_drafts_history.history_id, frm_drafts_history.draft_id 251 FROM frm_posts_drafts 252 INNER JOIN frm_drafts_history ON frm_posts_drafts.draft_id 253 WHERE ' . $this->db->in(
'post_id', $post_ids,
false,
'integer'));
255 while ($row = $this->db->fetchAssoc(
$res)) {
256 $draft_ids[] = (
int) $row[
'draft_id'];
270 if ($draft_ids !== []) {
271 $res = $this->db->query(
272 'SELECT history_id FROM frm_drafts_history WHERE ' . $this->db->in(
'draft_id', $draft_ids,
false,
'integer')
275 while ($row = $this->db->fetchAssoc(
$res)) {
280 $this->db->manipulate(
281 'DELETE FROM frm_drafts_history WHERE ' . $this->db->in(
'draft_id', $draft_ids,
false,
'integer')
static getInstancesByDraftId(int $draft_id)
static moveMediaObjects(string $post_message, string $source_type, int $source_id, string $target_type, int $target_id, int $direction=0)
readByHistoryId(int $history_id)
deleteHistoryByPostIds(array $post_ids=[])
getLastAutosaveByDraftId(int $draft_id)
setDraftDate(string $draft_date)
setHistoryId(int $history_id)
Class ilForumDraftHistory.
setPostSubject(string $post_subject)
deleteHistoryByDraftIds(array $draft_ids=[])
setPostMessage(string $post_message)
getFirstAutosaveByDraftId(int $draft_id)
setDraftId(int $draft_id)
static newInstanceByDraftId(int $draft_id)
static populateWithDatabaseRecord(ilForumDraftsHistory $history_draft, array $row)
__construct(int $history_id=0)