本文整理汇总了PHP中Members::list_users_by_posts_for_anchor方法的典型用法代码示例。如果您正苦于以下问题:PHP Members::list_users_by_posts_for_anchor方法的具体用法?PHP Members::list_users_by_posts_for_anchor怎么用?PHP Members::list_users_by_posts_for_anchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Members
的用法示例。
在下文中一共展示了Members::list_users_by_posts_for_anchor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: layout
/**
* list articles as topics in a forum
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// allow for complete styling
$text = '<div class="last_articles">';
// build a list of articles
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Articles::get_permalink($item);
// build a title
if (is_object($overlay)) {
$title = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$title = Codes::beautify_title($item['title']);
}
// reset everything
$prefix = $label = $suffix = $icon = '';
// signal articles to be published
if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$prefix .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// flag expired articles
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$prefix .= EXPIRED_FLAG . ' ';
} elseif ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// signal locked articles
if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
$suffix .= ' ' . LOCKED_FLAG;
}
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$suffix .= ' ' . Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// indicate the id in the hovering popup
$hover = i18n::s('View the page');
if (Surfer::is_member()) {
$hover .= ' [article=' . $item['id'] . ']';
}
// one box per update
$text .= '<div class="last_article" >';
// use the title as a link to the page
$text .= Skin::build_block($prefix . ucfirst($title) . $suffix, 'header1');
// some details about this page
$details = array();
// page starter and date
if ($item['create_name']) {
$details[] = sprintf(i18n::s('Started by %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id'])) . ' ' . Skin::build_date($item['create_date']);
}
// page last modification
if ($item['edit_date'] && $item['edit_action'] == 'article:update' && $item['edit_name']) {
$details[] = Anchors::get_action_label($item['edit_action']) . ' ' . sprintf(i18n::s('by %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id'])) . ' ' . Skin::build_date($item['edit_date']);
}
// friends
if ($friends =& Members::list_users_by_posts_for_anchor('article:' . $item['id'], 0, USERS_LIST_SIZE, 'comma5', $item['create_id'])) {
$details[] = sprintf(i18n::s('with %s'), $friends);
}
// people details
if ($details) {
$text .= '<p class="details">' . join(', ', $details) . "</p>\n";
}
// the introductory text
$introduction = '';
if (is_object($overlay)) {
$introduction = $overlay->get_text('introduction', $item);
} elseif ($item['introduction']) {
$introduction = $item['introduction'];
}
if ($introduction) {
$text .= '<div style="margin: 1em 0;">' . Codes::beautify_introduction($introduction) . '</div>';
}
// insert overlay data, if any
if (is_object($overlay)) {
//.........这里部分代码省略.........
示例2: sprintf
$context['page_title'] = i18n::s('Persons that I am following');
} else {
$context['page_title'] = sprintf(i18n::s('Persons followed by %s'), $anchor->get_title());
}
} elseif (!strncmp($anchor->get_reference(), 'category:', 9)) {
$context['page_title'] = sprintf(i18n::s('Members of %s'), $anchor->get_title());
} else {
$context['page_title'] = i18n::s('Editors');
}
}
// look for the user through his nick name
if (isset($_REQUEST['assigned_name']) && ($user = Users::get($_REQUEST['assigned_name']))) {
$_REQUEST['anchor'] = 'user:' . $user['id'];
}
// the current list of category members
if (!strncmp($anchor->get_reference(), 'category:', 9) && ($users =& Members::list_users_by_posts_for_anchor($anchor->get_reference(), 0, 5 * USERS_LIST_SIZE, 'raw')) && count($users)) {
// splash message
$context['text'] .= '<div style="margin-top: 2em;">' . sprintf(i18n::s('Persons assigned to %s'), $anchor->get_title());
// browse the list
foreach ($users as $id => $user) {
// make an url
$url = Users::get_permalink($user);
// gather information on this user
$prefix = $suffix = $type = $icon = '';
if (isset($user['full_name']) && $user['full_name']) {
$label = $user['full_name'] . ' (' . $user['nick_name'] . ')';
} else {
$label = $user['nick_name'];
}
// surfer cannot be deselected
if ($anchor->is_owned($id, FALSE)) {
示例3: foreach
// send the message
if (Mailer::notify(Surfer::from(), $to, $subject, $message, $headers)) {
// feed-back to the sender
$context['text'] .= '<p>' . i18n::s('A message has been sent to:') . "</p>\n" . '<ul>' . "\n";
foreach ($to as $address) {
$context['text'] .= '<li>' . encode_field($address) . '</li>' . "\n";
}
$context['text'] .= '</ul>' . "\n";
// back to the category page
$menu = array();
$menu[] = Skin::build_link(Categories::get_permalink($item), i18n::s('Done'), 'button');
$context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
}
Mailer::close();
// no recipient has been found
} elseif (!($recipients =& Members::list_users_by_posts_for_anchor('category:' . $item['id'], 0, 200, 'mail')) || !count($recipients)) {
Logger::error(i18n::s('No recipient has been found.'));
// display the form
} else {
// the form to send a message
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
// build a nice list of recipients
$label = i18n::s('Message recipients');
$input = Skin::build_box(i18n::s('Select recipients'), $recipients, 'folded');
$fields[] = array($label, $input);
// the subject
$label = i18n::s('Message title');
$input = '<input type="text" name="subject" id="subject" size="70" value="' . encode_field($item['title']) . '" />';
$fields[] = array($label, $input);
// the message
$label = i18n::s('Message content');