<div class="filters">
			<br>
			<div class="panel panel-block">
			
				<div class="panel-heading">
					<h3 class="panel-title">Filter by resource type</h3>
				</div>
				<div class="panel-body">

					<?php 
$officeTypeField = field_info_field('field_appoffice_type');
$officeTypes = list_allowed_values($officeTypeField);
$officeTypesTooltipDesc = array("SCORE Office" => "SCORE is a nonprofit association comprised of over 13,000 volunteer business counselors, advisors, and mentors who offer free counseling and mentoring throughout the U.S. and its territories.", "Small Business Development Center" => "Small Business Development Centers (SBDCs) are partnerships primarily between the government and colleges/universities aimed at providing educational services to small business owners.", "SBA District Office" => "SBA District Offices offer counseling, training and business development specialists to help you start and grow your business.", "SBA Regional Office" => "SBA Regional Offices offer counseling, training and business development specialists to help you start and grow your business.", "Disaster Field Office" => "SBA Disaster Field Offices offer counseling and financial assistance to those who are rebuilding their homes and businesses after natural disasters.", "U.S. Export Assistance Center" => "U.S. Export Assistance Centers (USEACs) are designed to provide export assistance and make worldwide commerce achievable for your small- or medium-sized business.", "Private Lender" => "The SBA extends financial assistance through private sector lenders, such as banks and other financial institutions, who make the loans with an SBA guaranty. A participating lender may make one of three decisions: to approve the loan itself, make it with SBA's guaranty, or decline it altogether.", "Women's Business Center" => "Women's Business Centers (WBCs) represent a national network of educational centers designed to assist women to start and grow small businesses.", "Veteran's Business Outreach Center" => "Veterans Business Outreach Centers (VBOCs) are designed to provide entrepreneurial development services and referrals for eligible veterans owning or considering starting a small business.", "Small Business Investment Company" => "A Small Business Investment Company (SBIC) is a private lending company which is licensed and regulated by the Small Business Administration (SBA). SBIC's offer venture capital financing to higher-risk small businesses, and SBIC loans are guaranteed by the SBA.", "Procurement & Technical Assistance Center" => "Procurement Technical Assistance Centers (PTACs) provide technical assistance to businesses that want to sell products and services to federal, state, and/or local governments.", "Microloan Program Intermediary Lender" => "The U.S. Small Business Administration (SBA) offers a Microloan Program that provides microloans (loans of \$50,000 or less) to small businesses by way of a network of private non-profit community and faith based lenders (subject to availability of funds). The SBA makes loans to these Intermediary Lenders, enabling the lenders in turn to make loans to small business borrowers.", "Certified Development Company" => "Certified Development Companies (CDCs) are nonprofit corporations certified and regulated by the SBA which work with participating lenders to provide financing to small businesses.", "U.S. Commercial Service Office" => "The U.S. Commercial Service is the trade promotion arm of the U.S. Department of Commerce’s International Trade Administration. U.S. Commercial Service trade professionals in over 100 U.S. cities and in more than 75 countries help U.S. companies get started in exporting or increase sales to new global markets.", "Rural Development Office" => "USDA Office of Rural Development (RD) is an agency with the United States Department of Agriculture which runs programs intended to improve the economy and quality of life in rural America.", "NIST (MEP - Manufacturing Extension Partnership)" => "The Manufacturing Extension Partnership (MEP) is a catalyst for strengthening American manufacturing – accelerating its ongoing transformation into a more efficient and powerful engine of innovation driving economic growth and job creation.", "BIS Export Enforcement Office" => "BIS Export Enforcement Office works cooperatively with the exporting community to prevent violations, and conducts investigations to gather evidence to support criminal and administrative sanctions.", "BIS Outreach and Education Services Division Office" => "The BIS Outreach and Educational Services Division is responsible for responding to inquiries from the exporting community regarding the Export Administration Regulations (EAR), export control policy, and licensing procedures. It also plans, conducts and participates in seminars and other outreach efforts to help exporters understand and comply with the EAR.", "MBDA Business Center" => "Minority-owned firms seeking to penetrate new markets — domestic & global — and growing in size and scale, can access business experts at a MBDA Business Center. Whether it’s securing capital, competing for a contract, identifying a strategic partner or becoming export-ready, your success is our priority.");
?>
						<ul class="resourcecenters-filter-filters">
							<?php 
