bean->id) ) { // No reason to set everything up just to have it fail in the display() call return; } parent::preDisplay(); $viewHelper = new UserViewHelper($this->ss, $this->bean, 'DetailView'); $viewHelper->setupAdditionalFields(); $errors = ""; $msgGood = false; if (isset($_REQUEST['pwd_set']) && $_REQUEST['pwd_set']!= 0){ if ($_REQUEST['pwd_set']=='4'){ require_once('modules/Users/password_utils.php'); $errors.=canSendPassword(); } else { $errors.=translate('LBL_NEW_USER_PASSWORD_'.$_REQUEST['pwd_set'],'Users'); $msgGood = true; } }else{ //IF BEAN USER IS LOCKOUT if($this->bean->getPreference('lockout')=='1') { $errors.=translate('ERR_USER_IS_LOCKED_OUT','Users'); } } $this->ss->assign("ERRORS", $errors); $this->ss->assign("ERROR_MESSAGE", $msgGood ? translate('LBL_PASSWORD_SENT','Users') : translate('LBL_CANNOT_SEND_PASSWORD','Users')); $buttons = ""; if ((is_admin($current_user) || $_REQUEST['record'] == $current_user->id ) && !empty($sugar_config['default_user_name']) && $sugar_config['default_user_name'] == $this->bean->user_name && isset($sugar_config['lock_default_user_name']) && $sugar_config['lock_default_user_name']) { $buttons .= " "; } elseif (is_admin($current_user)|| ($GLOBALS['current_user']->isAdminForModule('Users')&& !$this->bean->is_admin) || $_REQUEST['record'] == $current_user->id) { $buttons .= " "; if ((is_admin($current_user)|| $GLOBALS['current_user']->isAdminForModule('Users') )) { if (!$current_user->is_group){ $buttons .= " "; if($this->bean->id != $current_user->id) { $buttons .=" "; } if (!$this->bean->portal_only && !$this->bean->is_group && !$this->bean->external_auth_only && isset($sugar_config['passwordsetting']['SystemGeneratedPasswordON']) && $sugar_config['passwordsetting']['SystemGeneratedPasswordON']){ $buttons .= " "; } } } } $this->ss->assign('EDITBUTTONS',$buttons); $show_roles = (!($this->bean->is_group=='1' || $this->bean->portal_only=='1')); $this->ss->assign('SHOW_ROLES', $show_roles); //Mark whether or not the user is a group or portal user $this->ss->assign('IS_GROUP_OR_PORTAL', ($this->bean->is_group=='1' || $this->bean->portal_only=='1') ? true : false); if ( $show_roles ) { ob_start(); echo "
"; require_once('modules/ACLRoles/DetailUserRole.php'); echo "
"; $role_html = ob_get_contents(); ob_end_clean(); $this->ss->assign('ROLE_HTML',$role_html); } } public function getMetaDataFile() { $userType = 'Regular'; if($this->bean->is_group == 1){ $userType = 'Group'; } if ( $userType != 'Regular' ) { $oldType = $this->type; $this->type = $oldType.'group'; } $metadataFile = parent::getMetaDataFile(); if ( $userType != 'Regular' ) { $this->type = $oldType; } return $metadataFile; } function display() { if ($this->bean->portal_only == 1 || $this->bean->is_group == 1 ) { $this->options['show_subpanels'] = false; $this->dv->formName = 'DetailViewGroup'; $this->dv->view = 'DetailViewGroup'; } //handle request to reset the homepage if(isset($_REQUEST['reset_homepage'])){ $this->bean->resetPreferences('Home'); global $current_user; if($this->bean->id == $current_user->id) { $_COOKIE[$current_user->id . '_activePage'] = '0'; setcookie($current_user->id . '_activePage','0',3000); } } return parent::display(); } /** * getHelpText * * This is a protected function that returns the help text portion. It is called from getModuleTitle. * We override the function from SugarView.php to make sure the create link only appears if the current user * meets the valid criteria. * * @param $module String the formatted module name * @return $theTitle String the HTML for the help text */ protected function getHelpText($module) { $theTitle = ''; if($GLOBALS['current_user']->isAdminForModule('Users') ) { $createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif'); $url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView"); $theTitle = << {$GLOBALS['app_strings']['LNK_CREATE']} EOHTML; } return $theTitle; } }