public static function planning($history, $parent_table = null, $parent_id = null) { $results = Queries::planning($history, $parent_table, $parent_id); $now_pos = 0; foreach ($results as $index => $entry) { if (strtotime($entry->date_end) < strtotime('today')) { $now_pos = $index + 1; } $entry->date_start = DateFormat::dateTable($entry->date_start); $entry->date_end = DateFormat::dateTable($entry->date_end); $entry->duration = DateFormat::timeDuration($entry->duration); } $today = new stdClass(); $today->todayRow = true; $today->id = 'today'; $today->completion = false; $today->date_start = '<b>' . DateFormat::dateTable() . '</b>'; $today->date_end = '<b>' . DateFormat::dateTable() . '</b>'; $today->parent_name = '</a><b>Today is a gift</b><a href="">'; $today->duration = '<b>-</b>'; $today->goal = '<b>Thats why it\'s called the present</b>'; $today->state = '<b>-</b>'; array_splice($results, $now_pos, 0, array($today)); return $results; }