ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 
 deleteDraftsByPostIds (array $post_ids=array())
 
 deleteDraftsByDraftIds (array $draft_ids=array())
 

Static Public Member Functions

static getDraftInstancesByUserId ($user_id)
 
static getInstancesByUserIdAndThreadId ($user_id, $thread_id)
 
static newInstanceByDraftId ($draft_id)
 
static newInstanceByHistorytId ($history_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.

334 {
335 global $DIC;
336
337 $this->db = $DIC->database();
338
339 if ($user_id && $post_id && $draft_id) {
340 $this->setPostAuthorId($user_id);
341 $this->setPostId($post_id);
342 $this->setDraftId($draft_id);
343 $this->readDraft();
344 }
345 }
setPostAuthorId($post_author_id)
global $DIC
Definition: saml.php:7

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

+ Here is the call graph for this function:

Member Function Documentation

◆ createDraftBackup()

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

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

752 {
753 global $DIC;
754 $ilDB = $DIC->database();
755
756 $res = $ilDB->queryF(
757 'SELECT * FROM frm_posts_drafts WHERE draft_id = %s',
758 array('integer'),
759 array((int) $draft_id)
760 );
761
762 while ($row = $ilDB->fetchAssoc($res)) {
763 $tmp_obj = new self;
765 }
766
767 $history_obj = new ilForumDraftsHistory();
768 $history_obj->deleteHistoryByDraftIds(array($draft_id));
769
770 $history_obj->setDraftId($draft_id);
771 $history_obj->setPostSubject($tmp_obj->getPostSubject());
772 $history_obj->setPostMessage($tmp_obj->getPostMessage());
773 $history_obj->addDraftToHistory();
774
776 $tmp_obj->getPostMessage(),
777 self::MEDIAOBJECT_TYPE,
778 $draft_id,
780 $history_obj->getHistoryId()
781 );
782 }
Class ilForumDraftHistory.
static populateWithDatabaseRecord(ilForumPostDraft $draft, array $row)
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
foreach($_POST as $key=> $value) $res
global $ilDB

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteDraft()

ilForumPostDraft::deleteDraft ( )

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

509 {
510 $this->db->manipulateF(
511 'DELETE FROM frm_posts_drafts WHERE draft_id = %s',
512 array('integer'),
513 array($this->getDraftId())
514 );
515 }

References getDraftId().

+ Here is the call graph for this function:

◆ deleteDraftsByDraftIds()

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

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

560 {
561 foreach ($draft_ids as $draft_id) {
563
564 // delete attachments of draft
565 $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draft_id);
566 $objFileDataForumDrafts->delete();
567 }
568 $this->db->manipulate('DELETE FROM frm_drafts_history WHERE ' . $this->db->in('draft_id', $draft_ids, false, 'integer'));
569 $this->db->manipulate('DELETE FROM frm_posts_drafts WHERE ' . $this->db->in('draft_id', $draft_ids, false, 'integer'));
570 }
This class handles all operations on files for the drafts of a forum object.
static deleteMobsOfDraft($draft_id)

References $draft_id, and deleteMobsOfDraft().

+ Here is the call graph for this function:

◆ deleteDraftsByPostIds()

ilForumPostDraft::deleteDraftsByPostIds ( array  $post_ids = array())
Parameters
array$post_ids

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

538 {
539 $draft_ids = array();
540 $res = $this->db->query('SELECT draft_id FROM frm_posts_drafts WHERE ' . $this->db->in('post_id', $post_ids, false, 'integer'));
541 while ($row = $this->db->fetchAssoc($res)) {
542 $draft_ids[] = $row['draft_id'];
543 }
544
545 foreach ($draft_ids as $draft_id) {
547
548 // delete attachments of draft
549 $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draft_id);
550 $objFileDataForumDrafts->delete();
551 }
552 $this->db->manipulate('DELETE FROM frm_drafts_history WHERE ' . $this->db->in('draft_id', $draft_ids, false, 'integer'));
553 $this->db->manipulate('DELETE FROM frm_posts_drafts WHERE ' . $this->db->in('draft_id', $draft_ids, false, 'integer'));
554 }

