fieldHelper = new UserViewHelper($this->ss, $this->bean, 'EditView'); $this->fieldHelper->setupAdditionalFields(); parent::preDisplay(); } public function getMetaDataFile() { $userType = 'Regular'; if($this->fieldHelper->usertype == 'GROUP'){ $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() { global $current_user, $app_list_strings; //lets set the return values if(isset($_REQUEST['return_module'])){ $this->ss->assign('RETURN_MODULE',$_REQUEST['return_module']); } $this->ss->assign('IS_ADMIN', $current_user->is_admin ? true : false); //make sure we can populate user type dropdown. This usually gets populated in predisplay unless this is a quickeditform if(!isset($this->fieldHelper)){ $this->fieldHelper = new UserViewHelper($this->ss, $this->bean, 'EditView'); $this->fieldHelper->setupAdditionalFields(); } if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { $this->ss->assign('RETURN_MODULE', $_REQUEST['return_module']); $this->ss->assign('RETURN_ACTION', $_REQUEST['return_action']); $this->ss->assign('RETURN_ID', $_REQUEST['record']); $this->bean->id = ""; $this->bean->user_name = ""; $this->ss->assign('ID',''); } else { if(isset($_REQUEST['return_module'])) { $this->ss->assign('RETURN_MODULE', $_REQUEST['return_module']); } else { $this->ss->assign('RETURN_MODULE', $this->bean->module_dir); } $return_id = isset($_REQUEST['return_id'])?$_REQUEST['return_id']:$this->bean->id; if (isset($return_id)) { $return_action = isset($_REQUEST['return_action'])?$_REQUEST['return_action']:'DetailView'; $this->ss->assign('RETURN_ID', $return_id); $this->ss->assign('RETURN_ACTION', $return_action); } } /////////////////////////////////////////////////////////////////////////////// //// REDIRECTS FROM COMPOSE EMAIL SCREEN if(isset($_REQUEST['type']) && (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Emails')) { $this->ss->assign('REDIRECT_EMAILS_TYPE', $_REQUEST['type']); } //// END REDIRECTS FROM COMPOSE EMAIL SCREEN /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //// NEW USER CREATION ONLY if(empty($this->bean->id)) { $this->ss->assign('SHOW_ADMIN_CHECKBOX','height="30"'); $this->ss->assign('NEW_USER','1'); }else{ $this->ss->assign('NEW_USER','0'); $this->ss->assign('NEW_USER_TYPE','DISABLED'); } //// END NEW USER CREATION ONLY /////////////////////////////////////////////////////////////////////////////// // FIXME: Translate error prefix if(isset($_REQUEST['error_string'])) $this->ss->assign('ERROR_STRING', 'Error: '.$_REQUEST['error_string'].''); if(isset($_REQUEST['error_password'])) $this->ss->assign('ERROR_PASSWORD', 'Error: '.$_REQUEST['error_password'].''); // Build viewable versions of a few fields for non-admins if(!empty($this->bean->id)) { if( !empty($this->bean->status) ) { $this->ss->assign('STATUS_READONLY',$app_list_strings['user_status_dom'][$this->bean->status]); } if( !empty($this->bean->employee_status) ) { $this->ss->assign('EMPLOYEE_STATUS_READONLY', $app_list_strings['employee_status_dom'][$this->bean->employee_status]); } if( !empty($this->bean->reports_to_id) ) { $reportsToUser = get_assigned_user_name($this->bean->reports_to_id); $reportsToUserField = "\n"; $reportsToUserField .= ""; $this->ss->assign('REPORTS_TO_READONLY', $reportsToUserField); } if( !empty($this->bean->title) ) { $this->ss->assign('TITLE_READONLY', $this->bean->title); } if( !empty($this->bean->department) ) { $this->ss->assign('DEPT_READONLY', $this->bean->department); } } $processSpecial = false; $processFormName = ''; if ( isset($this->fieldHelper->usertype) && ($this->fieldHelper->usertype == 'GROUP' )) { $this->ev->formName = 'EditViewGroup'; $processSpecial = true; $processFormName = 'EditViewGroup'; } $this->ev->process($processSpecial,$processFormName); echo $this->ev->display($this->showTitle); } /** * 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; } }