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)) {
122 $ilDB = $DIC->database();
125 'SELECT * FROM frm_drafts_history WHERE draft_id = %s ORDER BY draft_date DESC',
131 $draftHistory =
new self();
132 $draftHistory = self::populateWithDatabaseRecord($draftHistory, $row);
134 $instances[] = $draftHistory;
145 $history_draft->
setDraftId((
int) $row[
'draft_id']);
150 return $history_draft;
153 public function delete():
void 155 $this->db->manipulateF(
156 'DELETE FROM frm_drafts_history WHERE history_id = %s',
164 $res = $this->db->queryF(
165 'SELECT * FROM frm_drafts_history WHERE draft_id = %s ORDER BY history_id ASC',
170 if ($row = $this->db->fetchAssoc(
$res)) {
180 $res = $this->db->queryF(
181 'SELECT * FROM frm_drafts_history WHERE draft_id = %s ORDER BY history_id DESC',
186 while ($row = $this->db->fetchAssoc(
$res)) {
196 $next_id = $this->db->nextId(
'frm_drafts_history');
198 'frm_drafts_history',
200 'history_id' => [
'integer', $next_id],
201 'draft_id' => [
'integer', $this->
getDraftId()],
204 'draft_date' => [
'timestamp', date(
"Y-m-d H:i:s")]
213 foreach ($oldMediaObjects as $oldMob) {
230 self::MEDIAOBJECT_TYPE,
236 $draft->updateDraft();
249 if ($post_ids !== []) {
250 $res = $this->db->query(
' 251 SELECT frm_drafts_history.history_id, frm_drafts_history.draft_id 252 FROM frm_posts_drafts 253 INNER JOIN frm_drafts_history ON frm_posts_drafts.draft_id 254 WHERE ' . $this->db->in(
'post_id', $post_ids,
false,
'integer'));
256 while ($row = $this->db->fetchAssoc(
$res)) {
257 $draft_ids[] = (
int) $row[
'draft_id'];
271 if ($draft_ids !== []) {
272 $res = $this->db->query(
273 'SELECT history_id FROM frm_drafts_history WHERE ' . $this->db->in(
'draft_id', $draft_ids,
false,
'integer')
276 while ($row = $this->db->fetchAssoc(
$res)) {
281 $this->db->manipulate(
282 '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)