References $draft_id, $res, $row, and deleteMobsOfDraft().

+ Here is the call graph for this function:

◆ deleteDraftsByUserId()

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

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

576 {
577 global $DIC;
578 $ilDB = $DIC->database();
579
580 $res = $ilDB->queryF(
581 'SELECT draft_id FROM frm_posts_drafts WHERE post_author_id = %s',
582 array('integer'),
583 array($user_id)
584 );
585
586 $draft_ids = array();
587 while ($row = $ilDB->fetchAssoc($res)) {
588 $draft_ids[] = $row['draft_id'];
589 }
590
591 foreach ($draft_ids as $draft_id) {
593
594 // delete attachments of draft
595 $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draft_id);
596 $objFileDataForumDrafts->delete();
597 }
598
599 $ilDB->manipulate('DELETE FROM frm_drafts_history WHERE ' . $ilDB->in('draft_id', $draft_ids, false, 'integer'));
600 $ilDB->manipulateF(
601 'DELETE FROM frm_posts_drafts WHERE post_author_id = %s',
602 array('integer'),
603 array($user_id)
604 );
605 }

References $DIC, $draft_id, $ilDB, $res, $row, and deleteMobsOfDraft().

+ Here is the call graph for this function:

◆ deleteMobsOfDraft()

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

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

521 {
522 require_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
523 // delete mobs of draft
524 $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draft_id);
525 foreach ($oldMediaObjects as $oldMob) {
526 if (ilObjMediaObject::_exists($oldMob)) {
527 ilObjMediaObject::_removeUsage($oldMob, 'frm~d:html', $draft_id);
528 $mob_obj = new ilObjMediaObject($oldMob);
529 $mob_obj->delete();
530 }
531 }
532 }
Class ilObjMediaObject.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
static _exists($a_id, $a_reference=false, $a_type=null)
checks wether a lm content object with specified id exists or not

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

Referenced by deleteDraftsByDraftIds(), deleteDraftsByPostIds(), and deleteDraftsByUserId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDraftId()

ilForumPostDraft::getDraftId ( )
Returns
int

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

124 {
125 return $this->draft_id;
126 }

References $draft_id.

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

+ Here is the caller graph for this function:

◆ getDraftInstancesByUserId()

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

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

392 {
393 if (!self::$instances[$user_id]) {
394 self::readDrafts($user_id);
395 }
396
397 return self::$instances[$user_id]['draft_ids'];
398 }
static readDrafts($user_id)

References readDrafts().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDraftsStatisticsByRefId()

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

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

650 {
651 global $DIC;
652 $ilDB = $DIC->database();
653 $ilUser = $DIC->user();
654
655 if (!isset(self::$forum_statistics_cache[$ref_id][$ilUser->getId()])) {
656 $forumId = ilObjForum::lookupForumIdByRefId($ref_id);
657
658 $res = $ilDB->queryF(
659 '
660 SELECT COUNT(draft_id) num_drafts, thread_id FROM frm_posts_drafts
661 WHERE forum_id = %s AND post_author_id = %s
662 GROUP BY thread_id',
663 array('integer', 'integer'),
664 array($forumId, $ilUser->getId())
665 );
666
667 $num_drafts_total = 0;
668
669 while ($row = $ilDB->fetchAssoc($res)) {
670 $num_drafts_total += $row['num_drafts'];
671 self::$forum_statistics_cache[$ref_id][$ilUser->getId()][$row['thread_id']] = $row['num_drafts'];
672 }
673
674 self::$forum_statistics_cache[$ref_id][$ilUser->getId()]['total'] = $num_drafts_total;
675 }
676 return self::$forum_statistics_cache[$ref_id][$ilUser->getId()];
677 }
static lookupForumIdByRefId($ref_id)
$ilUser
Definition: imgupload.php:18

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

Referenced by ilForumTopicTableGUI\fillRow(), and ilObjForumListGUI\getProperties().

