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:  * Show a summary of all available queues and their number of open tickets.
 4:  */
 5: class Whups_Block_Queuesummary extends Horde_Core_Block
 6: {
 7:     /**
 8:      */
 9:     public function __construct($app, $params = array())
10:     {
11:         parent::__construct($app, $params);
12: 
13:         $this->_name = _("Queue Summary");
14:     }
15: 
16:     /**
17:      */
18:     protected function _content()
19:     {
20:         global $whups_driver;
21: 
22:         $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::READ);
23:         $qsummary = $whups_driver->getQueueSummary(array_keys($queues));
24:         if (!$qsummary) {
25:             return '<p><em>' . _("There are no open tickets.") . '</em></p>';
26:         }
27: 
28:         $summary = $types = array();
29:         foreach ($qsummary as $queue) {
30:             $types[$queue['type']] = $queue['type'];
31:             if (!isset($summary[$queue['id']])) {
32:                 $summary[$queue['id']] = $queue;
33:             }
34:             $summary[$queue['id']][$queue['type']] = $queue['open_tickets'];
35:         }
36: 
37:         $html = '<thead><tr>';
38:         $sortby = 'queue_name';
39:         foreach (array_merge(array('queue_name' => _("Queue")), $types) as $column => $name) {
40:             $html .= '<th' . ($sortby == $column ? ' class="sortdown"' : '') . '>' . $name . '</th>';
41:         }
42:         $html .= '</tr></thead><tbody>';
43: 
44:         foreach ($summary as $queue) {
45:             $html .= '<tr><td>' . Horde::link(Whups::urlFor('queue', $queue, true), $queue['description']) . htmlspecialchars($queue['name']) . '</a></td>';
46:             foreach ($types as $type) {
47:                 $html .= '<td>' . (isset($queue[$type]) ? $queue[$type] : '&nbsp;') . '</td>';
48:             }
49:             $html .= '</tr>';
50:         }
51: 
52:         Horde::addScriptFile('tables.js', 'horde', true);
53: 
54:         return '<table id="whups_block_queuesummary" cellspacing="0" class="tickets striped sortable">' . $html . '</tbody></table>';
55:     }
56: 
57: }
58: 
API documentation generated by ApiGen