ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilForumPostDraft Class Reference

Class ilForumPostDraft. More...

+ Collaboration diagram for ilForumPostDraft:

Public Member Functions

 getPostNotify ()
 
 setPostNotify ($post_notify)
 
 getDraftId ()
 
 setDraftId ($draft_id)
 
 getPostId ()
 
 setPostId ($post_id)
 
 getForumId ()
 
 setForumId ($forum_id)
 
 getThreadId ()
 
 setThreadId ($thread_id)
 
 getPostSubject ()
 
 setPostSubject ($post_subject)
 
 getPostMessage ()
 
 setPostMessage ($post_message)
 
 getPostDate ()
 
 setPostDate ($post_date)
 
 getPostUpdate ()
 
 setPostUpdate ($post_update)
 
 getUpdateUserId ()
 
 setUpdateUserId ($update_user_id)
 
 getPostUserAlias ()
 
 setPostUserAlias ($post_user_alias)
 
 getPostAuthorId ()
 
 setPostAuthorId ($post_author_id)
 
 getPostDisplayUserId ()
 
 setPostDisplayUserId ($post_display_user_id)
 
 getNotify ()
 
 setNotify ($notify)
 
 __construct ($user_id=0, $post_id=0, $draft_id=0)
 ilForumPostDraft constructor. More...
 
 saveDraft ()
 
 updateDraft ()
 
 deleteDraft ()
 
 deleteDraftsByDraftIds (array $draft_ids=array())
 

Static Public Member Functions

static getDraftInstancesByUserId ($user_id)
 
static getInstancesByUserIdAndThreadId ($user_id, $thread_id)
 
static deleteMobsOfDraft ($draft_id)
 
static deleteDraftsByUserId ($user_id)
 
static isSavePostDraftAllowed ()
 
static isAutoSavePostDraftAllowed ()
 
static lookupAutosaveInterval ()
 
static getDraftsStatisticsByRefId ($ref_id)
 
static moveDraftsByMergedThreads ($source_thread_id, $target_thread_id)
 
static moveDraftsByMovedThread ($thread_ids, $source_ref_id, $target_ref_id)
 
static getThreadDraftData ($post_author_id, $forum_id)
 
static createDraftBackup ($draft_id)
 

Data Fields

const MEDIAOBJECT_TYPE = 'frm~d:html'
 

Protected Member Functions

 readDraft ()
 

Static Protected Member Functions

static populateWithDatabaseRecord (ilForumPostDraft $draft, array $row)
 
static readDrafts ($user_id)
 

Protected Attributes

 $draft_id = 0
 
 $post_id = 0
 
 $forum_id = 0
 
 $thread_id = 0
 
 $post_subject = ''
 
 $post_message = ''
 
 $post_date = '0000-00-00 00:00:00'
 
 $post_update = '0000-00-00 00:00:00'
 
 $update_user_id = 0
 
 $post_user_alias = ''
 
 $post_author_id = 0
 
 $post_display_user_id = 0
 
 $notify = 0
 
 $post_notify = 0
 

Static Protected Attributes

static $forum_statistics_cache = array()
 
static $drafts_settings_cache = array()
 

Static Private Attributes

static $instances = array()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumPostDraft::__construct (   $user_id = 0,
  $post_id = 0,
  $draft_id = 0 
)

ilForumPostDraft constructor.

Parameters
int$user_id
int$post_id

Definition at line 333 of file class.ilForumPostDraft.php.

References $draft_id, $post_id, readDraft(), setDraftId(), setPostAuthorId(), and setPostId().

334  {
335  if($user_id && $post_id && $draft_id)
336  {
337  $this->setPostAuthorId($user_id);
338  $this->setPostId($post_id);
339  $this->setDraftId($draft_id);
340  $this->readDraft();
341  }
342  }
setPostAuthorId($post_author_id)
+ Here is the call graph for this function:

Member Function Documentation

◆ createDraftBackup()

static ilForumPostDraft::createDraftBackup (   $draft_id)
static
Parameters
$draft_id

Definition at line 728 of file class.ilForumPostDraft.php.

References $draft_id, $ilDB, $res, $row, array, ilForumDraftsHistory\MEDIAOBJECT_TYPE, and ilForumUtil\moveMediaObjects().

Referenced by ilObjForumGUI\doHistoryCheck(), and ilObjForumGUI\restoreFromHistoryObject().

