<?php $sortbyurl = Horde::addParameter(Horde::selfURL(false), 'sortdir=' . abs(1 - $prefs->getValue('sortdir')));
$sortbyurl = Horde::addParameter($sortbyurl, 'from_application=' . $from_application);
$sortbyurl = Horde::addParameter($sortbyurl, 'from_parameters=' . serialize($from_parameters));
?>
<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 echo Horde::link(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::addParameter($sortbyurl, 'sortby=' . NAG_SORT_COMPLETION), _("Sort by Completion Status"), 'widget') . Horde::img('complete.gif', _("Completed?")) ?></a>
    </th>
    <th class="<?php echo ($prefs->getValue('sortby') == NAG_SORT_OWNER) ? 'selected' : 'item' ?>" width="2%" align="left" nowrap="nowrap">
        <?php echo Horde::link(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::addParameter($sortbyurl, '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 echo Horde::link(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::addParameter($sortbyurl, 'sortby=' . NAG_SORT_PRIORITY), _("Sort by Priority"), 'widget') . _("Pri") ?></a>
    </th>
    <th class="<?php echo ($prefs->getValue('sortby') == NAG_SORT_NAME) ? 'selected' : 'item' ?>" width="60%" align="left" nowrap="nowrap">
        <?php echo Horde::link(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::addParameter($sortbyurl, '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 echo Horde::link(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::addParameter($sortbyurl, '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 echo Horde::link(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::addParameter($sortbyurl, 'sortby=' . NAG_SORT_CATEGORY), _("Sort by Category"), 'widget') . _("Category") ?></a>
    </th>
    <td width="2%"><?php echo Horde::img('note.gif', _("Task Note?")) ?></td></tr>