+ 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.

156 {
157 return $this->forum_id;
158 }

References $forum_id.

Referenced by saveDraft().

+ Here is the caller graph for this function:

◆ getInstancesByUserIdAndThreadId()

static ilForumPostDraft::getInstancesByUserIdAndThreadId (   $user_id,
  $thread_id 
)
static
Parameters
$user_id
$thread_id
Returns
\ilForumPostDraft[]

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

406 {
407 if (!self::$instances[$user_id]) {
408 self::readDrafts($user_id);
409 }
410
411 if (isset(self::$instances[$user_id][$thread_id])) {
412 return self::$instances[$user_id][$thread_id];
413 }
414
415 return [];
416 }

References $thread_id, and readDrafts().

Referenced by ilObjForumGUI\renderDraftContent(), and ilObjForumGUI\renderSplitButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNotify()

ilForumPostDraft::getNotify ( )
Returns
int

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

316 {
317 return $this->notify;
318 }

References $notify.

Referenced by saveDraft(), and updateDraft().

+ 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().

+ Here is the caller graph for this function:

◆ getPostDate()

ilForumPostDraft::getPostDate ( )
Returns
string

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

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

References $post_date.

◆ getPostDisplayUserId()

ilForumPostDraft::getPostDisplayUserId ( )
Returns
int

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

References $post_display_user_id.

Referenced by saveDraft(), and updateDraft().

+ Here is the caller graph for this function:

◆ getPostId()

ilForumPostDraft::getPostId ( )
Returns
int

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

140 {
141 return $this->post_id;
142 }

References $post_id.

Referenced by readDraft(), and saveDraft().

+ Here is the caller graph for this function:

◆ getPostMessage()

ilForumPostDraft::getPostMessage ( )
Returns
string

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

204 {
205 return $this->post_message;
206 }

References $post_message.

Referenced by saveDraft(), and updateDraft().

+ Here is the caller graph for this function:

◆ getPostNotify()

ilForumPostDraft::getPostNotify ( )
Returns
int

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

108 {
109 return $this->post_notify;
110 }

References $post_notify.

Referenced by saveDraft(), and updateDraft().

+ Here is the caller graph for this function:

◆ getPostSubject()

ilForumPostDraft::getPostSubject ( )
Returns
string

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

188 {
189 return $this->post_subject;
190 }

References $post_subject.

Referenced by saveDraft(), and updateDraft().

+ Here is the caller graph for this function:

◆ getPostUpdate()

ilForumPostDraft::getPostUpdate ( )
Returns
string

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

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

References $post_update.

◆ getPostUserAlias()

ilForumPostDraft::getPostUserAlias ( )
Returns
string

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

References $post_user_alias.

Referenced by saveDraft(), and updateDraft().

+ 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 724 of file class.ilForumPostDraft.php.

725 {
726 global $DIC;
727 $ilDB = $DIC->database();
728
729 $res = $ilDB->queryF(
730 'SELECT * FROM frm_posts_drafts
731 WHERE post_author_id = %s
732 AND forum_id = %s
733 AND thread_id = %s
734 AND post_id = %s
735 ORDER BY post_date DESC',
736 array('integer', 'integer', 'integer', 'integer'),
737 array($post_author_id, $forum_id, 0, 0)
738 );
739 $draft_data = array();
740 while ($row = $ilDB->fetchAssoc($res)) {
741 $tmp_obj = new self;
743 $draft_data[] = array('subject'=> $tmp_obj->getPostSubject(), 'post_update' => $tmp_obj->getPostUpdate(), 'draft_id' => $tmp_obj->getDraftId());
744 }
745 return $draft_data;
746 }

References $DIC, $forum_id, $ilDB, $post_author_id, $res, $row, and populateWithDatabaseRecord().

Referenced by ilObjForumGUI\getContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getThreadId()

ilForumPostDraft::getThreadId ( )
Returns
int

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

172 {
173 return $this->thread_id;
174 }

