本文整理汇总了PHP中Members::list_editors_for_member方法的典型用法代码示例。如果您正苦于以下问题:PHP Members::list_editors_for_member方法的具体用法?PHP Members::list_editors_for_member怎么用?PHP Members::list_editors_for_member使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Members
的用法示例。
在下文中一共展示了Members::list_editors_for_member方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
$layout = Layouts::new_('mail', 'user');
// avoid links to this page
if (is_object($layout) && is_callable(array($layout, 'set_variant'))) {
$layout->set_variant('unchecked');
}
// 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
示例2: alert_watchers
/**
* alert watchers of this anchor
*
* @param array message attributes, such as 'subject', 'message', 'headers'
* @param string description of the on-going action (e.g., 'file:create')
* @param boolean TRUE if access to the target object is restricted, FALSE otherwise
* @return boolean TRUE on success, FALSE otherwise
*/
function alert_watchers($mail, $action = NULL, $restricted = FALSE)
{
global $context;
// do not notify watchers if overlay prevents it
if (is_object($this->overlay) && !$this->overlay->should_notify_watchers($mail)) {
return FALSE;
}
// list all items in the watching context
$containers = $this->get_watched_context($action);
// finalize the message
$mail['message'] = Mailer::build_notification($mail['notification'], 1);
// allow for message threading
if (!isset($mail['headers'])) {
$mail['headers'] = Mailer::set_thread($this->get_reference());
}
// we are private, so consider only watchers who are also editors
if ($this->item['active'] == 'N') {
$restricted = TRUE;
}
// list editors if access is restricted
$editors = NULL;
if ($restricted) {
$editors = Members::list_editors_for_member($this->get_focus(), 0, 10000, 'ids');
}
// do the job
return Users::alert_watchers($containers, $mail, $editors);
}
示例3: list_editors_by_name
/**
* list all editors of a section
*
* This function lists editors of this section, or of any parent section.
*
* @param array attributes of the 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_editors_by_name($item, $offset = 0, $count = 7, $variant = 'comma5')
{
global $context;
// this page itself
$anchors = array('section:' . $item['id']);
// look at parents
if ($anchor = Anchors::get($item['anchor'])) {
// look for editors of parent section
$anchors[] = $anchor->get_reference();
// look for editors of any ancestor
$handle = $anchor->get_parent();
while ($handle && ($parent = Anchors::get($handle))) {
$anchors[] = $handle;
$handle = $parent->get_parent();
}
}
// list users assigned to any of these anchors
return Members::list_editors_for_member($anchors, $offset, $count, $variant);
}