Gets the supplied form submission data mapped to a dto.

@param array $submission

@return object
@throws InvalidFormSubmissionException
328685
public function mapFormSubmissionToDto(array $submission)
    {
        $formData = $this->getStagedForm()->process($submission);

        return new ObjectActionParameter(
                $formData[IObjectAction::OBJECT_FIELD_NAME],
                new ArrayDataObject($formData)
        );
    }
1344847
public function getInnerFormSubmissionExceptionFor(string $fieldName)
    {
        return isset($this->invalidInnerFormSubmissionExceptions[$fieldName])
                ? $this->invalidInnerFormSubmissionExceptions[$fieldName]
                : null;
    }
12875
function getUnstartedSubmissions($project) {
		$submissions = array ();
		$creatingSubmissions = $this->submissionService->findCreatingSubmissionsByProjectShortCode($project->shortCode)->return;
		foreach ($creatingSubmissions as &$creatingSubmission){
			$sub = new Submission();
			$sub->ticket = $creatingSubmission->ticket;
			$sub->name = $creatingSubmission->submissionInfo->name;
			array_push($submissions , $sub);
		}
		return $submissions;
	}
1258851
public function actionIndex()
    {
        $this->requirePostRequest();
        $request = Craft::$app->getRequest();
        $plugin = Plugin::getInstance();
        $settings = $plugin->getSettings();

        $submission = new Submission();
        $submission->fromEmail = $request->getBodyParam('fromEmail');
        $submission->fromName = $request->getBodyParam('fromName');
        $submission->subject = $request->getBodyParam('subject');

        $message = $request->getBodyParam('message');
        if (is_array($message)) {
            $submission->message = array_filter($message, function($value) {
                return $value !== '';
            });
        } else {
            $submission->message = $message;
        }

        if ($settings->allowAttachments && isset($_FILES['attachment']) && isset($_FILES['attachment']['name'])) {
            if (is_array($_FILES['attachment']['name'])) {
                $submission->attachment = UploadedFile::getInstancesByName('attachment');
            } else {
                $submission->attachment = [UploadedFile::getInstanceByName('attachment')];
            }
        }

        if (!$plugin->getMailer()->send($submission)) {
            if ($request->getAcceptsJson()) {
                return $this->asJson(['errors' => $submission->getErrors()]);
            }

            Craft::$app->getSession()->setError(Craft::t('contact-form', 'There was a problem with your submission, please check the form and try again!'));
            Craft::$app->getUrlManager()->setRouteParams([
                'variables' => ['message' => $submission]
            ]);

            return null;
        }

        if ($request->getAcceptsJson()) {
            return $this->asJson(['success' => true]);
        }

        Craft::$app->getSession()->setNotice($settings->successFlashMessage);
        return $this->redirectToPostedUrl($submission);
    }
242407
public function submitreview($data, $form) {
		$registration = $this->getCurrentRegistration();
		$form->saveInto($registration);

		//save registrant data if selected attendee
		$registrantid = isset($data['RegistrantAttendeeID']) ? (int)$data['RegistrantAttendeeID'] : null;
		if($registrantid && $attendee = $registration->Attendees()->byID($registrantid)) {
			$registrantData = array();
			foreach ($registration->stat('registrant_fields') as $field) {
				$registrantData[$field] = $attendee->$field;
			};
			$registration->update($registrantData);
		}
		
		$registration->calculateTotal(); // final calculation
		$registration->write();
		//redirect to appropriate place, based on total cost
		$action = $registration->canPay() ? 'payment' : 'complete';
		return $this->redirect($this->Link($action));
	}
301807
final public function getFormData(string $formExpression): array
    {
        $form = $this->page->object($formExpression, true)->first();
        if ($form === null) {
            throw new \InvalidArgumentException('Cant find form. Possible invalid expression ');
        }

        $formData = [];
        # textarea
        foreach ($form->element('//textarea') as $textArea) {
            $formData[$textArea->getAttribute('name')] = $textArea->nodeValue;
        }

        # radio and checkboxes
        foreach ($form->element('//input[@checked]') as $textArea) {
            $formData[$textArea->getAttribute('name')] = $textArea->getAttribute('value');
        }

        # hidden, text, submit
        $hiddenAndTextElements = $form->element('//input[@type="hidden" or @type="text" or @type="submit" or not(@type)]');
        foreach ($hiddenAndTextElements as $element) {
            $formData[$element->getAttribute('name')] = $element->getAttribute('value');
        }

        # selects
        foreach ($form->object('//select[not(@multiple)]', true) as $select) {
            $name = $select->value('//select/@name')->first();
            if ($name === null) {
                continue;
            }
            $formData[$name] = $select->value('//option[@selected]/@value')->first();
        }

        # multiple selects
        foreach ($form->object('//select[@multiple]', true) as $multipleSelect) {
            $name = $multipleSelect->value('//select/@name')->first();
            if ($name === null) {
                continue;
            }
            $options = $multipleSelect->value('//option[@selected]/@value');
            if (preg_match('!\[\]$!', $name)) {
                $name = rtrim($name, '[]');
                $formData[$name] = $options->all();
            } else {
                $formData[$name] = $options->last();
            }
        }
        return $formData;
    }
