Inheritance: extends Horde_Form
Ejemplo n.º 1
0
$deleteform = new Whups_Form_Ticket_Delete($vars, $title);
if ($vars->get('formname') == 'whups_form_ticket_delete' && $deleteform->validate($vars)) {
    if ($vars->get('submitbutton') == _("Delete")) {
        $deleteform->getInfo($vars, $info);
        try {
            $ticket->delete();
            $notification->push(sprintf(_("Ticket %d has been deleted."), $info['id']), 'horde.success');
            Horde::url($prefs->getValue('whups_default_view') . '.php', true)->redirect();
        } catch (Whups_Exception $e) {
            $notification->push(_("There was an error deleting the ticket:") . ' ' . $e->getMessage(), 'horde.error');
        } catch (Horde_Exception_NotFound $e) {
            $notification->push(sprintf(_("Ticket %d not found."), $info['id']));
        }
    } else {
        $notification->push(_("The ticket was not deleted."), 'horde.message');
    }
}
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
require WHUPS_TEMPLATES . '/prevnext.inc';
$tabs = Whups::getTicketTabs($vars, $id);
echo $tabs->render('delete');
$deleteform->renderActive($deleteform->getRenderer(), $vars, Horde::url('ticket/delete.php'), 'post');
echo '<br />';
$form = new Whups_Form_TicketDetails($vars, $ticket);
$ticket->setDetails($vars);
$r = $form->getRenderer();
$r->beginInactive($title);
$r->renderFormInactive($form, $vars);
$r->end();
$page_output->footer();
Ejemplo n.º 2
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();
Ejemplo n.º 3
0
$vars = Horde_Variables::getDefaultVariables();
if ($vars->searchfield) {
    $vars->id = $vars->searchfield;
}
$ticket = Whups::getCurrentTicket();
$ticket->setDetails($vars);
$title = '[#' . $ticket->getId() . '] ' . $ticket->get('summary');
Whups::addTopbarSearch();
Whups::addFeedLink();
$page_output->addLinkTag($ticket->feedLink());
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
require WHUPS_TEMPLATES . '/prevnext.inc';
$tabs = Whups::getTicketTabs($vars, $ticket->getId());
echo $tabs->render('history');
$form = new Whups_Form_TicketDetails($vars, $ticket);
$renderer = $form->getRenderer();
$renderer->_name = $form->getName();
$renderer->beginInactive($title);
$renderer->renderFormInactive($form, $vars);
$renderer->end();
echo '<br class="spacer" />';
$comment = new Whups_Form_Renderer_Comment();
$comment->begin(_("History"));
$history = Whups::permissionsFilter($whups_driver->getHistory($ticket->getId(), $form), 'comment', Horde_Perms::READ);
$chtml = array();
foreach ($history as $transaction => $comment_values) {
    $chtml[] = $comment->render($transaction, new Horde_Variables($comment_values));
}
if ($prefs->getValue('comment_sort_dir')) {
    $chtml = array_reverse($chtml);