Пример #1
0
function a3_people_contact_lite_upgrade_plugin()
{
    // Upgrade to 1.0.3
    if (version_compare(get_option('a3rev_wp_people_contact_version'), '1.0.3') === -1) {
        People_Contact_Profile_Data::install_database();
        update_option('a3rev_wp_people_contact_version', '1.0.3');
        include PEOPLE_CONTACT_DIR . '/upgrade/updates/people-contact-update-1.0.3.php';
    }
    // Upgrade to 1.1.1
    if (version_compare(get_option('a3rev_wp_people_contact_version'), '1.1.1') === -1) {
        update_option('a3rev_wp_people_contact_version', '1.1.1');
        include PEOPLE_CONTACT_DIR . '/upgrade/updates/people-contact-update-1.1.1.php';
    }
    // Upgrade to 1.1.4 for Lite version
    if (version_compare(get_option('a3rev_wp_people_contact_version'), '1.1.4') === -1) {
        update_option('a3rev_wp_people_contact_version', '1.1.4');
        include PEOPLE_CONTACT_DIR . '/upgrade/updates/people-contact-update-1.1.4.php';
    }
    // Upgrade to 1.2.0
    if (version_compare(get_option('a3rev_wp_people_contact_lite_version'), '1.2.0') === -1) {
        update_option('a3rev_wp_people_contact_lite_version', '1.2.0');
        // Build sass
        global $a3_people_contact_less;
        $a3_people_contact_less->plugin_build_sass();
    }
    if (version_compare(get_option('a3rev_wp_people_contact_lite_version'), '2.0.1') === -1) {
        update_option('a3rev_wp_people_contact_lite_version', '2.0.1');
        include PEOPLE_CONTACT_DIR . '/upgrade/updates/people-contact-update-2.0.1.php';
    }
    update_option('a3rev_wp_people_contact_lite_version', '2.0.3');
    update_option('a3rev_wp_people_contact_version', '2.0.3');
    update_option('a3rev_wp_people_contact_ultimate_version', '2.0.3');
}
Пример #2
0
<?php

