Skip to content

Commit

Permalink
Style
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed May 27, 2016
1 parent df374ec commit 3f30be8
Showing 1 changed file with 38 additions and 40 deletions.
78 changes: 38 additions & 40 deletions whups/templates/view/results.inc
@@ -1,8 +1,8 @@
<script type="text/javascript">
function table_sortCallback(tableId, column, sortDown)
{
HordeCore.doAction('setPrefValue', { pref: 'sortby', value: column });
HordeCore.doAction('setPrefValue', { pref: 'sortdir', value: sortDown });
HordeCore.doAction('setPrefValue', { pref: 'sortby', value: column });
HordeCore.doAction('setPrefValue', { pref: 'sortdir', value: sortDown });
}
</script>

Expand All @@ -14,45 +14,42 @@ function table_sortCallback(tableId, column, sortDown)
<?php if (count($this->_params['results'])): ?>
<br class="spacer" />
<table class="horde-table tickets sortable" id="sresults_<?php echo $this->_id ?>" width="100%">
<thead><tr class="nowrap">
<?php
echo '<thead><tr class="nowrap">';
foreach ($this->_params['values'] as $name => $value) {
if ($value == 'user_id_requester') {
$value = 'requester_formatted';
}
if ($sortby == $value) {
$class = ' class="' . $sortdirclass . '"';
$revurl = Horde::url($this->_params['url'])->add('sortdir', ($sortdir ? 0 : 1));
$sortlink = Horde::link($revurl, sprintf(_("Sort by %s"), $name), 'sortlink') . $name . '</a> ';
} else {
$class = '';
$url = Horde::url($this->_params['url'])->add('sortby', $value);
$sortlink = Horde::link($url, sprintf(_("Sort by %s"), $name), 'sortlink') . $name . '</a> ';
}

echo '<th id="' . $value . '"' . $class . '>' . $sortlink . '</th>';
}
echo '</tr></thead><tbody>';

foreach ($this->_params['results'] as $info) {
echo '<tr>';

$url = Whups::urlFor('ticket', $info['id']);

foreach ($this->_params['values'] as $name => $value) {
$thevalue = Whups::formatColumn($info, $value);
$sortval = '';
if ($value == 'timestamp' || $value == 'due' ||
substr($value, 0, 5) == 'date_') {
$sortval = isset($info[$value]) ? ' sortval="' . $info[$value] . '"' : '';
}

echo '<td' . $sortval . '>' . (strlen($thevalue) ? $thevalue : '&nbsp;') . '</td>';
}

echo '</tr>';
}
foreach ($this->_params['values'] as $name => $value):
if ($value == 'user_id_requester') {
$value = 'requester_formatted';
}
if ($sortby == $value) {
$class = ' class="' . $sortdirclass . '"';
$revurl = Horde::url($this->_params['url'])->add('sortdir', ($sortdir ? 0 : 1));
$sortlink = Horde::link($revurl, sprintf(_("Sort by %s"), $name), 'sortlink') . $name . '</a> ';
} else {
$class = '';
$url = Horde::url($this->_params['url'])->add('sortby', $value);
$sortlink = Horde::link($url, sprintf(_("Sort by %s"), $name), 'sortlink') . $name . '</a> ';
}
?>
<th id="<?php echo $value ?>"<?php echo $class ?>><?php echo $sortlink ?></th>
<?php endforeach ?>
</tr></thead>
<tbody>
<?php foreach ($this->_params['results'] as $info): ?>
<tr>
<?php
$url = Whups::urlFor('ticket', $info['id']);
foreach ($this->_params['values'] as $name => $value):
$thevalue = Whups::formatColumn($info, $value);
$sortval = '';
if ($value == 'timestamp' || $value == 'due' ||
substr($value, 0, 5) == 'date_') {
$sortval = isset($info[$value]) ? ' sortval="' . $info[$value] . '"' : '';
}
?>
<td<?php echo $sortval ?>><?php echo strlen($thevalue) ? $thevalue : '&nbsp;' ?></td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($GLOBALS['registry']->getAuth()): ?>
Expand All @@ -70,4 +67,5 @@ function table_sortCallback(tableId, column, sortDown)
<input type="submit" class="horde-default" value="<?php echo _("Save") ?>" />
</form>
</div>
<?php endif; endif; ?>
<?php endif ?>
<?php endif ?>

0 comments on commit 3f30be8

Please sign in to comment.