1298778
public function submissionSaveData(array $formData)
    {
        // remove empty values
        $formData = array_filter($formData);

        // get array of files to upload
        $files = [];
        foreach ($formData as $field => $value) {
            if (Request::hasFile($field)) {
                $files[$field] = Request::file($field);
                unset($formData[$field]);
            }
        }

        // save form submission
        $form_submission = new FormSubmission;
        $form_submission->form_block_id = $this->_block->id;
        $form_submission->content = serialize($formData);
        $form_submission->sent = 0;
        $form_submission->from_page_id = PageBuilder::pageId();
        $form_submission->save();
        $form_submission->uploadFiles($files);
        return $form_submission;
    }
1221698
public static function create_from_submission(\assign $assign, \stdClass $submission) {
        $data = array(
            'context' => $assign->get_context(),
            'objectid' => $submission->id,
            'relateduserid' => ($assign->get_instance()->teamsubmission) ? null : $submission->userid,
            'other' => array(
                'newstatus' => $submission->status
            )
        );
        /** @var submission_status_updated $event */
        $event = self::create($data);
        $event->set_assign($assign);
        $event->add_record_snapshot('assign_submission', $submission);
        return $event;
    }
614307
public function submitForm($options = [])
    {
        $_options = [
            'submitLabel' => __d('CakeAdmin', 'Submit'),
            'options' => [],
        ];

        $options = array_merge($_options, $options);

        return $this->Form->button($options['submitLabel'], $options['options']);
    }
272071
private function getHandler($handler): FormHandlerInterface
    {
        if (is_string($handler)) {
            if (!isset($this->handlers[$handler])) {
                $handler = new $handler();
            } else {
                $handler = $this->handlers[$handler];
            }
        }

        if (!$handler instanceof FormHandlerInterface) {
            throw new InvalidHandlerException(FormHandlerInterface::class, $handler);
        }

        return $handler;
    }
827300
public function userRole(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateUserRole();
        $this->validatePermissionsUserRole();
        $this->validateRedirectUserRole();
        $this->validateBool('status');
        $this->validateName();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
1324544
public function submission($formData)
    {
        $formRules = BlockFormRule::get_rules($this->_block->name.'-form');
        $v = Validator::make($formData, $formRules);
        if ($v->passes()) {

            foreach ($formData as $blockName => $content) {
                $fieldBlock = Block::preload($blockName);
                if ($fieldBlock->exists) {
                    if ($fieldBlock->type == 'datetime' && empty($content)) {
                        $content = new Carbon();
                    }
                    $formData[$blockName] = $content;
                }
            }

            $this->insertRow($formData);

            Email::sendFromFormData([$this->_block->name.'-form'], $formData, config('coaster::site.name') . ': New Form Submission - ' . $this->_block->label);

            return \redirect(Request::url());

        } else {
            FormMessage::set($v->messages());
        }

        return null;
    }
176714
public function filterSubmitted(array $allowed)
    {
        $this->submitted = array_intersect_key($this->submitted, array_flip($allowed));
        return $this->submitted;
    }
693747
public function submit($options = [])
    {
        if (is_string($options)) {
            $options = ['value' => $options];
        }

        if (!Arr::has($options, 'type')) {
            Arr::set($options, 'type', 'submit');
        }

        $input = new Input($this->expression('input'), $options);

        return $input;
    }
343193
private function getActionFormData()
    {
        $request    = oxNew(Request::class);
        $formData   = $request->getRequestEscapedParameter("editval");
        $formData   = $this->normalizeActionFormData($formData);

        return $formData;
    }
1296315
protected static function export_submission_data(\stdClass $submission, \context $context, array $currentpath) {
        $submissiondata = (object)[
            'timecreated' => transform::datetime($submission->timecreated),
            'timemodified' => transform::datetime($submission->timemodified),
            'status' => get_string('submissionstatus_' . $submission->status, 'mod_assign'),
            'groupid' => $submission->groupid,
            'attemptnumber' => ($submission->attemptnumber + 1),
            'latest' => transform::yesno($submission->latest)
        ];
        writer::with_context($context)
                ->export_data(array_merge($currentpath, [get_string('privacy:submissionpath', 'mod_assign')]), $submissiondata);
    }
706696
public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data) {
        $elements = array();

        $editoroptions = $this->get_edit_options();
        $submissionid = $submission ? $submission->id : 0;

        if (!isset($data->onlinetext)) {
            $data->onlinetext = '';
        }
        if (!isset($data->onlinetextformat)) {
            $data->onlinetextformat = editors_get_preferred_format();
        }

        if ($submission) {
            $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
            if ($onlinetextsubmission) {
                $data->onlinetext = $onlinetextsubmission->onlinetext;
                $data->onlinetextformat = $onlinetextsubmission->onlineformat;
            }

        }

        $data = file_prepare_standard_editor($data,
                                             'onlinetext',
                                             $editoroptions,
                                             $this->assignment->get_context(),
                                             'assignsubmission_onlinetext',
                                             ASSIGNSUBMISSION_ONLINETEXT_FILEAREA,
                                             $submissionid);
        $mform->addElement('editor', 'onlinetext_editor', $this->get_name(), null, $editoroptions);

        return true;
    }