本文整理汇总了PHP中Sections::list_watchers_by_posts方法的典型用法代码示例。如果您正苦于以下问题:PHP Sections::list_watchers_by_posts方法的具体用法?PHP Sections::list_watchers_by_posts怎么用?PHP Sections::list_watchers_by_posts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sections
的用法示例。
在下文中一共展示了Sections::list_watchers_by_posts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
if ($items = Sections::list_editors_by_name($item, 0, 1000, 'watch')) {
foreach ($items as $user_id => $user_label) {
$owner_state = '';
if ($user_id == $item['owner_id']) {
$owner_state = CHECKED_IMG;
}
$editor_state = CHECKED_IMG;
$watcher_state = '';
if (Members::check($anchors, 'user:' . $user_id)) {
$watcher_state = CHECKED_IMG;
}
$rows[$user_id] = array($user_label, $watcher_state, $editor_state, $owner_state);
}
}
// watchers
if ($items = Sections::list_watchers_by_posts($item, 0, 1000, 'watch')) {
foreach ($items as $user_id => $user_label) {
// this is a true participant to the item
$users_count += 1;
// add the checkmark to existing row
if (isset($rows[$user_id])) {
$rows[$user_id][1] = CHECKED_IMG;
} else {
$owner = '';
if ($user_id == $item['owner_id']) {
$owner = CHECKED_IMG;
}
$editor = '';
$watcher = CHECKED_IMG;
$rows[$user_id] = array($user_label, $watcher, $editor, $owner);
}
示例2: sprintf
// expired section
if (Surfer::is_empowered() && Surfer::is_logged() && $item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$details[] = EXPIRED_FLAG . ' ' . sprintf(i18n::s('Section has expired %s'), Skin::build_date($item['expiry_date']));
}
// provide more details to authenticated surfers
if (Surfer::is_logged()) {
// section owner
if (isset($item['owner_id']) && ($owner = Users::get($item['owner_id']))) {
$details[] = sprintf(i18n::s('%s: %s'), i18n::s('Owner'), Users::get_link($owner['full_name'], $owner['email'], $owner['id']));
}
// section editors
if ($items = Sections::list_editors_by_name($item, 0, 7, 'comma5')) {
$details[] = sprintf(i18n::s('%s: %s'), Skin::build_link(Users::get_url('section:' . $item['id'], 'select'), i18n::s('Editors')), $items);
}
// section watchers
if ($items = Sections::list_watchers_by_posts($item, 0, 7, 'comma5')) {
$details[] = sprintf(i18n::s('%s: %s'), Skin::build_link(Users::get_url('section:' . $item['id'], 'watch'), i18n::s('Watchers')), $items);
}
}
// display details, if any
if (count($details)) {
$text .= ucfirst(implode(BR . "\n", $details)) . BR . "\n";
}
// additional details for associates and editors
if (Surfer::is_empowered()) {
// other details
$details =& Sections::build_dates($anchor, $item);
// the number of hits
if ($item['hits'] > 1) {
$details[] = Skin::build_number($item['hits'], i18n::s('hits'));
}