/** * Get attributes for div representing a gantt element * * @param Aoe_Scheduler_Model_Schedule $schedule * @return string */ public function getGanttDivAttributes(Aoe_Scheduler_Model_Schedule $schedule) { if ($schedule->getStatus() == Mage_Cron_Model_Schedule::STATUS_RUNNING) { $duration = time() - strtotime($schedule->getExecutedAt()); } else { $duration = $schedule->getDuration() ? $schedule->getDuration() : 0; } $duration = $duration / $this->zoom; $duration = ceil($duration / 4) * 4 - 1; // round to numbers dividable by 4, then remove 1 px border $duration = max($duration, 3); $offset = (strtotime($schedule->getStarttime()) - $this->starttime) / $this->zoom; if ($offset < 0) { // cut bar $duration += $offset; $offset = 0; } return sprintf('class="task %s" id="id_%s" style="width: %spx; left: %spx;"', $schedule->getStatus(), $schedule->getScheduleId(), $duration, $offset); }