729  {
730  global $ilDB;
731 
732  $res = $ilDB->queryF('SELECT * FROM frm_posts_drafts WHERE draft_id = %s',
733  array('integer'), array((int)$draft_id));
734 
735  while($row = $ilDB->fetchAssoc($res))
736  {
737  $tmp_obj = new self;
738  self::populateWithDatabaseRecord($tmp_obj,$row);
739  }
740 
741  $history_obj = new ilForumDraftsHistory();
742  $history_obj->deleteHistoryByDraftIds(array($draft_id));
743 
744  $history_obj->setDraftId($draft_id);
745  $history_obj->setPostSubject($tmp_obj->getPostSubject());
746  $history_obj->setPostMessage($tmp_obj->getPostMessage());
747  $history_obj->addDraftToHistory();
748 
749  ilForumUtil::moveMediaObjects($tmp_obj->getPostMessage(),
750  self::MEDIAOBJECT_TYPE, $draft_id,
751  ilForumDraftsHistory::MEDIAOBJECT_TYPE, $history_obj->getHistoryId());
752  }
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
Class ilForumDraftHistory.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteDraft()

ilForumPostDraft::deleteDraft ( )

Definition at line 513 of file class.ilForumPostDraft.php.

References $ilDB, array, and getDraftId().

Referenced by ilObjForumGUI\publishDraftObject().

514  {
515  global $ilDB;
516 
517  $ilDB->manipulateF('DELETE FROM frm_posts_drafts WHERE draft_id = %s',
518  array('integer'), array($this->getDraftId()));
519  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteDraftsByDraftIds()

ilForumPostDraft::deleteDraftsByDraftIds ( array  $draft_ids = array())
Parameters
array$draft_ids

Definition at line 543 of file class.ilForumPostDraft.php.

References $draft_id, and $ilDB.

544  {
545  global $ilDB;
546 
547  foreach($draft_ids as $draft_id)
548  {
549  self::deleteMobsOfDraft($draft_id);
550 
551  // delete attachments of draft
552  $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draft_id);
553  $objFileDataForumDrafts->delete();
554  }
555  $ilDB->manipulate('DELETE FROM frm_drafts_history WHERE ' . $ilDB->in('draft_id', $draft_ids, false, 'integer'));
556  $ilDB->manipulate('DELETE FROM frm_posts_drafts WHERE ' . $ilDB->in('draft_id', $draft_ids, false, 'integer'));
557  }
This class handles all operations on files for the drafts of a forum object.
global $ilDB

◆ deleteDraftsByUserId()

static ilForumPostDraft::deleteDraftsByUserId (   $user_id)
static
Parameters
int$user_id

Definition at line 562 of file class.ilForumPostDraft.php.

References $draft_id, $ilDB, $res, $row, and array.

563  {
564  global $ilDB;
565 
566  $res = $ilDB->queryF('SELECT draft_id FROM frm_posts_drafts WHERE post_author_id = %s',
567  array('integer'), array($user_id));
568 
569  $draft_ids = array();
570  while($row = $ilDB->fetchAssoc($res))
571  {
572  $draft_ids[] = $row['draft_id'];
573  }
574 
575  foreach($draft_ids as $draft_id)
576  {
577  self::deleteMobsOfDraft($draft_id);
578 
579  // delete attachments of draft
580  $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draft_id);
581  $objFileDataForumDrafts->delete();
582  }
583 
584  $ilDB->manipulate('DELETE FROM frm_drafts_history WHERE ' . $ilDB->in('draft_id', $draft_ids, false, 'integer'));
585  $ilDB->manipulateF('DELETE FROM frm_posts_drafts WHERE post_author_id = %s',
586  array('integer'), array($user_id));
587  }
This class handles all operations on files for the drafts of a forum object.
Create styles array
The data for the language used.
global $ilDB

◆ deleteMobsOfDraft()

static ilForumPostDraft::deleteMobsOfDraft (   $draft_id)
static
Parameters
$draft_id

Definition at line 524 of file class.ilForumPostDraft.php.

References $draft_id, ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), and ilObjMediaObject\_removeUsage().

525  {
526  require_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
527  // delete mobs of draft
528  $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draft_id);
529  foreach($oldMediaObjects as $oldMob)
530  {
531  if(ilObjMediaObject::_exists($oldMob))
532  {
533  ilObjMediaObject::_removeUsage($oldMob, 'frm~d:html', $draft_id);
534  $mob_obj = new ilObjMediaObject($oldMob);
535  $mob_obj->delete();
536  }
537  }
538  }
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static _exists($a_id, $a_reference=false, $a_type=NULL)
checks wether a lm content object with specified id exists or not
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
Class ilObjMediaObject.
+ Here is the call graph for this function:

◆ getDraftId()

ilForumPostDraft::getDraftId ( )
Returns
int

