'priority' => _("Priority"),
'assignee' => _("Assignee"),
'due' => _("Due Date"),
+ 'start' => _("Due Date"),
'estimate' => _("Estimated Time"),
'category' => _("Category")
),
Nag::SORT_NAME => _("Task Name"),
Nag::SORT_CATEGORY => _("Category"),
Nag::SORT_DUE => _("Due Date"),
+ Nag::SORT_START => _("Start Date"),
Nag::SORT_COMPLETION => _("Completed?"),
Nag::SORT_ESTIMATE => _("Estimated Time"),
Nag::SORT_ASSIGNEE => _("Assignee"),
Nag::SORT_NAME => _("Task Name"),
Nag::SORT_CATEGORY => _("Category"),
Nag::SORT_DUE => _("Due Date"),
+ Nag::SORT_START => _("Start Date"),
Nag::SORT_COMPLETION => _("Completed?"),
Nag::SORT_ESTIMATE => _("Estimated Time"),
Nag::SORT_ASSIGNEE => _("Assignee"),
const SORT_DUE = 'due';
/**
+ * Sort by start date.
+ */
+ const SORT_START = 'start';
+
+ /**
* Sort by completion.
*/
const SORT_COMPLETION = 'completed';
}
/**
+ * Comparison function for sorting tasks by start date.
+ *
+ * @param array $a Task one.
+ * @param array $b Task two.
+ *
+ * @return integer 1 if task one is greater, -1 if task two is greater;
+ * 0 if they are equal.
+ */
+ public static function _sortByStart($a, $b)
+ {
+ if ($a->start == $b->start) {
+ return self::_sortByIdentity($a, $b);
+ }
+
+ // Treat empty start dates as farthest into the future.
+ if ($a->start == 0) {
+ return 1;
+ }
+ if ($b->start == 0) {
+ return -1;
+ }
+
+ return ($a->start > $b->start) ? 1 : -1;
+ }
+
+ /**
+ * Comparison function for reverse sorting tasks by start date.
+ *
+ * @param array $a Task one.
+ * @param array $b Task two.
+ *
+ * @return integer -1 if task one is greater, 1 if task two is greater,
+ * 0 if they are equal.
+ */
+ public static function _rsortByStart($a, $b)
+ {
+ if ($a->start == $b->start) {
+ return self::_sortByIdentity($b, $a);
+ }
+
+ // Treat empty start dates as farthest into the future.
+ if ($a->start == 0) {
+ return -1;
+ }
+ if ($b->start == 0) {
+ return 1;
+ }
+
+ return ($a->start < $b->start) ? 1 : -1;
+ }
+
+ /**
* Comparison function for sorting tasks by completion status.
*
* @param array $a Task one.
Nag::SORT_NAME => 'ByName',
Nag::SORT_CATEGORY => 'ByCategory',
Nag::SORT_DUE => 'ByDue',
+ Nag::SORT_START => 'ByStart',
Nag::SORT_COMPLETION => 'ByCompletion',
Nag::SORT_ASSIGNEE => 'ByAssignee',
Nag::SORT_ESTIMATE => 'ByEstimate',
<th id="s<?php echo Nag::SORT_DUE ?>"<?php if ($sortby == Nag::SORT_DUE) echo ' class="' . $sortdirclass . '"' ?> width="2%">
<?php echo Horde::widget(Horde::applicationUrl(Horde_Util::addParameter($baseurl, 'sortby', Nag::SORT_DUE)), _("Sort by Due Date"), 'sortlink', '', '', _("_Due Date")) ?>
</th>
+<?php endif; if (in_array('start', $columns)): ?>
+ <th id="s<?php echo Nag::SORT_START ?>"<?php if ($sortby == Nag::SORT_START) echo ' class="' . $sortdirclass . '"' ?> width="2%">
+ <?php echo Horde::widget(Horde::applicationUrl(Horde_Util::addParameter($baseurl, 'sortby', Nag::SORT_START)), _("Sort by Start Date"), 'sortlink', '', '', _("_Start Date")) ?>
+ </th>
<?php endif; if (in_array('estimate', $columns)): ?>
<th id="s<?php echo Nag::SORT_ESTIMATE ?>"<?php if ($sortby == Nag::SORT_ESTIMATE) echo ' class="' . $sortdirclass . '"' ?> width="10%">
<?php echo Horde::widget(Horde::applicationUrl(Horde_Util::addParameter($baseurl, 'sortby', Nag::SORT_ESTIMATE)), _("Sort by estimated time"), 'sortlink', '', '', _("Estimated Time")) ?>
<td class="nowrap" sortval="<?php echo $task->due ? (int)$task->due : PHP_INT_MAX ?>">
<?php echo $task->due ? strftime($dateFormat, $task->due) : ' ' ?>
</td>
+<?php endif; if (in_array('start', $columns)): ?>
+ <td class="nowrap" sortval="<?php echo $task->start ? (int)$task->start : PHP_INT_MAX ?>">
+ <?php echo $task->start ? strftime($dateFormat, $task->start) : ' ' ?>
+ </td>
<?php endif; if (in_array('estimate', $columns)): ?>
<td class="nowrap" sortval="<?php echo htmlspecialchars($task->estimation()) ?>">
<?php echo htmlspecialchars($task->estimation()) ?>