Hook that allows actions when data was saved

When not rerouted, the form will be populated afterwards

@param int $changed The number of changed rows (0 or 1 usually, but can be more)
226
protected function afterSave($changed)
    {
        if ($changed) {
            $this->accesslog->logChange($this->request, null, $this->formData);

            // Reload the current user data
            $user       = $this->currentUser;
            $currentOrg = $user->getCurrentOrganizationId();

            $this->loader->getUserLoader()->unsetCurrentUser();
            $user = $this->loader->getUser($user->getLoginName(), $user->getBaseOrganizationId())->setAsCurrentUser();
            $user->setCurrentOrganization($currentOrg);

            // In case locale has changed, set it in a cookie
            \Gems_Cookies::setLocale($this->formData['gsf_iso_lang'], $this->basepath);

            $this->addMessage($this->_('Saved your setup data', $this->formData['gsf_iso_lang']));
        } else {
            $this->addMessage($this->_('No changes to save!'));
        }

        if ($this->cacheTags && ($this->cache instanceof \Zend_Cache_Core)) {
            $this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, (array) $this->cacheTags);
        }
    }
696354
public function updateFromFormData($data)
    {
        $cmsFields = $this->getCMSFields();

        foreach ($data as $field => $datum) {
            $field = $cmsFields->dataFieldByName($field);

            if (!$field) {
                continue;
            }

            $field->setSubmittedValue($datum);
            $field->saveInto($this);
        }
    }
1073212
private function didAnyFileChange(array $changedFiles) : bool
    {
        foreach ($this->filesToWatch as $file) {
            if (in_array($file, $changedFiles)) {
                return true;
            }
        }
        return false;
    }
231048
def hook_changed(self, hook, new_data):
        """"""
        for field in self.hooks[hook]:
            widget = self.widgets[field]
            field.hook_changed(hook, widget, new_data)
695364
public function afterSave($insert, $changedAttributes)
    {
        $params = 'id=' . $this->id;
        if (($url = UrlRule::findOne(['route' => '/system/page/view', 'params' => $params])) != null) {
            $url->updateAttributes(['slug' => $this->route]);
        } else {
            $url = new UrlRule([
                'slug' => $this->route,
                'route' => '/system/page/view',
                'params' => $params,
            ]);
            $url->save();
        }

        parent::afterSave($insert, $changedAttributes);
    }
408076
private function changed()
    {
        if ($this->isDirty) {
            return;
        }

        $this->isDirty = true;

        if ($this->dm &&
            $this->mapping !== null &&
            $this->mapping['isOwningSide'] &&
            $this->owner &&
            $this->dm->getClassMetadata(get_class($this->owner))->isChangeTrackingNotify()) {
            $this->uow->scheduleForDirtyCheck($this->owner);
        }
    }
383389
protected function onInputEnd()
    {
        $data = array();
        if (Utility::isAssoc($this->params)) {
            $data = array($this->params);
        } else {
            $data = $this->params;
        }
        foreach ($data as $row) {
            $this->next($row);
        }
    }
178012
protected function onFileChanged()
    {
        $this->firstLinesRaw = null;
        $this->firstLines = null;
        if ($this->separatorWasDetected) {
            $this->separator = '';
            $this->separatorWasDetected = false;
        }
        if ($this->headerWasDetected) {
            $this->setHeader([]);
            $this->headerWasDetected = false;
        }
    }
1250084
private function previousChanges(Change $change)
    {
        return $this->changes()
            ->where('changes.id', '<=', $change->id)
            ->orderBy('changes.id', 'asc')
            ->get();

    }
1010488
public function onsubmitCallback($dc)
	{
		$type = $this->getDcaFieldValue($dc, 'type');
		if (!$type || substr($type, 0, 5) !== 'rsce_') {
			return;
		}

		$data = $this->getDcaFieldValue($dc, 'rsce_data', true);

		// Check if it is a new element with no data
		if ($data === null && !count($this->saveData)) {

			// Creates empty arrays for empty lists, see #4
			$data = $this->saveDataCallback(null, $dc);

			if ($data && substr($data, 0, 1) === '{') {
				\Database::getInstance()
					->prepare("UPDATE {$dc->table} SET rsce_data = ? WHERE id = ?")
					->execute($data, $dc->id);
			}

		}
	}