Definition at line 123 of file class.ilForumPostDraft.php.

References $draft_id.

Referenced by ilObjForumGUI\createTopLevelPostObject(), deleteDraft(), readDraft(), and updateDraft().

124  {
125  return $this->draft_id;
126  }
+ Here is the caller graph for this function:

◆ getDraftInstancesByUserId()

static ilForumPostDraft::getDraftInstancesByUserId (   $user_id)
static
Parameters
int$user_id
Returns
mixed

Definition at line 388 of file class.ilForumPostDraft.php.

Referenced by ilObjForumGUI\confirmDeleteThreadDraftsObject(), ilObjForumGUI\deleteThreadDraftsObject(), and ilForumPostingDraftsBlockGUI\fillDataSection().

389  {
390  if(!self::$instances[$user_id])
391  {
392  self::readDrafts($user_id);
393  }
394 
395  return self::$instances[$user_id]['draft_ids'];
396  }
+ Here is the caller graph for this function:

◆ getDraftsStatisticsByRefId()

static ilForumPostDraft::getDraftsStatisticsByRefId (   $ref_id)
static
Parameters
$ref_id
Returns
mixed

Definition at line 635 of file class.ilForumPostDraft.php.

References $ilDB, $ilUser, $ref_id, $res, $row, array, and ilObjForum\lookupForumIdByRefId().

Referenced by ilObjForumListGUI\init(), and ilForumTopicTableGUI\initMergeThreadsTable().

636  {
637  global $ilUser, $ilDB;
638 
639  if(!isset(self::$forum_statistics_cache[$ref_id][$ilUser->getId()]))
640  {
642 
643  $res = $ilDB->queryF('
644  SELECT COUNT(draft_id) num_drafts, thread_id FROM frm_posts_drafts
645  WHERE forum_id = %s AND post_author_id = %s
646  GROUP BY thread_id',
647  array('integer', 'integer'), array($forumId, $ilUser->getId()));
648 
649  $num_drafts_total = 0;
650 
651  while($row = $ilDB->fetchAssoc($res))
652  {
653  $num_drafts_total += $row['num_drafts'];
654  self::$forum_statistics_cache[$ref_id][$ilUser->getId()][$row['thread_id']] = $row['num_drafts'];
655  }
656 
657  self::$forum_statistics_cache[$ref_id][$ilUser->getId()]['total'] = $num_drafts_total;
658  }
659  return self::$forum_statistics_cache[$ref_id][$ilUser->getId()];
660  }
static lookupForumIdByRefId($ref_id)
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
$ref_id
Definition: sahs_server.php:39
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getForumId()

ilForumPostDraft::getForumId ( )
Returns
int

Definition at line 155 of file class.ilForumPostDraft.php.

References $forum_id.

Referenced by saveDraft().

156  {
157  return $this->forum_id;
158  }
+ Here is the caller graph for this function:

◆ getInstancesByUserIdAndThreadId()

static ilForumPostDraft::getInstancesByUserIdAndThreadId (   $user_id,
  $thread_id 
)
static
Parameters
$user_id
$thread_id
Returns
mixed

Definition at line 403 of file class.ilForumPostDraft.php.

References $draft_id, $ilDB, $res, $row, $thread_id, and array.

Referenced by ilObjForumGUI\autosaveThreadDraftAsyncObject(), ilObjForumGUI\getForumObjects(), and ilObjForumGUI\getSubTabs().

404  {
405  if(!self::$instances[$user_id])
406  {
407  self::readDrafts($user_id);
408  }
409 
410  if(self::$instances[$user_id][$thread_id])
411  {
412  return self::$instances[$user_id][$thread_id];
413  }
414  }
+ Here is the caller graph for this function:

◆ getNotify()

ilForumPostDraft::getNotify ( )
Returns
int

Definition at line 315 of file class.ilForumPostDraft.php.

References $notify.

Referenced by saveDraft(), and updateDraft().

316  {
317  return $this->notify;
318  }
+ Here is the caller graph for this function:

◆ getPostAuthorId()

ilForumPostDraft::getPostAuthorId ( )
Returns
int

Definition at line 283 of file class.ilForumPostDraft.php.

References $post_author_id.

Referenced by ilObjForumGUI\checkDraftAccess(), ilObjForumGUI\deleteSelectedDraft(), readDraft(), and saveDraft().

284  {
285  return $this->post_author_id;
286  }
+ Here is the caller graph for this function:

◆ getPostDate()

ilForumPostDraft::getPostDate ( )
Returns
string

Definition at line 219 of file class.ilForumPostDraft.php.

