本文整理汇总了PHP中Articles::list_watchers_by_posts方法的典型用法代码示例。如果您正苦于以下问题:PHP Articles::list_watchers_by_posts方法的具体用法?PHP Articles::list_watchers_by_posts怎么用?PHP Articles::list_watchers_by_posts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Articles
的用法示例。
在下文中一共展示了Articles::list_watchers_by_posts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
// expired article
if ((Surfer::is_associate() || $cur_article->is_assigned()) && $item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$details[] = EXPIRED_FLAG . ' ' . sprintf(i18n::s('Page has expired %s'), Skin::build_date($item['expiry_date']));
}
// provide more details to authenticated surfers
if (Surfer::is_logged()) {
// page 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']));
}
// page editors
if ($items = Articles::list_editors_by_name($item, 0, 7, 'comma5')) {
$details[] = sprintf(i18n::s('%s: %s'), Skin::build_link(Users::get_url('article:' . $item['id'], 'select'), i18n::s('Editors')), $items);
}
// page watchers
if ($items = Articles::list_watchers_by_posts($item, 0, 7, 'comma5')) {
$details[] = sprintf(i18n::s('%s: %s'), Skin::build_link(Users::get_url('article:' . $item['id'], 'watch'), i18n::s('Watchers')), $items);
}
}
// display details, if any
if (count($details)) {
$text .= ucfirst(implode(BR . "\n", $details)) . BR . "\n";
}
// other details
$details =& Articles::build_dates($anchor, $item);
// signal articles to be published
if ($item['publish_date'] <= NULL_DATE) {
if ($cur_article->allows('publication')) {
$label = Skin::build_link(Articles::get_url($item['id'], 'publish'), i18n::s('not published'));
} else {
$label = i18n::s('not published');
示例2: foreach
Skin::define_img('CHECKED_IMG', 'ajax/accept.png', '*');
$offset = ($zoom_index - 1) * USERS_LIST_SIZE;
// list editors of this page, and of parent sections
if ($items = Articles::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 = '';
$rows[$user_id] = array($user_label, $watcher_state, $editor_state, $owner_state);
}
}
// watchers
if ($items = Articles::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);
}