Пример #1
0
function bp_checkins_autocomplete_place_src()
{
    $src = $_REQUEST['q'];
    if (bp_checkins_has_places('src=' . $src)) {
        ?>
		<?php 
        while (bp_checkins_has_places()) {
            bp_checkins_the_place();
            ?>
			<li><?php 
            bp_checkins_places_avatar();
            ?>
<a href="<?php 
            bp_checkins_places_the_permalink();
            ?>
" title="<?php 
            bp_checkins_places_title();
            ?>
" class="rez-place" onclick="javascript:launch('<?php 
            bp_checkins_places_the_permalink();
            ?>
')"><?php 
            bp_checkins_places_title();
            ?>
</a></li>
		<?php 
        }
        ?>
	 <?php 
    }
    die;
}
    function widget($args, $instance)
    {
        global $bp;
        extract($args);
        if (bp_checkins_is_group_places_area() || bp_checkins_is_user_area() && bp_is_current_action('places-area') || bp_checkins_if_single_place()) {
            return false;
        }
        if (!$instance['max_places']) {
            $instance['max_places'] = 5;
        }
        if (!$instance['places_type']) {
            $instance['places_type'] = -1;
        }
        if ($instance['dynamic'] === false) {
            $instance['dynamic'] = 1;
        }
        echo $before_widget;
        echo $before_title . $instance['title'] . $after_title;
        ?>
		
		<?php 
        $widget_args = array('per_page' => $instance['max_places'], 'type' => $instance['places_type']);
        if ((int) $instance['dynamic'] == 1 && bp_displayed_user_id()) {
            $widget_args['user_id'] = bp_displayed_user_id();
        }
        if ((int) $instance['dynamic'] == 1 && bp_is_groups_component() && bp_is_single_item() && $bp->groups->current_group->status == 'public') {
            $widget_args['group_id'] = $bp->groups->current_group->id;
        }
        ?>
		
		<?php 
        if (!empty($widget_args['group_id']) || !empty($widget_args['user_id'])) {
            ?>
			
			<div class="item-options">
				
				<?php 
            if (bp_displayed_user_id()) {
                printf(__('%s&#039;s places', 'bp-checkins'), bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'object' => 'user', 'type' => 'thumb', 'width' => 20, 'height' => 20)) . bp_core_get_userlink(bp_displayed_user_id()));
            }
            if (bp_is_groups_component() && bp_is_single_item()) {
                printf(__('%s&#039;s places', 'bp-checkins'), bp_core_fetch_avatar(array('item_id' => $bp->groups->current_group->id, 'object' => 'group', 'type' => 'thumb', 'width' => 20, 'height' => 20)) . '<a href="' . bp_get_group_permalink($bp->groups->current_group) . '">' . esc_attr($bp->groups->current_group->name) . '</a>');
            }
            ?>
	
				
			</div>
		
		<?php 
        }
        ?>

		<?php 
        if (bp_checkins_has_places($widget_args)) {
            ?>
			
			<ul id="widget-places-list" class="item-list">
				<?php 
            while (bp_checkins_has_places()) {
                bp_checkins_the_place();
                ?>

					<li>
						<div class="item-avatar">
							<?php 
                bp_checkins_places_avatar();
                ?>
						</div>
						<div class="item-title">
							<a href="<?php 
                bp_checkins_places_the_permalink();
                ?>
" title="<?php 
                bp_checkins_places_title();
                ?>
"><?php 
                bp_checkins_places_title();
                ?>
</a>
						</div>
						<?php 
                if (bp_checkins_places_is_live()) {
                    ?>
							<div class="item-meta">
								<span class="activity"><?php 
                    bp_checkins_places_live_status();
                    ?>
</span>
							</div>
						<?php 
                }
                ?>
						<div class="clear"></div>
					</li>

				<?php 
            }
            ?>

		<?php 
        } else {
            ?>

			<div class="widget-error">
				<p><?php 
            _e('Sorry, there was no places found.', 'bp-checkins');
            ?>
</p>
			</div>

		<?php 
        }
        ?>


		<?php 
        echo $after_widget;
        ?>
	<?php 
    }
		<div class="places-header">

			<?php 
bp_checkins_places_action();
?>

		</div>

			<div class="places-inner">
				
				<?php 
bp_checkins_places_featured_image();
?>

				<h4><a href="<?php 
bp_checkins_places_the_permalink();
?>
" title="<?php 
bp_checkins_places_title();
?>
"><?php 
bp_checkins_places_title();
?>
</a> <?php 
if (bp_checkins_places_is_live()) {
    bp_checkins_places_live_status();
}
?>
</h4>
				
				<p class="place-excerpt"><?php