public function getItems() { $current_id = -1; $display_items = array(); $shows = array(); $showInstance = array(); if ($this->opts["myShows"] === 1) { $shows = $this->getUsersShows(); } elseif ($this->opts["showFilter"] !== 0) { $shows[] = $this->opts["showFilter"]; } elseif ($this->opts["showInstanceFilter"] !== 0) { $showInstance[] = $this->opts["showInstanceFilter"]; } $scheduled_items = Application_Model_Schedule::GetScheduleDetailItems($this->startDT, $this->endDT, $shows, $showInstance); for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) { $item = $scheduled_items[$i]; //don't send back data for filler rows. if (isset($item["playout_status"]) && $item["playout_status"] < 0) { continue; } //make a header row. if ($current_id !== $item["si_id"]) { //make a footer row. if ($current_id !== -1) { // pass in the previous row as it's the last row for // the previous show. $display_items[] = $this->makeFooterRow($scheduled_items[$i - 1]); } $display_items[] = $this->makeHeaderRow($item); $current_id = $item["si_id"]; $this->pos = 1; } //make a normal data row. $row = $this->makeScheduledItemRow($item); //don't display the empty rows. if (isset($row)) { $display_items[] = $row; } if ($current_id !== -1 && !in_array($current_id, $this->showInstances)) { $this->showInstances[] = $current_id; } } //make the last footer if there were any scheduled items. if (count($scheduled_items) > 0) { $display_items[] = $this->makeFooterRow($scheduled_items[count($scheduled_items) - 1]); } return array("schedule" => $display_items, "showInstances" => $this->showInstances); }