コード例 #1
0
ファイル: form.php プロジェクト: OpenDoorBrewCo/odbc-wp-prod
    $data = (array) $route_obj[0];
} elseif (!isset($_GET['doaction']) and isset($response['success'])) {
    // Reset $_POST object for antoher entry.
    unset($data);
}
if (!empty($locations)) {
    $all_locations = array();
    foreach ($locations as $loc) {
        $assigned_categories = array();
        if (isset($loc->location_group_map) and is_array($loc->location_group_map)) {
            foreach ($loc->location_group_map as $c => $cat) {
                $assigned_categories[] = $categories_data[$cat];
            }
        }
        $assigned_categories = implode(',', $assigned_categories);
        $loc_checkbox = $form->field_checkbox('select_route_way_points[]', array('value' => $loc->location_id, 'current' => in_array($loc->location_id, (array) $data['route_way_points']) ? $loc->location_id : '', 'class' => 'chkbox_class', 'before' => '<div class="col-md-1">', 'after' => '</div>'));
        $all_locations[] = array($loc_checkbox, $loc->location_title, $loc->location_address, $assigned_categories);
    }
}
$form->set_header(__('Route Information', WPGMP_TEXT_DOMAIN), $response, __('Manage Routes', WPGMP_TEXT_DOMAIN), 'wpgmp_manage_route');
$form->add_element('text', 'route_title', array('lable' => __('Route Title', WPGMP_TEXT_DOMAIN), 'value' => (isset($data['route_title']) and !empty($data['route_title'])) ? sanitize_text_field(wp_unslash($data['route_title'])) : '', 'id' => 'route_title', 'desc' => __('Please enter route title.', WPGMP_TEXT_DOMAIN), 'placeholder' => __('Route Title', WPGMP_TEXT_DOMAIN), 'required' => true));
$color = empty($data['route_stroke_color']) ? '8CAEF2' : sanitize_text_field(wp_unslash($data['route_stroke_color']));
$form->add_element('text', 'route_stroke_color', array('lable' => __('Stroke Color', WPGMP_TEXT_DOMAIN), 'value' => $color, 'class' => 'color {pickerClosable:true} form-control', 'id' => 'route_stroke_color', 'desc' => __('Choose route direction stroke color.(Default is Blue)', WPGMP_TEXT_DOMAIN), 'placeholder' => __('Route Stroke Color', WPGMP_TEXT_DOMAIN)));
$stroke_opacity = array('1' => '1', '0.9' => '0.9', '0.8' => '0.8', '0.7' => '0.7', '0.6' => '0.6', '0.5' => '0.5', '0.4' => '0.4', '0.3' => '0.3', '0.2' => '0.2', '0.1' => '0.1');
$form->add_element('select', 'route_stroke_opacity', array('lable' => __('Stroke Opacity', WPGMP_TEXT_DOMAIN), 'current' => (isset($data['route_stroke_opacity']) and !empty($data['route_stroke_opacity'])) ? sanitize_text_field(wp_unslash($data['route_stroke_opacity'])) : '', 'desc' => __('Please select route direction stroke opacity.', WPGMP_TEXT_DOMAIN), 'options' => $stroke_opacity, 'class' => 'form-control-select'));
$stroke_weight = array();
for ($sw = 10; $sw >= 1; $sw--) {
    $stroke_weight[$sw] = $sw;
}
$form->add_element('select', 'route_stroke_weight', array('lable' => __('Stroke Weight', WPGMP_TEXT_DOMAIN), 'current' => (isset($data['route_stroke_weight']) and !empty($data['route_stroke_weight'])) ? sanitize_text_field(wp_unslash($data['route_stroke_weight'])) : '', 'desc' => __('Please select route stroke weight.', WPGMP_TEXT_DOMAIN), 'options' => $stroke_weight, 'class' => 'form-control-select'));
$route_travel_mode = array('DRIVING' => 'DRIVING', 'WALKING' => 'WALKING', 'BICYCLING' => 'BICYCLING', 'TRANSIT' => 'TRANSIT');
コード例 #2
0
<?php

/**
 * This class used to manage permissions in backend.
 * @author Flipper Code <*****@*****.**>
 * @version 1.0.0
 * @package Maps
 */
global $wp_roles;
$wpgmp_roles = $wp_roles->get_names();
unset($wpgmp_roles['administrator']);
$wpgmp_permissions = array('wpgmp_admin_overview' => 'Map Overview', 'wpgmp_form_location' => 'Add Locations', 'wpgmp_manage_location' => 'Manage Locations', 'wpgmp_import_location' => 'Import Locations', 'wpgmp_form_map' => 'Create Map', 'wpgmp_manage_map' => 'Manage Map', 'wpgmp_manage_drawing' => 'Drawing', 'wpgmp_form_group_map' => 'Add Marker Category', 'wpgmp_manage_group_map' => 'Manage Marker Category', 'wpgmp_form_route' => 'Add Routes', 'wpgmp_manage_route' => 'Manage Routes', 'wpgmp_settings' => 'Settings');
$form = new Responsive_Markup();
$form->set_header(__('Manage Permission(s)', WPGMP_TEXT_DOMAIN), $response);
if (!empty($wpgmp_permissions)) {
    $count = 0;
    foreach ($wpgmp_permissions as $wpgmp_mkey => $wpgmp_mvalue) {
        $permission_row[$count][0] = $wpgmp_mvalue;
        foreach ($wpgmp_roles as $wpgmp_role_key => $wpgmp_role_value) {
            $urole = get_role($wpgmp_role_key);
            $permission_row[$count][] = $form->field_checkbox('wpgmp_map_permissions[' . $wpgmp_role_key . '][' . $wpgmp_mkey . ']', array('value' => 'true', 'current' => @array_key_exists($wpgmp_mkey, $urole->capabilities) == true ? 'true' : 'false', 'before' => '<div class="col-md-1">', 'after' => '</div>', 'class' => 'chkbox_class'));
        }
        $count++;
    }
}
$form->add_element('table', 'wpgmp_save_permission_table', array('heading' => array_merge(array('Page'), $wpgmp_roles), 'data' => $permission_row, 'before' => '<div class="col-md-11">', 'after' => '</div>'));
$form->add_element('submit', 'wpgmp_save_permission', array('value' => __('Save Permissions', WPGMP_TEXT_DOMAIN)));
$form->add_element('hidden', 'operation', array('value' => 'save'));
$form->render();
コード例 #3
0
ファイル: form.php プロジェクト: hoa32811/wp_thanhtrung_hotel
    $parent_category_data = array();
    if (!$data['location_group_map']) {
        $data['location_group_map'] = array();
    }
    foreach ($categories as $category) {
        if (is_null($category->group_parent) or 0 == $category->group_parent) {
            $parent_category_data = ' ---- ';
        } else {
            $parent_category_data = $all_categories[$category->group_parent]->group_map_title;
        }
        if ('' != $category->group_marker) {
            $icon_src = "<img src='" . $category->group_marker . "' />";
        } else {
            $icon_src = "<img src='" . WPGMP_IMAGES . "default_marker.png' />";
        }
        $select_input = $form->field_checkbox('location_group_map[]', array('value' => $category->group_map_id, 'current' => in_array($category->group_map_id, $data['location_group_map']) ? $category->group_map_id : '', 'class' => 'chkbox_class', 'before' => '<div class="col-md-1">', 'after' => '</div>'));
        $category_data[] = array($select_input, $category->group_map_title, $parent_category_data, $icon_src);
    }
    $category_data = $form->add_element('table', 'location_group_map', array('heading' => array('Select', 'Category', 'Parent', 'Icon'), 'data' => $category_data, 'before' => '<div class="col-md-12">', 'after' => '</div>'));
} else {
    $form->add_element('message', 'message', array('value' => __('You don\'t have categorie(s).', WPGMP_TEXT_DOMAIN), 'class' => 'alert alert-info', 'before' => '<div class="col-md-12">', 'after' => '</div>'));
}
$form->add_element('submit', 'save_entity_data', array('value' => __('Save Location', WPGMP_TEXT_DOMAIN)));
$form->add_element('hidden', 'operation', array('value' => 'save'));
if (isset($_GET['doaction']) and 'edit' == $_GET['doaction']) {
    $form->add_element('hidden', 'entityID', array('value' => intval(wp_unslash($_GET['location_id']))));
}
$form->render();
$infowindow_message = (isset($data['location_messages']) and !empty($data['location_messages'])) ? $data['location_messages'] : '';
$infowindow_disable = (isset($data['location_settings']) and !empty($data['location_settings'])) ? $data['location_settings'] : '';
$category_obj = $category_obj->get(array(array('group_map_id', '=', intval(wp_unslash($_GET['group_map_id'])))));