References $post_date.

220  {
221  return $this->post_date;
222  }

◆ getPostDisplayUserId()

ilForumPostDraft::getPostDisplayUserId ( )
Returns
int

Definition at line 299 of file class.ilForumPostDraft.php.

References $post_display_user_id.

Referenced by saveDraft(), and updateDraft().

300  {
302  }
+ Here is the caller graph for this function:

◆ getPostId()

ilForumPostDraft::getPostId ( )
Returns
int

Definition at line 139 of file class.ilForumPostDraft.php.

References $post_id.

Referenced by readDraft(), and saveDraft().

140  {
141  return $this->post_id;
142  }
+ Here is the caller graph for this function:

◆ getPostMessage()

ilForumPostDraft::getPostMessage ( )
Returns
string

Definition at line 203 of file class.ilForumPostDraft.php.

References $post_message.

Referenced by saveDraft(), and updateDraft().

204  {
205  return $this->post_message;
206  }
+ Here is the caller graph for this function:

◆ getPostNotify()

ilForumPostDraft::getPostNotify ( )
Returns
int

Definition at line 107 of file class.ilForumPostDraft.php.

References $post_notify.

Referenced by saveDraft(), and updateDraft().

108  {
109  return $this->post_notify;
110  }
+ Here is the caller graph for this function:

◆ getPostSubject()

ilForumPostDraft::getPostSubject ( )
Returns
string

Definition at line 187 of file class.ilForumPostDraft.php.

References $post_subject.

Referenced by saveDraft(), and updateDraft().

188  {
189  return $this->post_subject;
190  }
+ Here is the caller graph for this function:

◆ getPostUpdate()

ilForumPostDraft::getPostUpdate ( )
Returns
string

Definition at line 235 of file class.ilForumPostDraft.php.

References $post_update.

236  {
237  return $this->post_update;
238  }

◆ getPostUserAlias()

ilForumPostDraft::getPostUserAlias ( )
Returns
string

Definition at line 267 of file class.ilForumPostDraft.php.

References $post_user_alias.

Referenced by saveDraft(), and updateDraft().

268  {
269  return $this->post_user_alias;
270  }
+ Here is the caller graph for this function:

◆ getThreadDraftData()

static ilForumPostDraft::getThreadDraftData (   $post_author_id,
  $forum_id 
)
static
Parameters
$post_author_id
$forum_id
Returns
array

Definition at line 703 of file class.ilForumPostDraft.php.

References $forum_id, $ilDB, $post_author_id, $res, $row, and array.

Referenced by ilObjForumGUI\getSubTabs().

