Whups::getTicketTabs PHP Method

getTicketTabs() public static method

Returns the tabs for navigating between ticket actions.
public static getTicketTabs ( &$vars, $id )
    public static function getTicketTabs(&$vars, $id)
    {
        $tabs = new Horde_Core_Ui_Tabs(null, $vars);
        $queue = Whups_Ticket::makeTicket($id)->get('queue');
        $tabs->addTab(_("_History"), self::urlFor('ticket', $id), 'history');
        $tabs->addTab(_("_Attachments"), self::urlFor('ticket_action', array('attachments', $id)), 'attachments');
        if (self::hasPermission($queue, 'queue', 'update')) {
            $tabs->addTab(_("_Update"), self::urlFor('ticket_action', array('update', $id)), 'update');
        } else {
            $tabs->addTab(_("_Comment"), self::urlFor('ticket_action', array('comment', $id)), 'comment');
        }
        $tabs->addTab(_("_Watch"), self::urlFor('ticket_action', array('watch', $id)), 'watch');
        if (self::hasPermission($queue, 'queue', Horde_Perms::DELETE)) {
            $tabs->addTab(_("S_et Queue"), self::urlFor('ticket_action', array('queue', $id)), 'queue');
        }
        if (self::hasPermission($queue, 'queue', 'update')) {
            $tabs->addTab(_("Set _Type"), self::urlFor('ticket_action', array('type', $id)), 'type');
        }
        if (self::hasPermission($queue, 'queue', Horde_Perms::DELETE)) {
            $tabs->addTab(_("_Delete"), self::urlFor('ticket_action', array('delete', $id)), 'delete');
        }
        return $tabs;
    }

Usage Example

Exemplo n.º 1
0
        // Update attributes.
        $whups_driver->setAttributes($info, $ticket);
        // Add attachment if one was uploaded.
        if (!empty($info['newattachment']['name'])) {
            $ticket->change('attachment', array('name' => $info['newattachment']['name'], 'tmp_name' => $info['newattachment']['tmp_name']));
        }
        // If there was a new comment and permissions were specified
        // on it, set them.
        if (!empty($info['group'])) {
            $ticket->change('comment-perms', $info['group']);
        }
        try {
            $ticket->commit();
            $notification->push(_("Ticket Updated"), 'horde.success');
            $ticket->show();
        } catch (Whups_Exception $e) {
            $notification->push($e, 'horde.error');
        }
    }
}
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
require WHUPS_TEMPLATES . '/prevnext.inc';
$tabs = Whups::getTicketTabs($vars, $id);
echo $tabs->render('update');
$editform->renderActive($editform->getRenderer(), $vars, Horde::url('ticket/update.php'), 'post');
echo '<br class="spacer" />';
$form = new Whups_Form_TicketDetails($vars, $ticket, $title);
$ticket->setDetails($vars);
$form->renderInactive($form->getRenderer(), $vars);
$page_output->footer();
All Usage Examples Of Whups::getTicketTabs