foreach ($officeTypes as $officeKey => $officeType) {
    ?>
								<?php 
    $officeId = cssFriendlyString($officeKey);
    ?>
								<?php 
    if ($officeId === 'sbaregionaloffice') {
        continue;
    }
    ?>
/**
 * hook_preprocess_field__field_resources()
 * Prepare resource data from field collection to create file/language table for resources
 * @todo add a method to count how many languages are available in language field (currently 4) and pass to template
 */
function gitp_preprocess_field__field_documents(&$variables)
{
    $items = $variables['items'];
    $documents = array();
    $fields = field_info_fields();
    $languages = list_allowed_values($fields['field_fc_resource_language']);
    $lang_count = count($languages);
    $processed = array();
    foreach ($languages as $language => $lang_value) {
        foreach ($items as $key => $item) {
            foreach ($item['entity']['field_collection_item'] as $delta => $fc_item) {
                $delta_lang = $fc_item['field_fc_resource_language'][0]['#markup'];
                $title = $fc_item['field_fc_resource_file_title'][0]['#markup'];
                if ($lang_value == $delta_lang) {
                    $url = '';
                    if (isset($fc_item['field_fc_document_file'])) {
                        $url = file_create_url($fc_item['field_fc_document_file']['#items'][0]['uri']);
                    }
                    if (!array_key_exists($title, $documents)) {
                        $documents[$title] = array();
                    }
                    if (!array_key_exists($lang_value, $documents[$title])) {
                        $documents[$title][$lang_value] = array();
                    }
                    $documents[$title][$lang_value] = $url;
                } else {
                    if (!isset($documents[$title][$lang_value])) {
                        $documents[$title][$lang_value] = NULL;
                    }
                }
            }
        }
        $processed[$lang_value] = TRUE;
    }
    $variables['element']['resources_table_data'] = $documents;
    $variables['element']['available_language_count'] = $lang_count;
}
 public function field_field_convert_list($property_name, $userprofile, $field, $instance)
 {
     if (!empty($property_name)) {
         if (!isset($userprofile->{$property_name}) && !is_string($userprofile->{$property_name})) {
             return;
         }
         $options = list_allowed_values($field);
         $best_match = 0.0;
         $match_sl = strtolower($userprofile->{$property_name});
         foreach ($options as $key => $option) {
             $option = trim($option);
             $match_option = strtolower($option);
             $this_match = 0;
             similar_text($match_option, $match_sl, $this_match);
             if ($this_match > $best_match) {
                 $best_match = $this_match;
                 $best_key = $key;
             }
         }
         return isset($best_key) ? array('value' => $best_key) : NULL;
     }
 }
Beispiel #4
0
 public function getValueOptions()
 {
     $field_storage_definitions = \Drupal::entityManager()->getFieldStorageDefinitions($this->definition['entity_type']);
     $field_storage = $field_storage_definitions[$this->definition['field_name']];
     $this->valueOptions = list_allowed_values($field_storage);
 }
Beispiel #5
0
/**
 * Provide example values of the tokens corresponding to an instance.
 *
 * A module that manages a field instance for combination-creation
 * should use this hook to provide example values for the two tokens
 * managed by commerce_bpc (the 'label' and 'value' tokens).
 *
 * These example values are used, for example, to provide live previews
 * the SKU and title of the products to be generated.
 *
 * @param array $instance
 *   An array holding the instance info for which example values should be
 *   returned.
 *
 * @return array
 *   An array with two keys 'label' and 'value', holding an example value
 *   for each.
 *
 * @see hook_commerce_bpc_tokens()
 */
function hook_commerce_bpc_token_sample_values($instance)
{
    $samples = array();
    $field_name = $instance['field_name'];
    $field = field_info_field($field_name);
    if ($field['module'] == 'list') {
        $options = list_allowed_values($field);
        $values = array_keys($options);
        $samples['value'] = array(LANGUAGE_NONE => array(array('value' => reset($values))));
        $samples['label'] = reset($options);
    }
    return $samples;
}
Beispiel #6
0
    }
    ?>
                <?php 
    print implode("<br/>", $vals);
    ?>
            </td>
            <?php 
}
?>
            <?php 
if (isset($node->field_programm_form['und'])) {
    ?>
            <td class="common-table__cell">
                <span class="common-table__cell--header">Форма обучения</span>
                <?php 
    $forms = list_allowed_values($all_fields_on_my_website["field_programm_form"]);
    $vals = array();
    ?>
                <?php 
    foreach ($node->field_programm_form['und'] as $k => $v) {
        $vals[] = $forms[$v['value']];
    }
    ?>
                <?php 
    print implode("<br/>", $vals);
    ?>
            </td>
            <?php 
}
?>
            <?php 
