Set what to do when the form is 'finished'.

@return \MUtil_Snippets_ModelYesNoDeleteSnippetAbstract
485869
protected function setAfterDeleteRoute()
    {
        parent::setAfterDeleteRoute();

        if (is_array($this->afterSaveRouteUrl)) {
            $this->afterSaveRouteUrl[\MUtil_Model::REQUEST_ID] = $this->trackId;
            $this->afterSaveRouteUrl[\Gems_Model::ROUND_ID]    = null;
            $this->afterSaveRouteUrl[$this->confirmParameter]  = null;
        }
    }
840000
public function handleAfterCompletion()
    {
        $survey = $this->getSurvey();
        $event  = $survey->getSurveyCompletedEvent();

        if ($event) {
            try {
                $changed = $event->processTokenData($this);
                if ($changed && is_array($changed)) {

                    $this->setRawAnswers($changed);

                    return $changed;
                }
            } catch (\Exception $e) {
                $this->logger->log(sprintf(
                        "After completion event error for token %s on survey '%s' using event '%s': %s",
                        $this->_tokenId,
                        $this->getSurveyName(),
                        $event->getEventName(),
                        $e->getMessage()
                        ), \Zend_Log::ERR);
            }
        }
    }
971962
public function withTrashed()
    {
        $this->withTrashed = true;

        $this->query = $this->useWithTrashed($this->query);

        return $this;
    }
919992
public function finished()
    {
        $submission = $this->getRequest()->getSession()->get('userformssubmission'. $this->ID);

        if ($submission) {
            $submission = SubmittedForm::get()->byId($submission);
        }

        $referrer = isset($_GET['referrer']) ? urldecode($_GET['referrer']) : null;

        if (!$this->DisableAuthenicatedFinishAction) {
            $formProcessed = $this->getRequest()->getSession()->get('FormProcessed');

            if (!isset($formProcessed)) {
                return $this->redirect($this->Link() . $referrer);
            } else {
                $securityID = $this->getRequest()->getSession()->get('SecurityID');
                // make sure the session matches the SecurityID and is not left over from another form
                if ($formProcessed != $securityID) {
                    // they may have disabled tokens on the form
                    $securityID = md5($this->getRequest()->getSession()->get('FormProcessedNum'));
                    if ($formProcessed != $securityID) {
                        return $this->redirect($this->Link() . $referrer);
                    }
                }
            }

            $this->getRequest()->getSession()->clear('FormProcessed');
        }

        $data = [
            'Submission' => $submission,
            'Link' => $referrer
        ];

        $this->extend('updateReceivedFormSubmissionData', $data);

        return $this->customise([
            'Content' => $this->customise($data)->renderWith(__CLASS__ . '_ReceivedFormSubmission'),
            'Form' => '',
        ]);
    }
