本文整理汇总了PHP中Whups::getOwners方法的典型用法代码示例。如果您正苦于以下问题:PHP Whups::getOwners方法的具体用法?PHP Whups::getOwners怎么用?PHP Whups::getOwners使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Whups
的用法示例。
在下文中一共展示了Whups::getOwners方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: download
/**
* @throws Whups_Exception
*/
public function download(Horde_Variables $vars)
{
global $injector, $whups_driver;
switch ($vars->actionID) {
case 'download_file':
// Get the ticket details first.
if (empty($vars->ticket)) {
exit;
}
$details = $whups_driver->getTicketDetails($vars->ticket);
// Check permissions on this ticket.
if (!count(Whups::permissionsFilter($whups_driver->getHistory($vars->ticket), 'comment', Horde_Perms::READ))) {
throw new Whups_Exception(sprintf(_("You are not allowed to view ticket %d."), $vars->ticket));
}
try {
$vfs = $injector->getInstance('Horde_Core_Factory_Vfs')->create();
} catch (Horde_Exception $e) {
throw new Whups_Exception(_("The VFS backend needs to be configured to enable attachment uploads."));
}
try {
return array('data' => $vfs->read(Whups::VFS_ATTACH_PATH . '/' . $vars->ticket, $vars->file), 'name' => $vars->file);
} catch (Horde_Vfs_Exception $e) {
throw new Whups_Exception(sprintf(_("Access denied to %s"), $vars->file));
}
break;
case 'report':
$_templates = Horde::loadConfiguration('templates.php', '_templates', 'whups');
$tpl = $vars->template;
if (empty($_templates[$tpl])) {
throw new Whups_Exception(_("The requested template does not exist."));
}
if ($_templates[$tpl]['type'] != 'searchresults') {
throw new Whups_Exception(_("This is not a search results template."));
}
// Fetch all unresolved tickets assigned to the current user.
$info = array('id' => explode(',', $vars->ids));
$tickets = $whups_driver->getTicketsByProperties($info);
foreach ($tickets as $id => $info) {
$tickets[$id]['#'] = $id + 1;
$tickets[$id]['link'] = Whups::urlFor('ticket', $info['id'], true, -1);
$tickets[$id]['date_created'] = strftime('%x', $info['timestamp']);
$tickets[$id]['owners'] = Whups::getOwners($info['id']);
$tickets[$id]['owner_name'] = Whups::getOwners($info['id'], false, true);
$tickets[$id]['owner_email'] = Whups::getOwners($info['id'], true, false);
if (!empty($info['date_assigned'])) {
$tickets[$id]['date_assigned'] = strftime('%x', $info['date_assigned']);
}
if (!empty($info['date_resolved'])) {
$tickets[$id]['date_resolved'] = strftime('%x', $info['date_resolved']);
}
// If the template has a callback function defined for data
// filtering, call it now.
if (!empty($_templates[$tpl]['callback'])) {
array_walk($tickets[$id], $_templates[$tpl]['callback']);
}
}
Whups::sortTickets($tickets, isset($_templates[$tpl]['sortby']) ? $_templates[$tpl]['sortby'] : null, isset($_templates[$tpl]['sortdir']) ? $_templates[$tpl]['sortdir'] : null);
$template = $injector->createInstance('Horde_Template');
$template->set('tickets', $tickets);
$template->set('now', strftime('%x'));
$template->set('values', Whups::getSearchResultColumns(null, true));
return array('data' => $template->parse($_templates[$tpl]['template']), 'name' => isset($_templates[$tpl]['filename']) ? $_templates[$tpl]['filename'] : 'report.html');
}
}
示例2: toString
/**
* Returns a plain text representation of a ticket.
*/
public function toString()
{
$fields = array('queue' => _("Queue"), 'version' => _("Version"), 'type' => _("Type"), 'state' => _("State"), 'priority' => _("Priority"), 'due' => _("Due"));
/* Find longest translated field name. */
$length = 0;
foreach (array_merge($fields, array(_("Summary"), _("Owners"))) as $field) {
$length = max($length, Horde_String::length($field));
}
$wrap_break = "\n" . str_repeat(' ', $length + 2) . '| ';
$wrap_width = 73 - $length;
/* Ticket properties. */
$message = ' ' . Horde_String::pad(_("Ticket"), $length) . ' | ' . $this->_id . "\n" . ' ' . Horde_String::pad(_("Summary"), $length) . ' | ' . Horde_String::wrap($this->get('summary'), $wrap_width, $wrap_break) . "\n";
foreach ($fields as $field => $label) {
if ($name = $this->get($field . '_name')) {
$message .= ' ' . Horde_String::pad($label, $length) . ' | ' . Horde_String::wrap($name, $wrap_width, $wrap_break) . "\n";
}
}
$message .= ' ' . Horde_String::pad(_("Owners"), $length) . ' | ' . Horde_String::wrap(Whups::getOwners($this->_id, false, true), $wrap_width, $wrap_break) . "\n";
return $message;
}