References $thread_id.

Referenced by saveDraft().

+ 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().

+ Here is the caller graph for this function:

◆ isAutoSavePostDraftAllowed()

static ilForumPostDraft::isAutoSavePostDraftAllowed ( )
static
Returns
bool

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

623 {
624 if (!self::isSavePostDraftAllowed()) {
625 // feature is globally deactivated
626 return false;
627 }
628 if (!isset(self::$drafts_settings_cache['autosave_drafts'])) {
629 global $DIC;
630
631 self::$drafts_settings_cache['autosave_drafts'] = (bool) $DIC->settings()->get('autosave_drafts', false);
632 self::$drafts_settings_cache['autosave_drafts_ival'] = (int) $DIC->settings()->get('autosave_drafts_ival', 30);
633 }
634 return self::$drafts_settings_cache['autosave_drafts'];
635 }

References $DIC.

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

+ Here is the caller graph for this function:

◆ isSavePostDraftAllowed()

static ilForumPostDraft::isSavePostDraftAllowed ( )
static
Returns
bool

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

611 {
612 if (!isset(self::$drafts_settings_cache['save_post_drafts'])) {
613 global $DIC;
614 self::$drafts_settings_cache['save_post_drafts'] = (bool) $DIC->settings()->get('save_post_drafts', false);
615 }
616 return self::$drafts_settings_cache['save_post_drafts'];
617 }

References $DIC.

Referenced by ilForumTopicTableGUI\__construct(), ilObjForumGUI\addThreadObject(), ilObjForumGUI\createTopLevelPostObject(), ilObjForumGUI\deleteSelectedDraft(), ilObjForumGUI\deleteThreadDraftsObject(), ilObjForumGUI\getContent(), ilObjForumListGUI\getProperties(), ilObjForumGUI\initTopicCreateForm(), ilObjForumGUI\publishDraftObject(), ilObjForumGUI\publishThreadDraftObject(), ilObjForumGUI\saveThreadAsDraftObject(), and ilObjForumGUI\updateThreadDraftObject().

+ Here is the caller graph for this function:

◆ lookupAutosaveInterval()

static ilForumPostDraft::lookupAutosaveInterval ( )
static

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

638 {
639 if (self::isAutoSavePostDraftAllowed()) {
640 return self::$drafts_settings_cache['autosave_drafts_ival'];
641 }
642 return 0;
643 }

Referenced by ilObjForumGUI\addAutosave().

+ 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 683 of file class.ilForumPostDraft.php.

684 {
685 global $DIC;
686 $ilDB = $DIC->database();
687
688 $ilDB->update(
689 'frm_posts_drafts',
690 array('thread_id' => array('integer', $target_thread_id)),
691 array('thread_id' => array('integer', $source_thread_id))
692 );
693 }

References $DIC, and $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 700 of file class.ilForumPostDraft.php.

701 {
702 global $DIC;
703 $ilDB = $DIC->database();
704
705 $source_forum_id = ilObjForum::lookupForumIdByRefId($source_ref_id);
706 $target_forum_id = ilObjForum::lookupForumIdByRefId($target_ref_id);
707
708 $ilDB->manipulateF(
709 '
710 UPDATE frm_posts_drafts
711 SET forum_id = %s
712 WHERE forum_id = %s
713 AND ' . $ilDB->in('thread_id', $thread_ids, false, 'integer'),
714 array('integer', 'integer'),
715 array($target_forum_id, $source_forum_id)
716 );
717 }

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

+ Here is the call graph for this function:

◆ newInstanceByDraftId()

static ilForumPostDraft::newInstanceByDraftId (   $draft_id)
static
Parameters
$draft_id
Returns
self

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

423 {
424 global $DIC;
425 $ilDB = $DIC->database();
426
427 $res = $ilDB->queryF(
428 'SELECT * FROM frm_posts_drafts WHERE draft_id = %s',
429 array('integer'),
430 array($draft_id)
431 );
432
433 $tmp_obj = new ilForumPostDraft();
434 while ($row = $ilDB->fetchAssoc($res)) {
436 }
437 return $tmp_obj;
438 }
Class ilForumPostDraft.

