本文整理汇总了PHP中Whups::attachmentUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Whups::attachmentUrl方法的具体用法?PHP Whups::attachmentUrl怎么用?PHP Whups::attachmentUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Whups
的用法示例。
在下文中一共展示了Whups::attachmentUrl方法的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: render
public function render($transaction, &$vars)
{
global $prefs, $conf, $registry;
static $canUpdate, $comment_count = 0;
if (!isset($canUpdate)) {
$canUpdate = $GLOBALS['registry']->getAuth() && Whups::hasPermission($vars->get('queue'), 'queue', 'update');
}
$comment = '';
$private = false;
$changes = array();
$changelist = $vars->get('changes');
if (!$changelist) {
return '';
}
/* Format each change in this history entry, including comments,
* etc. */
foreach ($changelist as $change) {
switch ($change['type']) {
case 'summary':
$changes[] = sprintf(_("Summary ⇒ %s"), htmlspecialchars($change['value']));
break;
case 'message':
$ticket = $vars->get('ticket_id');
try {
if (Whups::hasMessage($ticket, $change['value'])) {
$changes[] = implode(' ', Whups::messageUrls($ticket, $change['value'], $vars->get('queue')));
}
} catch (Whups_Exception $e) {
}
break;
case 'delete-attachment':
$changes[] = _("Deleted Original Message");
break;
case 'attachment':
$ticket = $vars->get('ticket_id');
try {
if ($file = Whups::getAttachments($ticket, $change['value'])) {
$changes[] = sprintf(_("New Attachment: %s"), implode(' ', Whups::attachmentUrl($ticket, $file, $vars->get('queue'))));
} else {
$changes[] = sprintf(_("New Attachment: %s"), htmlspecialchars($change['value']));
}
} catch (Whups_Exception $e) {
$changes[] = sprintf(_("New Attachment: %s"), htmlspecialchars($change['value']));
}
break;
case 'delete-attachment':
$changes[] = sprintf(_("Deleted Attachment: %s"), htmlspecialchars($change['value']));
break;
case 'assign':
$changes[] = sprintf(_("Assigned to %s"), Whups::formatUser($change['value'], false, true, true));
break;
case 'unassign':
$changes[] = sprintf(_("Taken from %s"), Whups::formatUser($change['value'], false, true, true));
break;
case 'comment':
$comment = $change['comment'];
$private = !empty($change['private']);
if ($comment) {
$reply = Horde::link(Horde::url($canUpdate ? 'ticket/update.php' : 'ticket/comment.php')->add(array('id' => $vars->get('ticket_id'), 'transaction' => $transaction))) . _("Reply to this comment") . '</a>';
}
break;
case 'queue':
$changes[] = sprintf(_("Queue ⇒ %s"), htmlspecialchars($change['label']));
break;
case 'version':
$changes[] = sprintf(_("Version ⇒ %s"), htmlspecialchars($change['label']));
break;
case 'type':
$changes[] = sprintf(_("Type ⇒ %s"), htmlspecialchars($change['label']));
break;
case 'state':
$changes[] = sprintf(_("State ⇒ %s"), htmlspecialchars($change['label']));
break;
case 'priority':
$changes[] = sprintf(_("Priority ⇒ %s"), htmlspecialchars($change['label']));
break;
case 'attribute':
$changes[] = sprintf(_("%s ⇒ %s"), htmlspecialchars($change['label']), htmlspecialchars($change['human']));
break;
case 'due':
if ($change['label']) {
$changes[] = sprintf(_("Due ⇒ %s"), strftime($prefs->getValue('date_format'), $change['label']));
}
break;
}
}
if ($comment) {
$flowed = new Horde_Text_Flowed($comment, 'UTF-8');
$flowed->setDelSp(true);
$comment = $flowed->toFlowed(false);
$comment = $GLOBALS['injector']->getInstance('Horde_Core_Factory_TextFilter')->filter($comment, array('text2html', 'simplemarkup', 'highlightquotes'), array(array('parselevel' => Horde_Text_Filter_Text2html::MICRO), array('html' => true), array('hideBlocks' => true)));
if ($prefs->getValue('autolink_tickets') && $conf['prefs']['autolink_terms']) {
// Replace existing links by tokens to avoid double linking.
$comment = preg_replace_callback('/<a.*?<\\/a>/', array($this, '_writeTokens'), $comment);
$comment = preg_replace_callback('/(' . $conf['prefs']['autolink_terms'] . ')\\s*#?(\\d+)/i', array($this, '_autolink'), $comment);
$comment = preg_replace_callback('/\\0/', array($this, '_readTokens'), $comment);
}
$comment_count++;
if ($private) {
$comment_label = Horde::img('locked.png') . sprintf(_("Comment #%d (Private)"), $comment_count);
//.........这里部分代码省略.........