19 declare(strict_types=1);
35 Closure $subjectFormatterCallable,
36 private int $relatedDraftId,
37 private int $relatedForumId,
38 private string $action
48 if ($this->actor->isAnonymous() || $this->actor->getId() <= 0) {
52 if ($this->thread->getId() > 0 && $this->thread->isClosed()) {
62 !$this->relatedPost->isActivated() || $this->relatedPost->isCensored()
70 $relatedPostId = $this->relatedPost->getId();
73 $this->
form->checkInput();
76 if ($this->relatedDraftId > 0) {
77 $draftId = $this->relatedDraftId;
79 $draftId = (
int) $this->
form->getInput(
'draft_id');
85 if (
'showreply' === $this->action) {
87 $draftObj->setPostSubject($subjectFormatterCallback($inputValues[
'subject']));
89 $draftObj->setPostUserAlias($inputValues[
'alias']);
90 $draftObj->setNotificationStatus((
bool) $inputValues[
'notify']);
91 $draftObj->setUpdateUserId($this->actor->getId());
92 $draftObj->setPostAuthorId($this->actor->getId());
93 $draftObj->setPostDisplayUserId(($this->forumProperties->isAnonymized() ? 0 : $this->actor->getId()));
94 $draftObj->updateDraft();
102 $draftObj->getDraftId(),
109 $draftObj->setDraftId($draftId);
110 $draftObj->setPostSubject($subjectFormatterCallback($inputValues[
'subject']));
112 $draftObj->addDraftToHistory();
120 $draftObj->getHistoryId(),
128 $draftObj->setForumId($this->relatedForumId);
129 $draftObj->setThreadId($this->thread->getId());
130 $draftObj->setPostId($relatedPostId);
131 $draftObj->setPostSubject($subjectFormatterCallback($inputValues[
'subject']));
133 $draftObj->setPostUserAlias($inputValues[
'alias']);
134 $draftObj->setNotificationStatus((
bool) $inputValues[
'notify']);
135 $draftObj->setPostAuthorId($this->actor->getId());
136 $draftObj->setPostDisplayUserId(($this->forumProperties->isAnonymized() ? 0 : $this->actor->getId()));
137 $draftObj->saveDraft();
145 $draftObj->getDraftId(),
152 $response->draft_id = $draftObj->getDraftId();
165 array $uploadedObjects,
166 array $oldMediaObjects,
167 array $curMediaObjects
169 foreach ($uploadedObjects as $mob) {
174 foreach ($oldMediaObjects as $mob) {
178 foreach ($curMediaObjects as $mob) {
189 'subject' => (string) $this->
form->getInput(
'subject'),
190 'message' => (string) $this->
form->getInput(
'message'),
191 'notify' => (
int) $this->
form->getInput(
'notify'),
193 $this->
form->getInput(
'alias'),
194 $this->forumProperties->isAnonymized()
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static _getMediaObjects(string $a_text, int $a_direction=0)
Returns all media objects found in the passed string.
handleMedia(string $type, int $draftId, array $uploadedObjects, array $oldMediaObjects, array $curMediaObjects)
Class ilForumSaveAsyncDraftAction.
Closure $subjectFormatterCallable
Class ilForumDraftHistory.
static getPublicUserAlias(string $user_alias, bool $is_anonymized)
static isAutoSavePostDraftAllowed()
form( $class_path, string $cmd, string $submit_caption="")
static newInstanceByDraftId(int $draft_id)
__construct(private ilObjUser $actor, private ilPropertyFormGUI $form, private ilForumProperties $forumProperties, private ilForumTopic $thread, private ?ilForumPost $relatedPost, Closure $subjectFormatterCallable, private int $relatedDraftId, private int $relatedForumId, private string $action)
executeAndGetResponseObject()