_doc->hasLoggedInUserAccessToPageId($this->getOption('idPage'))) { $this->_doc->display404(); } $this->_getDataObj()->setLoggedInUser($this->_doc->getAuthData()); return parent::exec(); } protected function _initAction() { parent::_initAction(); // Redirect to Edit Profile page if logged in individual tries to edit his/her own profile if (in_array($this->_action, ['edit', 'update']) && $this->_getDataObj()->getPrimaryKey() == $this->_doc->getAuthData('id') ) { $url = Qs_SiteMap::findFirst(null, ['type' => 'User\\'], ['defaultAction' => 'edit'], 'url'); $this->redirect($url . '?sessionName=' . $this->getSessionName()); } return $this; } protected function _getFormInstance($type, array $options = array()) { if (in_array($type, ['new', 'edit'])) { $hasPermission = (bool) $this->_doc->getAuthData('hasPermission'); $options['jobTitleElementMode'] = $hasPermission ? SelectOther::MODE_SELECT_OTHER : SelectOther::MODE_SELECT; $options['companyId'] = $this->_doc->getAuthData('companyId'); $options['hasLeadership'] = (bool) $this->_getDataObj()->getData('leadershipGroupId'); } return parent::_getFormInstance($type, $options); } protected function _postInsert() { $data = $this->_getDataObj()->setFilterByStatus(false)->clearData()->getData(); $this->sendEmail2Admin($data); return $this; } protected function _postUpdate() { $this->_sendProfileUpdateNotification(); return parent::_postUpdate(); } protected function _sendProfileUpdateNotification() { $previousData = $this->_getDataObj()->getPreviousData(); $currentData = $this->_getDataObj()->setFilterByStatus(false)->clearData()->getData(); $diffMail = new DiffMail($previousData, $currentData); $diffMail->send(); return $this; } }