704  {
705  global $ilDB;
706 
707  $res = $ilDB->queryF('SELECT * FROM frm_posts_drafts
708  WHERE post_author_id = %s
709  AND forum_id = %s
710  AND thread_id = %s
711  AND post_id = %s
712  ORDER BY post_date DESC',
713  array('integer', 'integer', 'integer', 'integer'),
715  $draft_data = array();
716  while($row = $ilDB->fetchAssoc($res))
717  {
718  $tmp_obj = new self;
719  self::populateWithDatabaseRecord($tmp_obj, $row);
720  $draft_data[] = array('subject'=> $tmp_obj->getPostSubject(), 'post_update' => $tmp_obj->getPostUpdate(), 'draft_id' => $tmp_obj->getDraftId());
721  }
722  return $draft_data;
723  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getThreadId()

ilForumPostDraft::getThreadId ( )
Returns
int

Definition at line 171 of file class.ilForumPostDraft.php.

References $thread_id.

Referenced by saveDraft().

172  {
173  return $this->thread_id;
174  }
+ Here is the caller graph for this function:

◆ getUpdateUserId()

ilForumPostDraft::getUpdateUserId ( )
Returns
int

Definition at line 251 of file class.ilForumPostDraft.php.

References $update_user_id.

Referenced by updateDraft().

252  {
253  return $this->update_user_id;
254  }
+ Here is the caller graph for this function:

◆ isAutoSavePostDraftAllowed()

static ilForumPostDraft::isAutoSavePostDraftAllowed ( )
static
Returns
bool

Definition at line 605 of file class.ilForumPostDraft.php.

References $ilSetting.

Referenced by ilObjForumGUI\addAutosave(), ilObjForumGUI\autosaveDraftAsyncObject(), ilObjForumGUI\autosaveThreadDraftAsyncObject(), ilObjForumGUI\cancelDraftObject(), ilObjForumGUI\doHistoryCheck(), ilObjForumGUI\editDraftObject(), ilObjForumGUI\publishDraftObject(), and ilObjForumGUI\restoreFromHistoryObject().

606  {
607  if(!self::isSavePostDraftAllowed())
608  {
609  // feature is globally deactivated
610  return false;
611  }
612  if(!isset(self::$drafts_settings_cache['autosave_drafts']))
613  {
614  global $ilSetting;
615 
616  self::$drafts_settings_cache['autosave_drafts'] = (bool)$ilSetting->get('autosave_drafts', false);
617  self::$drafts_settings_cache['autosave_drafts_ival'] = (int)$ilSetting->get('autosave_drafts_ival', 30);
618  }
619  return self::$drafts_settings_cache['autosave_drafts'];
620  }
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ isSavePostDraftAllowed()

static ilForumPostDraft::isSavePostDraftAllowed ( )
static
Returns
bool

Definition at line 592 of file class.ilForumPostDraft.php.

References $ilSetting.

Referenced by ilObjForumGUI\cancelDraftObject(), ilObjForumGUI\createThreadObject(), ilObjForumGUI\createTopLevelPostObject(), ilObjForumGUI\deleteSelectedDraft(), ilObjForumGUI\deleteThreadDraftsObject(), ilObjForumGUI\editDraftObject(), ilObjForumGUI\getForumObjects(), ilObjForumGUI\getSubTabs(), ilObjForumListGUI\init(), ilObjForumGUI\isWritingWithPseudonymAllowed(), ilObjForumGUI\publishDraftObject(), and ilObjForumGUI\restoreFromHistoryObject().

593  {
594  if(!isset(self::$drafts_settings_cache['save_post_drafts']))
595  {
596  global $ilSetting;
597  self::$drafts_settings_cache['save_post_drafts'] = (bool)$ilSetting->get('save_post_drafts', false);
598  }
599  return self::$drafts_settings_cache['save_post_drafts'];
600  }
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ lookupAutosaveInterval()

static ilForumPostDraft::lookupAutosaveInterval ( )
static

Definition at line 622 of file class.ilForumPostDraft.php.

Referenced by ilObjForumGUI\addAutosave(), and ilObjForumGUI\cancelDraftObject().

623  {
624  if(self::isAutoSavePostDraftAllowed())
625  {
626  return self::$drafts_settings_cache['autosave_drafts_ival'];
627  }
628  return 0;
629  }
+ Here is the caller graph for this function:

◆ moveDraftsByMergedThreads()

static ilForumPostDraft::moveDraftsByMergedThreads (   $source_thread_id,
  $target_thread_id 
)
static
Parameters
$source_thread_id
$target_thread_id

Definition at line 666 of file class.ilForumPostDraft.php.

References $ilDB, and array.

667  {
668  global $ilDB;
669 
670  $ilDB->update('frm_posts_drafts',
671  array('thread_id' => array('integer', $target_thread_id)),
672  array('thread_id' => array('integer', $source_thread_id))
673  );
674  }
Create styles array
The data for the language used.
global $ilDB

◆ moveDraftsByMovedThread()

static ilForumPostDraft::moveDraftsByMovedThread (   $thread_ids,
  $source_ref_id,
  $target_ref_id 
)
static
Parameters
array$thread_ids
int$source_ref_id
int$target_ref_id

Definition at line 681 of file class.ilForumPostDraft.php.

References $ilDB, array, and ilObjForum\lookupForumIdByRefId().

682  {
683  global $ilDB;
684 
685  $source_forum_id = ilObjForum::lookupForumIdByRefId($source_ref_id);
686  $target_forum_id = ilObjForum::lookupForumIdByRefId($target_ref_id);
687 
688  $ilDB->manipulateF('
689  UPDATE frm_posts_drafts
690  SET forum_id = %s
691  WHERE forum_id = %s
692  AND '. $ilDB->in('thread_id', $thread_ids, false, 'integer'),
693  array('integer', 'integer'),
694  array($target_forum_id, $source_forum_id)
695  );
696  }
static lookupForumIdByRefId($ref_id)
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ populateWithDatabaseRecord()

static ilForumPostDraft::populateWithDatabaseRecord ( ilForumPostDraft  $draft,
array  $row 
)
staticprotected
Parameters
$draftilForumPostDraft
$rowarray

Definition at line 86 of file class.ilForumPostDraft.php.

References setDraftId(), setForumId(), setNotify(), setPostAuthorId(), setPostDate(), setPostDisplayUserId(), setPostId(), setPostMessage(), setPostNotify(), setPostSubject(), setPostUpdate(), setPostUserAlias(), setThreadId(), and setUpdateUserId().

87  {
88  $draft->setDraftId($row['draft_id']);
89  $draft->setForumId($row['forum_id']);
90  $draft->setPostAuthorId($row['post_author_id']);
91  $draft->setPostDate($row['post_date']);
92  $draft->setPostDisplayUserId($row['pos_display_usr_id']);
93  $draft->setPostId($row['post_id']);
94  $draft->setPostMessage($row['post_message']);
95  $draft->setPostSubject($row['post_subject']);
96  $draft->setPostUpdate($row['post_update']);
97  $draft->setPostUserAlias($row['post_user_alias']);
98  $draft->setThreadId($row['thread_id']);
99  $draft->setUpdateUserId($row['update_user_id']);
100  $draft->setNotify($row['notify']);
101  $draft->setPostNotify($row['post_notify']);
102  }
setPostUserAlias($post_user_alias)
setPostDisplayUserId($post_display_user_id)
setUpdateUserId($update_user_id)
setPostMessage($post_message)
setPostSubject($post_subject)
setPostAuthorId($post_author_id)
+ Here is the call graph for this function:

◆ readDraft()

ilForumPostDraft::readDraft ( )
protected

Definition at line 347 of file class.ilForumPostDraft.php.

References $ilDB, $res, $row, array, getDraftId(), getPostAuthorId(), and getPostId().

Referenced by __construct().

348  {
349  global $ilDB;
350 
351  $res = $ilDB->queryF(
352  'SELECT * FROM frm_posts_drafts WHERE post_author_id = %s AND post_id = %s AND draft_id = %s',
353  array('integer', 'integer','integer'),
354  array($this->getPostAuthorId(), $this->getPostId(), $this->getDraftId())
355  );
356 
357  while($row = $ilDB->fetchAssoc($res))
358  {
359  self::populateWithDatabaseRecord($this, $row);
360  }
361  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readDrafts()

static ilForumPostDraft::readDrafts (   $user_id)
staticprotected
Parameters
int$user_id

Definition at line 366 of file class.ilForumPostDraft.php.

References $ilDB, $res, $row, and array.

367  {
368  global $ilDB;
369 
370  $res = $ilDB->queryF('SELECT * FROM frm_posts_drafts WHERE post_author_id = %s',
371  array('integer'), array($user_id));
372 
373  self::$instances[$user_id] = array();
374  while($row = $ilDB->fetchAssoc($res))
375  {
376  $tmp_obj = new ilForumPostDraft();
377  self::populateWithDatabaseRecord($tmp_obj, $row);
378  self::$instances[$user_id][$row['thread_id']][$tmp_obj->getPostId()][] = $tmp_obj;
379  self::$instances[$user_id]['draft_ids'][$tmp_obj->getDraftId()] = $tmp_obj;
380  }
381  unset($tmp_obj);
382  }
Class ilForumPostDraft.
Create styles array
The data for the language used.
global $ilDB

◆ saveDraft()

ilForumPostDraft::saveDraft ( )

Definition at line 469 of file class.ilForumPostDraft.php.

References $draft_id, $ilDB, $post_date, array, date, getForumId(), getNotify(), getPostAuthorId(), getPostDisplayUserId(), getPostId(), getPostMessage(), getPostNotify(), getPostSubject(), getPostUserAlias(), getThreadId(), and setDraftId().

470  {
471  global $ilDB;
472 
473  $draft_id = $ilDB->nextId('frm_posts_drafts');
474  $post_date = date("Y-m-d H:i:s");
475 
476  $ilDB->insert('frm_posts_drafts', array(
477  'draft_id' => array('integer', $draft_id),
478  'post_id' => array('integer', $this->getPostId()),
479  'thread_id' => array('integer', $this->getThreadId()),
480  'forum_id' => array('integer', $this->getForumId()),
481  'post_author_id' => array('integer', $this->getPostAuthorId()),
482  'post_subject' => array('text', $this->getPostSubject()),
483  'post_message' => array('clob', $this->getPostMessage()),
484  'notify' => array('integer', $this->getNotify()),
485  'post_notify' => array('integer', $this->getPostNotify()),
486  'post_date' => array('timestamp', $post_date),
487  'post_update' => array('timestamp', $post_date),
488 // 'update_user_id' => array('integer', $this->getUpdateUserId()),
489  'post_user_alias' => array('text', $this->getPostUserAlias()),
490  'pos_display_usr_id' => array('integer', $this->getPostDisplayUserId())
491  ));
492  $this->setDraftId($draft_id);
493  return $draft_id;
494  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ setDraftId()

ilForumPostDraft::setDraftId (   $draft_id)
Parameters
int$draft_id

Definition at line 131 of file class.ilForumPostDraft.php.

References $draft_id.

Referenced by __construct(), populateWithDatabaseRecord(), and saveDraft().

132  {
133  $this->draft_id = $draft_id;
134  }
+ Here is the caller graph for this function:

◆ setForumId()

ilForumPostDraft::setForumId (   $forum_id)
Parameters
int$forum_id

Definition at line 163 of file class.ilForumPostDraft.php.

References $forum_id.

Referenced by populateWithDatabaseRecord().

164  {
165  $this->forum_id = $forum_id;
166  }
+ Here is the caller graph for this function:

◆ setNotify()

ilForumPostDraft::setNotify (   $notify)
Parameters
int$notify

Definition at line 323 of file class.ilForumPostDraft.php.

References $notify.

Referenced by populateWithDatabaseRecord().

324  {
325  $this->notify = $notify;
326  }
+ Here is the caller graph for this function:

◆ setPostAuthorId()

ilForumPostDraft::setPostAuthorId (   $post_author_id)
Parameters
int$post_author_id

Definition at line 291 of file class.ilForumPostDraft.php.

References $post_author_id.

Referenced by __construct(), and populateWithDatabaseRecord().

292  {
293  $this->post_author_id = $post_author_id;
294  }
+ Here is the caller graph for this function:

◆ setPostDate()

ilForumPostDraft::setPostDate (   $post_date)
Parameters
string$post_date

Definition at line 227 of file class.ilForumPostDraft.php.

References $post_date.

Referenced by populateWithDatabaseRecord().

228  {
229  $this->post_date = $post_date;
230  }
+ Here is the caller graph for this function:

◆ setPostDisplayUserId()

ilForumPostDraft::setPostDisplayUserId (   $post_display_user_id)
Parameters
int$post_display_user_id

Definition at line 307 of file class.ilForumPostDraft.php.

References $post_display_user_id.

Referenced by populateWithDatabaseRecord().

308  {
309  $this->post_display_user_id = $post_display_user_id;
310  }
+ Here is the caller graph for this function:

◆ setPostId()

ilForumPostDraft::setPostId (   $post_id)
Parameters
int$post_id

Definition at line 147 of file class.ilForumPostDraft.php.

References $post_id.

Referenced by __construct(), and populateWithDatabaseRecord().

148  {
149  $this->post_id = $post_id;
150  }
+ Here is the caller graph for this function:

◆ setPostMessage()

ilForumPostDraft::setPostMessage (   $post_message)
Parameters
string$post_message

Definition at line 211 of file class.ilForumPostDraft.php.

References $post_message.

Referenced by populateWithDatabaseRecord().

212  {
213  $this->post_message = $post_message;
214  }
+ Here is the caller graph for this function:

◆ setPostNotify()

ilForumPostDraft::setPostNotify (   $post_notify)
Parameters
int$post_notify

Definition at line 115 of file class.ilForumPostDraft.php.

References $post_notify.

Referenced by populateWithDatabaseRecord().

116  {
117  $this->post_notify = $post_notify;
118  }
+ Here is the caller graph for this function:

◆ setPostSubject()

ilForumPostDraft::setPostSubject (   $post_subject)
Parameters
string$post_subject

Definition at line 195 of file class.ilForumPostDraft.php.

References $post_subject.

Referenced by populateWithDatabaseRecord().

196  {
197  $this->post_subject = $post_subject;
198  }
+ Here is the caller graph for this function:

◆ setPostUpdate()

ilForumPostDraft::setPostUpdate (   $post_update)
Parameters
string$post_update

Definition at line 243 of file class.ilForumPostDraft.php.

References $post_update.

Referenced by populateWithDatabaseRecord().

244  {
245  $this->post_update = $post_update;
246  }
+ Here is the caller graph for this function:

◆ setPostUserAlias()

ilForumPostDraft::setPostUserAlias (   $post_user_alias)
Parameters
string$post_user_alias

Definition at line 275 of file class.ilForumPostDraft.php.

References $post_user_alias.

Referenced by populateWithDatabaseRecord().

276  {
277  $this->post_user_alias = $post_user_alias;
278  }
+ Here is the caller graph for this function:

◆ setThreadId()

ilForumPostDraft::setThreadId (   $thread_id)
Parameters
int$thread_id

Definition at line 179 of file class.ilForumPostDraft.php.

References $thread_id.

Referenced by populateWithDatabaseRecord().

180  {
181  $this->thread_id = $thread_id;
182  }
+ Here is the caller graph for this function:

◆ setUpdateUserId()

ilForumPostDraft::setUpdateUserId (   $update_user_id)
Parameters
int$update_user

Definition at line 259 of file class.ilForumPostDraft.php.

References $update_user_id.

Referenced by populateWithDatabaseRecord().

260  {
261  $this->update_user_id = $update_user_id;
262  }
+ Here is the caller graph for this function:

◆ updateDraft()

ilForumPostDraft::updateDraft ( )

Definition at line 496 of file class.ilForumPostDraft.php.

References $ilDB, array, date, getDraftId(), getNotify(), getPostDisplayUserId(), getPostMessage(), getPostNotify(), getPostSubject(), getPostUserAlias(), and getUpdateUserId().

497  {
498  global $ilDB;
499 
500  $ilDB->update('frm_posts_drafts', array(
501  'post_subject' => array('text', $this->getPostSubject()),
502  'post_message' => array('clob', $this->getPostMessage()),
503  'notify' => array('integer', $this->getNotify()),
504  'post_notify' => array('integer', $this->getPostNotify()),
505  'post_update' => array('timestamp', date("Y-m-d H:i:s")),
506  'update_user_id' => array('integer', $this->getUpdateUserId()),
507  'post_user_alias' => array('text', $this->getPostUserAlias()),
508  'pos_display_usr_id' => array('integer', $this->getPostDisplayUserId())
509  ),
510  array('draft_id' => array('integer', $this->getDraftId())));
511  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $draft_id

◆ $drafts_settings_cache

ilForumPostDraft::$drafts_settings_cache = array()
staticprotected

Definition at line 80 of file class.ilForumPostDraft.php.

◆ $forum_id

ilForumPostDraft::$forum_id = 0
protected

Definition at line 22 of file class.ilForumPostDraft.php.

Referenced by getForumId(), getThreadDraftData(), and setForumId().

◆ $forum_statistics_cache

ilForumPostDraft::$forum_statistics_cache = array()
staticprotected

Definition at line 75 of file class.ilForumPostDraft.php.

◆ $instances

ilForumPostDraft::$instances = array()
staticprivate

Definition at line 69 of file class.ilForumPostDraft.php.

◆ $notify

ilForumPostDraft::$notify = 0
protected

Definition at line 63 of file class.ilForumPostDraft.php.

Referenced by getNotify(), and setNotify().

◆ $post_author_id

ilForumPostDraft::$post_author_id = 0
protected

Definition at line 54 of file class.ilForumPostDraft.php.

Referenced by getPostAuthorId(), getThreadDraftData(), and setPostAuthorId().

◆ $post_date

ilForumPostDraft::$post_date = '0000-00-00 00:00:00'
protected

Definition at line 38 of file class.ilForumPostDraft.php.

Referenced by getPostDate(), saveDraft(), and setPostDate().

◆ $post_display_user_id

ilForumPostDraft::$post_display_user_id = 0
protected

Definition at line 58 of file class.ilForumPostDraft.php.

Referenced by getPostDisplayUserId(), and setPostDisplayUserId().

◆ $post_id

ilForumPostDraft::$post_id = 0
protected

Definition at line 18 of file class.ilForumPostDraft.php.

Referenced by __construct(), getPostId(), and setPostId().

◆ $post_message

ilForumPostDraft::$post_message = ''
protected

Definition at line 34 of file class.ilForumPostDraft.php.

Referenced by getPostMessage(), and setPostMessage().

◆ $post_notify

ilForumPostDraft::$post_notify = 0
protected

Definition at line 64 of file class.ilForumPostDraft.php.

Referenced by getPostNotify(), and setPostNotify().

◆ $post_subject

ilForumPostDraft::$post_subject = ''
protected

Definition at line 30 of file class.ilForumPostDraft.php.

Referenced by getPostSubject(), and setPostSubject().

◆ $post_update

ilForumPostDraft::$post_update = '0000-00-00 00:00:00'
protected

Definition at line 42 of file class.ilForumPostDraft.php.

Referenced by getPostUpdate(), and setPostUpdate().

◆ $post_user_alias

ilForumPostDraft::$post_user_alias = ''
protected

Definition at line 50 of file class.ilForumPostDraft.php.

Referenced by getPostUserAlias(), and setPostUserAlias().

◆ $thread_id

ilForumPostDraft::$thread_id = 0
protected

◆ $update_user_id

ilForumPostDraft::$update_user_id = 0
protected

Definition at line 46 of file class.ilForumPostDraft.php.

Referenced by getUpdateUserId(), and setUpdateUserId().

◆ MEDIAOBJECT_TYPE


The documentation for this class was generated from the following file: