1: <?php
2: 3: 4:
5: class Whups_Block_Unassigned extends Horde_Core_Block
6: {
7: 8:
9: public function __construct($app, $params = array())
10: {
11: parent::__construct($app, $params);
12:
13: $this->_name = _("Unassigned Tickets");
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('notowner' => true,
24: 'nores' => true,
25: 'queue' => $queue_ids);
26: $unassigned = $whups_driver->getTicketsByProperties($info);
27: if (!$unassigned) {
28: return '<p><em>' . _("No tickets are unassigned!") . '</em></p>';
29: }
30:
31: $html = '<thead><tr>';
32: $sortby = $prefs->getValue('sortby');
33: $sortdirclass = ' class="' . ($prefs->getValue('sortdir') ? 'sortup' : 'sortdown') . '"';
34: foreach (Whups::getSearchResultColumns('block') as $name => $column) {
35: $html .= '<th' . ($sortby == $column ? $sortdirclass : '') . '>' . $name . '</th>';
36: }
37: $html .= '</tr></thead><tbody>';
38:
39: Whups::sortTickets($unassigned);
40: foreach ($unassigned as $ticket) {
41: $link = Horde::link(Whups::urlFor('ticket', $ticket['id'], true));
42: $html .= '<tr><td>' . $link . htmlspecialchars($ticket['id']) . '</a></td>' .
43: '<td>' . $link . htmlspecialchars($ticket['summary']) . '</a></td>' .
44: '<td>' . htmlspecialchars($ticket['priority_name']) . '</td>' .
45: '<td>' . htmlspecialchars($ticket['state_name']) . '</td></tr>';
46: }
47:
48: Horde::addScriptFile('tables.js', 'horde', true);
49:
50: return '<table id="whups_block_mytickets" cellspacing="0" class="tickets striped sortable">' . $html . '</tbody></table>';
51: }
52:
53: }
54: