}
/**
+ * Does the task require to be displayed?
+ *
+ * @return boolean True in case the task should be displayed.
+ */
+ public function needsDisplay()
+ {
+ return $this->display != Horde_LoginTasks::DISPLAY_NONE;
+ }
+
+ /**
* Indicates if the display of the current task should be joined with the
* given previous task.
*
*/
public function addTask($task)
{
- $tmp = array(
- 'display' => false,
- 'task' => $task
- );
-
- if ($task->display != Horde_LoginTasks::DISPLAY_NONE) {
- $tmp['display'] = true;
- }
-
switch ($task->priority) {
case Horde_LoginTasks::PRIORITY_HIGH:
- array_unshift($this->_tasks, $tmp);
+ array_unshift($this->_tasks, $task);
break;
case Horde_LoginTasks::PRIORITY_NORMAL:
- $this->_tasks[] = $tmp;
+ $this->_tasks[] = $task;
break;
}
}
reset($this->_tasks);
while (list($k, $v) = each($this->_tasks)) {
- if ($v['display'] && ($k >= $this->_ptr)) {
+ if ($v->needsDisplay() && ($k >= $this->_ptr)) {
break;
}
- $tmp[] = $v['task'];
+ $tmp[] = $v;
}
if ($advance) {
reset($this->_tasks);
while (list($k, $v) = each($this->_tasks)) {
- if (!$v['display'] ||
- (!is_null($previous) && !$v['task']->joinDisplayWith($previous))) {
+ if (!$v->needsDisplay() ||
+ (!is_null($previous) && !$v->joinDisplayWith($previous))) {
break;
}
- $tmp[] = $v['task'];
- $previous = $v['task'];
+ $tmp[] = $v;
+ $previous = $v;
}
if ($advance) {