892232
public function definition_after_data() {
        global $CFG, $DB, $OUTPUT;

        $mform = $this->_form;
        $userid = $mform->getElementValue('id');

        // Trim required name fields.
        foreach (useredit_get_required_name_fields() as $field) {
            $mform->applyFilter($field, 'trim');
        }

        if ($user = $DB->get_record('user', array('id' => $userid))) {

            // Remove description.
            if (empty($user->description) && !empty($CFG->profilesforenrolledusersonly) && !$DB->record_exists('role_assignments', array('userid' => $userid))) {
                $mform->removeElement('description_editor');
            }

            // Print picture.
            $context = context_user::instance($user->id, MUST_EXIST);
            $fs = get_file_storage();
            $hasuploadedpicture = ($fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.png') || $fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.jpg'));
            if (!empty($user->picture) && $hasuploadedpicture) {
                $imagevalue = $OUTPUT->user_picture($user, array('courseid' => SITEID, 'size' => 64));
            } else {
                $imagevalue = get_string('none');
            }
            $imageelement = $mform->getElement('currentpicture');
            $imageelement->setValue($imagevalue);

            if ($mform->elementExists('deletepicture') && !$hasuploadedpicture) {
                $mform->removeElement('deletepicture');
            }

            // Disable fields that are locked by auth plugins.
            $fields = get_user_fieldnames();
            $authplugin = get_auth_plugin($user->auth);
            $customfields = $authplugin->get_custom_user_profile_fields();
            $customfieldsdata = profile_user_record($userid, false);
            $fields = array_merge($fields, $customfields);
            foreach ($fields as $field) {
                if ($field === 'description') {
                    // Hard coded hack for description field. See MDL-37704 for details.
                    $formfield = 'description_editor';
                } else {
                    $formfield = $field;
                }
                if (!$mform->elementExists($formfield)) {
                    continue;
                }

                // Get the original value for the field.
                if (in_array($field, $customfields)) {
                    $key = str_replace('profile_field_', '', $field);
                    $value = isset($customfieldsdata->{$key}) ? $customfieldsdata->{$key} : '';
                } else {
                    $value = $user->{$field};
                }

                $configvariable = 'field_lock_' . $field;
                if (isset($authplugin->config->{$configvariable})) {
                    if ($authplugin->config->{$configvariable} === 'locked') {
                        $mform->hardFreeze($formfield);
                        $mform->setConstant($formfield, $value);
                    } else if ($authplugin->config->{$configvariable} === 'unlockedifempty' and $value != '') {
                        $mform->hardFreeze($formfield);
                        $mform->setConstant($formfield, $value);
                    }
                }
            }

            // Next the customisable profile fields.
            profile_definition_after_data($mform, $user->id);

        } else {
            profile_definition_after_data($mform, 0);
        }
    }
1327326
public function onAfterDelete() {
		parent::onAfterDelete();

		// Delete related environments
		foreach($this->Environments() as $env) {
			$env->delete();
		}

		if(!file_exists($this->getProjectFolderPath())) {
			return;
		}
		// Create a basic new environment config from a template
		if(Config::inst()->get('DNEnvironment', 'allow_web_editing')) {
			FileSystem::removeFolder($this->getProjectFolderPath());
		}
	}
101290
public function delete()
    {
        if ($this->state === State::PENDING) {
            throw new LogicException('You cannot delete pending models');
        } elseif ($this->state === State::SAVED) {
            $this->state = State::DELETED;
        }

        return $this;
    }
893322
public function createForm()
    {
        $this->collapse->childNodes->push(new Navbar\Form());

        return $this->form = $this->collapse->childNodes->last();
    }
624542
public function onBeforeWrite()
    {
        if (!$this->Original()->exists() && $this->Cropped()->exists()) {
            $this->Cropped()->delete();
        } elseif ($this->Original()->exists()) {
            $changes = $this->getChangedFields();

            if ($this->hasChanged($changes, 'ContainerX') ||
                $this->hasChanged($changes, 'ContainerY') ||
                $this->hasChanged($changes, 'ContainerWidth') ||
                $this->hasChanged($changes, 'ContainerHeight') ||
                $this->hasChanged($changes, 'CropperX') ||
                $this->hasChanged($changes, 'CropperY') ||
                $this->hasChanged($changes, 'CropperWidth') ||
                $this->hasChanged($changes, 'CropperHeight')) {
                    $this->doCrop = true;
            }
        }

        parent::onBeforeWrite();
    }
1321014
public function end()
    {
        if ($this->isStarted()) {
            if (is_callable($this->getCleanupCallback())) {
                call_user_func($this->getCleanupCallback());
            }
            session_write_close();
        }

        return $this;
    }
1260468
public function sasEditInstance()
    {
        $this->loadStandaloneMode();

        $clazz = $this->getCurrentClass();
		$instance = $this->getCurrentInstance();

		$formContainer = new tao_actions_form_Instance($clazz, $instance);
		$myForm = $formContainer->getForm();

		if($myForm->isSubmited()){
			if($myForm->isValid()){
				$binder = new tao_models_classes_dataBinding_GenerisFormDataBinder($instance);
				$instance = $binder->bind($myForm->getValues());
				$instance = $this->getClassService()->setDefaultItemContent($instance);
				$this->setData('message', __('Item saved'));
			}
		}

		$this->setData('uri', tao_helpers_Uri::encode($instance->getUri()));
		$this->setData('classUri', tao_helpers_Uri::encode($clazz->getUri()));
		$this->setData('formTitle', __('Edit item'));
		$this->setData('myForm', $myForm->render());
		$this->setView('form.tpl', 'tao');
	}
373109
public function afterDetach()
    {
        $handler = $this->get('handler');
        if (class_exists($handler)) {
            $handler = new $handler();

            return $handler->afterDetach($this);
        }
    }
906504
public function onAfterDelete()
    {
        // Prepare blank manipulation
        $manipulations = new AssetManipulationList();

        // Add all assets for deletion
        $this->addAssetsFromRecord($manipulations, $this->owner, AssetManipulationList::STATE_DELETED);

        // Whitelist assets that exist in other stages
        $this->addAssetsFromOtherStages($manipulations);

        // Apply visibility rules based on the final manipulation
        $this->processManipulation($manipulations);
    }
737214
public function onAfterDelete()
    {
        parent::onAfterDelete();
        $wfActionInstances = WorkflowActionInstance::get()
            /** @skipUpgrade */
            ->leftJoin('WorkflowInstance', '"WorkflowInstance"."ID" = "WorkflowActionInstance"."WorkflowID"')
            ->where(sprintf('"BaseActionID" = %d AND ("WorkflowStatus" IN (\'Active\',\'Paused\'))', $this->ID));
        foreach ($wfActionInstances as $wfActionInstance) {
            $wfInstances = WorkflowInstance::get()->filter('CurrentActionID', $wfActionInstance->ID);
            foreach ($wfInstances as $wfInstance) {
                $wfInstance->Groups()->removeAll();
                $wfInstance->Users()->removeAll();
                $wfInstance->delete();
            }
            $wfActionInstance->delete();
        }
        // Delete outbound transitions
        $transitions = WorkflowTransition::get()->filter('ActionID', $this->ID);
        foreach ($transitions as $transition) {
            $transition->Groups()->removeAll();
            $transition->Users()->removeAll();
            $transition->delete();
        }
    }
1091056
protected function setAfterSaveRoute()
    {
        // Default is just go to the index
        if ($this->routeAction && ($this->request->getActionName() !== $this->routeAction)) {
            $tokenId = $this->_replacementTokenId ? $this->_replacementTokenId : $this->token->getTokenId();
            $this->afterSaveRouteUrl = array(
                $this->request->getActionKey() => $this->routeAction,
                \MUtil_Model::REQUEST_ID       => $tokenId,
                );
        }

        return $this;
    }
235919
public function RenderEnd () {
		$this->PreDispatch();
		$this->SetFormTagRenderingStatus(FALSE);
		$result = '</form>'
			. $this->RenderSupportingJs()
			. $this->RenderSupportingCss();
		$this->cleanSessionErrorsAfterRender();
		return $result;
	}
142042
public function doDelete($data, Form $form) {
        $record=$this->currentPage();
    
        if($record->canDelete()) {
            Session::set('CodeBank.deletedSnippetID', $record->ID);
            $record->delete();
    
            $this->response->addHeader('X-Status', rawurlencode(_t('CodeBank.SNIPPET_DELETED', '_Snippet has been deleted')));
        }else {
            $this->response->addHeader('X-Status', rawurlencode(_t('CodeBank.PERMISSION_DENIED', '_Permission Denied')));
        }
        
        $this->redirect('admin/codeBank/');
        return $this->getResponseNegotiator()->respond($this->request);
    }