本文整理汇总了PHP中Whups::getUserAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Whups::getUserAttributes方法的具体用法?PHP Whups::getUserAttributes怎么用?PHP Whups::getUserAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Whups
的用法示例。
在下文中一共展示了Whups::getUserAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catch
* did not receive this file, see http://www.horde.org/licenses/bsdl.php.
*
* @author Jan Schneider <jan@horde.org>
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('whups');
$vars = Horde_Variables::getDefaultVariables();
$ticket = Whups::getCurrentTicket();
$view = $injector->createInstance('Horde_View');
try {
$files = $ticket->listAllAttachments();
} catch (Whups_Exception $e) {
$notification->push($e);
}
if ($files) {
$format = array($prefs->getValue('date_format'), $prefs->getValue('time_format'));
$attachments = Whups::getAttachments($ticket->getId());
$view->attachments = array();
foreach ($files as $file) {
$view->attachments[] = array_merge(array('timestamp' => $file['timestamp'], 'date' => strftime($format[0], $file['timestamp']) . ' ' . strftime($format[1], $file['timestamp']), 'user' => Whups::formatUser(Whups::getUserAttributes($file['user_id']), true, true, true)), Whups::attachmentUrl($ticket->getId(), $attachments[$file['value']], $ticket->get('queue')));
}
}
Whups::addTopbarSearch();
Whups::addFeedLink();
$page_output->addLinkTag($ticket->feedLink());
$page_output->addScriptFile('tables.js', 'horde');
$page_output->header(array('title' => sprintf(_("Attachments for %s"), '[#' . $id . '] ' . $ticket->get('summary'))));
$notification->notify(array('listeners' => 'status'));
echo Whups::getTicketTabs($vars, $ticket->getId())->render('attachments');
echo $view->render('ticket/attachments');
$page_output->footer();
示例2: mail
/**
* Sends email notifications to a list of recipients.
*
* We do some ugly work in here to make sure that no one gets comments
* mailed to them that they shouldn't see (because of group permissions).
*
* @param array $opts Option hash with notification information.
* Possible values:
* - ticket: (Whups_Ticket) A ticket. If not set,
* this is assumed to be a reminder
* message.
* - recipients: (array|string) The list of recipients,
* with user names as keys and user roles
* as values.
* - subject: (string) The email subject.
* - view: (Horde_View) The view object for the
* message text.
* - template: (string) The template file for the
* message text.
* - from: (string) The email sender.
* - new: (boolean, optional) Whether the passed
* ticket was just created.
*/
public function mail(array $opts)
{
global $conf, $registry, $prefs;
$opts = array_merge(array('ticket' => false, 'new' => false), $opts);
/* Set up recipients and message headers. */
$mail = new Horde_Mime_Mail(array('X-Whups-Generated' => 1, 'User-Agent' => 'Whups ' . $registry->getVersion(), 'Precedence' => 'bulk', 'Auto-Submitted' => $opts['ticket'] ? 'auto-replied' : 'auto-generated'));
$mail_always = null;
if ($opts['ticket'] && !empty($conf['mail']['always_copy'])) {
$mail_always = $conf['mail']['always_copy'];
if (strpos($mail_always, '<@>') !== false) {
try {
$mail_always = str_replace('<@>', $opts['ticket']->get('queue_name'), $mail_always);
} catch (Whups_Exception $e) {
$mail_always = null;
}
}
if ($mail_always && !isset($opts['recipients'][$mail_always])) {
$opts['recipients'][$mail_always] = 'always';
}
}
if ($opts['ticket'] && ($queue = $this->getQueue($opts['ticket']->get('queue'))) && !empty($queue['email'])) {
$mail->addHeader('From', $queue['email']);
} elseif (!empty($conf['mail']['from_addr'])) {
$mail->addHeader('From', $conf['mail']['from_addr']);
} else {
$mail->addHeader('From', Whups::formatUser($opts['from']));
}
if (!empty($conf['mail']['return_path'])) {
$mail->addHeader('Return-Path', $conf['mail']['return_path']);
}
if ($opts['ticket']) {
$opts['subject'] = '[' . $registry->get('name') . ' #' . $opts['ticket']->getId() . '] ' . $opts['subject'];
}
$mail->addHeader('Subject', $opts['subject']);
/* Get our array of comments, sorted in the appropriate order. */
if ($opts['ticket']) {
$comments = $this->getHistory($opts['ticket']->getId());
if ($conf['mail']['commenthistory'] == 'new' && count($comments)) {
$comments = array_pop($comments);
$comments = array($comments);
} elseif ($conf['mail']['commenthistory'] != 'chronological') {
$comments = array_reverse($comments);
}
} else {
$comments = array();
}
/* Don't notify any email address more than once. */
$seen_email_addresses = array();
/* Get VFS handle for attachments. */
if ($opts['ticket']) {
$vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create();
try {
$attachments = Whups::getAttachments($opts['ticket']->getId());
} catch (Whups_Exception $e) {
$attachments = array();
Horde::log($e);
}
}
$from = Whups::getUserAttributes($opts['from']);
foreach ($opts['recipients'] as $user => $role) {
/* Make sure to check permissions as a guest for the 'always_copy'
* address, and as the recipient for all others. */
$to = $full_name = '';
if (!empty($mail_always) && $user == $mail_always) {
$details = null;
$mycomments = Whups::permissionsFilter($comments, 'comment', Horde_Perms::READ, '');
$to = $mail_always;
} else {
$details = Whups::getUserAttributes($user);
if (!empty($details['email'])) {
$to = Whups::formatUser($details);
$mycomments = Whups::permissionsFilter($comments, 'comment', Horde_Perms::READ, $details['user']);
}
$full_name = $details['name'];
}
/* We may have no recipients due to users excluding themselves
* from self notifies. */
//.........这里部分代码省略.........