847212
public function success(Form $form) : void
    {
        if ($this->presenter->isAjax())
        {
            $values = $form->getValues();

            try
            {
                $redirect = NULL;
                $page = $this->pageRepository->findOneById($values->pageId);

                if ($this->redirectId)
                {
                    $redirect = $this->onPageRepository->findOneRedirectById($this->redirectId);
                }

                $this->onPageManager->saveRedirect($redirect, $page, $values->oldUrl);

                $form->reset();

                $this->presenter->notificationAjax(
                    'URL přesměrována',
                    'URL byla úspěšně přesměrována.',
                    'success',
                    FALSE
                );

                $this->onSave();
            }
            catch (DatabaseException $exception)
            {
                $this->presenter->notificationAjax(
                    'Chyba',
                    $exception->getMessage(),
                    'error'
                );
            }
        }
    }
79951
public function handleRefreshState()
	{
		$this->findSessionValues();
		$this->findDefaultFilter();
		$this->findDefaultSort();
		$this->findDefaultPerPage();

		$this->getPresenter()->payload->_datagrid_url = $this->refresh_url;
		$this->redrawControl('non-existing-snippet');
	}
1063265
protected function saveData()
    {
        $this->beforeSave();

        $fromOrgId   = $this->request->getParam(\MUtil_Model::REQUEST_ID2);
        $fromPid     = $this->request->getParam(\MUtil_Model::REQUEST_ID1);
        $fromRespId  = $this->respondent->getId();
        $toOrgId     = $this->formData['gr2o_id_organization'];
        $toPatientId = $this->formData['gr2o_patient_nr'];

        switch ($this->formData['change_method']) {
            case 'share':
                $this->_changed = $this->saveShare($fromOrgId, $fromPid, $toOrgId, $toPatientId);
                break;

            case 'copy':
                $this->_changed = $this->saveShare($fromOrgId, $fromPid, $toOrgId, $toPatientId);
                $this->_changed += $this->saveMoveTracks($fromOrgId, $fromRespId, $toOrgId, $toPatientId, false);
                break;

            case 'move':
                $this->_changed = $this->saveTo($fromOrgId, $fromPid, $toOrgId, $toPatientId);
                $this->_changed += $this->saveMoveTracks($fromOrgId, $fromRespId, $toOrgId, $toPatientId, true);
                break;

            default:
                $this->_changed = 0;

        }

        // Message the save
        $this->afterSave($this->_changed);
    }
1072647
public function save_changes($data) {
        $data = (array) $data;
        unset($data['filter']);
        unset($data['contextid']);
        foreach ($data as $name => $value) {
            if ($value !== '') {
                filter_set_local_config($this->filter, $this->context->id, $name, $value);
            } else {
                filter_unset_local_config($this->filter, $this->context->id, $name);
            }
        }
    }
1318203
public function onPostBind($event)
    {
        $form = $event->getForm();

        if ( ! $form->isRoot()) return;

        $clientData = $event->getForm()->getData();

        if ( ! is_object($clientData)) return;

        $this->filterService->filterEntity($clientData);

    }
509014
function put($data)
    {
        if ($this->_change == self::STATE_INSERT)
        {
            $this->_change = self::STATE_UPDATE;
            $this->_update = $data;
        }
        elseif ($this->_change == self::STATE_EMPTY)
        {
            $this->_change = self::STATE_INSERT;
            $this->_data = $data;
        }
    }
1255072
protected function afterSave($changed)
    {
        parent::afterSave($changed);

        $model = $this->getModel();
        if ($model instanceof \Gems_Model_AppointmentModel) {
            $count = $model->getChangedTokenCount();
            if ($count) {
                $this->addMessage(sprintf($this->plural('%d token changed', '%d tokens changed', $count), $count));
            }
        }
    }