Overview

Packages

  • Horde
    • Form
    • MIME
      • Viewer
    • Scheduler
  • None
  • Whups
    • UnitTests

Classes

  • Whups_Application
  • Whups_Block_Myqueries
  • Whups_Block_Myrequests
  • Whups_Block_Mytickets
  • Whups_Block_Query
  • Whups_Block_Queuecontents
  • Whups_Block_Queuesummary
  • Whups_Block_Unassigned
  • Whups_Driver_sql
  • Whups_Exception
  • Whups_Factory_Driver
  • Whups_Form_AddListener
  • Whups_Form_DeleteListener
  • Whups_Form_Queue_StepOne
  • Whups_Form_Queue_StepThree
  • Whups_Form_Queue_StepTwo
  • Whups_Form_Renderer_Query
  • Whups_Form_SetTypeStepOne
  • Whups_Form_SetTypeStepTwo
  • Whups_Form_Ticket_Delete
  • Whups_Test_Perms
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Display a summary of the current user's assigned tickets.
 4:  */
 5: class Whups_Block_Mytickets 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 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('owner' => Whups::getOwnerCriteria($GLOBALS['registry']->getAuth()),
24:                       'nores' => true,
25:                       'queue' => $queue_ids);
26:         $assigned = $whups_driver->getTicketsByProperties($info);
27:         if (!$assigned) {
28:             return '<p><em>' . _("No tickets are assigned to you.") . '</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($assigned);
40:         foreach ($assigned 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: 
API documentation generated by ApiGen