122 $this->db = $DIC->database();
135 $res = $this->db->queryF(
136 'SELECT * FROM frm_drafts_history WHERE history_id = %s',
141 while (
$row = $this->db->fetchAssoc(
$res)) {
153 $ilDB = $DIC->database();
156 'SELECT * FROM frm_drafts_history WHERE draft_id = %s ORDER BY draft_date DESC',
160 $instances = array();
163 $tmp_obj = self::populateWithDatabaseRecord($tmp_obj,
$row);
165 $instances[] = $tmp_obj;
184 return $history_draft;
187 public function delete()
189 $this->db->manipulatef(
190 'DELETE FROM frm_drafts_history WHERE history_id = %s',
201 $res = $this->db->queryF(
202 'SELECT * FROM frm_drafts_history WHERE draft_id = %s 203 ORDER BY history_id ASC',
208 if (
$row = $this->db->fetchAssoc(
$res)) {
220 $res = $this->db->queryF(
221 'SELECT * FROM frm_drafts_history WHERE draft_id = %s 222 ORDER BY history_id DESC',
227 while (
$row = $this->db->fetchAssoc(
$res)) {
237 $next_id = $this->db->nextId(
'frm_drafts_history');
239 'frm_drafts_history',
240 array(
'history_id' => array(
'integer', $next_id),
241 'draft_id' => array(
'integer', $this->
getDraftId()),
244 'draft_date' => array(
'timestamp', date(
"Y-m-d H:i:s"))
256 foreach ($mediaObjects as $mob) {
257 foreach ($myMediaObjects as $myMob) {
258 if ($mob == $myMob) {
272 foreach ($oldMediaObjects as $oldMob) {
289 self::MEDIAOBJECT_TYPE,
295 $draft->updateDraft();
306 $draft_ids = array();
307 if (count($post_ids) > 0) {
308 $res = $this->db->query(
' 309 SELECT frm_drafts_history.history_id, frm_drafts_history.draft_id 310 FROM frm_posts_drafts 311 INNER JOIN frm_drafts_history ON frm_posts_drafts.draft_id 312 WHERE ' . $this->db->in(
'post_id', $post_ids,
false,
'integer'));
314 while (
$row = $this->db->fetchAssoc(
$res)) {
315 $draft_ids[] =
$row[
'draft_id'];
325 if (count($draft_ids) > 0) {
326 $res = $this->db->query(
'SELECT history_id FROM frm_drafts_history 327 WHERE ' . $this->db->in(
'draft_id', $draft_ids,
false,
'integer'));
329 while (
$row = $this->db->fetchAssoc(
$res)) {
334 $this->db->manipulate(
'DELETE FROM frm_drafts_history WHERE ' 335 . $this->db->in(
'draft_id', $draft_ids,
false,
'integer'));
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
readByHistoryId($history_id)
setHistoryId($history_id)
addMobsToDraftsHistory($message)
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
setPostSubject($post_subject)
deleteHistoryByPostIds($post_ids=array())
__construct($history_id=0)
ilForumDraftsHistory constructor.
Class ilForumDraftHistory.
catch(Exception $e) $message
setDraftDate($draft_date)
foreach($_POST as $key=> $value) $res
static newInstanceByDraftId($draft_id)
static getInstancesByDraftId($draft_id)
getFirstAutosaveByDraftId($draft_id)
deleteHistoryByDraftIds($draft_ids=array())
setPostMessage($post_message)
static populateWithDatabaseRecord(ilForumDraftsHistory $history_draft, array $row)
getLastAutosaveByDraftId($draft_id)