Newer
Older
global $thisstaff, $ticket;
// Map states to actions
$states = array('open');
if ($thisstaff->getRole($ticket ? $ticket->getDeptId() : null)->hasPerm(TicketModel::PERM_CLOSE)
&& (!$ticket || !$ticket->getMissingRequiredFields()))
$states = array_merge($states, array('closed'));
$statusId = $ticket ? $ticket->getStatusId() : 0;
$nextStatuses = array();
foreach (TicketStatusList::getStatuses(
array('states' => $states)) as $status) {
if (!isset($actions[$status->getState()])
|| $statusId == $status->getId())
continue;
$nextStatuses[] = $status;
}
if (!$nextStatuses)
return;
data-dropdown="#action-dropdown-statuses" data-placement="bottom" data-toggle="tooltip" title="<?php echo __('Change Status'); ?>">
<i class="icon-caret-down pull-right"></i>
aria-label="<?php echo __('Change Status'); ?>"
class="icon-flag"></i></a>
</span>
<div id="action-dropdown-statuses"
class="action-dropdown anchor-right">
<ul>
<?php foreach ($nextStatuses as $status) { ?>
<li>
<a class="no-pjax <?php
echo $ticket? 'ticket-action' : 'tickets-action'; ?>"
href="<?php
echo sprintf('#%s/status/%s/%d',
$ticket ? ('tickets/'.$ticket->getId()) : 'tickets',
$actions[$status->getState()]['action'],
$status->getId()); ?>"
<?php
if (isset($actions[$status->getState()]['href']))
$actions[$status->getState()]['href']);
?>
><i class="<?php
echo $actions[$status->getState()]['icon'] ?: 'icon-tag';
?>"></i> <?php
echo __($status->getName()); ?></a>
</li>