本文整理汇总了PHP中CityApi::users_show方法的典型用法代码示例。如果您正苦于以下问题:PHP CityApi::users_show方法的具体用法?PHP CityApi::users_show怎么用?PHP CityApi::users_show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CityApi
的用法示例。
在下文中一共展示了CityApi::users_show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shcaa_list_hope_groups
function shcaa_list_hope_groups($type, $showmap = 'true', $showchart = 'true')
{
// create the city object
$ca = new CityApi();
$ca->debug = false;
$ca->json = false;
// set the args
// args array can include
/*
page = [1,2,3,4,...]
search = ["downtown" | etc] <- optional group name search
under_group_id = [ 1234 | etc ] <- defaults to church group's ID
group_types = ["CG" | "Service" | "Campus" | etc] <- defaults to all group types
include_inactive = [ true | false ] <- defaults to false
include_addresses = [ true | false ]
include_composition = [ true | false ]
include_user_ids = [ true | false ]
*/
// cache the results
// attempt to get cached request
$transient_key = "_shcaa_hope_groups_feed";
// If cached (transient) data are used, output an HTML
// comment indicating such
$cached = get_transient($transient_key);
if (false !== $cached) {
$mygrps = $cached;
} else {
// create array of the groups filtered by the args and include the tags - for the call to theCITY api
$args = array();
$args['group_types'] = 'Hope';
$args['include_addresses'] = 'true';
$groups = $ca->groups_index($args);
$mygrps = array();
$grps = $groups['groups'];
$i = 0;
foreach ($grps as $grp) {
$mygrps[$i]['grp_id'] = $grp['id'];
$mygrps[$i]['parentid'] = $grp['parent_id'];
$mygrps[$i]['image'] = $grp['profile_pic'];
$mygrps[$i]['name'] = $grp['name'];
$mygrps[$i]['description'] = $grp['external_description'];
$mygrps[$i]['neighborhood'] = $grp['nearest_neighborhood_name'];
$mygrps[$i]['invite'] = $grp['default_invitation_custom_message'];
$mygrps[$i]['cityurl'] = $grp['internal_url'];
// address fields
if (isset($grp['addresses'][0]) && !empty($grp['addresses'][0])) {
$mygrps[$i]['add_name'] = $grp['addresses'][0]['friendly_name'];
$mygrps[$i]['add_street'] = $grp['addresses'][0]['street'];
$mygrps[$i]['add_street2'] = $grp['addresses'][0]['street2'];
$mygrps[$i]['add_city'] = $grp['addresses'][0]['city'];
$mygrps[$i]['add_state'] = $grp['addresses'][0]['state'];
$mygrps[$i]['add_zipcode'] = $grp['addresses'][0]['zipcode'];
$mygrps[$i]['add_longitude'] = $grp['addresses'][0]['longitude'];
$mygrps[$i]['add_latitude'] = $grp['addresses'][0]['latitude'];
}
// Get Tags
$tags = $ca->groups_tags_index($grp['id']);
if ($tags) {
foreach ($tags as $tag) {
if (is_array($tag)) {
$mygrps[$i]['mytags'] = array();
foreach ($tag as $el) {
$mygrps[$i]['mytags'][] = $el;
}
// end inner foreach
}
// end if
}
// end foreach
}
// end if tags
// Get Users
$users = $ca->groups_roles_index($grp['id']);
if ($users) {
foreach ($users as $user) {
if (is_array($user)) {
$mygrps[$i]['leaders'] = array();
$lc = 0;
foreach ($user as $usr) {
if ($usr['title'] == 'Leader') {
$mygrps[$i]['leaders'][$lc]['name'] = $usr['user_name'];
// get contact info
$userinfo = $ca->users_show($usr['user_id']);
$mygrps[$i]['leaders'][$lc]['phone'] = $userinfo['primary_phone'];
$mygrps[$i]['leaders'][$lc]['email'] = $userinfo['email'];
$mygrps[$i]['leaders'][$lc]['first'] = $userinfo['first'];
$mygrps[$i]['leaders'][$lc]['last'] = $userinfo['last'];
$mygrps[$i]['leaders'][$lc]['nickname'] = $userinfo['nickname'];
// group family members
$userfam = $ca->users_family_index($usr['user_id']);
$mygrps[$i]['leaders'][$lc]['fam_id'] = $userfam['external_id'];
$lc++;
}
}
// end inner foreach
}
// end if
}
// end foreach
}
//.........这里部分代码省略.........
示例2: format_json
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
</style>
<title>Test Users Show</title>
</head>
<body>
<?php
require_once 'test-util.php';
require_once dirname(__FILE__) . '/../lib/ca-main.php';
echo '<div class="apitest">';
echo '<h1>users_show</h1>';
$ca = new CityApi();
$ca->debug = true;
$ca->json = true;
$results = $ca->users_show('224870');
echo '<h2>var_dump results:</h2>';
echo '<pre>';
var_dump($results);
echo '</pre>';
echo '<h2>Formatted JSON results: </h2>';
echo '<pre>';
echo format_json($results);
echo '</pre>';
echo '<h2>var_dump last response start line:</h2>';
var_dump($ca->get_last_response_start_line());
echo '<h2>var_dump last headers:</h2>';
echo '<pre>';
echo var_dump($ca->get_last_headers());
echo '</pre>';
echo "<h2>Test with optional parameters:</h2>";