/**
  * 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)
  */
 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);
     }
 }
 /**
  * Validate the form
  *
  * As it is better for translation utilities to set the labels etc. translated,
  * the MUtil default is to disable translation.
  *
  * However, this also disables the translation of validation messages, which we
  * cannot set translated. The MUtil form is extended so it can make this switch.
  *
  * @param  array   $data
  * @param  boolean $disableTranslateValidators Extra switch
  * @return boolean
  */
 public function isValid($data, $disableTranslateValidators = null)
 {
     $this->_user = $this->loader->getUser(isset($data[$this->usernameFieldName]) ? $data[$this->usernameFieldName] : null, isset($data[$this->organizationFieldName]) ? $data[$this->organizationFieldName] : '');
     return parent::isValid($data, $disableTranslateValidators);
 }