80 if ($this->actor->isAnonymous() || !($this->actor->getId() > 0)) {
84 if ($this->thread->getId() > 0 && $this->thread->isClosed()) {
94 !$this->relatedPost->isActivated() || $this->relatedPost->isCensored()
102 $relatedPostId = $this->relatedPost->getId();
105 $this->form->checkInput();
108 if ($this->relatedDraftId > 0) {
111 $draftId = (int) $this->form->getInput(
'draft_id');
117 if (
'showreply' === $this->action) {
119 $draftObj->setPostSubject($subjectFormatterCallback($inputValues[
'subject']));
121 $draftObj->setPostUserAlias($inputValues[
'alias']);
122 $draftObj->setNotify($inputValues[
'notify']);
123 $draftObj->setUpdateUserId($this->actor->getId());
124 $draftObj->setPostAuthorId($this->actor->getId());
125 $draftObj->setPostDisplayUserId(($this->forumProperties->isAnonymized() ? 0 : $this->actor->getId()));
126 $draftObj->updateDraft();
134 $draftObj->getDraftId(),
140 $draftObj = new \ilForumDraftsHistory();
141 $draftObj->setDraftId($draftId);
142 $draftObj->setPostSubject($subjectFormatterCallback($inputValues[
'subject']));
144 $draftObj->addDraftToHistory();
152 $draftObj->getHistoryId(),
159 $draftObj = new \ilForumPostDraft();
160 $draftObj->setForumId($this->relatedForumId);
161 $draftObj->setThreadId($this->thread->getId());
162 $draftObj->setPostId($relatedPostId);
163 $draftObj->setPostSubject($subjectFormatterCallback($inputValues[
'subject']));
165 $draftObj->setPostUserAlias($inputValues[
'alias']);
166 $draftObj->setNotify($inputValues[
'notify']);
167 $draftObj->setPostAuthorId($this->actor->getId());
168 $draftObj->setPostDisplayUserId(($this->forumProperties->isAnonymized() ? 0 : $this->actor->getId()));
169 $draftObj->saveDraft();
177 $draftObj->getDraftId(),
184 $response->draft_id = $draftObj->getDraftId();
199 array $uploadedObjects,
200 array $oldMediaObjects,
201 array $curMediaObjects
203 foreach ($uploadedObjects as $mob) {
208 foreach ($oldMediaObjects as $mob) {
212 foreach ($curMediaObjects as $mob) {
224 $inputValues[
'subject'] = (string) $this->form->getInput(
'subject');
225 $inputValues[
'message'] = (string) $this->form->getInput(
'message');
226 $inputValues[
'notify'] = (int) $this->form->getInput(
'notify');
228 (
string) $this->form->getInput(
'alias'),
229 $this->forumProperties->isAnonymized()
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
handleMedia(string $type, int $draftId, array $uploadedObjects, array $oldMediaObjects, array $curMediaObjects)
static getPublicUserAlias($user_alias, $is_anonymized=false)
__construct(\ilObjUser $actor, \ilPropertyFormGUI $form, \ilForumProperties $forumProperties, \ilForumTopic $thread, $relatedPost, callable $subjectFormatterCallable, int $relatedDraftId, int $relatedForumId, string $action)
ilForumAutoSaveAsyncDraftAction constructor.
Class ilForumSaveAsyncDraftAction.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static isAutoSavePostDraftAllowed()
static newInstanceByDraftId($draft_id)
$subjectFormatterCallable
executeAndGetResponseObject()