本文整理汇总了PHP中ArrayUtils::AlphaSort方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayUtils::AlphaSort方法的具体用法?PHP ArrayUtils::AlphaSort怎么用?PHP ArrayUtils::AlphaSort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayUtils
的用法示例。
在下文中一共展示了ArrayUtils::AlphaSort方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($controller, $name)
{
$org_field = null;
$current_user = Member::currentUser();
$current_affiliations = $current_user->getCurrentAffiliations();
if (!$current_affiliations) {
$org_field = new TextField('Organization', 'Your Organization Name');
} else {
if (count($current_affiliations) > 1) {
$source = array();
foreach ($current_affiliations as $a) {
$org = $a->Organization();
$source[$org->ID] = $org->Name;
}
$source['0'] = "-- New One --";
$ddl = new DropdownField('OrgID', 'Your Organization', $source);
$ddl->setEmptyString('-- Select Your Organization --');
$org_field = new FieldGroup();
$org_field->push($ddl);
$org_field->push($txt = new TextField('Organization', ''));
$txt->addExtraClass('new-org-name');
} else {
$org_field = new TextField('Organization', 'Your Organization Name', $current_user->getOrgName());
}
}
$fields = new FieldList($org_field, new DropdownField('Industry', 'Your Organization’s Primary Industry', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$industry_options, array('' => '-- Please Select One --'), array('Other' => 'Other Industry (please specify)'))), new TextareaField('OtherIndustry', 'Other Industry'), $org_it_activity = new TextareaField('ITActivity', 'Your Organization’s Primary IT Activity'), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Your Organization’s Primary Location or Headquarters</p>'), $country = new DropdownField('PrimaryCountry', 'Country', CountryCodes::$iso_3166_countryCodes), new TextField('PrimaryState', 'State / Province / Region'), new TextField('PrimaryCity', 'City'), new DropdownField('OrgSize', 'Your Organization Size (All Branches, Locations, Sites)', DeploymentSurveyOptions::$organization_size_options), new CustomCheckboxSetField('OpenStackInvolvement', 'What best describes your Organization’s involvement with OpenStack?<BR>Select All That Apply', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$openstack_involvement_options)));
$org_it_activity->addExtraClass('hidden');
$country->setEmptyString('-- Select One --');
$nextButton = new FormAction('NextStep', ' Next Step ');
$actions = new FieldList($nextButton);
$validator = new RequiredFields();
Requirements::javascript('surveys/js/deployment_survey_yourorganization_form.js');
parent::__construct($controller, $name, $fields, $actions, $validator);
}
示例2: getCMSFields
function getCMSFields()
{
$fields = new FieldList($rootTab = new TabSet("Root"));
$fields->addFieldsToTab('Root.Main', array(new LiteralField('Break', ColumnFormatter::$left_column_start), new CustomCheckboxSetField('Toolkits', 'What toolkits do you use or plan to use to interact with the OpenStack API?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$toolkits_options, null, array('Other' => 'Other Toolkits (please specify)'))), $t1 = new TextareaField('OtherToolkits', ''), new LiteralField('Break', ColumnFormatter::$right_column_start), new CustomCheckboxSetField('ProgrammingLanguages', 'If you wrote your own code for interacting with the OpenStack API, what programming language did you write it in?', ArrayUtils::AlphaSort(AppDevSurveyOptions::$languages_options, null, array('Other' => 'Other (please specify)'))), $t2 = new TextareaField('OtherProgrammingLanguages', ''), new LiteralField('Break', ColumnFormatter::$end_columns), new LiteralField('Break', ColumnFormatter::$left_column_start), new CustomCheckboxSetField('APIFormats', 'If you wrote your own code for interacting with the OpenStack API, what wire format are you using?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$api_format_options, null, array('Other' => 'Other Wire Format (please specify)'))), $t3 = new TextareaField('OtherAPIFormats', ''), new CustomCheckboxSetField('OperatingSystems', 'What operating systems are you using or plan on using to develop your applications?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$opsys_options, null, array('Other' => 'Other Development OS (please specify)'))), $t4 = new TextareaField('OtherOperatingSystems', ''), new CustomCheckboxSetField('GuestOperatingSystems', 'What guest operating systems are you using or plan on using to deploy your applications to customers?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$opsys_options, null, array('Other' => 'Other Development OS (please specify)'))), $t5 = new TextareaField('OtherGuestOperatingSystems', ''), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Please share your thoughts with us on the state of applications on OpenStack</p>'), new TextAreaField('StruggleDevelopmentDeploying', 'What do you struggle with when developing or deploying applications on OpenStack?'), $docs = new DropdownField('DocsPriority', 'What is your top priority in evaluating API and SDK docs?', AppDevSurveyOptions::$docs_priority_options), $t6 = new TextareaField('OtherDocsPriority', '')));
$docs->setEmptyString('-- Select One --');
return $fields;
}
示例3: getCMSFields
function getCMSFields()
{
$CountryCodes = CountryCodes::$iso_3166_countryCodes;
$CountryCodes['Worldwide'] = 'Worldwide';
$CountryCodes['Prefer not to say'] = 'Prefer not to say';
$CountryCodes['Too many to list'] = 'Too many to list';
$fields = new FieldList($rootTab = new TabSet("Root"));
$fields->addFieldsToTab('Root.Main', array(new LiteralField('Break', '<p>Each deployment profile can be marked public if you wish for the basic information on this page to appear on openstack.org. If you select private we will treat all of the profile information as confidential information.</p>'), new OptionSetField('IsPublic', 'Would you like to keep this information confidential or allow the Foundation to share information about this deployment publicly?', array('1' => '<strong>Willing to share:</strong> The information on this page may be shared for this deployment', '0' => '<strong>Confidential:</strong> All details provided should be kept confidential to the OpenStack Foundation'), 0), new LiteralField('Break', '<hr/>'), new TextField('Label', 'Deployment Name<BR><p class="clean_text">Please create a friendly label, like “Production OpenStack Deployment”. This name is for your deployment in our survey tool. If several people at your organization work on one deployment, we would <b>really appreciate</b> you all referring to the same deployment by the same name!</p>'), $ddl_stage = new DropdownField('DeploymentStage', 'In what stage is your OpenStack deployment? (make a new deployment profile for each type of deployment)', DeploymentOptions::$stage_options), new MultiDropdownField('CountriesPhysicalLocation', 'In which country / countries is this OpenStack deployment physically located?', $CountryCodes), new MultiDropdownField('CountriesUsersLocation', 'In which country / countries are the users / customers for this deployment physically located?', $CountryCodes), $ddl_type = new DropdownField('DeploymentType', 'Deployment Type', DeploymentOptions::$deployment_type_options), new CustomCheckboxSetField('ProjectsUsed', 'Projects Used', DeploymentOptions::$projects_used_options), new CustomCheckboxSetField('CurrentReleases', 'What releases are you currently using?', DeploymentOptions::$current_release_options), new LiteralField('Break', 'Describe the workloads and frameworks running in this OpenStack environment.<BR>Select All That Apply'), new LiteralField('Break', '<hr/>'), new CustomCheckboxSetField('ServicesDeploymentsWorkloads', '<b>Services Deployments - workloads designed to be accessible for external users / customers</b>', DeploymentOptions::$services_deployment_workloads_options), $other_service_workload = new TextAreaField('OtherServicesDeploymentsWorkloads', ''), new CustomCheckboxSetField('EnterpriseDeploymentsWorkloads', '<b>Enterprise Deployments - workloads designed to be run internally to support business</b>', DeploymentOptions::$enterprise_deployment_workloads_options), $other_enterprise_workload = new TextAreaField('OtherEnterpriseDeploymentsWorkloads', ''), new CustomCheckboxSetField('HorizontalWorkloadFrameworks', '<b>Horizontal Workload Frameworks</b>', DeploymentOptions::$horizontal_workload_framework_options), $other_horizontal_workload = new TextAreaField('OtherHorizontalWorkloadFrameworks', '')));
$ddl_type->setEmptyString('-- Select One --');
$ddl_stage->setEmptyString('-- Select One --');
$details = array(new LiteralField('Break', '<p>The information below will help us better understand the most common configuration and component choices OpenStack deployments are using.</p>'), new LiteralField('Break', '<h3>Telemetry</h3>'), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Please provide the following information about the size and scale of this OpenStack deployment. This information is optional, but will be kept confidential and <b>never</b> published in connection with you or your organization.</p>'), new DropdownField('OperatingSystems', 'What is the main operating system running this OpenStack cloud deployment?', ArrayUtils::AlphaSort(DeploymentOptions::$operating_systems_options, array('' => '-- Select One --'), array('Other' => 'Other (please specify)'))), $other_os = new TextareaField('OtherOperatingSystems', ''), new CustomCheckboxSetField('UsedPackages', 'What packages does this deployment use…?<BR>Select All That Apply', DeploymentOptions::$used_packages_options), new CustomCheckboxSetField('CustomPackagesReason', 'If you have modified packages or have built your own packages, why?<BR>Select All That Apply', DeploymentOptions::$custom_package_reason_options), $other_custom_reason = new TextareaField('OtherCustomPackagesReason', ''), new CustomCheckboxSetField('DeploymentTools', 'What tools are you using to deploy / configure this cluster?<BR>Select All That Apply', DeploymentOptions::$deployment_tools_options), $other_deployment_tools = new TextareaField('OtherDeploymentTools', ''), new CustomCheckboxSetField('PaasTools', 'What Platform-as-a-Service (PaaS) tools are you using to manage applications on this OpenStack deployment?', ArrayUtils::AlphaSort(DeploymentOptions::$paas_tools_options, array('' => '-- Select One --'), array('Other' => 'Other Tool (please specify)'))), $other_paas = new TextareaField('OtherPaasTools', ''), new CustomCheckboxSetField('Hypervisors', 'If this deployment uses <b>OpenStack Compute (Nova)</b>, which hypervisors are you using?<BR>Select All That Apply', DeploymentOptions::$hypervisors_options), new TextareaField('OtherHypervisor', ''), new CustomCheckboxSetField('SupportedFeatures', 'Which compatibility APIs does this deployment support?<BR> Select All That Apply', DeploymentOptions::$deployment_features_options), new TextareaField('OtherSupportedFeatures', ''), new CustomCheckboxSetField('UsedDBForOpenStackComponents', 'What database do you use for the components of this OpenStack cloud?<BR>Select All That Apply', DeploymentOptions::$used_db_for_openstack_components_options), new TextareaField('OtherUsedDBForOpenStackComponents', ''), new CustomCheckboxSetField('NetworkDrivers', ' If this deployment uses <b>OpenStack Network (Neutron)</b>, which drivers are you using?<BR>Select All That Apply', DeploymentOptions::$network_driver_options), new TextareaField('OtherNetworkDriver', ''), new CustomCheckboxSetField('IdentityDrivers', 'If you are using <b>OpenStack Identity Service (Keystone)</b> which OpenStack identity drivers are you using?<BR>Select All That Apply', DeploymentOptions::$identity_driver_options), new TextareaField('OtherIndentityDriver', ''), new CustomCheckboxSetField('BlockStorageDrivers', 'If this deployment uses <b>OpenStack Block Storage (Cinder)</b>, which drivers are <BR>Select All That Apply', DeploymentOptions::$block_storage_divers_options), new TextareaField('OtherBlockStorageDriver', ''), new CustomCheckboxSetField('InteractingClouds', 'With what other clouds does this OpenStack deployment interact?<BR>Select All That Apply', DeploymentOptions::$interacting_clouds_options), new TextareaField('OtherInteractingClouds', ''), $ddl_users = new DropdownField('NumCloudUsers', 'Number of users', DeploymentOptions::$cloud_users_options), $ddl_nodes = new DropdownField('ComputeNodes', 'Physical compute nodes', DeploymentOptions::$compute_nodes_options), $ddl_cores = new DropdownField('ComputeCores', 'Processor cores', DeploymentOptions::$compute_cores_options), $ddl_instances = new DropdownField('ComputeInstances', 'Number of instances', DeploymentOptions::$compute_instances_options), $ddl_ips = new DropdownField('NetworkNumIPs', 'Number of fixed / floating IPs', DeploymentOptions::$network_ip_options), $ddl_block_size = new DropdownField('BlockStorageTotalSize', 'If this deployment uses <b>OpenStack Block Storage (Cinder)</b>, what is the size of its block storage?', DeploymentOptions::$storage_size_options), $ddl_block_size = new DropdownField('ObjectStorageSize', 'If this deployment uses <b>OpenStack Object Storage (Swift)</b>, what is the size of its block storage?', DeploymentOptions::$storage_size_options), $ddl_objects_size = new DropdownField('ObjectStorageNumObjects', 'If this deployment uses <b>OpenStack Object Storage (Swift)</b>, how many total objects are stored?', DeploymentOptions::$storage_objects_options), new LiteralField('Break', '<h3>Spotlight</h3>'), new LiteralField('Break', '<hr/>'), new CustomCheckboxSetField('WhyNovaNetwork', 'If this deployment uses nova-network and not OpenStack Network (Neutron), what would allow you to migrate to Neutron?', DeploymentOptions::$why_nova_network_options), $other_why_nova = new TextareaField('OtherWhyNovaNetwork', ''), $ddl_swift_dist_feat = new DropdownField('SwiftGlobalDistributionFeatures', 'Are you using Swift\'s global distribution features?', DeploymentOptions::$swift_global_distribution_features_options), $ddl_uses_cases = new DropdownField('SwiftGlobalDistributionFeaturesUsesCases', 'If yes, what is your use case?', DeploymentOptions::$swift_global_distribution_features_uses_cases_options), $other_uses_cases = new TextareaField('OtherSwiftGlobalDistributionFeaturesUsesCases', ''), $ddl_policies = new DropdownField('Plans2UseSwiftStoragePolicies', 'Do you have plans to use Swift\'s storage policies or erasure codes in the next year?', DeploymentOptions::$plans_2_use_swift_storage_policies_options), new TextareaField('OtherPlans2UseSwiftStoragePolicies', ''), $ddl_other_tools = new DropdownField('ToolsUsedForYourUsers', 'What tools are you using charging or show-back for your users?', DeploymentOptions::$tools_used_for_your_users_options), $other_tools = new TextareaField('OtherToolsUsedForYourUsers', ''), new TextareaField('Reason2Move2Ceilometer', 'If you are not using Ceilometer, what would allow you to move to it (optional free text)?'));
$ddl_users->setEmptyString('-- Select One --');
$ddl_nodes->setEmptyString('-- Select One --');
$ddl_cores->setEmptyString('-- Select One --');
$ddl_instances->setEmptyString('-- Select One --');
$ddl_ips->setEmptyString('-- Select One --');
$ddl_block_size->setEmptyString('-- Select One --');
$ddl_block_size->setEmptyString('-- Select One --');
$ddl_objects_size->setEmptyString('-- Select One --');
$ddl_swift_dist_feat->setEmptyString('-- Select One --');
$ddl_uses_cases->setEmptyString('-- Select One --');
$ddl_policies->setEmptyString('-- Select One --');
$ddl_other_tools->setEmptyString('-- Select One --');
$fields->addFieldsToTab('Root.Details', $details);
return $fields;
}
示例4: __construct
function __construct($controller, $name)
{
// Define fields //////////////////////////////////////
$fields = new FieldList(new LiteralField('paragraph', '<p>
The questions on this page are optional, but will help us better understand the details of how you are using and interacting with OpenStack. Any information you provide on this step will be treated as private and confidential and only used in aggregate reporting.
</p>
<p>
<strong>If you do not wish to answer these questions, you make <a href="' . $controller->Link('SkipAppDevSurvey') . '">skip to the next section</a>.</strong>
</p><hr>'), new CustomCheckboxSetField('Toolkits', 'What toolkits do you use or plan to use to interact with the OpenStack API?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$toolkits_options, null, array('Other' => 'Other Toolkits (please specify)'))), $t1 = new TextareaField('OtherToolkits', ''), new LiteralField('Container', '<div id="wrote_your_own_container" class="hidden">'), $programming_lang = new CustomCheckboxSetField('ProgrammingLanguages', 'If you wrote your own code for interacting with the OpenStack API, what programming language did you write it in?', ArrayUtils::AlphaSort(AppDevSurveyOptions::$languages_options, null, array('Other' => 'Other (please specify)'))), $other_programming_lang = new TextareaField('OtherProgrammingLanguages', ''), new CustomCheckboxSetField('APIFormats', 'If you wrote your own code for interacting with the OpenStack API, what wire format are you using?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$api_format_options, null, array('Other' => 'Other Wire Format (please specify)'))), $t3 = new TextareaField('OtherAPIFormats', ''), new LiteralField('Container', '</div>'), new CustomCheckboxSetField('OperatingSystems', 'What operating systems are you using or plan on using to develop your applications?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$opsys_options, null, array('Other' => 'Other Development OS (please specify)'))), $t4 = new TextareaField('OtherOperatingSystems', ''), new CustomCheckboxSetField('GuestOperatingSystems', 'What guest operating systems are you using or plan on using to deploy your applications to customers?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$opsys_options, null, array('Other' => 'Other Development OS (please specify)'))), $t5 = new TextareaField('OtherGuestOperatingSystems', ''), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Please share your thoughts with us on the state of applications on OpenStack</p>'), new TextAreaField('StruggleDevelopmentDeploying', 'What do you struggle with when developing or deploying applications on OpenStack?'), $docs = new DropdownField('DocsPriority', 'What is your top priority in evaluating API and SDK docs?', AppDevSurveyOptions::$docs_priority_options), $t6 = new TextareaField('OtherDocsPriority', ''));
$t1->addExtraClass('hidden');
$t3->addExtraClass('hidden');
$t4->addExtraClass('hidden');
$t5->addExtraClass('hidden');
$t6->addExtraClass('hidden');
$other_programming_lang->addExtraClass('hidden');
$docs->setEmptyString('-- Select One --');
// $prevButton = new CancelFormAction($controller->Link().'Login', 'Previous Step');
$nextButton = new FormAction('SaveAppDevSurvey', ' Next Step ');
$actions = new FieldList($nextButton);
// Create Validators
$validator = new RequiredFields();
Requirements::javascript('surveys/js/deployment_survey_appdevsurvey_form.js');
parent::__construct($controller, $name, $fields, $actions, $validator);
if ($AppDevSurvey = $this->controller->LoadAppDevSurvey()) {
$this->loadDataFrom($AppDevSurvey->data());
}
}
示例5: getCMSFields
function getCMSFields()
{
$fields = new FieldList();
$fields->push(new TabSet("Root"));
$CountryCodes = CountryCodes::$iso_3166_countryCodes;
$fields->addFieldsToTab('Root.About You', array($first_name_field = new ReadonlyField('FirstName', 'First name / Given name'), $last_name_field = new ReadonlyField('Surname', 'Last name / Family name'), $os_activity = new CustomCheckboxSetField('OpenStackActivity', 'Which of the following do you yourself personally do?<BR>Select All That Apply', DeploymentSurveyOptions::$activities_options), $os_relationship = new TextAreaField('OpenStackRelationship', 'Please describe your relationship with OpenStack'), $email_field = new ReadonlyField('Member.Email', 'Your Email', $this->Member()->Email), $ok_2_contact = new CheckboxField('OkToContact', 'The OpenStack Foundation and User Committee may communicate with me in the future about my usage.')));
$fields->addFieldsToTab('Root.YourOrganization', array(new ReadonlyField('Org.Name', 'Organization', $this->Org()->Name), new DropdownField('Industry', 'Your Organization’s Primary Industry', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$industry_options, array('' => '-- Please Select One --'), array('Other' => 'Other Industry (please specify)'))), new TextareaField('OtherIndustry', 'Other Industry'), $org_it_activity = new TextField('ITActivity', 'Your Organization’s Primary IT Activity'), new LiteralField('Break', '<p>Your Organization’s Primary Location or Headquarters</p>'), $ddl_country = new DropdownField('PrimaryCountry', 'Country', $CountryCodes), new TextField('PrimaryState', 'State / Province / Region'), new TextField('PrimaryCity', 'City'), new DropdownField('OrgSize', 'Your Organization Size (All Branches, Locations, Sites)', DeploymentSurveyOptions::$organization_size_options), new CheckboxSetField('OpenStackInvolvement', 'What best describes your Organization’s involvement with OpenStack?', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$openstack_involvement_options))));
$ddl_country->setEmptyString('-- Select One --');
$fields->addFieldsToTab('Root.Your Thoughts', array(new CustomCheckboxSetField('BusinessDrivers', 'What are your top business drivers for using OpenStack?<BR>Please rank up to 5.<BR>1 = top business driver, 2 = next, 3 = third, and so on<BR>Select At Least One', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$business_drivers_options, null, array('Other' => 'Something else not listed here (please specify)'))), new TextAreaField('OtherBusinessDrivers', ''), new CustomCheckboxSetField('InformationSources', 'Where do end up finding information about using OpenStack, after using search engines and talking to your colleagues?<BR>Select All That Apply', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$information_options, null, array('Other' => 'Other Sources (please specify)'))), new TextAreaField('OtherInformationSources', ''), $ddl_rate = new DropdownField('OpenStackRecommendRate', 'How likely are you to recommend OpenStack to a friend or colleague? (0=Least Likely, 10=Most Likely)', DeploymentSurveyOptions::$openstack_recommendation_rate_options), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>We would love to hear how OpenStack and the OpenStack Foundation can better meet your needs. These free-form questions are optional, but will provide valuable insights.</p>'), new LiteralField('Break', '<p>Your responses are anonymous, and each of these text fields is independent, so we cannot “See previous answer”. We would really appreciate a separate answer to each question.</p>'), new TextAreaField('WhatDoYouLikeMost', 'What do you like most about OpenStack, besides “free” and “open”?'), new TextAreaField('FurtherEnhancement', 'What areas of OpenStack require further enhancement? '), new TextAreaField('FoundationUserCommitteePriorities', 'What should be the priorities for the Foundation and User Committee during the coming year?'), new CheckboxField('InterestedUsingContainerTechnology', 'Are you interested in using container technology with OpenStack?'), new CustomCheckboxSetField('ContainerRelatedTechnologies', 'Which of the following container related technologies are you interested in using?<BR>Please select all that apply', DeploymentSurveyOptions::$container_related_technologies)));
$ddl_rate->setEmptyString('Neutral');
$app_config = new GridFieldConfig_RecordEditor();
$apps = new GridField("AppDevSurveys", "AppDevSurveys", $this->AppDevSurveys(), $app_config);
$fields->addFieldsToTab('Root.Application Development', array($apps));
$deployments_config = new GridFieldConfig_RecordEditor();
$deployments = new GridField("Deployments", "Deployments", $this->Deployments(), $deployments_config);
$fields->addFieldsToTab('Root.Deployments', array($deployments));
$first_name_field->setReadonly(true);
$last_name_field->setReadonly(true);
$email_field->setReadonly(true);
return $fields;
//return parent::getCMSFields();
}
示例6: __construct
function __construct($controller, $name)
{
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
if (Director::isLive()) {
Requirements::javascript("themes/openstack/javascript/jquery.ui.touch-punch.min.js");
} else {
Requirements::javascript("themes/openstack/javascript/jquery.ui.touch-punch.js");
}
$survey = Controller::curr()->GetCurrentSurvey();
$nextButton = new FormAction('NextStep', ' Next Step ');
//BusinessDrivers
$custom_field = array(new LiteralField('header', '<div id="catalog">'), new LiteralField('p1', '<p>What are your top business drivers for using OpenStack?</p>'), new LiteralField('p2', '<p>Please rank up to 5.</p>'), new LiteralField('p3', '<p>1 = top business driver, 2 = next, 3 = third, and so on</p>'), new LiteralField('p3', '<p><strong>Click your options to rank them. Select at least one.</strong> <a title="clear all options." href="#" id="clear_all_business_drivers">clear all</a></p>'), new LiteralField('table_begin', '<table class="your-thoughts-table"><tbody>'));
$business_drivers = empty($survey->BusinessDrivers) ? array() : explode(',', $survey->BusinessDrivers);
$business_drivers = count($business_drivers) > 0 ? array_combine($business_drivers, $business_drivers) : array();
$answer_count = 0;
foreach (DeploymentSurveyOptions::$business_drivers_options as $key => $value) {
$hash = md5($key);
$input = '';
if ($key == 'Other') {
$val = '';
if (isset($business_drivers[$key])) {
$val = $survey->OtherBusinessDrivers;
}
$input = sprintf(' <input type="text" id="business_drivers_other_text" value="%s"/>', $val);
}
$index = false;
if (isset($business_drivers[$key])) {
$index = array_search($key, array_keys($business_drivers));
}
if ($index === false) {
$row_html = sprintf('<tr><td class="rank-wrapper" data-answer="%s_answer"></td><td class="rank-text">%s%s</td></tr>', $hash, $value, $input);
} else {
++$answer_count;
++$index;
$row_html = sprintf('<tr><td class="rank-wrapper selected-rank" data-answer="%s_answer" data-sort="%s">%s</td><td class="rank-text">%s%s</td></tr>', $hash, $index, $index, $value, $input);
}
array_push($custom_field, new LiteralField('row', $row_html));
array_push($custom_field, new LiteralField('spacer', '<tr class="spacer"></tr>'));
}
array_push($custom_field, new LiteralField('end_table', '</tbody></table>'));
array_push($custom_field, new HiddenField('BusinessDrivers'));
array_push($custom_field, new HiddenField('OtherBusinessDrivers'));
array_push($custom_field, new LiteralField('footer', '</div>'));
$fields = new FieldList($custom_field);
$answer_table = array();
foreach (DeploymentSurveyOptions::$business_drivers_options as $key => $value) {
$hash = md5($key);
$answer_table[$hash . '_answer'] = $key;
}
$answer_table = json_encode($answer_table);
Requirements::customScript('var answer_table = ' . $answer_table . ';');
Requirements::customScript('rank_order = ' . $answer_count . ';');
$fields->add(new CustomCheckboxSetField('InformationSources', 'Where do you end up finding information about using OpenStack, after using search engines and talking to your colleagues?<BR>Select All That Apply', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$information_options, null, array('Other' => 'Other Sources (please specify)'))));
$fields->add(new TextAreaField('OtherInformationSources', ''));
$fields->add($ddl_rate = new DropdownField('OpenStackRecommendRate', 'How likely are you to recommend OpenStack to a friend or colleague? (0=Least Likely, 10=Most Likely)', DeploymentSurveyOptions::$openstack_recommendation_rate_options));
$fields->add(new CheckboxField('InterestedUsingContainerTechnology', 'Are you interested in using container technology with OpenStack?'));
$fields->add(new LiteralField('Break', '<div id="container_related_tech" class="hidden">'));
$fields->add(new CustomCheckboxSetField('ContainerRelatedTechnologies', 'Which of the following container related technologies are you interested in using?<BR>Select All That Apply', DeploymentSurveyOptions::$container_related_technologies));
$fields->add(new LiteralField('Break', '</div>'));
$fields->add(new LiteralField('Break', '<hr/>'));
$fields->add(new LiteralField('Break', '<p>We would love to hear how OpenStack and the OpenStack Foundation can better meet your needs. These free-form questions are optional, but will provide valuable insights.</p>'));
$fields->add(new LiteralField('Break', '<p>Your responses are anonymous, and each of these text fields is independent, so we cannot “See previous answer”. We would really appreciate a separate answer to each question.</p>'));
$fields->add(new TextAreaField('WhatDoYouLikeMost', 'What do you like most about OpenStack, besides “free” and “open”?'));
$fields->add(new TextAreaField('FurtherEnhancement', 'What areas of OpenStack require further enhancement? '));
$fields->add(new TextAreaField('FoundationUserCommitteePriorities', 'What should be the priorities for the Foundation and User Committee during the coming year?'));
$ddl_rate->setEmptyString('Neutral');
$actions = new FieldList($nextButton);
$validator = new RequiredFields();
Requirements::javascript('surveys/js/deployment_survey_yourthoughts_form.js');
parent::__construct($controller, $name, $fields, $actions, $validator);
}
示例7: __construct
function __construct($controller, $name)
{
$CurrentDeploymentID = Session::get('CurrentDeploymentID');
// Define fields //////////////////////////////////////
$fields = new FieldList(new LiteralField('Break', '<p>The questions on this page are optional, but will help us better understand the details of how the OpenStack software is being used. Any information you provide on this step will be treated as private and confidential and only used in aggregate reporting.</p><hr>'), new LiteralField('Break', '<p>The information below will help us better understand the most common configuration and component choices OpenStack deployments are using.</p>'), new LiteralField('Break', '<h3>Telemetry</h3>'), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Please provide the following information about the size and scale of this OpenStack deployment. This information is optional, but will be kept confidential and <b>never</b> published in connection with you or your organization.</p>'), new DropdownField('OperatingSystems', 'What is the main operating system running this OpenStack cloud deployment?', ArrayUtils::AlphaSort(DeploymentOptions::$operating_systems_options, array('' => '-- Select One --'), array('Other' => 'Other (please specify)'))), $other_os = new TextareaField('OtherOperatingSystems', ''), new CustomCheckboxSetField('UsedPackages', 'What packages does this deployment use…?<BR>Select All That Apply', DeploymentOptions::$used_packages_options), new LiteralField('Container', '<div id="custom_package_reason_container" class="hidden">'), new CustomCheckboxSetField('CustomPackagesReason', ' If you have modified packages or have built your own packages, why?<BR>Select All That Apply', DeploymentOptions::$custom_package_reason_options), $other_custom_reason = new TextareaField('OtherCustomPackagesReason', ''), new LiteralField('Container', '</div>'), new CustomCheckboxSetField('DeploymentTools', 'What tools are you using to deploy / configure this cluster?<BR>Select All That Apply', DeploymentOptions::$deployment_tools_options), $other_deployment_tools = new TextareaField('OtherDeploymentTools', ''), new CustomCheckboxSetField('PaasTools', 'What Platform-as-a-Service (PaaS) tools are you using to manage applications on this OpenStack deployment?', ArrayUtils::AlphaSort(DeploymentOptions::$paas_tools_options, array('' => '-- Select One --'), array('Other' => 'Other Tool (please specify)'))), $other_paas = new TextareaField('OtherPaasTools', ''));
$deployment = Controller::curr()->LoadDeployment($CurrentDeploymentID);
if (is_null($deployment)) {
Controller::curr()->redirect(Controller::curr()->Link() . 'Deployments');
}
$projects_used = $deployment->ProjectsUsed;
if (strpos($projects_used, 'Openstack Compute (Nova)') !== false) {
$fields->add(new CustomCheckboxSetField('Hypervisors', 'Which <b>OpenStack Compute (Nova)</b> hypervisors are you using?<BR>Select All That Apply', DeploymentOptions::$hypervisors_options));
$fields->add($other_hyper = new TextareaField('OtherHypervisor', ''));
$other_hyper->addExtraClass('hidden');
}
$fields->add(new CustomCheckboxSetField('SupportedFeatures', 'Which compatibility APIs does this deployment support?<BR> Select All That Apply', DeploymentOptions::$deployment_features_options));
$fields->add($other_feat = new TextareaField('OtherSupportedFeatures', ''));
$fields->add(new CustomCheckboxSetField('UsedDBForOpenStackComponents', 'What database do you use for the components of this OpenStack cloud?<BR>Select All That Apply', DeploymentOptions::$used_db_for_openstack_components_options));
$fields->add($other_db = new TextareaField('OtherUsedDBForOpenStackComponents', ''));
if (strpos($projects_used, 'Openstack Network') !== false) {
$fields->add(new CustomCheckboxSetField('NetworkDrivers', ' Which <b>OpenStack Network (Neutron)</b> drivers are you using?<BR>Select All That Apply', DeploymentOptions::$network_driver_options));
$fields->add($other_driver = new TextareaField('OtherNetworkDriver', ''));
$other_driver->addExtraClass('hidden');
}
if (strpos($projects_used, 'Openstack Identity Service (Keystone)') !== false) {
$fields->add(new CustomCheckboxSetField('IdentityDrivers', 'Which <b>OpenStack Identity Service (Keystone)</b> drivers are you using?<BR>Select All That Apply', DeploymentOptions::$identity_driver_options));
$fields->add($other_driver = new TextareaField('OtherIndentityDriver', ''));
$other_driver->addExtraClass('hidden');
}
if (strpos($projects_used, 'Openstack Block Storage (Cinder)') !== false) {
$fields->add(new CustomCheckboxSetField('BlockStorageDrivers', 'Which <b>OpenStack Block Storage (Cinder)</b> drivers are you using?<BR>Select All That Apply', DeploymentOptions::$block_storage_divers_options));
$fields->add($other_driver = new TextareaField('OtherBlockStorageDriver', ''));
$other_driver->addExtraClass('hidden');
}
$fields->add(new CustomCheckboxSetField('InteractingClouds', 'With what other clouds does this OpenStack deployment interact?<BR>Select All That Apply', DeploymentOptions::$interacting_clouds_options));
$fields->add($other_interacting_clouds = new TextareaField('OtherInteractingClouds', ''));
$other_interacting_clouds->addExtraClass('hidden');
$other_custom_reason->addExtraClass('hidden');
$other_os->addExtraClass('hidden');
$other_paas->addExtraClass('hidden');
$other_feat->addExtraClass('hidden');
$other_db->addExtraClass('hidden');
$other_deployment_tools->addExtraClass('hidden');
$fields->add(new LiteralField('Break', '<h3>What’s the size of this cloud…?</h3>'));
$fields->add(new LiteralField('Break', '<hr/>'));
$fields->add($ddl_users = new DropdownField('NumCloudUsers', 'Number of users', DeploymentOptions::$cloud_users_options));
$ddl_users->setEmptyString('-- Select One --');
$fields->add($ddl_nodes = new DropdownField('ComputeNodes', 'Physical compute nodes', DeploymentOptions::$compute_nodes_options));
$ddl_nodes->setEmptyString('-- Select One --');
$fields->add($ddl_cores = new DropdownField('ComputeCores', 'Processor cores', DeploymentOptions::$compute_cores_options));
$ddl_cores->setEmptyString('-- Select One --');
$fields->add($ddl_instances = new DropdownField('ComputeInstances', 'Number of instances', DeploymentOptions::$compute_instances_options));
$ddl_instances->setEmptyString('-- Select One --');
$fields->add($ddl_ips = new DropdownField('NetworkNumIPs', 'Number of fixed / floating IPs', DeploymentOptions::$network_ip_options));
$ddl_ips->setEmptyString('-- Select One --');
if (strpos($projects_used, 'Openstack Block Storage (Cinder)') !== false) {
$fields->add($ddl_block_size = new DropdownField('BlockStorageTotalSize', 'Which <b>OpenStack Block Storage (Cinder)</b> size are you using?', DeploymentOptions::$storage_size_options));
$ddl_block_size->setEmptyString('-- Select One --');
}
if (strpos($projects_used, 'Openstack Object Storage (Swift)') !== false) {
$fields->add($ddl_block_size = new DropdownField('ObjectStorageSize', 'Which <b>OpenStack Object Storage (Swift)</b> size are you using?', DeploymentOptions::$storage_size_options));
$ddl_block_size->setEmptyString('-- Select One --');
$fields->add($ddl_objects_size = new DropdownField('ObjectStorageNumObjects', 'How many <b>OpenStack Object Storage (Swift)</b> objects are stored?', DeploymentOptions::$storage_objects_options));
$ddl_objects_size->setEmptyString('-- Select One --');
}
// SPOTLIGHT
$fields->add(new LiteralField('Break', '<h3>Spotlight</h3>'));
$fields->add(new LiteralField('Break', '<hr/>'));
if (strpos($projects_used, 'Openstack Network') === false) {
$fields->add(new CustomCheckboxSetField('WhyNovaNetwork', 'If this deployment uses nova-network and not OpenStack Network (Neutron), what would allow you to migrate to Neutron?', DeploymentOptions::$why_nova_network_options));
$fields->add($other_why_nova = new TextareaField('OtherWhyNovaNetwork', ''));
$other_why_nova->addExtraClass('hidden');
}
if (strpos($projects_used, 'Openstack Object Storage (Swift)') !== false) {
$fields->add($ddl_swift_dist_feat = new DropdownField('SwiftGlobalDistributionFeatures', 'Are you using Swift\'s global distribution features?', DeploymentOptions::$swift_global_distribution_features_options));
$ddl_swift_dist_feat->setEmptyString('-- Select One --');
$fields->add($ddl_uses_cases = new DropdownField('SwiftGlobalDistributionFeaturesUsesCases', 'If yes, what is your use case?', DeploymentOptions::$swift_global_distribution_features_uses_cases_options));
$ddl_uses_cases->setEmptyString('-- Select One --');
$fields->add($other_uses_cases = new TextareaField('OtherSwiftGlobalDistributionFeaturesUsesCases', ''));
$other_uses_cases->addExtraClass('hidden');
$fields->add($ddl_policies = new DropdownField('Plans2UseSwiftStoragePolicies', 'Do you have plans to use Swift\'s storage policies or erasure codes in the next year?', DeploymentOptions::$plans_2_use_swift_storage_policies_options));
$ddl_policies->setEmptyString('-- Select One --');
$fields->add($other_policies = new TextareaField('OtherPlans2UseSwiftStoragePolicies', ''));
$other_policies->addExtraClass('hidden');
}
$fields->add($ddl_other_tools = new DropdownField('ToolsUsedForYourUsers', 'What tools are you using charging or show-back for your users?', DeploymentOptions::$tools_used_for_your_users_options));
$ddl_other_tools->setEmptyString('-- Select One --');
$fields->add($other_tools = new TextareaField('OtherToolsUsedForYourUsers', ''));
$other_tools->addExtraClass('hidden');
$fields->add(new TextareaField('Reason2Move2Ceilometer', 'If you are not using Ceilometer, what would allow you to move to it (optional free text)?'));
$saveButton = new FormAction('SaveDeployment', 'Save Deployment');
$cancelButton = new CancelFormAction($controller->Link() . 'Deployments', 'Cancel');
$actions = new FieldList($saveButton, $cancelButton);
// Create Validators
$validator = new RequiredFields();
parent::__construct($controller, $name, $fields, $actions, $validator);
if ($CurrentDeploymentID) {
//Populate the form with the current members data
if ($Deployment = $this->controller->LoadDeployment($CurrentDeploymentID)) {
$this->loadDataFrom($Deployment->data());
//.........这里部分代码省略.........