当前位置: 首页>>代码示例>>PHP>>正文


PHP Members::list_watchers_by_name_for_anchor方法代码示例

本文整理汇总了PHP中Members::list_watchers_by_name_for_anchor方法的典型用法代码示例。如果您正苦于以下问题:PHP Members::list_watchers_by_name_for_anchor方法的具体用法?PHP Members::list_watchers_by_name_for_anchor怎么用?PHP Members::list_watchers_by_name_for_anchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Members的用法示例。


在下文中一共展示了Members::list_watchers_by_name_for_anchor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: while

 // pre-invite someone
 $invited = '';
 if (isset($_REQUEST['invited']) && ($user = Users::get($_REQUEST['invited']))) {
     $invited = $user['nick_name'];
 } else {
     $handle = $item['anchor'];
     while ($handle && ($parent = Anchors::get($handle))) {
         $handle = $parent->get_parent();
         // invitation to a private page should be limited to editors
         if ($item['active'] == 'N') {
             if ($editors = Members::list_editors_for_member($parent->get_reference(), 0, 1000, $layout)) {
                 $input .= Skin::build_box(sprintf(i18n::s('Invite editors of %s'), $parent->get_title()), Skin::build_list($editors, 'compact'), 'folded');
             }
             // else invitation should be extended to watchers
         } else {
             if ($watchers = Members::list_watchers_by_name_for_anchor($parent->get_reference(), 0, 1000, $layout)) {
                 $input .= Skin::build_box(sprintf(i18n::s('Invite watchers of %s'), $parent->get_title()), Skin::build_list($watchers, 'compact'), 'folded');
             }
         }
     }
 }
 // add some names manually
 $input .= Skin::build_box(i18n::s('Invite some persons'), '<textarea name="to" id="names" rows="3" cols="50">' . $invited . '</textarea><div><span class="tiny">' . i18n::s('Enter nick names, or email addresses, separated by commas.') . '</span></div>', 'unfolded');
 // combine all these elements
 $fields[] = array($label, $input);
 // the subject
 $label = i18n::s('Message title');
 if (is_object($overlay)) {
     $title = $overlay->get_live_title($item);
 } else {
     $title = $item['title'];
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:invite.php

示例2: array

     $anchors = array($anchor->get_reference());
     $handle = $anchor->get_parent();
     while ($handle && ($parent = Anchors::get($handle))) {
         $anchors[] = $handle;
         $handle = $parent->get_parent();
     }
     // authorized users
     $restricted = NULL;
     if ($anchor->is_hidden() && ($editors =& Members::list_anchors_for_member($anchors))) {
         foreach ($editors as $editor) {
             if (strpos($editor, 'user:') === 0) {
                 $restricted[] = substr($editor, strlen('user:'));
             }
         }
     }
     $users = Members::list_watchers_by_name_for_anchor($anchors, 0, 5 * USERS_LIST_SIZE, 'raw', $restricted);
 }
 // the current list of watchers
 if (count($users)) {
     // 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'];
         }
         // format the item
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:select.php

示例3: elseif

 $output .= Skin::finalize_list($menu, 'menu_bar');
 // list watched users by posts
 $watched = '';
 if ($items =& Members::list_connections_for_user('user:' . $item['id'], 0, 200, 'watch')) {
     if (is_array($items)) {
         $items = Skin::build_list($items, 'decorated');
     }
     $watched .= $items;
 } elseif (Surfer::get_id() == $item['id']) {
     $watched .= '<p>' . i18n::s('Click on the link above to follow someone.') . '</p>';
 } else {
     $watched .= '<p>' . sprintf(i18n::s('%s is not yet following other persons.'), $item['full_name']) . '</p>';
 }
 // the list of followers
 $followers = '';
 if ($items = Members::list_watchers_by_name_for_anchor('user:' . $item['id'], 0, 1000, 'compact')) {
     if (is_array($items)) {
         $items = Skin::build_list($items, 'compact');
     }
     if (Surfer::get_id() == $item['id']) {
         $followers .= '<p>' . i18n::s('Persons who follow you:') . '</p>' . $items;
     } else {
         $followers .= '<p>' . sprintf(i18n::s('Persons who follow %s:'), $item['full_name']) . '</p>' . $items;
     }
 }
 // connect to people
 if (Surfer::get_id() && Surfer::get_id() != $item['id']) {
     // suggest a new connection
     if (!Members::check('user:' . $item['id'], 'user:' . Surfer::get_id())) {
         Skin::define_img('USERS_WATCH_IMG', 'users/watch.gif');
         $link = Users::get_url('user:' . $item['id'], 'track');
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:element.php

示例4: list_watchers_by_name

 /**
  * list watchers of a section in alphabetical order
  *
  * If the section is public or restricted to any member, the full list of persons watching this
  * specific section, or any parent section, is provided.
  *
  * For example, if the root section A contains a section B, which contains section C, and if
  * C is public, the function looks for persons assigned either to A, to B or to C.
  *
  * If the section is private, then the function looks for any private parent, and list all
  * persons watching one of these sections.
  *
  * For example, if the root section A is public, and if it contains a section B that is private,
  * and if B contains section C, the function looks for persons assigned either to B or to C.
  * This is because watchers of section A may not be entitled to watch content of B nor of C.
  *
  * @param array attributes of the watched section
  * @param int the offset from the start of the list; usually, 0 or 1
  * @param int the number of items to display
  * @param string 'full', etc or object, i.e., an instance of Layout_Interface adapted to list of users
  * @return NULL on error, else an ordered array with $url => ($prefix, $label, $suffix, $icon)
  */
 public static function list_watchers_by_name($item, $offset = 0, $count = 7, $variant = 'comma5')
 {
     global $context;
     // this section itself
     $anchors = array('section:' . $item['id']);
     // there is at least a parent section
     if ($anchor = Anchors::get($item['anchor'])) {
         // this section is private, list only hidden parent sections
         if ($item['active'] == 'N') {
             // parent is hidden
             if ($anchor->is_hidden()) {
                 $anchors[] = $anchor->get_reference();
                 // look for grand parents
                 $handle = $anchor->get_parent();
                 while ($handle && ($parent = Anchors::get($handle))) {
                     if (!$parent->is_hidden()) {
                         break;
                     }
                     $anchors[] = $handle;
                     $handle = $parent->get_parent();
                 }
             }
             // else list all parent sections
         } else {
             // add parent section
             $anchors[] = $anchor->get_reference();
             // look for all grand parents
             $handle = $anchor->get_parent();
             while ($handle && ($parent = Anchors::get($handle))) {
                 $anchors[] = $handle;
                 $handle = $parent->get_parent();
             }
         }
     }
     // list users watching one of these anchors
     return Members::list_watchers_by_name_for_anchor($anchors, $offset, $count, $variant);
 }
开发者ID:rair,项目名称:yacs,代码行数:59,代码来源:sections.php

示例5: list_watchers_by_name

 /**
  * list all watchers of a page
  *
  * If the page is public or restricted to any member, the full list of persons watching this
  * page, and its parent section. If the parent section has the option 'forward_notifications'
  * the persons assigned to grand parent section are added.
  *
  * For example, if the root section A contains a section B, which contains page P, and if
  * P is public, the function looks for persons assigned either to B or to P.
  *
  * If the parent section has option 'forward_notifications', then this fonction adds watchers
  * of grand-parent section to the list.
  *
  * If the page is private, then the function looks for wtahcers of it, and for editors of the
  * parent section that may also be watchers.
  *
  * For example, if the section A is public, and if it contains private page P, the function
  * looks for watchers of P and for editors of A that are also watchers of A.
  * This is because watchers of section A who are not editors are not entitled to watch P.
  *
  * @param array attributes of the watched page
  * @param int the offset from the start of the list; usually, 0 or 1
  * @param int the number of items to display
  * @param string 'full', etc or object, i.e., an instance of Layout_Interface adapted to list of users
  * @return NULL on error, else an ordered array with $url => ($prefix, $label, $suffix, $icon)
  *
  */
 public static function list_watchers_by_name($item, $offset = 0, $count = 7, $variant = 'comma5')
 {
     global $context;
     // this page itself
     $anchors = array('article:' . $item['id']);
     // to list persons entitled to access this page
     $ancestors = array('article:' . $item['id']);
     // look at parents
     if ($anchor = Anchors::get($item['anchor'])) {
         // notify watchers of parent section
         $anchors[] = $anchor->get_reference();
         // notify watchers of grand-parent section too
         if ($anchor->has_option('forward_notifications', FALSE) && $anchor->get_parent()) {
             $anchors[] = $anchor->get_parent();
         }
         // editors of parent and grand parent section are entitled to access the page too
         $ancestors[] = $anchor->get_reference();
         $handle = $anchor->get_parent();
         while ($handle && ($parent = Anchors::get($handle))) {
             // notify watchers of grand-parent section too
             if ($parent->has_option('forward_notifications', FALSE) && $parent->get_parent()) {
                 $anchors[] = $parent->get_parent();
             }
             $ancestors[] = $handle;
             $handle = $parent->get_parent();
         }
     }
     // authorized users only
     $restricted = NULL;
     if ($item['active'] == 'N' && ($editors =& Members::list_anchors_for_member($ancestors))) {
         foreach ($editors as $editor) {
             if (strpos($editor, 'user:') === 0) {
                 $restricted[] = substr($editor, strlen('user:'));
             }
         }
     }
     // list users watching one of these anchors
     return Members::list_watchers_by_name_for_anchor($anchors, $offset, $count, $variant, $restricted);
 }
开发者ID:rair,项目名称:yacs,代码行数:66,代码来源:articles.php


注:本文中的Members::list_watchers_by_name_for_anchor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。