1: <?php
2: 3: 4:
5: class Whups_Block_Myrequests extends Horde_Core_Block
6: {
7: 8:
9: public function __construct($app, $params = array())
10: {
11: parent::__construct($app, $params);
12:
13: $this->_name = _("My Requests");
14: }
15:
16: 17:
18: protected function _content()
19: {
20: global $whups_driver, $prefs;
21:
22: $queue_ids = array_keys(Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::READ));
23: $info = array('requester' => $GLOBALS['registry']->getAuth(),
24: 'notowner' => 'user:' . $GLOBALS['registry']->getAuth(),
25: 'nores' => true,
26: 'queue' => $queue_ids);
27: $requests = $whups_driver->getTicketsByProperties($info);
28: if (!$requests) {
29: return '<p><em>' . _("You have no open requests.") . '</em></p>';
30: }
31:
32: $html = '<thead><tr>';
33: $sortby = $prefs->getValue('sortby');
34: $sortdirclass = ' class="' . ($prefs->getValue('sortdir') ? 'sortup' : 'sortdown') . '"';
35: foreach (Whups::getSearchResultColumns('block') as $name => $column) {
36: $html .= '<th' . ($sortby == $column ? $sortdirclass : '') . '>' . $name . '</th>';
37: }
38: $html .= '</tr></thead><tbody>';
39:
40: Whups::sortTickets($requests);
41: foreach ($requests as $ticket) {
42: $link = Horde::link(Whups::urlFor('ticket', $ticket['id'], true));
43: $html .= '<tr><td>' . $link . htmlspecialchars($ticket['id']) . '</a></td>' .
44: '<td>' . $link . htmlspecialchars($ticket['summary']) . '</a></td>' .
45: '<td>' . htmlspecialchars($ticket['priority_name']) . '</td>' .
46: '<td>' . htmlspecialchars($ticket['state_name']) . '</td></tr>';
47: }
48:
49: Horde::addScriptFile('tables.js', 'horde', true);
50:
51: return '<table id="whups_block_myrequests" cellspacing="0" class="tickets striped sortable">' . $html . '</tbody></table>';
52: }
53:
54: }
55: