/** * Build user details array fields required by user access (edit) pages * * @param array $userData Array containing users data (see users table) * @return array Array formatted for use in template object as in user access pages */ function getUserDetailsFields($userData) { $userExists = !empty($userData['user_id']); $userDetailsFields = array(); $aLanguages = RV_Admin_Languages::getAvailableLanguages(); $userDetailsFields[] = array('name' => 'login', 'label' => $GLOBALS['strUsername'], 'value' => $userData['username'], 'freezed' => !empty($userData['user_id'])); $userDetailsFields[] = array('name' => 'passwd', 'label' => $GLOBALS['strPassword'], 'type' => 'password', 'value' => '', 'hidden' => !empty($userData['user_id'])); $userDetailsFields[] = array('name' => 'passwd2', 'label' => $GLOBALS['strPasswordRepeat'], 'type' => 'password', 'value' => '', 'hidden' => !empty($userData['user_id'])); $userDetailsFields[] = array('name' => 'contact_name', 'label' => $GLOBALS['strContactName'], 'value' => $userData['contact_name'], 'freezed' => $userExists); $userDetailsFields[] = array('name' => 'email_address', 'label' => $GLOBALS['strEMail'], 'value' => $userData['email_address'], 'freezed' => $userExists); $userDetailsFields[] = array('type' => 'select', 'name' => 'language', 'label' => $GLOBALS['strLanguage'], 'options' => $aLanguages, 'value' => !empty($userData['language']) ? $userData['language'] : $GLOBALS['_MAX']['PREF']['language'], 'disabled' => $userExists); return $userDetailsFields; }
public function configurationAction() { $oWizard = new OX_Admin_UI_Install_Wizard($this->getInstallStatus()); $this->setCurrentStepIfReachable($oWizard, 'configuration'); $oUpgrader = $this->getUpgrader(); $isUpgrade = $this->getInstallStatus()->isUpgrade(); //setup form $aPluginsVerifyResult = OX_Admin_UI_Install_InstallUtils::checkPluginsVerified(); $prevPathRequired = !$aPluginsVerifyResult['verified']; $aLanguages = RV_Admin_Languages::getAvailableLanguages(); $aTimezones = OX_Admin_Timezones::AvailableTimezones(true); $oForm = new OX_Admin_UI_Install_ConfigForm($this->oTranslation, $oWizard->getCurrentStep(), $aLanguages, $aTimezones, $isUpgrade, $prevPathRequired); $aStepData = $oWizard->getStepData(); //setup defaults if ($this->getRequest()->isGet() && empty($aStepData)) { $aConfig = $oUpgrader->getConfig(); if ($prevPathRequired) { $aConfig['previousInstallationPath'] = $aPluginsVerifyResult['path']; } $aStepData['config'] = $aConfig; //admin part $aStepData['prefs'] = array(); $aStepData['prefs']['timezone'] = OX_Admin_Timezones::getTimezone(); $aStepData['admin'] = array(); $aStepData['admin']['language'] = 'en'; } //populate form $oForm->populateForm($aStepData); //process if install if ($oForm->isSubmitted() && $oForm->validate()) { if ($this->processConfigurationAction($oForm, $oWizard, $isUpgrade)) { $aConfig = $oForm->populateConfig(); $oWizard->setStepData($aConfig); $oWizard->markStepAsCompleted(); $this->redirect('jobs'); } } $this->setModelProperty('form', $oForm->serialize()); $this->setModelProperty('oWizard', $oWizard); $this->setModelProperty('isUpgrade', $isUpgrade); $this->setModelProperty('loaderMessage', $GLOBALS['strConfigureProgressMessage']); $this->setModelProperty('isUpgrade', $isUpgrade); }
// Display the settings page's header and sections phpAds_PageHeader("5.1"); if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) { // Show all "Preferences" sections phpAds_ShowSections(array("5.1", "5.2", "5.3", "5.5", "5.6", "5.4")); } else { if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { // Show the "Account Preferences", "User Log" and "Channel Management" sections of the "Preferences" sections phpAds_ShowSections(array("5.1", "5.2", "5.4", "5.7")); } else { if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) || OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { // Show the "User Preferences" section of the "Preferences" sections $sections = array("5.1", "5.2"); if (OA_Permission::hasPermission(OA_PERM_USER_LOG_ACCESS)) { $sections[] = "5.4"; } phpAds_ShowSections($sections); } } } // Set the correct section of the preference pages and display the drop-down menu $oOptions->selection("name-language"); // Get the current logged in user details $oUser = OA_Permission::getCurrentUser(); $aUser = $oUser->aUser; // Prepare an array of HTML elements to display for the form, and // output using the $oOption object $aSettings = array(array('text' => $strUserDetails, 'items' => array(array('type' => 'plaintext', 'name' => 'username', 'value' => $aUser['username'], 'text' => $strUsername, 'size' => 35), array('type' => 'break'), array('type' => 'plaintext', 'name' => 'email_address', 'value' => $aUser['email_address'], 'text' => $strEmailAddress, 'size' => 35), array('type' => 'break'), array('type' => 'text', 'name' => 'contact_name', 'value' => $aUser['contact_name'], 'text' => $strFullName, 'size' => 35))), array('text' => $strLanguage, 'items' => array(array('type' => 'select', 'name' => 'language', 'text' => $strLanguage, 'items' => RV_Admin_Languages::getAvailableLanguages(), 'value' => $GLOBALS['_MAX']['PREF']['language'])))); $oOptions->show($aSettings, $aErrormessage); // Display the page footer phpAds_PageFooter();
function _validateLangage($language) { $aLanguages = RV_Admin_Languages::getAvailableLanguages(); return isset($aLanguages[$language]); }