<?php $sortbyurl = Horde::addParameter('list.php', 'sortdir=' . abs(1 - $prefs->getValue('sortdir'))) ?>
<tr><td class="control">
<table width="100%" border="0" cellpadding="0" cellspacing="1">
<tr class="item">
    <th class="<?php echo ($prefs->getValue('sortby') == NAG_SORT_COMPLETION) ? 'selected' : 'item' ?>" width="2%" align="left" nowrap="nowrap">
        <?php if ($prefs->getValue('sortby') == NAG_SORT_COMPLETION) echo Horde::link(Horde::applicationUrl(Horde::addParameter($sortbyurl, 'sortby', NAG_SORT_COMPLETION)), _("Sort Direction"), 'widget') . Horde::img($prefs->getValue('sortdir') ? 'za.gif' :  'az.gif', _("Sort Direction"), null, $registry->getParam('graphics', 'horde')) ?></a>
        <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter('list.php', 'sortby', NAG_SORT_COMPLETION)), _("Sort by Completion Status"), 'widget') . Horde::img('checkbox.gif', _("Completed?")) ?></a>
    </th>
    <th class="<?php echo ($prefs->getValue('sortby') == NAG_SORT_OWNER) ? 'selected' : 'item' ?>" width="2%" align="left" nowrap="nowrap">
        <?php if ($prefs->getValue('sortby') == NAG_SORT_OWNER) echo Horde::link(Horde::applicationUrl(Horde::addParameter($sortbyurl, 'sortby', NAG_SORT_OWNER)), _("Sort Direction"), 'widget') . Horde::img($prefs->getValue('sortdir') ? 'za.gif' :  'az.gif', _("Sort Direction"), null, $registry->getParam('graphics', 'horde')) ?></a>
        <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter('list.php', 'sortby', NAG_SORT_OWNER)), _("Sort by User Name"), 'widget') . _("Owner") ?></a>
    </th>
    <th class="<?php echo ($prefs->getValue('sortby') == NAG_SORT_PRIORITY) ? 'selected' : 'item' ?>" width="2%" align="left" nowrap="nowrap">
        <?php if ($prefs->getValue('sortby') == NAG_SORT_PRIORITY) echo Horde::link(Horde::applicationUrl(Horde::addParameter($sortbyurl, 'sortby', NAG_SORT_PRIORITY)), _("Sort Direction"), 'widget') . Horde::img($prefs->getValue('sortdir') ? 'za.gif' : 'az.gif', _("Sort Direction"), null, $registry->getParam('graphics', 'horde')) ?></a>
        <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter('list.php', 'sortby', NAG_SORT_PRIORITY)), _("Sort by Priority"), 'widget') . _("Pri") ?></a>
    </th>
    <th width="2%">
        <?php echo Horde::img('edit.gif', _("Edit Task")) ?>
    </td>
    <th class="<?php echo ($prefs->getValue('sortby') == NAG_SORT_NAME) ? 'selected' : 'item' ?>" width="60%" align="left" nowrap="nowrap">
        <?php if ($prefs->getValue('sortby') == NAG_SORT_NAME) echo Horde::link(Horde::applicationUrl(Horde::addParameter($sortbyurl, 'sortby', NAG_SORT_NAME)), _("Sort Direction"), 'widget') . Horde::img($prefs->getValue('sortdir') ? 'za.gif' : 'az.gif', _("Sort Direction"), null, $registry->getParam('graphics', 'horde')) ?></a>
        <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter('list.php', 'sortby', NAG_SORT_NAME)), _("Sort by Name"), 'widget') . _("Name") ?></a>
    </th>
    <th class="<?php echo ($prefs->getValue('sortby') == NAG_SORT_DUE) ? 'selected' : 'item' ?>" width="12%" align="left" nowrap="nowrap">
        <?php if ($prefs->getValue('sortby') == NAG_SORT_DUE) echo Horde::link(Horde::applicationUrl(Horde::addParameter($sortbyurl, 'sortby', NAG_SORT_DUE)), _("Sort Direction"), 'widget') . Horde::img($prefs->getValue('sortdir') ? 'za.gif' : 'az.gif', _("Sort Direction"), null, $registry->getParam('graphics', 'horde')) ?></a>
        <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter('list.php', 'sortby', NAG_SORT_DUE)), _("Sort by Due Date"), 'widget') . _("Due Date") ?></a>
    </th>
    <th class="<?php echo ($prefs->getValue('sortby') == NAG_SORT_CATEGORY) ? 'selected' : 'item' ?>" width="20%" align="left" nowrap="nowrap">
        <?php if ($prefs->getValue('sortby') == NAG_SORT_CATEGORY) echo Horde::link(Horde::applicationUrl(Horde::addParameter($sortbyurl, 'sortby', NAG_SORT_CATEGORY)), _("Sort Direction"), 'widget') . Horde::img($prefs->getValue('sortdir') ? 'za.gif' : 'az.gif', _("Sort Direction"), null, $registry->getParam('graphics', 'horde')) ?></a>
        <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter('list.php', 'sortby', NAG_SORT_CATEGORY)), _("Sort by Category"), 'widget') . _("Category") ?></a>
    </th>
    <td width="2%"><?php echo Horde::img('note.gif', _("Task Note?")) ?></td>
    <td width="2%"><?php echo Horde::img('alarm.gif', _("Task Alarm?")) ?></td></tr>