if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$contacts = get_option('contact_arr');
if (is_array($contacts) && count($contacts) > 0) {
    $i = 0;
    foreach ($contacts as $key => $value) {
        $i++;
        $new_value = array();
        foreach ($value as $key => $field) {
            $new_value[$key] = esc_attr(stripslashes($field));
        }
        $new_value['c_order'] = $i;
        People_Contact_Profile_Data::insert_row($new_value);
    }
}
    public static function admin_screen()
    {
        global $people_contact_grid_view_icon;
        $message = '';
        if (isset($_GET['action']) && $_GET['action'] == 'del' && isset($_GET['id']) && $_GET['id'] >= 0) {
            People_Contact_Profile_Data::delete_row($_GET['id']);
            $message = '<div class="updated" id=""><p>' . __('Profile Successfully deleted.', 'cup_cp') . '</p></div>';
        } elseif (isset($_GET['edited_profile'])) {
            $message = '<div class="updated" id=""><p>' . __('Profile Successfully updated.', 'cup_cp') . '</p></div>';
        } elseif (isset($_GET['created_profile'])) {
            $message = '<div class="updated" id=""><p>' . __('Profile Successfully created.', 'cup_cp') . '</p></div>';
        }
        $my_contacts = People_Contact_Profile_Data::get_results('', 'c_order ASC', '', 'ARRAY_A');
        ?>
        <div id="htmlForm">
        <div style="clear:both"></div>
		<div class="wrap a3rev_manager_panel_container">
        
        <?php 
        echo $message;
        ?>
        <div class="icon32 icon32-a3rev-ui-settings icon32-a3revpeople-contact-settings" id="icon32-a3revpeople-contact-manager"><br></div><h1><?php 
        _e('Profiles', 'cup_cp');
        ?>
 <a class="add-new-h2" href="<?php 
        echo admin_url('admin.php?page=people-contact', 'relative');
        ?>
"><?php 
        _e('Add New', 'cup_cp');
        ?>
</a></h1>
		<div style="clear:both;height:5px;"></div>
		<form name="contact_setting" method="post" action="">
		  <table class="wp-list-table widefat fixed striped sorttable">
			<thead>
			  <tr>
				<th width="30" class="manage-column column-sortable" style="text-align:left;white-space:nowrap"></th>
				<th width="25" class="manage-column column-number" style="text-align:right;white-space:nowrap"><?php 
        _e('No', 'cup_cp');
        ?>
</th>
				<th width="40" class="manage-column column-image">&nbsp;</th>
				<th class="manage-column column-title" style="text-align:left;white-space:nowrap"><?php 
        _e('Name', 'cup_cp');
        ?>
</th>
				<th width="18%" class="manage-column column-email" style="text-align:left;white-space:nowrap"><?php 
        _e('Email', 'cup_cp');
        ?>
</th>
				<th width="8%" class="manage-column column-phone" style="text-align:left;white-space:nowrap"><?php 
        _e('Phone', 'cup_cp');
        ?>
</th>
				<th width="15%" style="text-align:left" class="manage-column column-location"><?php 
        _e('Location', 'cup_cp');
        ?>
</th>
				<th width="85" style="text-align:center" class="manage-column column-actions"></th>
			  </tr>
			</thead>
			<tfoot>
			  <tr>
				<th class="manage-column column-sortable" style="text-align:left;white-space:nowrap"></th>
				<th class="manage-column column-number" style="text-align:right;white-space:nowrap"><?php 
        _e('No', 'cup_cp');
        ?>
</th>
				<th class="manage-column column-image">&nbsp;</th>
				<th class="manage-column column-title" style="text-align:left;white-space:nowrap"><?php 
        _e('Name', 'cup_cp');
        ?>
</th>
				<th class="manage-column column-email" style="text-align:left;white-space:nowrap"><?php 
        _e('Email', 'cup_cp');
        ?>
</th>
				<th class="manage-column column-phone" style="text-align:left;white-space:nowrap"><?php 
        _e('Phone', 'cup_cp');
        ?>
</th>
				<th style="text-align:left" class="manage-column column-location"><?php 
        _e('Location', 'cup_cp');
        ?>
</th>
				<th style="text-align:center" class="manage-column column-actions"></th>
			  </tr>
			</tfoot>
			<tbody>
			<?php 
        if (is_array($my_contacts) && count($my_contacts) > 0) {
            $i = 0;
            foreach ($my_contacts as $value) {
                $i++;
                if ($value['c_avatar'] != '') {
                    $src = $value['c_avatar'];
                } else {
                    $src = PEOPLE_CONTACT_IMAGE_URL . '/no-avatar.png';
                }
                ?>
			  <tr id="recordsArray_<?php 
                echo $value['id'];
                ?>
">
				<td class="column-sortable" style="cursor:pointer;" valign="middle"><img src="<?php 
                echo PEOPLE_CONTACT_IMAGE_URL;
                ?>
/updown.png" style="cursor:pointer" /></td>
				<td valign="middle" class="no column-number" style="text-align:right;"><span class="number_item"><?php 
                echo $i;
                ?>
</span></td>
				<td valign="middle" class="avatar column-image" align="center"><img src="<?php 
                echo $src;
                ?>
" style="border:1px solid #CCC;padding:2px;background:#FFF;width:32px;" /></td>
				<td valign="middle" style="text-align:left;" class="name column-title"><?php 
                esc_attr_e(stripslashes($value['c_name']));
                ?>
</td>
				<td valign="middle" class="phone column-email"><?php 
                esc_attr_e(stripslashes($value['c_email']));
                ?>
</td>
				<td valign="middle" class="phone column-phone"><?php 
                esc_attr_e(stripslashes($value['c_phone']));
                ?>
</td>
				<td valign="middle" class="address column-location"><?php 
                esc_attr_e(stripslashes($value['c_address']));
                ?>
</td>
				<td valign="middle" class="column-actions" align="center"><a title="<?php 
                _e('Edit', 'cup_cp');
                ?>
" href="<?php 
                echo admin_url('admin.php?page=people-contact&action=edit&id=' . $value['id'], 'relative');
                ?>
"><?php 
                _e('Edit', 'cup_cp');
                ?>
</a> | <a title="<?php 
                _e('Delete', 'cup_cp');
                ?>
" href="<?php 
                echo admin_url('admin.php?page=people-contact-manager&action=del&id=' . $value['id'], 'relative');
                ?>
" onclick="if(!confirm('<?php 
                _e('Are you sure delete this profile?', 'cup_cp');
                ?>
')){return false;}else{return true;}"><?php 
                _e('Delete', 'cup_cp');
                ?>
</a></td>
			  </tr>
			  <?php 
            }
        } else {
            ?>
			  <tr>
				<td valign="middle" align="center" colspan="8"><?php 
            _e('No Profile', 'cup_cp');
            ?>
</td>
			  </tr>
			  <?php 
        }
        ?>
			</tbody>
		  </table>
		  <?php 
        $people_update_orders = wp_create_nonce("people_update_orders");
        ?>
			<script type="text/javascript">
				(function($){
					$(function(){
						var fixHelper = function(e, ui) {
							ui.children().each(function() {
								$(this).width($(this).width());
							});
							return ui;
						};
						$(".sorttable tbody").sortable({ helper: fixHelper, placeholder: "ui-state-highlight", opacity: 0.8, cursor: 'move', update: function() {
							var order = $(this).sortable("serialize") + '&action=people_update_orders&security=<?php 
        echo $people_update_orders;
        ?>
';
							$.post("<?php 
        echo admin_url('admin-ajax.php', 'relative');
        ?>
", order, function(theResponse){
								$(".people_table").find(".number_item").each(function(index){
									$(this).html(index+1);
								});
							});
						}
						});
					});
				})(jQuery);
			</script>
		</form>
        </div>
        </div>
		<?php 
    }
Пример #4
0
 public static function people_update_orders()
 {
     check_ajax_referer('people_update_orders', 'security');
     $updateRecordsArray = $_REQUEST['recordsArray'];
     $i = 0;
     foreach ($updateRecordsArray as $recordIDValue) {
         $i++;
         People_Contact_Profile_Data::update_order($recordIDValue, $i);
     }
     die;
 }
Пример #5
0
    public function load_ajax_contact_form()
    {
        global $people_contact_grid_view_icon;
        global $people_email_inquiry_global_settings;
        if (trim($people_email_inquiry_global_settings['inquiry_contact_text_button']) != '') {
            $inquiry_contact_text_button = $people_email_inquiry_global_settings['inquiry_contact_text_button'];
        } else {
            $inquiry_contact_text_button = __('SEND', 'cup_cp');
        }
        $inquiry_contact_button_class = apply_filters('people_inquiry_contact_button_class', '');
        $inquiry_contact_form_class = apply_filters('people_inquiry_contact_form_class', '');
        $contact_id = $_REQUEST['contact_id'];
        $data = People_Contact_Profile_Data::get_row($contact_id, '', 'ARRAY_A');
        if ($data['c_avatar'] != '') {
            $src = $data['c_avatar'];
            $c_attachment_id = $data['c_attachment_id'];
        } else {
            $src = PEOPLE_CONTACT_IMAGE_URL . '/no-avatar.png';
            $c_attachment_id = 0;
        }
        $img_output = '<img width="80" class="wp-image-' . $c_attachment_id . '" src="' . $src . '" />';
        if (function_exists('wp_make_content_images_responsive')) {
            $img_output = wp_make_content_images_responsive($img_output);
        }
        ?>
		<div class="custom_contact_popup <?php 
        echo $inquiry_contact_form_class;
        ?>
">
        <div style="padding:10px;">
		<div style="clear:both"></div>
		<div class="people_email_inquiry_contact_heading" ><?php 
        echo $people_email_inquiry_global_settings['inquiry_contact_heading'];
        ?>
</div>
		<div style="clear:both; margin-top:10px"></div>
        <div class="people_email_inquiry_site_name"><?php 
        echo $people_email_inquiry_global_settings['inquiry_form_site_name'];
        ?>
</div>
        <div style="clear:both; margin-top:5px"></div>
		<div style="float:left; margin-right:20px;" class="people_email_inquiry_default_image_container"><?php 
        echo $img_output;
        ?>
</div>
        <div style="display:block; margin-bottom:10px; padding-left:22%;" class="people_email_inquiry_product_heading_container">
			<div class="people_email_inquiry_profile_position"><?php 
        esc_attr_e(stripslashes($data['c_title']));
        ?>
</div>
            <div class="people_email_inquiry_profile_name"><?php 
        esc_attr_e(stripslashes($data['c_name']));
        ?>
</div>
        </div>
		<div style="clear:both;height:1em;"></div>
        <div class="people_email_inquiry_content" id="people_email_inquiry_content_<?php 
        echo $contact_id;
        ?>
">
        	<input type="hidden" value="<?php 
        esc_attr_e(stripslashes($data['c_email']));
        ?>
" id="profile_email_<?php 
        echo $contact_id;
        ?>
" name="profile_email" />
        	<input type="hidden" value="<?php 
        esc_attr_e(stripslashes($data['c_title']));
        ?>
 <?php 
        esc_attr_e(stripslashes($data['c_name']));
        ?>
" id="profile_name_<?php 
        echo $contact_id;
        ?>
" name="profile_name" />
            <div class="people_email_inquiry_field">
                <label class="people_email_inquiry_label" for="c_name_<?php 
        echo $contact_id;
        ?>
"><?php 
        people_ict_t_e('Default Form - Contact Name', __('Name', 'cup_cp'));
        ?>
 <span class="gfield_required">*</span></label>
                <input type="text" name="c_name" id="c_name_<?php 
        echo $contact_id;
        ?>
" value="" /></div>
            <div class="people_email_inquiry_field">
                <label class="people_email_inquiry_label" for="c_email_<?php 
        echo $contact_id;
        ?>
"><?php 
        people_ict_t_e('Default Form - Contact Email', __('Email', 'cup_cp'));
        ?>
 <span class="gfield_required">*</span></label>
                <input type="text" name="c_email" id="c_email_<?php 
        echo $contact_id;
        ?>
" value="" /></div>
            <div class="people_email_inquiry_field">
                <label class="people_email_inquiry_label" for="c_phone_<?php 
        echo $contact_id;
        ?>
"><?php 
        people_ict_t_e('Default Form - Contact Phone', __('Phone', 'cup_cp'));
        ?>
 <span class="gfield_required">*</span></label>
                <input type="text" name="c_phone" id="c_phone_<?php 
        echo $contact_id;
        ?>
" value="" /></div>
            <div class="people_email_inquiry_field">
                <label class="people_email_inquiry_label" for="c_subject_<?php 
        echo $contact_id;
        ?>
"><?php 
        people_ict_t_e('Default Form - Contact Subject', __('Subject', 'cup_cp'));
        ?>
 </label>
                <input type="text" name="c_subject" id="c_subject_<?php 
        echo $contact_id;
        ?>
" value="" /></div>
            <div class="people_email_inquiry_field">
                <label class="people_email_inquiry_label" for="c_message_<?php 
        echo $contact_id;
        ?>
"><?php 
        people_ict_t_e('Default Form - Contact Message', __('Message', 'cup_cp'));
        ?>
 <span class="gfield_required">*</span></label>
                <textarea rows="3" name="c_message" id="c_message_<?php 
        echo $contact_id;
        ?>
"></textarea></div>
            <div class="people_email_inquiry_field">
                <?php 
        if ($people_email_inquiry_global_settings['send_copy'] != 'no') {
            ?>
                <label class="people_email_inquiry_label">&nbsp;</label>
                <label class="people_email_inquiry_send_copy"><input type="checkbox" name="send_copy" id="send_copy_<?php 
            echo $contact_id;
            ?>
" value="1" checked="checked" /> <?php 
            people_ict_t_e('Default Form - Send Copy', __('Send a copy of this email to myself.', 'cup_cp'));
            ?>
</label>
                <?php 
        }
        ?>
                <a class="people_email_inquiry_form_button <?php 
        echo $inquiry_contact_button_class;
        ?>
" id="people_email_inquiry_bt_<?php 
        echo $contact_id;
        ?>
" contact_id="<?php 
        echo $contact_id;
        ?>
"><?php 
        echo $inquiry_contact_text_button;
        ?>
</a>
            </div>
            <div style="clear:both"></div>
        </div>
		<div style="clear:both"></div>
		<div class="ajax-wait">&nbsp;</div>
        </div>
        </div>
		<?php 
        die;
    }
Пример #6
0
    public static function admin_screen_add_edit()
    {
        global $people_contact_location_map_settings;
        global $people_contact_admin_init;
        add_filter($people_contact_admin_init->plugin_name . '_' . 'a3_people_groupes_box' . '_pro_version_name', array('People_Category_Manager_Panel', 'get_ultimate_version_name'));
        add_filter($people_contact_admin_init->plugin_name . '_' . 'a3_people_groupes_box' . '_pro_plugin_page_url', array('People_Category_Manager_Panel', 'get_ultimate_page_url'));
        global $people_contact_admin_interface;
        $address_error_class = '';
        $message = '';
        if (get_option('a3_people_profile_save_failure', 0) == 1) {
            $address_error_class = 'input_error';
            $message = '<div class="message error"><p>' . __('ERROR: A location address must be entered. Please enter a Location Address for this profile.', 'cup_cp') . '</p></div>';
            delete_option('a3_people_profile_save_failure');
        }
        $bt_type = 'add_new_contact';
        $bt_value = __('Create', 'cup_cp');
        $title = __('Add New Profile', 'cup_cp');
        $center_address = 'Australia';
        $center_lat = -25.155123773636443;
        $center_lng = 133.77513599999997;
        $latlng_center = $latlng = $center_lat . ',' . $center_lng;
        $bt_cancel = '<input type="button" class="button" onclick="window.location=\'admin.php?page=people-contact-manager\'" value="' . __('Cancel', 'cup_cp') . '" />';
        $data = array('c_title' => '', 'c_name' => '', 'c_email' => '', 'c_phone' => '', 'c_fax' => '', 'c_mobile' => '', 'c_website' => '', 'c_address' => '', 'c_latitude' => '', 'c_longitude' => '', 'c_shortcode' => '', 'c_avatar' => '', 'c_attachment_id' => 0, 'c_about' => '');
        if (isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['id']) && $_GET['id'] >= 0) {
            $bt_type = 'update_contact';
            $data = People_Contact_Profile_Data::get_row($_GET['id'], '', 'ARRAY_A');
            $title = __('Edit Profile', 'cup_cp');
            if ((trim($data['c_latitude']) == '' || trim($data['c_longitude']) == '') && trim($data['c_address']) != '') {
                $googleapis_url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($data['c_address']) . '&sensor=false';
                $geodata = file_get_contents($googleapis_url);
                $geodata = json_decode($geodata);
                $data['c_latitude'] = $geodata->results[0]->geometry->location->lat;
                $data['c_longitude'] = $geodata->results[0]->geometry->location->lng;
            }
            if (trim($data['c_latitude']) != '' && trim($data['c_longitude']) != '') {
                $latlng_center = $latlng = $data['c_latitude'] . ',' . $data['c_longitude'];
            }
            $bt_value = __('Update', 'cup_cp');
        }
        if (isset($_POST['update_contact']) || isset($_POST['add_new_contact'])) {
            $data = array_merge($data, $_REQUEST['contact_arr']);
        }
        ?>
        <div id="htmlForm">
        <div style="clear:both"></div>
		<div class="wrap">
		<style>
		.input_error {
			border-color: #cc0000 !important;
		}
		</style>
		<?php 
        echo $message;
        ?>
        <div class="icon32 icon32-a3rev-ui-settings icon32-a3revpeople-contact-settings" id="icon32-a3revpeople-contact-addnew"><br></div><h1><?php 
        echo $title;
        ?>
</h1>
          <div style="clear:both;"></div>
		  <div class="contact_manager a3rev_panel_container a3rev_custom_panel_container">
			<form action="" name="add_conact" id="add_contact" method="post">
			<input type="hidden" value="<?php 
        if (isset($_GET['id'])) {
            echo $_GET['id'];
        }
        ?>
" id="profile_id" name="contact_arr[profile_id]">
            <div class="col-left">
	            <?php 
        ob_start();
        ?>
				<table class="form-table" style="margin-bottom:0;">
				  <tbody>
					<tr valign="top">
					  <th scope="row"><label for="c_title"><?php 
        _e('Title / Position', 'cup_cp');
        ?>
</label></th>
					  <td><input type="text" class="regular-text" value="<?php 
        if (isset($data['c_title'])) {
            esc_attr_e(stripslashes($data['c_title']));
        }
        ?>
" id="c_title" name="contact_arr[c_title]"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="c_name"><?php 
        _e('Name', 'cup_cp');
        ?>
</label></th>
					  <td><input type="text" class="regular-text" value="<?php 
        if (isset($data['c_name'])) {
            esc_attr_e(stripslashes($data['c_name']));
        }
        ?>
" id="c_name" name="contact_arr[c_name]"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="c_avatar"><?php 
        _e('Profile Image', 'cup_cp');
        ?>
</label></th>
					  <td class="profileavatar">
	                  <?php 
        global $people_contact_uploader;
        ?>
	                  <?php 
        echo $people_contact_uploader->upload_input('c_avatar', 'c_avatar', $data['c_avatar'], $data['c_attachment_id'], '', __('Profile Image', 'cup_cp'), '', 'width:100%;', '<div class="description">' . __("Image format .jpg, .png", 'cup_cp') . '</div>');
        ?>
	                  </td>
					</tr>
	        	  </tbody>
				</table>
				<?php 
        $settings_html = ob_get_clean();
        $people_contact_admin_interface->panel_box($settings_html, array('name' => __('Profile Details', 'cup_cp'), 'desc' => __("Fields left empty will not show on the front end.", 'cup_cp'), 'css' => 'margin-top: 5px', 'id' => 'a3_people_profile_details_box', 'is_box' => true));
        ?>

		        <?php 
        ob_start();
        ?>
				<table class="form-table" style="margin-bottom:0;" width="100%">
				  <tbody>
					<tr valign="top">
					  <th scope="row"><label for="c_email"><?php 
        _e('Email', 'cup_cp');
        ?>
</label></th>
					  <td><input type="text" class="regular-text" value="<?php 
        if (isset($data['c_email'])) {
            esc_attr_e(stripslashes($data['c_email']));
        }
        ?>
" id="c_email" name="contact_arr[c_email]"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="c_phone"><?php 
        _e('Phone', 'cup_cp');
        ?>
</label></th>
					  <td><input type="text" class="regular-text" value="<?php 
        if (isset($data['c_phone'])) {
            esc_attr_e(stripslashes($data['c_phone']));
        }
        ?>
" id="c_phone" name="contact_arr[c_phone]"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="c_fax"><?php 
        _e('Fax', 'cup_cp');
        ?>
</label></th>
					  <td><input type="text" class="regular-text" value="<?php 
        if (isset($data['c_fax'])) {
            esc_attr_e(stripslashes($data['c_fax']));
        }
        ?>
" id="c_fax" name="contact_arr[c_fax]"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="c_mobile"><?php 
        _e('Mobile', 'cup_cp');
        ?>
</label></th>
					  <td><input type="text" class="regular-text" value="<?php 
        if (isset($data['c_mobile'])) {
            esc_attr_e(stripslashes($data['c_mobile']));
        }
        ?>
" id="c_mobile" name="contact_arr[c_mobile]"></td>
					</tr>
	                <tr valign="top">
					  <th scope="row"><label for="c_website"><?php 
        _e('Website', 'cup_cp');
        ?>
</label></th>
					  <td><input type="text" class="regular-text" value="<?php 
        if (isset($data['c_website']) && trim($data['c_website']) != '') {
            echo esc_url(stripslashes($data['c_website']));
        } else {
            echo 'http://';
        }
        ?>
" id="c_website" name="contact_arr[c_website]" onfocus="if (this.value == 'http://') {this.value = '';}" onblur="if (this.value == '') {this.value = 'http://';}" /></td>
					</tr>
	                <tr valign="top">
					  <td class="forminp" colspan="2" style="padding-left:0;">
					   <div class="row_mod" ><label for="c_website"><?php 
        _e('About', 'cup_cp');
        ?>
</label></div>
	                  	<?php 
        wp_editor(stripslashes($data['c_about']), 'c_about', array('textarea_name' => 'contact_arr[c_about]', 'wpautop' => true, 'textarea_rows' => 8));
        ?>
	                  </td>
					</tr>
				  </tbody>
				</table>
				<?php 
        $settings_html = ob_get_clean();
        $people_contact_admin_interface->panel_box($settings_html, array('name' => __('Contact Details', 'cup_cp'), 'desc' => __("Fields left empty will not show on the front end.", 'cup_cp'), 'id' => 'a3_people_contact_details_box', 'is_box' => true));
        ?>

	        	<?php 
        ob_start();
        ?>
				<table class="form-table" style="margin-bottom:0;">
				  <tbody>
					<tr valign="top">
					  <th scope="row"><label for="show_on_main_page"><?php 
        _e('Contact Page Display', 'cup_cp');
        ?>
</label></th>
					  <td>
					  	<?php 
        if (!isset($data['show_on_main_page'])) {
            $data['show_on_main_page'] = 1;
        }
        ?>
					  	<input
					  		id="show_on_main_page"
							name="contact_arr[show_on_main_page]"
							class="a3rev-ui-onoff_checkbox show_on_main_page"
	                        checked_label="<?php 
        _e('ON', 'cup_cp');
        ?>
"
	                        unchecked_label="<?php 
        _e('OFF', 'cup_cp');
        ?>
"
	                        type="checkbox"
							value="1"
							<?php 
        checked(1, $data['show_on_main_page'], true);
        ?>
							/>
					  </td>
					</tr>
				  </tbody>
				</table>
				<div class="show_marker_on_main_map_container" style="<?php 
        if (1 != $data['show_on_main_page']) {
            echo 'visibility:hidden; height: 0px; overflow: hidden; margin-bottom: 0px;';
        }
        ?>
" >
					<table class="form-table" style="margin-bottom:0;">
					  <tbody>
						<tr valign="top">
						  <th scope="row"><label for="enable_map_marker"><?php 
        _e('Show on Contact Page map', 'cup_cp');
        ?>
</label></th>
						  <td>
						  	<?php 
        if (!isset($data['enable_map_marker'])) {
            $data['enable_map_marker'] = 1;
        }
        ?>
						  	<input
						  		id="enable_map_marker"
								name="contact_arr[enable_map_marker]"
								class="a3rev-ui-onoff_checkbox enable_map_marker"
		                        checked_label="<?php 
        _e('ON', 'cup_cp');
        ?>
"
		                        unchecked_label="<?php 
        _e('OFF', 'cup_cp');
        ?>
"
		                        type="checkbox"
								value="1"
								<?php 
        checked(1, $data['enable_map_marker'], true);
        ?>
								/>
								<span class="description"><?php 
        echo __('ON to show this Profile on the Contact Page map', 'cup_cp');
        ?>
</span>
						  </td>
						</tr>
					  </tbody>
					</table>
				</div>
				<?php 
        $settings_html = ob_get_clean();
        $people_contact_admin_interface->panel_box($settings_html, array('name' => __('Contact Page Profile', 'cup_cp'), 'desc' => __('Switch OFF and this profile will not show on the main Contact Us Page but still can be inserted by shortcode (Pro and Ultimate Versions) and assigned to groups (Ultimate Version) that are inserted by shortcode.', 'cup_cp'), 'id' => 'a3_people_contact_page_profile_box', 'is_box' => true));
        ?>

				<div>
					<?php 
        ob_start();
        ?>
		            <table class="form-table" style="margin-bottom:0;">
		            <tr valign="top">
						  <th scope="row"><label for="c_shortcode"><?php 
        _e('Enter Form Shortcode', 'cup_cp');
        ?>
</label></th>
						  <td>
		                  <input type="text" class="regular-text" value="" id="c_shortcode" name="contact_arr[c_shortcode]"></td>
						</tr>
					  </tbody>
					</table>
					<?php 
        $settings_html = ob_get_clean();
        $people_contact_admin_interface->panel_box($settings_html, array('name' => __('Contact Form by Shortcode', 'cup_cp'), 'desc' => sprintf(__('Add a unique Contact Form for this profile. Supports Contact Form 7 or Gravity Forms plugin shortcodes. Feature must be switched <a href="%s" target="_blank">ON here</a> + Contact Form Type > Create Form by Shortcode switch.', 'cup_cp'), admin_url('admin.php?page=people-contact-settings&tab=email-inquiry')), 'class' => 'pro_feature_fields', 'id' => 'a3_people_contact_form_shortcode_box', 'is_box' => true));
        ?>
				</div>

				<div class="categories_selection_container">
              		<?php 
        ob_start();
        ?>
					<div class="categories_selection">
		              <?php 
        $all_categories = array(array('id' => 1, 'category_name' => __('Profile Group', 'cup_cp')));
        if (is_array($all_categories) && count($all_categories) > 0) {
            foreach ($all_categories as $category_data) {
                ?>
		                	<div style="float:left; width:100%; margin-bottom:10px;">
		                    	<input
										name="categories_assign[]"
										class="a3rev-ui-onoff_checkbox"
		                                checked_label="<?php 
                _e('YES', 'cup_cp');
                ?>
"
		                                unchecked_label="<?php 
                _e('NO', 'cup_cp');
                ?>
"
		                                type="checkbox"
										value="<?php 
                echo $category_data['id'];
                ?>
"
										/>
		                    	<?php 
                esc_attr_e(stripslashes($category_data['category_name']));
                ?>
		                	</div>
		                    <div style="clear:both"></div>
		                <?php 
            }
        } else {
            _e('No Groups', 'cup_cp');
        }
        ?>
              		</div>
              		<?php 
        $settings_html = ob_get_clean();
        $people_contact_admin_interface->panel_box($settings_html, array('name' => __('Assign Profile to Groups', 'cup_cp'), 'desc' => __('Use the ON | OFF switches to assign this profile to any number of Groups', 'cup_cp'), 'class' => 'pro_feature_fields', 'id' => 'a3_people_groupes_box', 'is_box' => true));
        ?>
              	</div>

            </div>
			<div class="col-right">
				<?php 
        ob_start();
        ?>
				<table class="form-table" style="margin-bottom:0;">
				  <tbody>
					<tr valign="top">
					  <th scope="row"><label for="c_address"><?php 
        _e('Address', 'cup_cp');
        ?>
</label></th>
					  <td><input type="text" class="regular-text <?php 
        echo $address_error_class;
        ?>
" value="<?php 
        if (isset($data['c_address'])) {
            esc_attr_e(stripslashes($data['c_address']));
        }
        ?>
" id="c_address" name="contact_arr[c_address]"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="c_latitude"><?php 
        _e('Latitude', 'cup_cp');
        ?>
</label></th>
					  <td><input type="text" readonly="readonly" class="regular-text" value="<?php 
        if (isset($data['c_latitude'])) {
            echo $data['c_latitude'];
        }
        ?>
" id="c_latitude" name="contact_arr[c_latitude]"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="c_longitude"><?php 
        _e('Longitude', 'cup_cp');
        ?>
</label></th>
					  <td><input type="text" readonly="readonly" class="regular-text" value="<?php 
        if (isset($data['c_longitude'])) {
            echo $data['c_longitude'];
        }
        ?>
" id="c_longitude" name="contact_arr[c_longitude]"></td>
					</tr>
					<tr>
						<th></th>
						<td>
							<div style="font-size: 13px;"><?php 
        echo __('* <strong>Tip</strong> - drag and drop the map marker to the required location', 'cup_cp');
        ?>
</div>
							<div class="maps_content" style="padding:10px 0px;">
					    		<div id="map_canvas"></div>
		              		</div>
		              	</td>
					</tr>
				  </tbody>
				</table>
				<?php 
        $settings_html = ob_get_clean();
        $people_contact_admin_interface->panel_box($settings_html, array('name' => __('Profile Location Address', 'cup_cp'), 'desc' => __('<strong>REQUIRED</strong>: All profiles must have a map location set. The location set here is used for this profile on the Contact Us Page map (optional) and any Group map (optional) that the profile has been assigned to.', 'cup_cp'), 'id' => 'a3_people_location_address_box', 'is_box' => true, 'alway_open' => true));
        ?>

              	<div style="clear:both"></div>
			</div>
            <div style="clear:both"></div>
			<script type="text/javascript" >
			<?php 
        $map_type = $people_contact_location_map_settings['map_type'];
        if ($map_type == '') {
            $map_type = 'ROADMAP';
        }
        $zoom_level = 1;
        if (isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['id']) && $_GET['id'] >= 0) {
            $zoom_level = $people_contact_location_map_settings['zoom_level'];
            if ($zoom_level <= 0) {
                $zoom_level = 1;
            }
        }
        ?>

			var geocoder;
			var map;
			var marker;

			function initialize(){
			//MAP
			  var latlng = new google.maps.LatLng(<?php 
        echo $latlng;
        ?>
);
			  var latlng_center = new google.maps.LatLng(<?php 
        echo $latlng_center;
        ?>
);
			  var options = {
				zoom: <?php 
        echo $zoom_level;
        ?>
,
				center: latlng_center,

				mapTypeId: google.maps.MapTypeId.<?php 
        echo $map_type;
        ?>
			  };

			  map = new google.maps.Map(document.getElementById("map_canvas"), options);

			  //GEOCODER
			  geocoder = new google.maps.Geocoder();

			  marker = new google.maps.Marker({
				map: map,
				draggable: true,
				position: latlng
			  });

			}

			jQuery(document).ready(function ($) {

				initialize();

				function a3_people_reload_map() {
					var current_lat = $("#c_latitude").val();
					var current_lng = $("#c_longitude").val();
					if ( current_lat != '' && current_lng != '' ) {
						var current_center = new google.maps.LatLng(current_lat, current_lng);
					} else {
						var current_center = new google.maps.LatLng(<?php 
        echo $latlng_center;
        ?>
);
					}
					google.maps.event.trigger(map, "resize"); //this fix the problem with not completely map
					map.setCenter(current_center);
				}

				$(document).on( "a3rev-ui-onoff_checkbox-switch", '.show_on_main_page', function( event, value, status ) {
					$(".show_marker_on_main_map_container").attr('style','display:none;');
					if ( status == 'true' ) {
						$(".show_marker_on_main_map_container").slideDown();
					} else {
						$(".show_marker_on_main_map_container").slideUp();
					}
				});

				$(document).on('click', '.a3-plugin-ui-panel-box', function(){
					//if ( $(this).hasClass('google_map_canvas_resized') || $(this).hasClass('box_open') ) return;

					//we have to set center for map after resize, but we need to know center BEFORE we resize it
					setTimeout( function() {
						a3_people_reload_map();
					}, 600 );
					$(this).addClass('google_map_canvas_resized');
				});

				$("#c_address").focus(function() {
					$(this).removeClass('input_error');
				});

				$(function() {
					$("#c_address").autocomplete({
					  //This bit uses the geocoder to fetch address values
					  source: function(request, response) {
						geocoder.geocode( {'address': request.term }, function(results, status) {
						  response($.map(results, function(item) {
							return {
							  label:  item.formatted_address,
							  value: item.formatted_address,
							  latitude: item.geometry.location.lat(),
							  longitude: item.geometry.location.lng()
							}
						  }));
						})
					  },
					  //This bit is executed upon selection of an address
					  select: function(event, ui) {
						$("#c_latitude").val(ui.item.latitude);
						$("#c_longitude").val(ui.item.longitude);
						var location = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
						marker.setPosition(location);
						map.setCenter(location);
					  }
					});
			  	});

			  //Add listener to marker for reverse geocoding
			  google.maps.event.addListener(marker, 'drag', function() {
				geocoder.geocode({'latLng': marker.getPosition()}, function(results, status) {
				  if (status == google.maps.GeocoderStatus.OK) {
					if (results[0]) {
					  $('#c_address').removeClass('input_error').val(results[0].formatted_address);
					  $('#c_latitude').val(marker.getPosition().lat());
					  $('#c_longitude').val(marker.getPosition().lng());
					}
				  }
				});
			  });

			  google.maps.event.addListener(marker, 'dragend', function() {
			  	map.setCenter(marker.getPosition());
			  });

			});
			</script>
			<div style="clear:both"></div>
			<p class="submit" style="margin-bottom:0;padding-bottom:0;">
            <input type="hidden" value="<?php 
        echo $bt_type;
        ?>
" name="<?php 
        echo $bt_type;
        ?>
" />
            <input type="submit" value="<?php 
        echo $bt_value;
        ?>
" class="button button-primary" id="add_edit_buttom" name="add_edit_buttom"> <?php 
        echo $bt_cancel;
        ?>
</p>
			</form>
		  </div>
		  <div style="clear:both"></div>
		</div>
        <div style="clear:both"></div>
		</div>
		<?php 
    }
Пример #7
0
 public static function delete_rows($items = array())
 {
     if (is_array($items) && count($items) > 0) {
         foreach ($items as $profile_id) {
             People_Contact_Profile_Data::delete_row($profile_id);
         }
     }
 }
 public function people_contacts_html($atts)
 {
     global $people_contact;
     extract(shortcode_atts(array(), $atts));
     $contacts = People_Contact_Profile_Data::get_results('', 'c_order ASC', '', 'ARRAY_A');
     return '<div id="people_contacts_container">' . $people_contact->create_contact_maps($contacts) . '</div>';
 }