References $DIC, $draft_id, $ilDB, $res, $row, and populateWithDatabaseRecord().

Referenced by ilObjForumGUI\addThreadObject(), ilObjForumGUI\autosaveDraftAsyncObject(), ilObjForumGUI\autosaveThreadDraftAsyncObject(), ilObjForumGUI\cancelDraftObject(), ilObjForumGUI\cancelPostObject(), ilObjForumGUI\checkDraftAccess(), ilObjForumGUI\deliverDraftZipFileObject(), ilFileDataForumDrafts\deliverZipFile(), ilObjMediaObject\getParentObjectIdForUsage(), ilObjForumGUI\initTopicCreateForm(), ilObjForumGUI\publishThreadDraftObject(), ilForumDraftsHistory\rollbackAutosave(), ilObjForumGUI\saveThreadAsDraftObject(), and ilObjForumGUI\updateThreadDraftObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newInstanceByHistorytId()

static ilForumPostDraft::newInstanceByHistorytId (   $history_id)
static
Parameters
$history_id
Returns
ilForumPostDraft
Exceptions
ilException

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

446 {
447 global $DIC;
448 $ilDB = $DIC->database();
449
450 $res = $ilDB->queryF(
451 'SELECT * FROM frm_drafts_history WHERE history_id = %s',
452 array('integer'),
453 array($history_id)
454 );
455
456 while ($row = $ilDB->fetchAssoc($res)) {
457 $tmp_obj = new ilForumPostDraft();
459 return $tmp_obj;
460 }
461
462 throw new ilException(sprintf("Could not find history object for id %s", $history_id));
463 }
sprintf('%.4f', $callTime)
Base class for ILIAS Exception handling.

References $DIC, $ilDB, $res, $row, populateWithDatabaseRecord(), and sprintf.

+ 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.

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)
setPostMessage($post_message)
setPostSubject($post_subject)
setPostDisplayUserId($post_display_user_id)
setUpdateUserId($update_user_id)

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

Referenced by createDraftBackup(), getThreadDraftData(), newInstanceByDraftId(), newInstanceByHistorytId(), readDraft(), and readDrafts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readDraft()

ilForumPostDraft::readDraft ( )
protected

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

351 {
352 $res = $this->db->queryF(
353 'SELECT * FROM frm_posts_drafts WHERE post_author_id = %s AND post_id = %s AND draft_id = %s',
354 array('integer', 'integer','integer'),
355 array($this->getPostAuthorId(), $this->getPostId(), $this->getDraftId())
356 );
357
358 while ($row = $this->db->fetchAssoc($res)) {
360 }
361 }

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

Referenced by __construct().

+ 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.

367 {
368 global $DIC;
369 $ilDB = $DIC->database();
370
371 $res = $ilDB->queryF(
372 'SELECT * FROM frm_posts_drafts WHERE post_author_id = %s',
373 array('integer'),
374 array($user_id)
375 );
376
377 self::$instances[$user_id] = array();
378 while ($row = $ilDB->fetchAssoc($res)) {
379 $tmp_obj = new ilForumPostDraft();
381 self::$instances[$user_id][$row['thread_id']][$tmp_obj->getPostId()][] = $tmp_obj;
382 self::$instances[$user_id]['draft_ids'][$tmp_obj->getDraftId()] = $tmp_obj;
383 }
384 unset($tmp_obj);
385 }

References $DIC, $ilDB, $res, $row, and populateWithDatabaseRecord().

Referenced by getDraftInstancesByUserId(), and getInstancesByUserIdAndThreadId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveDraft()

ilForumPostDraft::saveDraft ( )

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