<?php

$field_name = field_info_field('field_name');
$allowed_values = list_allowed_values($field_name);
    print $timeliness;
}
print '</div>';
print '</div>';
print '<div class="row">';
print '<div class="columns medium-6">';
$field_comparability_info = field_info_instance('node', 'field_chars_comparability', $node->type);
print '<h4>' . $field_comparability_info['label'] . '</h4>';
$comparability = drupal_render($group['field_chars_comparability']);
$comparability_info = drupal_render($group['field_chars_compare_remarks']);
if (!(strlen($comparability) > 0 || strlen($comparability_info) > 0)) {
    print eige_administrative_data_no_field_data_markup();
} else {
    print '<div class="field field-type-text field-field-eige-sp-comparability">';
    $field = field_info_field('field_chars_comparability', 'eige_statistical_product');
    $allowed_values = list_allowed_values($field);
    $selected_values = eige_administrative_data_get_all_field_values($group['field_chars_comparability']);
    print eige_administrative_data_get_options_list_markup($allowed_values, $selected_values);
    print '</div>';
    print $comparability_info;
}
print '</div>';
print '<div class="columns medium-6">';
$field_developments_info = field_info_instance('node', 'field_chars_developments', $node->type);
print '<h4>' . $field_developments_info['label'] . '</h4>';
$development = drupal_render($group['field_chars_developments']);
if (!strlen($development) > 0) {
    print eige_administrative_data_no_field_data_markup();
} else {
    print $development;
}
function create_events_search_filters($searchVariables)
{
    $keyword = htmlspecialchars($searchVariables['keyword']);
    if (htmlspecialchars($searchVariables['applySubmit'])) {
        $keyword = 'Search Events';
    } else {
        $searchVariables = array();
    }
    $startDate = $searchVariables['startDate'];
    $endDate = $searchVariables['endDate'];
    if ($startDate && !$endDate) {
        $startDate = new DateTime($searchVariables['startDate']);
        $endDate = new DateTime($searchVariables['endDate']);
        if (!$endDate) {
            $endDate = $startDate->modify('+1 day');
        }
        $startDate->modify('-1 day');
        $startDate = $startDate->format('m/d/Y');
        $endDate = $endDate->format('m/d/Y');
    }
    echo "<div id='event-search-error'></div>";
    echo "<div class='region region-sidebar-first'>";
    echo "<div id='event-search-filters' class='views-exposed-form views-exposed-widgets clearfix'>";
    echo "<form action='/events-search' method='post' id='form-events-listings-and-filters' accept-charset='UTF-8'>";
    echo "<div id='events-text-search'>\n             <label for='solr-search-events' class='element-invisible'>Search Events</label>\n             <input type='text' id='solr-search-events' name='keyword' value='{$keyword}' onfocus='jQuery(\"#solr-search-events\").val(\"\");'>\n             <input type='submit' class='form-submit solr-search-events-submit' value='Search'>\n             <script>\n             jQuery('#events-text-search input[type=\"text\"]').keyup(function(event){\n                  if(event.keyCode == 13){\n                      jQuery('#events-text-search input[type=\"button\"]').click();\n                  }\n              });\n             </script>\n          </div>";
    echo "<div id='edit-date-filter-wrapper' class='views-exposed-widget'>\n         <label for='date-filter'>Event Dates</label>\n         <button id='event-dates' type='button' class='btn btn-danger' data-toggle='collapse' data-target='#date-filter'>Event Dates</button>\n         <div id='date-filter' class='views-exposed-widget views-widget collapse in'>\n             <div id='clear-event-dates' class='date-padding'>\n                <a href='#' onClick='jQuery(\"#edit-date-filter-min-date\").val(\"\"); jQuery(\"#edit-date-filter-max-date\").val(\"\"); return false;'>Clear Dates</a>\n             </div>\n             <div id='edit-date-filter-min-wrapper' class='date-padding'>\n                <div id='edit-date-filter-min'>\n                    <label for='edit-date-filter-min-date'>Start date </label>\n                    <input class='bef-datepicker form-text' type='text' id='edit-date-filter-min-date' name='startDate' value='{$startDate}' size='60' maxlength='128' /><br />\n                </div>\n             </div>\n             <div id='edit-date-filter-max-wrapper' class='date-padding'>\n                <div id='edit-date-filter-max'>\n                  <label for='edit-date-filter-max-date'>End date </label>\n                  <input class='bef-datepicker form-text'  type='text' id='edit-date-filter-max-date' name='endDate' value='{$endDate}' size='60' maxlength='128' />\n                </div>\n             </div>\n         </div>\n      </div>";
    $filters = array("Event Type" => "field_event_type", "Industry" => "field_program_industry", "Organization" => "field_program_org_tht_owns_prog", "State" => "field_event_state");
    $solr_field_mapping = array("field_program_org_tht_owns_prog" => "sm_field_program_org_tht_owns_pr", "field_program_industry" => "sm_field_program_industry", "field_event_state" => "sm_field_event_state", "field_event_type" => "sm_field_event_type");
    foreach ($filters as $label => $filter) {
        //this gives us a unique list of filter items that have corresponding event data
        //in other words, we have events that have a filter selected - i.e. Event Type - we only want to show
        //Event Types that actually contain corresponding events in our system
        //This prevents displaying event filters that will return an empty result
        //It also doesn't make sense to make a filter available unless it could return a result
        //**************** IMPORTANT ************************
        //We are getting event data from a feed from SBA.gov, their event types, organizations, etc don't match ours exactly
        //there is a tamper on the import events feed to do some of this mapping. but, the default is to populate
        //our field with their data - i.e. they have bad data, so some of our organizations will have a phone number.
        //In order to avoid showing this bad data as an option for the user, I only show options that are in the list
        //of allowed values in our content type for that field
        $field = field_info_field($filter);
        $allowed_values = list_allowed_values($field);
        $filter_db_column = $filter . '_value';
        $filter_db_table = 'field_data_' . $filter;
        $query = "SELECT DISTINCT({$filter_db_column})\n              FROM {$filter_db_table}\n              JOIN node n ON {$filter_db_table}.entity_id = n.nid\n              WHERE bundle = 'event' AND n.status != 0\n              ORDER BY {$filter_db_column}";
        $events_with_filter = db_query($query);
        $events_with_filter = $events_with_filter->fetchAllKeyed();
        if (!count($events_with_filter)) {
            continue;
        }
        echo "<div class='views-exposed-widget' id='{$filter}-wrapper'>\n                <label for='{$filter}'>{$label}</label>\n                <button id='event-dates' type='button' class='btn btn-danger collapsed' data-toggle='collapse' data-target='#{$filter}-filter'>{$label}</button>\n                <div class='filter-options-wrapper form-checkboxes views-widget form-checkboxes bef-select-as-checkboxes collapse out' id='{$filter}-filter'>";
        $solr_field_name = $solr_field_mapping[$filter];
        $has_any_filters = FALSE;
        foreach ($events_with_filter as $filter_name => $nothing) {
            //if the data contained in the database doesn't match our list of allowed values, do not show the filter
            //this will prevent the users from performing a search that returns no results
            if (!array_key_exists($filter_name, $allowed_values)) {
                continue;
            }
            $has_any_filters = TRUE;
            $value = str_replace("'", "\\'", $value);
            $checkboxID = str_replace('_', '-', $filter_name);
            echo "<div class='form-item form-type-bef-checkbox bef-checkboxes'>\n                    <input type='checkbox' name='{$filter}" . "[]" . "' value='{$filter_name}' id='edit-field-{$checkboxID}-value'";
            if (in_array($filter_name, $searchVariables[$filter])) {
                echo " checked";
            }
            if ($filter == 'field_event_state' || $filter == 'field_event_type') {
                $filter_name = $allowed_values[$filter_name];
            }
            echo ">";
            echo "<label class='option' for='edit-field-{$checkboxID}-label'>" . ucwords($filter_name) . "</label></div>";
        }
        echo "</div></div>";
        if (!$has_any_filters) {
            print "<script type='text/javascript'>jQuery('#{$filter}-wrapper').hide();</script>";
        }
    }
    echo "<div id='events-text-search' class='apply-search'>\n        <br />\n        <input type='hidden' name='page' value='{$page}' id='hidden-page-number'>\n        <input type='submit' value='Apply' name='applySubmit' class='form-submit solr-search-events-submit' id='apply-submit'>\n      </div>";
    echo "</form>";
    echo "</div>";
    echo "</div>";
}