Skip to content
Snippets Groups Projects
status-options.tmpl.php 1.84 KiB
Newer Older
Peter Rotich's avatar
Peter Rotich committed
<?php
$actions= array(
        'close' => array(
            'icon'  => 'icon-repeat',
Peter Rotich's avatar
Peter Rotich committed
            'state' => 'closed'
Peter Rotich's avatar
Peter Rotich committed
            ),
        'resolve' => array(
            'icon'  => 'icon-ok-circle',
Peter Rotich's avatar
Peter Rotich committed
            'state' => 'resolved'
Peter Rotich's avatar
Peter Rotich committed
            ),
        'reopen' => array(
            'icon'  => 'icon-undo',
Peter Rotich's avatar
Peter Rotich committed
            'state' => 'open'
Peter Rotich's avatar
Peter Rotich committed
            ),
        );

foreach($actions as $k => $v) {
Peter Rotich's avatar
Peter Rotich committed
    $criteria = array('states' => array($v['state']));
Peter Rotich's avatar
Peter Rotich committed
    if (!($statuses = TicketStatusList::getStatuses($criteria)->all()))
        continue;

    if ($statuses && count($statuses) > 1) {
    ?>
        <span
            class="action-button"
            data-dropdown="#action-dropdown-<?php echo $k; ?>">
            <a id="tickets-<?php echo $k; ?>"
                class="tickets-action"
                href="#tickets/status/<?php echo $k; ?>"><i
Peter Rotich's avatar
Peter Rotich committed
                class="<?php echo $v['icon']; ?>"></i> <?php
                echo TicketStateField::getVerb($v['state']); ?></a>
Peter Rotich's avatar
Peter Rotich committed
            <i class="icon-caret-down"></i>
        </span>
        <div id="action-dropdown-<?php echo $k; ?>"
            class="action-dropdown anchor-right">
          <ul>
            <?php
            foreach ($statuses as $s) {
                ?>

             <li>
                 <a class="no-pjax tickets-action"
                    href="#tickets/status/<?php echo $k; ?>/<?php
                    echo $s->getId(); ?>"> <i
                        class="icon-tag"></i> <?php echo __($s->getName()); ?></a> </li>
Peter Rotich's avatar
Peter Rotich committed
            <?php
            } ?>
          </ul>
        </div>
    <?php
    } else {
    ?>
        <a id="tickets-<?php echo $k; ?>" class="action-button tickets-action"
            href="#tickets/status/<?php echo $k; ?>"><i
Peter Rotich's avatar
Peter Rotich committed
            class="<?php echo $v['icon']; ?>"></i> <?php
            echo TicketStateField::getVerb($v['state']); ?></a>
Peter Rotich's avatar
Peter Rotich committed
<?php
    }
}
?>