/usr/share/horde/whups/lib/Block/Tickets.php is in php-horde-whups 3.0.0~beta1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | <?php
/**
* Base class for blocks that display a summary of tickets.
*/
class Whups_Block_Tickets extends Horde_Core_Block
{
/**
* Is this block enabled?
*
* @var boolean
*/
public $enabled = false;
/**
* Returns the parameters needed by block.
*
* @return array The block's parameters.
*/
protected function _params()
{
$all = array_flip(Whups::getSearchResultColumns());
unset($all['id']);
return array('columns' => array(
'type' => 'multienum',
'name' => _("Columns"),
'default' => array_values(Whups::getSearchResultColumns('block')),
'values' => $all,
));
}
/**
*/
protected function _content()
{
}
/**
* Generates a table with ticket information.
*
* @param array $tickets A list of tickets.
* @param string $tableClass The DOM ID to use for the generated table.
*
* @return string Table HTML code.
*/
protected function _table($tickets, $tableId = null)
{
if (!$tableId) {
$tableId = get_class($this);
}
$sortby = $GLOBALS['prefs']->getValue('sortby');
$sortdirclass = ' class="' . ($GLOBALS['prefs']->getValue('sortdir') ? 'sortup' : 'sortdown') . '"';
$html = '<thead><tr><th' . ($sortby == 'id' ? $sortdirclass : '') . '>' . _("Id") . '</th>';
foreach (Whups::getSearchResultColumns('block', $this->_params['columns']) as $name => $column) {
if ($column == 'id') {
continue;
}
$html .= '<th' . ($sortby == $column ? $sortdirclass : '') . '>' . $name . '</th>';
}
$html .= '</tr></thead><tbody>';
Whups::sortTickets($tickets);
foreach ($tickets as $ticket) {
foreach (Whups::getSearchResultColumns('block', $this->_params['columns']) as $column) {
$thevalue = Whups::formatColumn($ticket, $column);
$sortval = '';
if ($column == 'timestamp' || $column == 'due' ||
substr($column, 0, 5) == 'date_') {
$sortval = (strlen($ticket[$column]) ? ' sortval="' . $ticket[$column] . '"' : '');
}
$html .= '<td' . $sortval . '>' . (strlen($thevalue) ? $thevalue : ' ') . '</td>';
}
$html .= '</tr>';
}
$GLOBALS['page_output']->addScriptFile('tables.js', 'horde');
return '<table id="' . htmlspecialchars($tableId) . '" class="horde-table sortable" style="width:100%">' . $html . '</tbody></table>';
}
}
|