466 {
467 $draft_id = $this->db->nextId('frm_posts_drafts');
468 $post_date = date("Y-m-d H:i:s");
469
470 $this->db->insert('frm_posts_drafts', array(
471 'draft_id' => array('integer', $draft_id),
472 'post_id' => array('integer', $this->getPostId()),
473 'thread_id' => array('integer', $this->getThreadId()),
474 'forum_id' => array('integer', $this->getForumId()),
475 'post_author_id' => array('integer', $this->getPostAuthorId()),
476 'post_subject' => array('text', $this->getPostSubject()),
477 'post_message' => array('clob', $this->getPostMessage()),
478 'notify' => array('integer', $this->getNotify()),
479 'post_notify' => array('integer', $this->getPostNotify()),
480 'post_date' => array('timestamp', $post_date),
481 'post_update' => array('timestamp', $post_date),
482// 'update_user_id' => array('integer', $this->getUpdateUserId()),
483 'post_user_alias' => array('text', $this->getPostUserAlias()),
484 'pos_display_usr_id' => array('integer', $this->getPostDisplayUserId())
485 ));
486 $this->setDraftId($draft_id);
487 return $draft_id;
488 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())

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

+ 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.

132 {
133 $this->draft_id = $draft_id;
134 }

References $draft_id.

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

+ 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.

164 {
165 $this->forum_id = $forum_id;
166 }

References $forum_id.

Referenced by populateWithDatabaseRecord().

+ Here is the caller graph for this function:

◆ setNotify()

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

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

324 {
325 $this->notify = $notify;
326 }

References $notify.

Referenced by populateWithDatabaseRecord().

+ 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.

292 {
293 $this->post_author_id = $post_author_id;
294 }

References $post_author_id.

Referenced by __construct(), and populateWithDatabaseRecord().

+ 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.

228 {
229 $this->post_date = $post_date;
230 }

References $post_date.

Referenced by populateWithDatabaseRecord().

+ 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.

308 {
309 $this->post_display_user_id = $post_display_user_id;
310 }

References $post_display_user_id.

Referenced by populateWithDatabaseRecord().

+ 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.

148 {
149 $this->post_id = $post_id;
150 }

References $post_id.

Referenced by __construct(), and populateWithDatabaseRecord().

+ 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.

212 {
213 $this->post_message = $post_message;
214 }

References $post_message.

Referenced by populateWithDatabaseRecord().

+ 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.

116 {
117 $this->post_notify = $post_notify;
118 }

References $post_notify.

Referenced by populateWithDatabaseRecord().

+ 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.

196 {
197 $this->post_subject = $post_subject;
198 }

References $post_subject.

Referenced by populateWithDatabaseRecord().

+ 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.

244 {
245 $this->post_update = $post_update;
246 }

References $post_update.

Referenced by populateWithDatabaseRecord().

+ 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.

276 {
277 $this->post_user_alias = $post_user_alias;
278 }

References $post_user_alias.

Referenced by populateWithDatabaseRecord().

+ 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.

180 {
181 $this->thread_id = $thread_id;
182 }

References $thread_id.

Referenced by populateWithDatabaseRecord().

+ Here is the caller graph for this function:

◆ setUpdateUserId()

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

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

260 {
261 $this->update_user_id = $update_user_id;
262 }

References $update_user_id.

Referenced by populateWithDatabaseRecord().

+ Here is the caller graph for this function:

◆ updateDraft()

ilForumPostDraft::updateDraft ( )

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

491 {
492 $this->db->update(
493 'frm_posts_drafts',
494 array(
495 'post_subject' => array('text', $this->getPostSubject()),
496 'post_message' => array('clob', $this->getPostMessage()),
497 'notify' => array('integer', $this->getNotify()),
498 'post_notify' => array('integer', $this->getPostNotify()),
499 'post_update' => array('timestamp', date("Y-m-d H:i:s")),
500 'update_user_id' => array('integer', $this->getUpdateUserId()),
501 'post_user_alias' => array('text', $this->getPostUserAlias()),
502 'pos_display_usr_id' => array('integer', $this->getPostDisplayUserId())
503 ),
504 array('draft_id' => array('integer', $this->getDraftId()))
505 );
506 }

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

+ 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: