$category = $modelFactory->create_object('group_map'); $categories = (array) $category->fetch(); if (isset($_GET['doaction']) and 'edit' == $_GET['doaction'] and isset($_GET['group_map_id'])) { $category_obj = $category->fetch(array(array('group_map_id', '=', intval(wp_unslash($_GET['group_map_id']))))); $_POST = (array) $category_obj[0]; } elseif (!isset($_GET['doaction']) and isset($response['success'])) { // Reset $_POST object for antoher entry. unset($_POST); } $form = new Responsive_Markup(); $form->set_header(__('Marker Category', WPGMP_TEXT_DOMAIN), $response, __('Manage Marker Categories', WPGMP_TEXT_DOMAIN), 'wpgmp_manage_group_map'); if (is_array($categories)) { $markers = array(' ' => 'Please Select'); foreach ($categories as $i => $single_category) { if ($single_category->group_parent == 0 or $single_category->group_parent == '') { $markers[$single_category->group_map_id] = $single_category->group_map_title; } } $form->add_element('select', 'group_parent', array('lable' => __('Parent Category', WPGMP_TEXT_DOMAIN), 'current' => (isset($_POST['group_parent']) and !empty($_POST['group_parent'])) ? intval(wp_unslash($_POST['group_parent'])) : '', 'desc' => __('Assign parent category if any.', WPGMP_TEXT_DOMAIN), 'options' => $markers)); } $form->add_element('text', 'group_map_title', array('lable' => __('Marker Category Title', WPGMP_TEXT_DOMAIN), 'value' => (isset($_POST['group_map_title']) and !empty($_POST['group_map_title'])) ? sanitize_text_field(wp_unslash($_POST['group_map_title'])) : '', 'id' => 'group_map_title', 'desc' => __('Enter here marker category title.', WPGMP_TEXT_DOMAIN), 'class' => 'create_map form-control', 'placeholder' => __('Marker Category Title', WPGMP_TEXT_DOMAIN), 'required' => true)); $form->set_col(3); $form->add_element('image_picker', 'group_marker', array('lable' => __('Choose Marker Image', WPGMP_TEXT_DOMAIN), 'src' => isset($_POST['group_marker']) ? wp_unslash($_POST['group_marker']) : WPGMP_IMAGES . '/default_marker.png', 'required' => false)); $form->add_element('extensions', 'wpgmp_category_form', array('value' => $_POST['extensions_fields'], 'before' => '<div class="col-md-11">', 'after' => '</div>')); $form->set_col(1); $form->add_element('submit', 'create_group_map_location', array('value' => 'Save Marker Category', 'before' => '<div class="col-md-12">', 'after' => '</div>')); $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['group_map_id'])))); } $form->render();
global $wpdb; $modelFactory = new FactoryModelWPGMP(); $category = $modelFactory->create_object('group_map'); $categories = (array) $category->fetch(); if (isset($_GET['doaction']) and 'edit' == $_GET['doaction'] and isset($_GET['group_map_id'])) { $category_obj = $category->fetch(array(array('group_map_id', '=', intval(wp_unslash($_GET['group_map_id']))))); $_POST = (array) $category_obj[0]; } elseif (!isset($_GET['doaction']) and isset($response['success'])) { // Reset $_POST object for antoher entry. unset($_POST); } $form = new Responsive_Markup(); $form->set_header(__('Marker Category', WPGMP_TEXT_DOMAIN), $response, __('Manage Marker Categories', WPGMP_TEXT_DOMAIN), 'wpgmp_manage_group_map'); if (is_array($categories)) { $markers = array(' ' => 'Please Select'); foreach ($categories as $i => $single_category) { if ($single_category->group_parent == 0 or $single_category->group_parent == '') { $markers[$single_category->group_map_id] = $single_category->group_map_title; } } $form->add_element('select', 'group_parent', array('lable' => __('Parent Category', WPGMP_TEXT_DOMAIN), 'current' => (isset($_POST['group_parent']) and !empty($_POST['group_parent'])) ? intval(wp_unslash($_POST['group_parent'])) : '', 'desc' => __('Assign parent category if any.', WPGMP_TEXT_DOMAIN), 'options' => $markers)); } $form->add_element('text', 'group_map_title', array('lable' => __('Marker Category Title', WPGMP_TEXT_DOMAIN), 'value' => (isset($_POST['group_map_title']) and !empty($_POST['group_map_title'])) ? sanitize_text_field(wp_unslash($_POST['group_map_title'])) : '', 'id' => 'group_map_title', 'desc' => __('Enter here marker category title.', WPGMP_TEXT_DOMAIN), 'class' => 'create_map form-control', 'placeholder' => __('Marker Category Title', WPGMP_TEXT_DOMAIN), 'required' => true)); $form->set_col(3); $form->add_element('image_picker', 'group_marker', array('lable' => __('Choose Marker Image', WPGMP_TEXT_DOMAIN), 'src' => isset($_POST['group_marker']) ? wp_unslash($_POST['group_marker']) : WPGMP_IMAGES . '/default_marker.png', 'required' => false)); $form->add_element('submit', 'create_group_map_location', array('value' => 'Save Marker Category', 'before' => '<div class="col-md-12">', 'after' => '</div>')); $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['group_map_id'])))); } $form->render();
$all_categories[$category->group_map_id] = $category; } } $location_obj = $modelFactory->create_object('location'); if (isset($_GET['doaction']) and 'edit' == $_GET['doaction'] and isset($_GET['location_id'])) { $location_obj = $location_obj->fetch(array(array('location_id', '=', intval(wp_unslash($_GET['location_id']))))); $data = (array) $location_obj[0]; } elseif (!isset($_GET['doaction']) and isset($response['success'])) { // Reset $_POST object for antoher entry. unset($data); } $form = new Responsive_Markup(); $form->set_header(__('Location Information', WPGMP_TEXT_DOMAIN), $response, __('Manage Locations', WPGMP_TEXT_DOMAIN), 'wpgmp_manage_location'); $form->add_element('text', 'location_title', array('lable' => __('Location Title', 'wpgmp_google_map'), 'value' => (isset($data['location_title']) and !empty($data['location_title'])) ? $data['location_title'] : '', 'desc' => __('Enter here the location title.', WPGMP_TEXT_DOMAIN), 'required' => true, 'placeholder' => __('Enter Location Title', WPGMP_TEXT_DOMAIN))); $form->add_element('text', 'location_address', array('lable' => __('Location Address', WPGMP_TEXT_DOMAIN), 'value' => (isset($data['location_address']) and !empty($data['location_address'])) ? $data['location_address'] : '', 'desc' => __('Enter here the address. Google auto suggest helps you to choose one.', WPGMP_TEXT_DOMAIN), 'required' => true, 'class' => 'form-control wpgmp_auto_suggest', 'placeholder' => __('Type Location Address', WPGMP_TEXT_DOMAIN))); $form->set_col(2); $form->add_element('text', 'location_latitude', array('lable' => __('Latitude and Longitude', WPGMP_TEXT_DOMAIN), 'value' => (isset($data['location_latitude']) and !empty($data['location_latitude'])) ? $data['location_latitude'] : '', 'id' => 'googlemap_latitude', 'desc' => __('Enter here the latitude.', WPGMP_TEXT_DOMAIN), 'required' => true, 'class' => 'google_latitude form-control', 'placeholder' => __('Enter the Latitude', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->add_element('text', 'location_longitude', array('value' => (isset($data['location_longitude']) and !empty($data['location_longitude'])) ? $data['location_longitude'] : '', 'id' => 'googlemap_longitude', 'desc' => __('Enter here the longitude.', WPGMP_TEXT_DOMAIN), 'required' => true, 'class' => 'google_longitude form-control', 'placeholder' => __('Enter the Longitude', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->add_element('text', 'location_city', array('lable' => __('City and State', WPGMP_TEXT_DOMAIN), 'value' => (isset($data['location_city']) and !empty($data['location_city'])) ? $data['location_city'] : '', 'id' => 'googlemap_city', 'desc' => __('Enter here the city.', WPGMP_TEXT_DOMAIN), 'class' => 'google_city form-control', 'placeholder' => __('City', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->add_element('text', 'location_state', array('value' => (isset($data['location_state']) and !empty($data['location_state'])) ? $data['location_state'] : '', 'id' => 'googlemap_state', 'desc' => __('Enter here the state.', WPGMP_TEXT_DOMAIN), 'class' => 'google_state form-control', 'placeholder' => __('State', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->add_element('text', 'location_country', array('lable' => __('Country and Postal Code', WPGMP_TEXT_DOMAIN), 'value' => (isset($data['location_country']) and !empty($data['location_country'])) ? $data['location_country'] : '', 'id' => 'googlemap_country', 'desc' => __('Enter here the country.', WPGMP_TEXT_DOMAIN), 'class' => 'google_country form-control', 'placeholder' => __('Country', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->add_element('text', 'location_postal_code', array('value' => (isset($data['location_postal_code']) and !empty($data['location_postal_code'])) ? $data['location_postal_code'] : '', 'id' => 'googlemap_postal_code', 'desc' => __('Enter here the postal code.', WPGMP_TEXT_DOMAIN), 'class' => 'google_postal_code form-control', 'placeholder' => __('Postal Code', WPGMP_TEXT_DOMAIN), 'before' => '<div class="col-md-4">', 'after' => '</div>')); $form->set_col(1); $form->add_element('div', 'wpgmp_map', array('lable' => __('Current Location', WPGMP_TEXT_DOMAIN), 'id' => 'wpgmp_map', 'style' => array('width' => '100%', 'height' => '300px'))); $form->add_element('radio', 'location_settings[onclick]', array('lable' => __('On Click', WPGMP_TEXT_DOMAIN), 'radio-val-label' => array('marker' => __('Display Infowindow', WPGMP_TEXT_DOMAIN), 'custom_link' => __('Redirect', WPGMP_TEXT_DOMAIN)), 'current' => $data['location_settings']['onclick'], 'class' => 'chkbox_class switch_onoff', 'default_value' => 'marker', 'data' => array('target' => '.wpgmp_location_onclick'))); $form->add_element('textarea', 'location_messages', array('lable' => __('Infowindow Message', WPGMP_TEXT_DOMAIN), 'value' => (isset($data['location_messages']) and !empty($data['location_messages'])) ? $data['location_messages'] : '', 'desc' => __('Enter here the infoWindow message.', WPGMP_TEXT_DOMAIN), 'textarea_rows' => 10, 'textarea_name' => 'location_messages', 'class' => 'form-control wpgmp_location_onclick wpgmp_location_onclick_marker', 'id' => 'googlemap_infomessage', 'show' => 'false')); $form->add_element('text', 'location_settings[redirect_link]', array('lable' => __('Redirect Url', WPGMP_TEXT_DOMAIN), 'value' => $data['location_settings']['redirect_link'], 'desc' => __('Enter here the redirect url. e.g http://www.flippercode.com', WPGMP_TEXT_DOMAIN), 'class' => 'wpgmp_location_onclick_custom_link wpgmp_location_onclick form-control', 'before' => '<div class="col-md-8">', 'after' => '</div>', 'show' => 'false')); $form->add_element('select', 'location_settings[redirect_link_window]', array('options' => array('yes' => __('YES', WPGMP_TEXT_DOMAIN), 'no' => __('NO', WPGMP_TEXT_DOMAIN)), 'lable' => __('Open new tab', WPGMP_TEXT_DOMAIN), 'current' => $data['location_settings']['redirect_link_window'], 'desc' => __('Open a new window tab.', WPGMP_TEXT_DOMAIN), 'class' => 'wpgmp_location_onclick_redirect wpgmp_location_onclick form-control', 'before' => '<div class="col-md-2">', 'after' => '</div>', 'show' => 'false')); $form->add_element('checkbox', 'location_infowindow_default_open', array('lable' => __('Infowindow Default Open', WPGMP_TEXT_DOMAIN), 'value' => 'true', 'id' => 'location_infowindow_default_open', 'current' => $data['location_infowindow_default_open'], 'desc' => __('Check to enable infowindow default open.', WPGMP_TEXT_DOMAIN), 'class' => 'chkbox_class')); $form->add_element('checkbox', 'location_draggable', array('lable' => __('Marker Draggable', WPGMP_TEXT_DOMAIN), 'value' => 'true', 'id' => 'location_draggable', 'current' => $data['location_draggable'], 'desc' => __('Check if you want to allow visitors to drag the marker.', WPGMP_TEXT_DOMAIN), 'class' => 'chkbox_class')); $form->add_element('select', 'location_animation', array('lable' => __('Marker Animation', WPGMP_TEXT_DOMAIN), 'current' => (isset($data['location_animation']) and !empty($data['location_animation'])) ? $data['location_animation'] : '', 'desc' => __('Please select marker animation.', WPGMP_TEXT_DOMAIN), 'options' => array('BOUNCE' => 'Bounce', 'DROP' => 'DROP'), 'before' => '<div class="col-md-3">', 'after' => '</div>'));