コード例 #1
0
function swa_ajax_list_activity()
{
    $page = $_POST["page"] ? $_POST["page"] : 1;
    $scope = $_POST['scope'];
    $per_page = $_POST['per_page'] ? $_POST['per_page'] : 10;
    $max = $_POST['max'] ? $_POST['max'] : 200;
    $show_avatar = $_POST['show_avatar'] ? $_POST['show_avatar'] : "yes";
    $show_filters = $_POST['show_filters'] ? $_POST['show_filters'] : "yes";
    $included = $_POST['included_components'] ? $_POST['included_components'] : false;
    $excluded = $_POST['excluded_components'] ? $_POST['excluded_components'] : false;
    $is_personal = $_POST['is_personal'] ? $_POST['is_personal'] : "no";
    $is_blog_admin_activity = $_POST['is_blog_admin_activity'] ? $_POST['is_blog_admin_activity'] : "no";
    $show_post_form = $_POST["show_post_form"] ? $_POST["show_post_form"] : "no";
    //$show_filters=true,$included=false,$excluded=false
    bp_swa_list_activities($per_page, $page, $scope, $max, $show_avatar, $show_filters, $included, $excluded, $is_personal, $is_blog_admin_activity, $show_post_form);
    exit(0);
}
コード例 #2
0
    function widget($args, $instance)
    {
        global $bp;
        extract($args);
        $included_components = $instance["included_components"];
        $excluded_components = $instance["excluded_components"];
        if (empty($included_components)) {
            $included_components = BP_Activity_Activity::get_recorded_components();
        }
        $scope = $included_components;
        if (!empty($scope) && is_array($excluded_components)) {
            $scope = array_diff($scope, $excluded_components);
        }
        if (!empty($scope)) {
            $scope = join(",", $scope);
        }
        if (!empty($included_components) && is_array($included_components)) {
            $included_components = join(",", $included_components);
        }
        if (!empty($excluded_components) && is_array($excluded_components)) {
            $excluded_components = join(",", $excluded_components);
        }
        //find scope
        echo $before_widget;
        echo $before_title . $instance['title'];
        if ($instance['show_feed_link'] == "yes") {
            echo ' <a class="swa-rss" href="' . bp_get_sitewide_activity_feed_link() . '" title="' . __('Site Wide Activity RSS Feed', 'swa') . '">' . __('[RSS]', 'swa') . '</a>';
        }
        echo $after_title;
        bp_swa_list_activities($instance['per_page'], 1, $scope, $instance['max_items'], $instance["show_avatar"], $instance["show_activity_filters"], $included_components, $excluded_components, $instance['is_personal'], $instance['is_blog_admin_activity'], $instance['show_post_form']);
        ?>
		<input type='hidden' name='max' id='swa_max_items' value="<?php 
        echo $instance['max_items'];
        ?>
" />  
		<input type='hidden' name='max' id='swa_per_page' value="<?php 
        echo $instance['per_page'];
        ?>
" />  
		<input type='hidden' name='show_avatar' id='swa_show_avatar' value="<?php 
        echo $instance['show_avatar'];
        ?>
" />
		<input type='hidden' name='show_filters' id='swa_show_filters' value="<?php 
        echo $instance['show_activity_filters'];
        ?>
" />
		<input type='hidden' name='included_components' id='swa_included_components' value="<?php 
        echo $included_components;
        ?>
" />
		<input type='hidden' name='excluded_components' id='swa_excluded_components' value="<?php 
        echo $excluded_components;
        ?>
" />
		<input type='hidden' name='is_personal' id='swa_is_personal' value="<?php 
        echo $instance['is_personal'];
        ?>
" />
		<input type='hidden' name='is_blog_admin_activity' id='swa_is_blog_admin_activity' value="<?php 
        echo $instance['is_blog_admin_activity'];
        ?>
" />
		<input type='hidden' name='show_post_form' id='swa_show_post_form' value="<?php 
        echo $instance['show_post_form'];
        ?>
" />

	<?php 
        echo $after_widget;
        ?>
	<?php 
    }
コード例 #3
0
    function widget($args, $instance)
    {
        global $bp;
        if ($instance['is_personal'] == 'yes' && !is_user_logged_in()) {
            return;
        }
        //do  not show anything
        extract($args);
        $included_components = $instance["included_components"];
        $excluded_components = $instance["excluded_components"];
        if (empty($included_components)) {
            $included_components = BP_Activity_Activity::get_recorded_components();
        }
        //let us assume that the scope is selected components
        $scope = $included_components;
        //if the user has excluded some of the components , let us remove it from scope
        if (!empty($scope) && is_array($excluded_components)) {
            $scope = array_diff($scope, $excluded_components);
        }
        //ok, now we will create a comma separated list
        if (!empty($scope)) {
            $scope = join(",", $scope);
        }
        if (!empty($included_components) && is_array($included_components)) {
            $included_components = join(",", $included_components);
        }
        if (!empty($excluded_components) && is_array($excluded_components)) {
            $excluded_components = join(",", $excluded_components);
        }
        //find scope
        echo $before_widget;
        echo $before_title . $instance['title'];
        if ($instance['show_feed_link'] == "yes") {
            echo ' <a class="swa-rss" href="' . bp_get_sitewide_activity_feed_link() . '" title="' . __('Site Wide Activity RSS Feed', 'swa') . '">' . __('[RSS]', 'swa') . '</a>';
        }
        echo $after_title;
        $args = $instance;
        $args['page'] = 1;
        $args['scope'] = $scope;
        $args['max'] = $instance['max_items'];
        $args['show_filters'] = $instance["show_activity_filters"];
        $args['included'] = $included_components;
        $args['excluded'] = $excluded_components;
        //is_personal, is_blog_admin activity etc are set in the
        bp_swa_list_activities($args);
        ?>
		<input type='hidden' name='max' id='swa_max_items' value="<?php 
        echo $instance['max_items'];
        ?>
" />  
		<input type='hidden' name='max' id='swa_per_page' value="<?php 
        echo $instance['per_page'];
        ?>
" />  
		<input type='hidden' name='show_avatar' id='swa_show_avatar' value="<?php 
        echo $instance['show_avatar'];
        ?>
" />
		<input type='hidden' name='show_content' id='swa_show_content' value="<?php 
        echo $instance['show_activity_content'];
        ?>
" />
		<input type='hidden' name='show_filters' id='swa_show_filters' value="<?php 
        echo $instance['show_activity_filters'];
        ?>
" />
		<input type='hidden' name='included_components' id='swa_included_components' value="<?php 
        echo $included_components;
        ?>
" />
		<input type='hidden' name='excluded_components' id='swa_excluded_components' value="<?php 
        echo $excluded_components;
        ?>
" />
		<input type='hidden' name='is_personal' id='swa_is_personal' value="<?php 
        echo $instance['is_personal'];
        ?>
" />
		<input type='hidden' name='is_blog_admin_activity' id='swa_is_blog_admin_activity' value="<?php 
        echo $instance['is_blog_admin_activity'];
        ?>
" />
		<input type='hidden' name='show_post_form' id='swa_show_post_form' value="<?php 
        echo $instance['show_post_form'];
        ?>
" />

	<?php 
        echo $after_widget;
        ?>
	<?php 
    }